From 9af01ebcb51d8713590717ece411e2183e885a72 Mon Sep 17 00:00:00 2001 From: Koeun Choi Date: Mon, 21 Jan 2013 13:07:16 +0900 Subject: [PATCH] remove legacy codes : jquery-geo Change-Id: I063edb5bc7fd8bc567896e30003dcd79fdd3c0a2 --- COPYING | 5 - libs/js/jquery-geo-1.0b2/.gitignore | 5 - libs/js/jquery-geo-1.0b2/LICENSE-GPL | 278 - libs/js/jquery-geo-1.0b2/LICENSE-MIT | 22 - libs/js/jquery-geo-1.0b2/README.md | 324 - libs/js/jquery-geo-1.0b2/apple-touch-icon.png | Bin 2252 -> 0 bytes libs/js/jquery-geo-1.0b2/dev-journal-ryan.txt | 2184 ----- libs/js/jquery-geo-1.0b2/docs/404.html | 22 - libs/js/jquery-geo-1.0b2/docs/css/handheld.css | 8 - libs/js/jquery-geo-1.0b2/docs/css/style.css | 159 - .../docs/examples/all-shingled.html | 209 - .../jquery-geo-1.0b2/docs/examples/all-tiled.html | 210 - libs/js/jquery-geo-1.0b2/docs/examples/append.html | 103 - .../docs/examples/appendservice.html | 94 - .../jquery-geo-1.0b2/docs/examples/basemaps.html | 116 - libs/js/jquery-geo-1.0b2/docs/examples/bbox.html | 298 - .../js/jquery-geo-1.0b2/docs/examples/bostock.html | 84 - libs/js/jquery-geo-1.0b2/docs/examples/census.html | 142 - libs/js/jquery-geo-1.0b2/docs/examples/center.html | 147 - .../jquery-geo-1.0b2/docs/examples/css/style.css | 86 - libs/js/jquery-geo-1.0b2/docs/examples/defer.html | 143 - .../js/jquery-geo-1.0b2/docs/examples/destroy.html | 67 - libs/js/jquery-geo-1.0b2/docs/examples/drag.html | 65 - libs/js/jquery-geo-1.0b2/docs/examples/draw.html | 80 - .../jquery-geo-1.0b2/docs/examples/drawStyle.html | 142 - libs/js/jquery-geo-1.0b2/docs/examples/empty.html | 42 - .../docs/examples/emptyservice.html | 39 - libs/js/jquery-geo-1.0b2/docs/examples/events.html | 160 - libs/js/jquery-geo-1.0b2/docs/examples/find.html | 67 - .../docs/examples/findservice.html | 76 - .../docs/examples/geo-geometry.html | 344 - .../jquery-geo-1.0b2/docs/examples/geometry.html | 133 - .../jquery-geo-1.0b2/docs/examples/hurricane.html | 178 - libs/js/jquery-geo-1.0b2/docs/examples/image.html | 107 - .../docs/examples/img/ajax-loader.gif | Bin 673 -> 0 bytes .../js/jquery-geo-1.0b2/docs/examples/img/boat.png | Bin 1022 -> 0 bytes .../docs/examples/img/jsfiddle.png | Bin 459 -> 0 bytes .../jquery-geo-1.0b2/docs/examples/img/marker.png | Bin 603 -> 0 bytes libs/js/jquery-geo-1.0b2/docs/examples/inset.html | 166 - .../jquery-geo-1.0b2/docs/examples/insetmap.html | 104 - .../jquery-geo-1.0b2/docs/examples/isGeodetic.html | 70 - libs/js/jquery-geo-1.0b2/docs/examples/jqm.html | 137 - .../docs/examples/js/all-shingled.js | 269 - .../jquery-geo-1.0b2/docs/examples/js/all-tiled.js | 273 - .../js/jquery-geo-1.0b2/docs/examples/js/iecors.js | 55 - .../jquery-geo-1.0b2/docs/examples/js/json2.min.js | 1 - libs/js/jquery-geo-1.0b2/docs/examples/kml.html | 81 - libs/js/jquery-geo-1.0b2/docs/examples/label.html | 81 - .../docs/examples/labelservice.html | 81 - libs/js/jquery-geo-1.0b2/docs/examples/logo.html | 126 - libs/js/jquery-geo-1.0b2/docs/examples/marker.html | 101 - .../js/jquery-geo-1.0b2/docs/examples/markers.html | 267 - .../js/jquery-geo-1.0b2/docs/examples/measure.html | 77 - libs/js/jquery-geo-1.0b2/docs/examples/mobile.html | 36 - .../jquery-geo-1.0b2/docs/examples/mode-zoom.html | 74 - .../js/jquery-geo-1.0b2/docs/examples/opacity.html | 86 - .../jquery-geo-1.0b2/docs/examples/panscroll.html | 94 - libs/js/jquery-geo-1.0b2/docs/examples/proj.html | 133 - .../js/jquery-geo-1.0b2/docs/examples/refresh.html | 122 - libs/js/jquery-geo-1.0b2/docs/examples/remove.html | 62 - .../docs/examples/removeservice.html | 56 - .../jquery-geo-1.0b2/docs/examples/services.html | 57 - .../jquery-geo-1.0b2/docs/examples/shapeStyle.html | 155 - .../docs/examples/shapeStyleservice.html | 156 - .../jquery-geo-1.0b2/docs/examples/shingled.html | 141 - .../jquery-geo-1.0b2/docs/examples/simplest.html | 29 - .../js/jquery-geo-1.0b2/docs/examples/spocode.html | 329 - libs/js/jquery-geo-1.0b2/docs/examples/static.html | 58 - .../jquery-geo-1.0b2/docs/examples/stringsrc.html | 65 - .../jquery-geo-1.0b2/docs/examples/template.html | 66 - libs/js/jquery-geo-1.0b2/docs/examples/tiger.html | 215 - .../docs/examples/tiledservices.html | 239 - .../docs/examples/tilingScheme.html | 211 - .../jquery-geo-1.0b2/docs/examples/tracking.html | 82 - .../docs/examples/twheat/css/style.css | 133 - .../docs/examples/twheat/img/$.geo-logo-small.png | Bin 1472 -> 0 bytes .../docs/examples/twheat/img/ajax-loader.gif | Bin 673 -> 0 bytes .../docs/examples/twheat/index.html | 67 - .../docs/examples/twheat/js/twheat.js | 452 - .../docs/examples/twitter-heat.html | 307 - .../jquery-geo-1.0b2/docs/examples/usastates.html | 66 - .../docs/examples/utah/apple-touch-icon.png | Bin 2875 -> 0 bytes .../docs/examples/utah/css/style.css | 222 - .../docs/examples/utah/favicon.ico | Bin 766 -> 0 bytes .../utah/img/BaseMapSelectorSprite-v1.1.png | Bin 48795 -> 0 bytes .../jquery-geo-1.0b2/docs/examples/utah/index.html | 64 - .../examples/utah/js/libs/jquery.watermark.min.js | 8 - .../examples/utah/js/libs/modernizr-1.7.min.js | 2 - .../docs/examples/utah/js/script.js | 100 - libs/js/jquery-geo-1.0b2/docs/examples/voting.html | 224 - libs/js/jquery-geo-1.0b2/docs/examples/wkt.html | 83 - libs/js/jquery-geo-1.0b2/docs/examples/xkcd.html | 62 - libs/js/jquery-geo-1.0b2/docs/examples/zoom.html | 63 - libs/js/jquery-geo-1.0b2/docs/geo/area.html | 60 - libs/js/jquery-geo-1.0b2/docs/geo/bbox.html | 70 - libs/js/jquery-geo-1.0b2/docs/geo/center.html | 51 - libs/js/jquery-geo-1.0b2/docs/geo/centroid.html | 61 - libs/js/jquery-geo-1.0b2/docs/geo/contains.html | 62 - libs/js/jquery-geo-1.0b2/docs/geo/distance.html | 54 - libs/js/jquery-geo-1.0b2/docs/geo/expandBy.html | 52 - libs/js/jquery-geo-1.0b2/docs/geo/height.html | 50 - libs/js/jquery-geo-1.0b2/docs/geo/include.html | 61 - libs/js/jquery-geo-1.0b2/docs/geo/index.html | 77 - libs/js/jquery-geo-1.0b2/docs/geo/length.html | 59 - libs/js/jquery-geo-1.0b2/docs/geo/pointAlong.html | 59 - libs/js/jquery-geo-1.0b2/docs/geo/polygonize.html | 52 - libs/js/jquery-geo-1.0b2/docs/geo/proj.html | 114 - libs/js/jquery-geo-1.0b2/docs/geo/reaspect.html | 51 - libs/js/jquery-geo-1.0b2/docs/geo/recenter.html | 52 - libs/js/jquery-geo-1.0b2/docs/geo/scaleBy.html | 52 - libs/js/jquery-geo-1.0b2/docs/geo/width.html | 50 - .../jquery-geo-1.0b2/docs/geographics/index.html | 44 - libs/js/jquery-geo-1.0b2/docs/geomap/append.html | 231 - .../jquery-geo-1.0b2/docs/geomap/axisLayout.html | 60 - libs/js/jquery-geo-1.0b2/docs/geomap/bbox.html | 63 - libs/js/jquery-geo-1.0b2/docs/geomap/bboxMax.html | 61 - libs/js/jquery-geo-1.0b2/docs/geomap/center.html | 59 - libs/js/jquery-geo-1.0b2/docs/geomap/cursors.html | 68 - libs/js/jquery-geo-1.0b2/docs/geomap/destroy.html | 50 - .../js/jquery-geo-1.0b2/docs/geomap/drawStyle.html | 71 - libs/js/jquery-geo-1.0b2/docs/geomap/empty.html | 61 - libs/js/jquery-geo-1.0b2/docs/geomap/find.html | 112 - .../jquery-geo-1.0b2/docs/geomap/geomapbbox.html | 53 - .../jquery-geo-1.0b2/docs/geomap/geomapclick.html | 53 - .../docs/geomap/geomapdblclick.html | 57 - .../docs/geomap/geomaploadend.html | 57 - .../docs/geomap/geomaploadstart.html | 57 - .../jquery-geo-1.0b2/docs/geomap/geomapmove.html | 53 - .../jquery-geo-1.0b2/docs/geomap/geomapshape.html | 57 - .../js/jquery-geo-1.0b2/docs/geomap/images/map.png | Bin 5005 -> 0 bytes libs/js/jquery-geo-1.0b2/docs/geomap/index.html | 296 - .../docs/geomap/measureLabels.html | 67 - libs/js/jquery-geo-1.0b2/docs/geomap/mode.html | 391 - libs/js/jquery-geo-1.0b2/docs/geomap/opacity.html | 88 - libs/js/jquery-geo-1.0b2/docs/geomap/pannable.html | 62 - .../js/jquery-geo-1.0b2/docs/geomap/pixelSize.html | 60 - libs/js/jquery-geo-1.0b2/docs/geomap/refresh.html | 94 - libs/js/jquery-geo-1.0b2/docs/geomap/remove.html | 68 - libs/js/jquery-geo-1.0b2/docs/geomap/resize.html | 54 - libs/js/jquery-geo-1.0b2/docs/geomap/scroll.html | 62 - libs/js/jquery-geo-1.0b2/docs/geomap/services.html | 207 - .../jquery-geo-1.0b2/docs/geomap/shapeStyle.html | 115 - libs/js/jquery-geo-1.0b2/docs/geomap/shift.html | 79 - .../jquery-geo-1.0b2/docs/geomap/tilingScheme.html | 95 - libs/js/jquery-geo-1.0b2/docs/geomap/toMap.html | 51 - libs/js/jquery-geo-1.0b2/docs/geomap/toPixel.html | 51 - libs/js/jquery-geo-1.0b2/docs/geomap/toggle.html | 88 - libs/js/jquery-geo-1.0b2/docs/geomap/zoom.html | 67 - libs/js/jquery-geo-1.0b2/docs/geomap/zoomMax.html | 64 - .../jquery-geo-1.0b2/docs/geomap/zoomMethod.html | 60 - libs/js/jquery-geo-1.0b2/docs/geomap/zoomMin.html | 64 - libs/js/jquery-geo-1.0b2/docs/html/index.html | 104 - .../docs/images/$.geo-logo-large.png | Bin 2252 -> 0 bytes .../docs/images/$.geo-logo-small.png | Bin 1472 -> 0 bytes .../js/jquery-geo-1.0b2/docs/images/$.geo-logo.png | Bin 2312 -> 0 bytes .../jquery-geo-1.0b2/docs/images/bostonbuilt.png | Bin 5083 -> 0 bytes libs/js/jquery-geo-1.0b2/docs/images/map.png | Bin 5005 -> 0 bytes libs/js/jquery-geo-1.0b2/docs/index.html | 175 - libs/js/jquery-geo-1.0b2/docs/internals/index.html | 85 - libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.js | 4826 ---------- .../jquery-geo-1.0b2/docs/jquery.geo-1.0a3.min.js | 128 - libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.js | 6233 ------------- .../jquery-geo-1.0b2/docs/jquery.geo-1.0a4.min.js | 171 - .../js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.1.js | 6956 --------------- .../docs/jquery.geo-1.0b1.1.min.js | 4 - libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.js | 6943 --------------- .../jquery-geo-1.0b2/docs/jquery.geo-1.0b1.min.js | 4 - libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.js | 7215 --------------- .../jquery-geo-1.0b2/docs/jquery.geo-test.min.js | 4 - libs/js/jquery-geo-1.0b2/docs/js/plugins.js | 34 - .../jquery-geo-1.0b2/docs/js/rainbow-custom.min.js | 13 - libs/js/jquery-geo-1.0b2/docs/js/script.js | 38 - .../js/jquery-geo-1.0b2/docs/quickstart/index.html | 50 - libs/js/jquery-geo-1.0b2/docs/what/index.html | 48 - libs/js/jquery-geo-1.0b2/favicon.ico | Bin 26694 -> 0 bytes libs/js/jquery-geo-1.0b2/grunt.js | 81 - libs/js/jquery-geo-1.0b2/index-full.html | 511 -- libs/js/jquery-geo-1.0b2/index.html | 292 - libs/js/jquery-geo-1.0b2/js/excanvas.js | 1417 --- libs/js/jquery-geo-1.0b2/js/excanvas.min.js | 14 - libs/js/jquery-geo-1.0b2/js/jquery-1.7.2.js | 9404 -------------------- libs/js/jquery-geo-1.0b2/js/jquery.geo.core.js | 1153 --- .../jquery-geo-1.0b2/js/jquery.geo.geographics.js | 571 -- libs/js/jquery-geo-1.0b2/js/jquery.geo.geomap.js | 2299 ----- libs/js/jquery-geo-1.0b2/js/jquery.geo.head.js | 23 - libs/js/jquery-geo-1.0b2/js/jquery.geo.shingled.js | 251 - libs/js/jquery-geo-1.0b2/js/jquery.geo.tiled.js | 303 - libs/js/jquery-geo-1.0b2/js/jquery.mousewheel.js | 84 - .../jquery-geo-1.0b2/js/jquery.mousewheel.min.js | 12 - libs/js/jquery-geo-1.0b2/js/jquery.ui.widget.js | 278 - .../js/jquery-geo-1.0b2/js/jquery.ui.widget.min.js | 10 - libs/js/jquery-geo-1.0b2/js/jsrender.js | 847 -- libs/js/jquery-geo-1.0b2/js/jsrender.min.js | 9 - libs/js/jquery-geo-1.0b2/libs/jquery/jquery.js | 9404 -------------------- libs/js/jquery-geo-1.0b2/libs/qunit/qunit.css | 232 - libs/js/jquery-geo-1.0b2/libs/qunit/qunit.js | 1659 ---- libs/js/jquery-geo-1.0b2/package.json | 34 - libs/js/jquery-geo-1.0b2/test/jquery.geo.html | 28 - libs/js/jquery-geo-1.0b2/test/jquery.geo_test.js | 38 - 199 files changed, 78869 deletions(-) delete mode 100755 libs/js/jquery-geo-1.0b2/.gitignore delete mode 100755 libs/js/jquery-geo-1.0b2/LICENSE-GPL delete mode 100755 libs/js/jquery-geo-1.0b2/LICENSE-MIT delete mode 100755 libs/js/jquery-geo-1.0b2/README.md delete mode 100755 libs/js/jquery-geo-1.0b2/apple-touch-icon.png delete mode 100755 libs/js/jquery-geo-1.0b2/dev-journal-ryan.txt delete mode 100755 libs/js/jquery-geo-1.0b2/docs/404.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/css/handheld.css delete mode 100755 libs/js/jquery-geo-1.0b2/docs/css/style.css delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/all-shingled.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/all-tiled.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/append.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/appendservice.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/basemaps.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/bbox.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/bostock.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/census.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/center.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/css/style.css delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/defer.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/destroy.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/drag.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/draw.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/drawStyle.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/empty.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/emptyservice.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/events.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/find.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/findservice.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/geo-geometry.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/geometry.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/hurricane.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/image.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/img/ajax-loader.gif delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/img/boat.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/img/jsfiddle.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/img/marker.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/inset.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/insetmap.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/isGeodetic.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/jqm.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/js/all-shingled.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/js/all-tiled.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/js/iecors.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/js/json2.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/kml.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/label.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/labelservice.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/logo.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/marker.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/markers.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/measure.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/mobile.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/mode-zoom.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/opacity.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/panscroll.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/proj.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/refresh.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/remove.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/removeservice.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/services.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/shapeStyle.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/shapeStyleservice.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/shingled.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/simplest.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/spocode.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/static.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/stringsrc.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/template.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/tiger.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/tiledservices.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/tilingScheme.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/tracking.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/twheat/css/style.css delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/twheat/img/$.geo-logo-small.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/twheat/img/ajax-loader.gif delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/twheat/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/twheat/js/twheat.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/twitter-heat.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/usastates.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/apple-touch-icon.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/css/style.css delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/favicon.ico delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/img/BaseMapSelectorSprite-v1.1.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/jquery.watermark.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/modernizr-1.7.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/utah/js/script.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/voting.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/wkt.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/xkcd.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/examples/zoom.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/area.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/bbox.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/center.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/centroid.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/contains.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/distance.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/expandBy.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/height.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/include.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/length.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/pointAlong.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/polygonize.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/proj.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/reaspect.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/recenter.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/scaleBy.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geo/width.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geographics/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/append.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/axisLayout.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/bbox.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/bboxMax.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/center.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/cursors.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/destroy.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/drawStyle.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/empty.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/find.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomapbbox.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomapclick.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomapdblclick.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadend.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadstart.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomapmove.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/geomapshape.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/images/map.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/measureLabels.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/mode.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/opacity.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/pannable.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/pixelSize.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/refresh.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/remove.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/resize.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/scroll.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/services.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/shapeStyle.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/shift.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/tilingScheme.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/toMap.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/toPixel.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/toggle.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/zoom.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/zoomMax.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/zoomMethod.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/geomap/zoomMin.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/html/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/images/$.geo-logo-large.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/images/$.geo-logo-small.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/images/$.geo-logo.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/images/bostonbuilt.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/images/map.png delete mode 100755 libs/js/jquery-geo-1.0b2/docs/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/internals/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.1.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.1.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/js/plugins.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/js/rainbow-custom.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/js/script.js delete mode 100755 libs/js/jquery-geo-1.0b2/docs/quickstart/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/docs/what/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/favicon.ico delete mode 100755 libs/js/jquery-geo-1.0b2/grunt.js delete mode 100755 libs/js/jquery-geo-1.0b2/index-full.html delete mode 100755 libs/js/jquery-geo-1.0b2/index.html delete mode 100755 libs/js/jquery-geo-1.0b2/js/excanvas.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/excanvas.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery-1.7.2.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.geo.core.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.geo.geographics.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.geo.geomap.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.geo.head.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.geo.shingled.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.geo.tiled.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.mousewheel.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.mousewheel.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.ui.widget.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jquery.ui.widget.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jsrender.js delete mode 100755 libs/js/jquery-geo-1.0b2/js/jsrender.min.js delete mode 100755 libs/js/jquery-geo-1.0b2/libs/jquery/jquery.js delete mode 100755 libs/js/jquery-geo-1.0b2/libs/qunit/qunit.css delete mode 100755 libs/js/jquery-geo-1.0b2/libs/qunit/qunit.js delete mode 100755 libs/js/jquery-geo-1.0b2/package.json delete mode 100755 libs/js/jquery-geo-1.0b2/test/jquery.geo.html delete mode 100755 libs/js/jquery-geo-1.0b2/test/jquery.geo_test.js diff --git a/COPYING b/COPYING index f5edf2f..6343b2c 100755 --- a/COPYING +++ b/COPYING @@ -33,11 +33,6 @@ widgets/jquery.mobile.groupindex/ including theme files (removed php files which required some changes), demo html, js, and also the jquery.mobile.scrollview.{js/css} in the common directories (already copied as part of datetimepicker). -widgets/jquery.mobile.maps/ - initial version taken from : - svn checkout http://jquery-ui-map.googlecode.com/svn/trunk/ jquery-ui-map-read-only - Checked out revision 254. - jQuery UI (http://jqueryui.com/) [MIT license] JQM-DateBox (https://github.com/jtsage/jquery-mobile-datebox) [CC 3.0 Attribution] developed by JTSage (http://dev.jtsage.com/blog/) diff --git a/libs/js/jquery-geo-1.0b2/.gitignore b/libs/js/jquery-geo-1.0b2/.gitignore deleted file mode 100755 index 7fb648e..0000000 --- a/libs/js/jquery-geo-1.0b2/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ - -/sandbox -/web.config -/update.bat -*.swp diff --git a/libs/js/jquery-geo-1.0b2/LICENSE-GPL b/libs/js/jquery-geo-1.0b2/LICENSE-GPL deleted file mode 100755 index 11dddd0..0000000 --- a/libs/js/jquery-geo-1.0b2/LICENSE-GPL +++ /dev/null @@ -1,278 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. diff --git a/libs/js/jquery-geo-1.0b2/LICENSE-MIT b/libs/js/jquery-geo-1.0b2/LICENSE-MIT deleted file mode 100755 index 2c50669..0000000 --- a/libs/js/jquery-geo-1.0b2/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Ryan Westphal - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/libs/js/jquery-geo-1.0b2/README.md b/libs/js/jquery-geo-1.0b2/README.md deleted file mode 100755 index 71577b0..0000000 --- a/libs/js/jquery-geo-1.0b2/README.md +++ /dev/null @@ -1,324 +0,0 @@ -# jQuery Geo - -After years of internal development, we are pleased to bring our JavaScript map widget and spatial analysis tools to the open-source world in the form of a jQuery plugin. - -## Getting Started -Using jQuery Geo requires adding one element, including one script (apart from jQuery itself) and calling one function. The following copy-and-paste snippet will help you get started. - -```html -
- - - -``` - -You can also download the latest release as a [minified JavaScript file][min] or a [full, uncompressed one][max]. - -[min]: http://code.jquerygeo.com/jquery.geo-1.0b1.min.js -[max]: http://code.jquerygeo.com/jquery.geo-1.0b1.js - - -## Documentation -The latest docs are hosted at: http://docs.jquerygeo.com - -Release and other announcements via @jQueryGeo on Twitter: https://twitter.com/jQueryGeo - -News and smaller updates via @ryanttb on Twitter: https://twitter.com/ryanttb - -## Contributing -In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt). - -## Release History - -### 1.0b2 -* examples - drawing markers -* geomap - ie8 - [bug] graphics do not resize with window -* examples - kml points -* docs - geomap - default action for shift option should be dragBox in dragBox mode -* geomap - default action for shift option should be dragBox in dragBox mode -* geomap - don't empty graphics on map interaction -* geographics - build labels in background, replace html once -* geomap - [bug] sometimes interaction with other elements doesn't work right on a page with a map -* geographics - don't empty labels on map interaction - -### 1.0b1.1 (2012-08-24) -* geomap - [bug] shingled deferred services lose img elements when changing scales slowly -* geomap - [bug] shapes don't render on smaller windows when zoomed in -* geomap - [bug] changing the zoom & center options at the same time does not zoom to the correct location - -### 1.0b1 (2012-07-30) -* geographics - use canvas compositing for Polygons with holes -* geographics - [bug] on polygons with holes, stroke draws a line from exterior ring to interior one -* docs - geomap - trigger a shape event when a user finishes measuring -* geomap - trigger a shape event when a user finishes measuring -* geomap - [bug] elements inside the map div lose their position setting -* geomap - trigger bboxchange when we update the map size after the window resizes -* geomap - [bug] multiple map widgets share the same compiled measureLabels template names and overwrite each other -* examples - inset map/multiple maps example -* geomap - [bug] in zoom mode, dragging from bottom-right to top-left draws box but doesn't zoom -* geomap - [bug] any mouse down triggers refresh, even without pan -* cdn - fix caching -** Cache-Control header max-age set to 5 years -** remove Expires header -* geomap - upgrade to jsrender 1.0pre -* deploy - build releases using grunt -* deploy - make a package for new jQuery plugin directory -** https://github.com/jquery/plugins.jquery.com/blob/master/docs/package.md -* deploy - lint JavaScript files -* docs - geomap - dragBbox mode -* docs - geo - polygonize function for bbox -* geo - polygonize function for bbox -* geomap - dragBbox mode -* docs - geomap - shift option (default, zoom, dragBbox, off) -* geomap - shift option (default, zoom, dragBbox, off) -* docs - geomap - loadstart, loadend events -* docs - geomap - allow append to take an array of shapes -* docs - geomap - allow remove to take an array of shapes -* docs - geomap - improve services option documentation -* geomap - clamp measure labels to [0, 0] -* geo - clamp centroid to bbox -* geomap - measure label for polygon should be in centroid -* geomap - merge interactive pan and zoom into one, faster system (pan/zoom rewrite) -* geomap - [bug] iOS - panning is visually jumpy but settles on the correct bbox in the end -* geomap - pinch-zoom doesn't follow user's fingers close enough when scaling -* geomap - [bug] pinch zoom on iPad 2 (iOS 5) doesn't refresh tiles when zooming out -* geomap - request new image in shingled service during interactive pan -* geomap - [bug] zoom in more than once with zoom method moves tiles to the wrong spot -* geomap - [bug] only services that have finished refreshing move when the user pans -* geomap - [bug] map panning is jumpy, appears to be related to shapes and/or drawing context -* geomap - [bug] pan sometimes lags on first drag -* geomap - tiled data-scaleOrigin should be stored as an array -* geomap - android - [bug] cannot always pan map after appending shapes -* geomap - android - browser stops pan/zoom after 7 logos on logo demo -* geomap - [bug] mouse wheel on bad or missing tile doesn't zoom out on first rotate -* geomap - increase mobile performance by 9000 -* docs - geomap - add argument to refresh to force reload of images for dynamic data -* docs - geomap - allow service-level refresh -* docs - geomap - zoomMax option (tiled & shingled) -* docs - geo - include method for bbox -* geomap - bboxMax should reset center & pixelSize -* geomap - [bug] initializing center, zoom, & bbox doesn't set all properties -* geo - [bug] polygonize doesn't return valid polygon when using geodetic coordinates -* geomap - [bug] dragBbox doesn't include the bbox property in the shape -* geomap - dragBbox should send a Point (with bbox) for single clicks -* docs - geomap - dragCircle mode -* geo - include method for bbox -* geomap - dragCircle mode -* geomap - [regression] refresh & toggle methods no longer keep original service objects in sync -* geomap - [bug] when a singled image hasn't loaded after pan and you double click on empty space, the zoomed bbox seems wrong -* geomap - allow service-level refresh -* geographics - remove the blit canvas from the DOM, i.e., don't attach -* geomap - don't initialze service-level geographics until they're used -* geomap - add argument to refresh to force reload of images (in case of dynamic data) -* geomap - loadstart, loadend events -* geomap - allow append to take an array of shapes -* geomap - allow remove to take an array of shapes -* geomap - zoomMax option -* geomap - [bug] cannot interact with other elements on the page on iOS after panning the map (#71) -* geomap - iOS - [bug] after one finger is removed, stop processing as if multitouch is still on -* geomap - dumb high-precision mice down on tiled maps -** otherwise, the high precision rounds down to zero change in zoom -* geomap - use linear distance for pinch zoom calculation -* docs - geomap - zoomMin option -* geomap - zoomMin option -* docs - geomap - use MapQuest Open by default; can't deny that it looks much nicer -* geomap - use MapQuest Open by default; can't deny that it looks much nicer -* docs - geomap - rename dragBbox to dragBox -* geomap - rename dragBbox to dragBox -* geomap - [bug] error using tiled deferred services - -### 1.0a4 (2012-02-19) -* geomap - [bug] changing the tilingScheme doesn't update pixelSize, maxPixelSize, center or centerMax -* geomap - [bug] shingled services throw exception during resize -* docs - geomap - axisLayout option -* geomap - axisLayout option -* docs - upgrade to jQuery Mobile rc3 -* docs - allow page refreshing -* docs - geomap - more modes: measureDistance, measureArea, static -* docs - geomap - append label argument -* docs - geomap - toPixel/toMap should take all coordinate dimensions like the proj functions -* geomap - toPixel/toMap should take all coordinate dimensions like the proj functions -* geomap - move the drawing container instead of individual points during pan -* geomap - [bug] drawStyle resets after window resize -* geomap - append label argument -* docs - geomap - measureLabels option -* geomap - measureLabels option -* geomap - measureDistance mode -* geomap - measureArea mode -* docs - geomap - service-level shapeStyle -* docs - geomap - getUrl string option -* geomap - [bug] create doesn't clear drawing shapes -* docs - geomap - service-level shapes -* docs - geo - detect geodetic coordinates and call $.geo.proj automatically, don't require devs to set $.geo.proj to null -* docs - geomap - add projection section explaining how bbox & center affect map unit type -* docs - geomap - rename getUrl to src -* docs - geomap - scroll option -* docs - geomap - pannable option -* geomap - src string option -* examples - string service src -* geomap - [bug] map tracks mouse when not panning if click on other elements -* geomap - pannable option -* geomap - scroll option -* geomap - [bug] shapesContainer is being cleared twice during mouse wheel zoom -* geomap - support pinch zoom on iOS -* docs - geo - add recenter function for bbox -* geomap - static mode -* docs - geomap - allow Deferred or Promise as return value from src function -* geomap - [bug] widget factory merges first service with default sometimes causing exceptions with shingled services -* geomap - allow Deferred or Promise as return value from src function -* geomap - [bug] resize event triggered too many times during resize -* geomap - service-level shapes -* geomap - service-level find -* geographics - add a resize method, call from geomap.resize -* geo - add recenter function for bbox -* geomap - [bug] errors creating second un-tiled map after destroying a first on same element -* geomap - refresh shouldn't request new images if the map element is hidden -* geomap - [bug] delayed multitouch isn't nearly as smooth as true multitouch -* geomap - [bug] tiled pinch zoom isn't smooth -* geo - detect geodetic coordinates and call $.geo.proj automatically, don't require devs to set $.geo.proj to null -* geomap - [bug] mouse wheel doesn't work with jQuery 1.7 -** upgrade to latest jquery.mousewheel plugin -* geomap - service object visibility and opacity options should be moved to a style property -* geomap - use currentServices in all functions unless we actually need to update the public options services object -* geomap - don't change user's service objects in opacity/toggle -* geomap - show attr text -* docs - geomap - selector argument to find method -* geomap - selector argument to find method -* geomap - pan mode should use a hand cursor by default -* geomap - [bug] only services that have finished refreshing move when the user pans -** for a4: hide unfinished services -* geomap - [bug] a user can mess with the center option, e.g., convert numbers to strings, and it can wreck havoc with map state -* geomap - [bug] zoom option doesn't return proper values for shingled services -* geomap - [bug] non-tiled maps can zoom out past zoom 0 -* geomap - don't request tiles that are -y index -* geomap - [bug] initializing tiled map by non-geodetic bbox always causes zoom level 0 -* docs - geomap - empty string needed for label element -* geomap - label divs should have class="geo-label" & style="position: absolute;" -* geomap - [bug] double tap to end shapes adds two points before ending the shape, in different places -* geomap - [bug] lifting fingers after pinch zoom in drawLineString or drawPolygon modes sometimes adds fake visual coordinate on touch point last lifted -* docs - upgrade to jQuery 1.7.2 -* geomap - [bug] scroll=off doesn't zoom map but also doesn't allow document scroll -* geomap - [bug] changing mode does not reset measure drawing -* geomap - [bug] jQuery UI Widget Factory no longer passes pageX & pageY event properties during trigger when using jQuery 1.7 -** upgrade to Widget Factory 1.8.17 -* examples - all demo (shingled) -* docs - geomap - custom modes -* examples - all demo (tiled) - -### 1.0a3 (2011-11-01) -* docs - geomap - more modes: zoom, drawPoint, drawLineString, drawPolygon -* geomap - [bug] tiles do not show when pixel sizes are near or lower than 1.0 -* geo - cache bbox as geoBbox to match namespacing convention started by jQuery Mobile -* docs - geo - initial bbox operations: center, height/width, expandBy, scaleBy & reaspect functions -* docs - geo - initial geometry operations: bbox, distance, contains, centroid -* docs - geomap - shape event -* docs - geomap - refresh argument in append, remove & empty -* docs - geomap - document the resize method -* docs - launch jquerygeo.com -* docs - upgrade to jQuery Mobile b3 -* docs - services - remove id property, explain the class property -* docs - rename getPixelSize to just pixelSize -* docs - services - change visible to visibility so it matches shapeStyle & CSS -* docs - geomap - allow child selector syntax to target service elements with toggle & opacity methods -* geomap - split servieTypes to different files -* geomap - add data-geo-service to all service container elements, set to type of service -* geomap - add data-geo-map to map divs initialized with geomap, remove on destroy -* geomap - allow child selector syntax to target service elements with toggle & opacity methods -* geomap - [bug] toggle does not refresh the map services being shown for the first time -* geomap - [bug] destroy keeps window resize handler -* geomap - [bug] destroy erases content originally inside map div -* geomap - serviceType objects' destroy method isn't being called -* geomap - [bug] destroyed geomaps remember appended shapes -* docs - geomap - zoom method -* geomap - zoom method -* geo - calculate bbox in projected coordinates -* docs - proj - mention that Geodetic methods can also do bbox -* geo - geometry - bbox function -* docs - geomap - destroy method -* geo - bbox - center function -* geo - bbox - height/width function -* geo - bbox - expandBy function -* geo - bbox - scaleBy function -* geo - bbox - reaspect function -* docs - geomap - drawStyle option -* geomap - [bug] shapeStyle not maintained after resize -* geomap - [bug] second drag while in inertial pan causes map to jump back -* geomap - drawPoint mode -* geomap - drawLineString mode -* geomap - refreshShapes should check bbox cache before drawing -* geomap - drawPolygon mode -* geomap - port zoom mode -* geomap - port shift-zoom mode for pan & draw modes -* geo - geometry - distance function -* examples - distance -* geomap - rename getPixelSize to just pixelSize -* geomap - [bug] zoom method doesn't work with shingled map -* geomap - store service state data as jQuery data on serviceContainer element -* geo - geometry - contains function -* geomap - rename service.visible to visibility having either "visible" or "hidden" values -* geo - geometry - centroid function -* geomap - make service id property optional, add HTML id to serviceContainer if present -* geomap - append should cache the shape's bbox (instead of the bbox function) -* geomap - remove should remove the shape's bbox cache -* geomap - empty should remove the bbox cache for all shapes -* geomap - make the refresh argument in append public, add one to remove & empty -* geomap - disable shape redraw during interactive zoom if more than 255 shapes -* geomap - [bug] shape bbox culling hides shapes that are partially on screen & should be drawn -* docs - geomap - make pixelSize a read-only option instead of a function -* geomap - make pixelSize a read-only option instead of a function -* docs - geomap - make shapeStyle an option -* geomap - make shapeStyle an option -* examples - rewrite shapeStyle example - -### 1.0a2.5 (2011-08-03) -* geomap - find - [bug] does not handle GeoJSON features -* geomap - find - allow for 0 pixel tolerance -* geomap - find - check for bbox on non-Point geometries before getting too specific -* geo - bbox - cache shape bboxes -* docs - do not suggest that it's ok to change the geometry now that we're caching bbox -* geomap - jsperf test of bbox query vs. geom query on point data -* geographics - [bug] 0 opacity acts as full opacity -* geomap - add opacity to service type objects & call from geomap's opacity method -* geomap - add toggle to service type objects & call from geomap's toggle method -* geo.proj - update bundled web mercator projection code (removed 150 lines of code) -* geomap - auto-handle window resize events -* docs/geomap - scale map according to cursor location instead of re-centering during double-click zoom -* geomap - iOS - [bug] second tap can be anywhere & cause a zoom -* geomap - shingled - [bug] map doesn't resize correctly -* examples - geomap drawStyle option - -### 1.0a2 (2011-06-29) -* geomap - Support dynamic map services -* geomap - [BUG] geomap causes a script error if jQuery UI is already included -* docs - Document shape methods -* geomap - [BUG] Port of soft double-click does not work -* geomap - [BUG] Cannot see dev-supplied inner content if not set to rel/abs position -* geomap - Add mobile test page -* geographics - Port graphic code from internal control -* geomap - Implement append method -* geographics - drawArc should use style's width and height and only take center as an argument -* geomap - Document and implement the public refresh method -* geomap - Implement shapeStyle method -* geographics - Draw points as rounded rectangles via width, height & borderRadius properties on shapeStyle, drop oval functionality -* geomap - Remove the pixels property from position events and add the type property to make the event argument a true GeoJSON Point -* proj - support up to four dimentional array to convert MultiPolygon coordinates in one shot -* proj - add functions to convert individual positions that developers can re-implement for their own projection -* geomap - implement remove method -* geomap - implement find method -* geomap - [bug] toPixel should round pixel values -* geomap - [bug] GeometryCollection shapes do not draw with their parent shape's style -* geomap - implement empty method - -### 1.0a1 (2011-05-09) -* docs - Document a new interface to our internal map control -* geomap - Port interactive map widget base to jQuery UI widget factory -* geomap - Support tiled map services - -## License -Copyright (c) 2012 Applied Geographics, Inc. -Project lead by Ryan Westphal -Licensed under the MIT, GPL licenses. diff --git a/libs/js/jquery-geo-1.0b2/apple-touch-icon.png b/libs/js/jquery-geo-1.0b2/apple-touch-icon.png deleted file mode 100755 index db2ecf1f8216330cd6e3b8ad1b4728d2aae0c91e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2252 zcmeHH`8U)H6#veAV=%@HdS%TpL&h$z&Dt2-WQ={Op7oF>LYaq@F~i7E_K=<|ArqP; zie4C$rQ&7xEJa!35UFPwj5q#;_v`DP^SSrj&%M9g&pG##76Netg-Si7n5uLr6|I!2j84O-+}6^} z*4E0=)ydY=&C%B@u_cy}PM4BN+#aZ`?a~_qyovkO4>h0{BU0t70 z0&6Z_s0pGxkEGT|QX8UvZ@3!qB07@m=GMfdH!&H_H{!X8OfDNlRtc6QlLQN1(WmCP{;RFK?R4Cz zk|>w3@~)xIg%w?E)`xu>urXwhznHg1$vr0b!$P;LVg=r>t$?rC(0L&CfoA3H zQ?=%vIgwuOoU=HNGjPcA&E-rfwi+a_{-Z-F-$LCYZvDkEG7OuQoYXT#wQFKatc5+d zq{y$okW4MWD%-$OeYF*tO^ICj%AQ9d+o~~=K1^N~X}@7r-hpq|l(`5RzAJuVpwRX6Xy%4P>uubHc9u7gMQZl5M#Q^BP2W&&buILOOTo-b1uRo;1i77>0mEWA#xHEsa z0mIrNcs|Hjlgz=56n%TmgD&~kBo!?OzvQd@5p~_od(x$)F2#r?lEI$`PRB5w;)YE_ z^dppOME8|7ae<0UMS+Xv!TnOVd2xWogBa|=^zOb*rN_?EkeAOkk0iR^n1uG5F&G5q z8tNawk4A^IYQ6gIWN<{SVV*ZiRraIL2E7e#CVe}UY@!~|&ONXOXsuLi(Lm0@na{#hAu|MRx*~k%7 zzjeZ0;d>vICWcJ1m*IC|O@z+njknN~<5LF|3tHxOdXLX+#Y>#x1u7LHNd@URQL|DW zI`1MXj^dzTG`~f71ICGqaPT0W&re6ND};+7=__#!lsX$E-I^W}AouHubX`U1EXc6x zD0XfDHk+X`ei??WSpc)rI~~_Sn`!nU551I7Q1Ue((10GM| max possible y for scale -* docs - geomap - view.service.row & view.service.column to string multiple services together or repeat horizontal tiles -* geomap - Firefox - [bug] inertial pan is choppy post touchstop -** post inertial pan rewrite -* geomap - dragCircle must hook into _refreshDrawing so that the circle moves correctly when the user zooms; which means I have to store the center coordinate as well as pixel -* geomap - [bug] on that note, I can't zoom in dragCircle mode -* docs - better describe append/find connection and how to append data and use the click event to find it later -** see email reply to Marc -* docs - geomap - describe "graphic service" as shingled with src set to empty string or null -* docs - warn users about potential CSS/JavaScript issues relating to generated elements -** ul, li, div, span, img -* geomap - compile shingled & tiled string src templates for re-use -** be sure their template names are unique so they don't overwrite each other -* geomap - don't redraw graphics if the map doesn't move during pan -* geomap - replace data-geo attributes with classes -* geomap - cache label coordinates (the labelPixel cannot be cached, it will change each refresh) -* geomap - rotate label based on segment -* geomap - use pointer-events: none where appropriate -* docs - geomap - allow template for label argument to append -* geomap - allow template for label argument to append -* docs - geomap - allow template for properties on style argument to append -* geomap - allow template for properties on style argument to append -* docs - geomap - shapeLabel property -** template for labels for all shapes added via append -* geomap - tiled - retry failed requests once if status === 0 (failed) -* geomap - shapeLabel property -* docs - geomap - allow template for properties on shapeStyle option -* geomap - allow template for properties on shapeStyle option -* geomap - better integrate resize with interactiveTransform -* geomap - determine if moz-transform improves speed in Firefox -* geomap - [bug] once we detect a pan, disable the ability to go to multitouch -* geomap - [bug] verify label clamping is correct in axisLayout=image maps -* docs - geomap - pass the service id (if there is one) to the src callback as a view property -* geomap - pass the service id (if there is one) to the src callback as a view property -* docs - geomap - support dynamic map services that only work in geodetic coordinates (sr=4326)? -** can be done with src function that uses $.geo.toGeodetic? -* geomap - support dynamic map services that only work in geodetic coordinates (sr=4326)? -* docs - geomap - pan events (pattern after HTML5 drag) -** can cancel with preventDefault -* docs - geomap - zoom events (pattern after HTML5 drag) -** can cancel with preventDefault -* docs - geomap - support two-finger vertical slide as zoom on mobile devices -* geomap - create own .position function b/c $.position is doing too much -** we don't have to worry about border or margin, all elements are within map div -* geomap - pan events (pattern after HTML5 drag) -* geomap - zoom events (pattern after HTML5 drag) -* geomap - test jQuery widget call chaining when setting option values -* geomap - when scroll is zoom, attempt to not zoom while user is scrolling the page anyway -* docs - geomap - document the correct way to add/change a service after init -* geomap - unbind keydown handler on destroy, it's on the document -* geomap - use requestAnimationFrame instead of setTimeout when waiting to move the map during intractiveTransform -* expose jQuery Geo as an AMD module so asynchronous loaders like RequireJS and curl.js can use it -* cdn - test cache headers with http://redbot.org/ before release -* docs - $.geo.WKT object -* geo - $.geo.WKT object -* geomap - panning cursor (closed hand, for when user is actually panning) -* geomap - completely original cursor set for pan, zoom, draw, etc. -* docs - geomap - replace method -* geomap - replace method -* geomap - draw shapes to img and integrate with interactiveTransform -* docs & examples - settle on the word "option" in all text (instead of property) to match widget function -* docs - make all map examples live -* docs - explain the 96px scale bar, why 96? -* docs - write a full page about GeoJSON and what each object type is to $.geo -* docs - geomap - allow name as service object property -** if a service has a name property, it will maintain a hidden input with the given name -* docs - geo - support up to GeometryCollection in distance -* geo - support up to GeometryCollection in distance -* docs - geo - support up to GeometryCollection in contains -* geo - support up to GeometryCollection in contains -* docs - geo - support up to GeometryCollection in centroid -* geo - support up to GeometryCollection in centroid -* geomap - show a drawPoint style while the mouse is down, hide if toolPan or dbltap scale -* geomap - audit allocations and reduce garbage -** see http://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript -* geomap - re-use services that have the same id as existing services -* geomap - deep extend existing service objects when services property is set -* geomap - cache point bbox if $.geo.proj is not null? -* geomap - spatially index shapes when a tilingScheme is in place -* geomap - internal - add _getVisibleTiles method and use it in tiled service and shapes spatial index -* geomap - remove wheel plugin and use built-in mousewheel event -* geomap - test how the comma selector works with the find method -* geomap - compile service src templates, refresh when services changes -* geomap - audit destroy and memory leaks (jQuery data values, JavaScript object references, etc.) -* code - prefer $.data over $.fn.data -* docs - internal - explain what projection is and which one we use by default (3395) and maybe why we call it web mercator & why we can't get to +/- 90 lat -* docs - internal - document how geomap draws shapes, the geomapgraphics widget and the reason shapeStyle is a method -* docs - demo - location based notes/to do list -* geomap - find should check labels first -* geo - geometry - implement JTS note: "The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid)" -* geo - all bbox operations should be done in non-geodetic coordinates for accuracy -* geo - support bbox in distance ( fix geomap.find ) -* geomap - perf test putting all containers that need to move with panning in a single super-container -* docs - geomap - multiple labels -* geomap - multiple labels -* docs/geomap - store WKT input for each service -* geographics - rename the generated style properties to something simple or get better control over closure compiler -* geomap - document and implement find's callback syntax -* geomap - custering demo/support -* proj - take scale factor into account when calculating distance in web mercator -* geographics - disable fill by setting style.fill to "" & stroke by style.stroke to "" -* geographics - See Modernizr for comment on BB Storm & canvas detection -* geographics - document graphics widget -* geographics - support border, padding, and margin -* geographics - undo manual outer div style changes -* geomap - store a copy of shapes as WKT in a hidden input -* geomap - only update WKT copy if shape is appended with refresh argument set to true -* geomap - find - [maybe] after flatten, check more cached bboxes for non-Point geometrie -* docs - geomap - support TMS -* geomap - support TMS -* docs - geomap - toDataURL method -* geomap - toDataURL method -* docs - geo - $.geo.guessLocation function -* geo - $.geo.guessLocation function -* docs - services - document the plugin architecture -* docs - geomap - drawPush function -** in the drawing modes, this function starts drawing or adds a point into the already-started shape at the given coordinate -** immediately triggers the shape event if mode is drawPoint -* geomap - drawPush function -* docs - geomap - drawPop function -** in the drawing modes, this function ends drawing or removes a point into the already-started shape at the given coordinate -* geomap - drawPop function -* docs - geomap - drawStop function -** in the drawing modes, this function ends drawing and triggers the shape event with whatever coordinates have already been added to the shape -* geomap - drawStop -* geomap - use profiling to improve pan performance -* geo - potentially add address cracking - -==2012-11-02== -===shape functions=== -I'm going to head into the realm of delaying refresh during shape operations: append, remove, and empty. - -The issue is that users, including myself, forget to add the ", false" to append calls which makes the geographics widget refresh after every append. That needs to stop. It's a little better now with double buffering but not all devices (including Android) support that. - -I'm also not sure about hooking into interactiveTransform. This might require it's own timeout but if I can hook into interactiveTransform, I still think that's the preferred options. - -I certainly don't want to trigger interactiveTransform. - -==2012-11-01== -===graphics=== -It feels very slow without the timeout in place. Also, I still get a graphics jump if I pan after the services refresh but before all images come in. Most likely due to the service div resetting position and the graphics div not. - -This isn't ready yet. I don't think attaching to the global "all images are done" is working how I wanted. I'm going to abandon it for now. - -===service type graphics=== -I need to better design more specifically how this will work. - -* Each service type's refresh method will get an array of graphics to draw. -* The service objects will maintain their own geographics widget. - -I don't know, it's keeping up pretty well the way it was. I'm sure i can make the graphics rendering errors happen but I might be able to release this as b2. - -Also, it could have been worse because of all the console writing I was doing, and having the debugger open. - -===labels=== -It wasn't too hard to get labels moving again. % placement works well. - -===shape refresh=== -I would still like to fix the timing of refreshShapes so that it's not so jumpy with wheel zoom. I wonder what it's like during pinch zoom though. - -I could potentially do the refreshShapes inside the base interactive timeout. Then it can be canceled by more interaction. - -That works quite well. That's exactly what I've been trying to do. - -===mouseWheelFinish=== -It this function even used anymore? If so, why isn't it part of interactiveTransform? - -==2012-10-30== -===graphics=== -Yes, more graphics talk. It might be too much to move refreshShapes to the service objects. I would want more planning. The most I can do now is not call _refreshShapes until all services have finished or some timeout has occurred. - -==2012-10-29== -===jster=== -I added this project to jster.net. I think it looks nice on the list. - -==2012-10-28== -===graphics=== -I'm going to change how service type objects and refreshShapes works. Service types will need to draw their own shapes. Here are some notes: - - The refresh method of the service type objects will get an array of all the shapes. - - The service types will initialize their own geographics if they wish and draw the shapes themselves. - - This will duplicate some code in tiled & shingled but better allow for custom service types. - - Might want to have the service type objects allow for some sort of inheritance. - - When refreshing shapes, current services should wait for all pending images to avoid graphics swap errors. However, there should be a long timeout in case the images or a tile takes way too long. - - On interactive transform, they will call the same method on their geographic widget. - -I originally considered sending only view-relevent shapes to each service type but who is the map widget to decide? - -I would like to further note that the shapes array sent to each service type's refresh method is not just an array of GeoJSON objects, it's contains all the internal stuff we track like shape-specific style. If the service type want's the layer's shapeStyle, it will have to ask for it, I think. Maybe that will change later. - -This may or may not fix the flip issue. The map itself will have a special, fake shingled service (src is ""), that has all the map's graphics. They will not refresh until all images have completed downloading, user interaction is mostly done (time for a flip!) or a long timeout has been reached. - -All of this will need to be WELL-documented before I release info about adding custom service types. - -==2012-10-25== -===geographics flicker=== -I am swapping buffers a little better now and I also have to force a swap if we get an interactiveTransform call after we've begun drawing the next scene. - -This is not quite ready for production but it's a lot better than it was before yesterday. - -===android browser=== -Android 2 doesn't have toDataURL so I have to disable doubleBuffer even if the option is set to true. I'm now feature testing for toDataURL. - -==2012-10-24== -===graphics=== -I'm going to hide labels during interactiveTransform but keep shapes for now. - -I don't have to keep removing & creating the scene images, I can reuse them and swap. Double buffer FTW. - -The timeout is going to be part of all graphics drawing, even non-true canvas. I might roll labels into the code as well. - -===labels=== -I should build HTML apart from the labelsContainer and set the container's html once during _end. Wow. That's a lot faster. I can't believe I wasn't doing that before. I feel less worried about copying existing label elements at the moment. - -===flicker=== -There's now too much flicker, especially with measure & drawing tools. I do need some kind of immediate mode...doubleBuffer option? - -==2012-10-23== -===touchstop=== -There is a serious issue with jQuery Geo and either iOS 6 and Android 4. I like to be the first one to say that jQuery Geo is far from perfect. But first, finish: - -===graphics=== -I'm close, I think in light of more serious issues, once I get graphics drawing working as planned, I'm going to ignore label updates until I fix the touchstop bug. So, shapes will remain during interactive movement but labels will disappear. - -===graphics jump=== -Similar to shingled, my graphics jump when I draw the new scene. I need to have an original /interactive/ image and a new final image. Currently, geographics DOM layout (in true canvas mode) is: - -div.geo-graphics - |- img - \- div.geo-labels-container - -Needs to be: - -div.geo-graphics - |- img (back) - |- img (front) - \- div.geo-labels-container - -And later it will finally be: - -div.geo-graphics - |- div.geo-graphics-scene-container (back) - | |- img - | \- div.geo-labels-container - \- div.geo-graphics-scene-container (front) - |- img - \- div.geo-labels-container - -==2012-10-18== -===graphics=== -I'm drawing graphics to the canvas internally now and copying to an image tag for later transform. That second part is going to be hard. - -==2012-10-16== -===shift=== -There is still something wrong with the first "shift" drag. It's noticeable with the measure tools. If you set mode to "measureLength" and start measuring, your first shift-drag will pan instead. Your second shift-drag will create a marquee zoom box. - -And what about dragCircle? That always seems to dragCircle no matter what shift is. It must follow a different path. - -===graphics=== -I have to re-enable moving shapes and have two thoughts on how to change the graphics widget. - -1. - -- add public begin/end functions and leave it to geomap (or later, the developer) to call them -- end will copy the current canvas data to an img which ... - -this is silly, I don't want to add more public methods than I have to. I need interactiveTransform but I think I want begin/end methods, but they should be private and happen behind the scenes. This leads me to my second option, internally calling end via a timer if we don't get another draw call within a requestAnimationFrame/timeout. It will call its internal end function. It will also call it if there's not image and the user calls interactiveTransform. - -==2012-10-15== -===ie8 graphics=== -A client noticed our graphics don't resize with the window on IE8. Not a suprise. - -===shift option=== -It's silly to have mode change to zoom when the shift option is default and the mode is dragBox. It should stay on dragBbox unless the use purposefully sets the shift option to "zoom". - -==2012-10-11== -===markers=== -I need to release this demo tonight. It's been too long. It's finally done. What's next? b2 issues I suppose. - -===b2=== -There are a few major issues I need to clean up. First, don't clear shapes while moving the map. - -==2012-10-09== -===tiles=== -Chris asked if geo provides the current tiles in view. That's not part of the design but I might add it in the future. A counter part to tilingScheme and zoom options. Maybe named bboxTiles. - -==2012-10-05== -===point shape labels=== -The width/height of the point shape style seems to change the position of the label. It shouldn't do that. Or, maybe it should. Why would a user want the label to be drawn over the shape when the shape is larger. If you're using point markers, you should know to use 0,0 width/height. - -==2012-10-04== -===marker=== -Twheat! 2 is out. Time to get back to making that marker demo people have been asking for. What to use for data? Maybe WA state boat launches, like in my other demo. That sounds fine. - -I'm not going to add docs or rename .geo-labels-container. It's not needed if you use negative margins on the .geo-label CSS class. - -In my canvas version of my marker demo, I think the image is taking too long to load, or rather the service is made visible too quickly. It's the right time for a jQuery Promise I think. Nah, I'll just refresh after the image loads. - -===click mode=== -Peter wins. I'm going to add a click mode to the official list. It will be identical to drawPoint but trigger the click event instead of the shape event. - -==2012-09-30== -===helping brazil=== -I got a question from a student in brazil about jQuery Geo not rendering graphics. Here are some tips I told him: - -There are no built-in limits in jQuery Geo. However, I can think of a few potential reasons why nothing is showing up. - -1. I don't usually have trouble with the number of coordinates in a polygon but the total amount of polygons. Too many polygons can cause browsers to stop responding. A combination of both (many coordinates and many polygons) will be even worse so it's always a good idea to generalize your data when you don't need it to be so accurate. -2. When you append a lot of features with the append function, add a ", false" at the end to delay refreshing the map until all the features are in. You can call "refresh" on the map when you're done. Something like this: $.each(polygons, function() { map.geomap("append", this, false); }); map.geomap("refresh"); -3. Be sure that if your data is in lat/long, that you put the longitude first in any coordinates. Despite how they are generally spoken, longitude is an X coordinate and should come first in jQuery geo: center: [ -71 /*lon*/, 40 /*lat*/ ], -4. When possible, store and draw your shapes in web mercator meters instead of lon, lat coordinates so jQuery Geo doesn't have to process them. -5. When you are trying to draw a LOT of data, it's best to use a map server and render it as a shingled service in jQuery Geo. I recommend GeoServer for PostGIS. -6. Lastly, try to get one polygon to render as a test first before attempting to render your whole country. - -I think it's good advice. - -===tiger=== -tiger has map services now, so, that's cool. They are running ArcGIS Server. I forget how to restyle layers in AGS. At least it's AGS 10 so we *can* change it. No we can't, that just determines a definition query. The layers do have a WMS service but it's an Esri one. I'm not sure if you can change the style in a URL. Each layer only has one style named: default. Maybe you can, with the SLD_BODY argument! - -Here's an example, encodeURIComponent on something like this: - -74redStatesredStates#FF0000 - -Good luck getting that to look nice in code :/ - -I made it smaller. Oh, and you can't send that to Esri's REST API because it's a WMS parameter. Ignoring it for now. That's too bad, it would really add to my TIGER demo. - -==2012-09-29== -===twheat=== -I'm going to release the new version to Twheat! tonight, Twheat! 2. - -===range=== -There's an issue with jQuery Geo and Chrome's handling of the range input. Chrome doesn't stop tracking the mouse, likely because we're cancelling the mouseup event. - -==2012-09-21== -===gaming=== -A month break (well, a couple bug fixes & a b1.1 release between) to play some games. Also, I did get it running as a desktop (Store) app in Windows 8 & will post about that later. - -==2012-08-24== -===center/zoom options=== -Ishmael has found some errors with setting zoom & center options. Specifically, if you set the zoom first and then the center, the final image doesn't refresh properly. - -http://jsfiddle.net/dyTn9/11/ - -==2012-08-22== -===shapeStyle=== -Somethings wrong with setting shapeStyle at init. I'm not sure this is a problem. I think I was appending to a service and didn't set the service's shape style, was setting the map's shapeStyle. Phew! - -===default service=== -There really needs to be a way to get a copy of the default service object. Perhaps just the string: default? - -$("#map").geomap( { - services: [ - "default", - - { - id: "my-service", - type: "shingled", - src: "" - } - ] -} ); - -I kind of like that. Maybe I should go further and include other strings: "osm", "toposm", "mq-o", "mq-oa", "bing", "esri-wsm", "esri-demo-*" - -That's a lot of extra objects to have hanging around. I might not want to go that far. Also, with a string, there's no way to set opacity or visibility. I'll think further. - -===socrata=== -At Evergreen Apps Challenge in Spokane, WA. Socrata has some great data/APIs! I need a section in here on data/map endpoints. - -==2012-08-20== -===drawPolygon=== -There's an error in my culling logic where I get a bbox that has xmax and ymax that are smaller than the minimum. - -I just noticed I don't double buffer drawLineString or drawPoint! - -===zoom class!=== -I had what I think is a great idea today. I can have a class on the map div that changes based on zoom, e.g., .geo-zoom-7. It won't help as much for non-tiled maps but it would be great to show/hide labels for tiled maps. Hide labels at world scale: - -.geo-zoom-0 .geo-label { display: none; } - -:) - -Although, maybe it should be a data selector: [data-zoom='0'] .geo-label - -That will be slower but looks nicer. I'm not sure. - -==2012-08-14== -===Deferred=== -I fixed that issue. _cancelUnloaded was correctly removing image elments but the load event still fired and old images removed unloaded, but correct, images before they could be shown. Nice error! - -==2012-08-13== -===Deferred=== -Here's a fiddle that shows the Deferred missing image on shingled service issue: http://fiddle.jshell.net/ryanttb/nZMEV/show/ - -jQuery Geo gets the images but none are shown in the map frame after all is said & done. - -==2012-08-08== -===image=== -There's a GigaPan of an Olymic Women's Volleyball tournament. It's a quadkey-based tile system and I can implement it in Geo. Here are some notes: - - some gigapan tile ids -http://tile111.gigapan.org/gigapans0/111225/tiles.83f6152eea5140f76880a283c3479288//rXX/rXXYYY.jpg -http://tile111.gigapan.org/gigapans0/111225/tiles.83f6152eea5140f76880a283c3479288//rXX/YYY/rXXYYYZ.jpg - -level 0: -r00/r000.jpg r00/r001.jpg r01/r010.jpg r01/r011.jpg r10/r100.jpg r10/r101.jpg -r00/r002.jpg r00/r003.jpg r01/r012.jpg r01/r013.jpg r10/r102.jpg r10/r013.jpg - -level 1: -r00/r0000.jpg r00/r0001.jpg r00/r0010.jpg r00/r0011.jpg -r00/r0002.jpg r00/r0003.jpg r00/r0010.jpg r00/r0011.jpg - -==2012-08-07== -===labelsContainer=== -Since this is always positioned relative to the graphics container, I think I can tell developers that it exists, has the class geo-labels-container and that they can offset it. That would be the best way to get image markers with an offset center. However, I think I'm going to rename it .geo-labels instead because it's shorter. - -.geo-map - .geo-service - .geo-labels - .geo-label - .geo-service - .geo-service - .geo-labels - .geo-label - - -==2012-07-31== -===beta=== -1.0b1 is out. I hope people like it. - -===wkt=== -I will need to test bad input later so that there aren't JavaScript errors even when I will be returning null. - -===b2=== -No rest. - -==2012-07-28== -===multitouch status=== -Here's some code to render multitouch status to an h1 tag. For future reference/debugging: - - $("h1").html("multitouch {
" + - "anchorDistance: " + anchorDistance + "
" + - "currentDistance: " + currentDistance + "
" + - "delta: " + ( ( currentDistance - anchorDistance ) / anchorDistance * 5 ) + "
" + - "}" ); - -Place it in touchmove. - -===multitouch refresh=== -I'm disabling refresh during multitouch and it makes the whold multitouch experience better, I think. - -===zoomMin=== -I'm going to fit this in for b1; might as well complete the API. - -==2012-07-26== -===mouse=== -Peter's mouse can't wheel zoom easilly. It's a high precision mouse and it doesn't click when you scroll it. I have a feeling I'm getting .25 delta and it's rounding down to zero. - -===iOS touch=== -I have to stop killing the document events on iOS. Phew! I wasn't shutting _inOp off after multitouch ends. - -==2012-07-26== -===zoomMax=== -Seems to work ok with tiled & shingled. I think I should document and add zoomMin this weekend. - -===pixelSizes=== -That bug where rendering zoom 0 with string src...this one: - -* geomap - [bug] tiled services with pixelSizes set do not render zoom level 0, when src is a template string - -appears to have been fixed with the latest jsRender for me. Here's a jsFiddle to prove it: http://jsfiddle.net/ryanttb/RNrNC/ - -==2012-07-25== -===zoomMax=== -Only clamp if it's *over* the zoomMax value. - -===shapeStyle=== -Since I'm not creating geographics widgets (or elements) for layers during startup, the shapeStyle property doesn't work. - -==2012-07-24== -===refresh tiles=== -I'm going to see if I can set jQuery Geo up to load tiles faster on faster browsers. Depending on how fast the initial refresh runs, I can decrease the timout delay. - -===click=== -The y value of a clicked coordinate is off a little. I'm creating a jsFiddle to find out what's up. It's not off. Something in their website is messing up my calculations for map point location. - -===refresh=== -Wow, I didn't notice until now that the new interactiveTransform code wasn't triggering refresh if the user was moving the mouse, even if they weren't actively panning. That's a good one to not have in b1 :) - -===zoomMax=== -I have too much redundant code calculating/testing agains zoomMax. I need to specify which functions don't test agains it. Likely _getPixelSize should not but _getZoom should. - -==2012-07-22== -===force=== -There is code from our original implementation to reload tiles. It is no longer being triggered. I'm wondering if I should remove it. There is also code for dirty tiles. They are removed at the end of refresh. I'm not sure I need to keep that code in there because I don't think it's being triggered either. - -==2012-07-20== -===jsRender=== -There's new syntax for default templating. It uses the {{>var}} syntax. I think the old one is still valid, {{:var}} but the new one is preferred. I will change jQuery Geo to use the new one by default. I should also change the docs. Ah, no, it's new syntax to do HTML encoding. I'll have to check the measure templates but I think I will go with higher performance {{:var}}. - -===refresh=== -I need to take control of when this is called so I can handle service-level refresh properly. - -That's better. _refresh will only run on the map itself and calls _refreshShapes on all the service objects. - -===interactiveTransform=== -I turned the timeout back up to 500. Panning was no longer happy in IE with some shapes to manage. - -==2012-07-13== -===interactiveTransform=== -A side effect of the way I'm doing interactiveTransform is that changes to the widget options bbox, center, and pixelSize aren't immediately available. I need to at least update the public options during each change. That may be a little expensive because I will have to do projection but is necessary. - -Ok, I think that's better, except that I forgot the zoom option. Added. - -===tile query=== -I've decreased the delay to begin checking for new images from 500ms to 256ms. There's a balance here somewhere. - -==2012-07-10== -===dragCircle=== -Time to move this into _refreshDrawing. But first, I have to trigger the Point shape event. Maybe not. I can't zoom. That's against the docs but I think I can leave it for b2. - -==2012-07-07== -===dragCircle=== -I'm going to add this to beta. It will work similar to dragBbox, including sending the bbox. - -===dragBbox=== -I may rename this to dragRectangle before the b1 release to keep the drawing modes more about geometry than geography. - -==2012-07-06== -===bboxMax=== -A side effect of changing bboxMax is that zoom's value will have to change. This means that changing bboxMax should refresh the map services. - -There's going to be more to do later when I want to handle changing bboxMax properly at runtime. It should hook into the interactiveTransform engine. For now, though, I'm going to make it work right during init. - -Heh, bboxMax wasn't doing anything right :) It now sets both centerMax & pixelSizeMax. - -===inset=== -A new example is up based on AppGeo's MapGeo product's inset map. - -===dragBbox=== -This needs to finally send a bbox. Also, handle points differently. No more click event but you will get a Point shape event. - -==2012-07-05== -===inset shingled map is off=== -If I pre-render an inset map and use a shingled service, the extent box is wrong vs. what we see on the map. - -===bboxMax=== -Initializing this property should set _userGeodetic because sometimes you want to init with bboxMax: [], zoom: 0. - -==2012-06-22== -===client work=== -I finished the docs last time, then client work stopped me from finishing the code. - -===bostock=== -In implementing the Bostock demo, I found a bug in jQuery Geo. There's a way around it but it's a little slower. The bug will go away when I fix bbox storage on appended shapes. - -==2012-06-07== -===vacation=== -I've been away for almost two weeks. Time to finish b1. - -===zoomMax=== -This is where I left off. I'm also considering zoomMin and zoomMax on service objects but that's not until later if needed. - -==2012-05-23== -===tiled=== -The new origin stuff appears to work better. I'm going to run through the other examples & see if I'm ready for a build. - -===chrome=== -Chrome's screen tearing is really bad. I'm going to try to disable 3d transform in Chrome. Maybe it's just my laptop, Chrome is doing the tearing even without translateZ. I'm reverting the changes for that test. - -===bbox=== -I'm getting a bbox event after a single tap. - -===setInteractiveTimemout=== -I need to only call this if: a) it's already been called once (to keep it going) & b) we actually change centerInteractive or pixelSizeInteractive. - -The programatic changes are going to be a part of this, too. I need a way to turn on trigger during setInteractiveTimemout. - -===programatic=== -I updated all the programatic calls to use the new system with the ability to say not to trigger. I will need to test these but for now, I do think I'm finally ready to merge. - -===merge=== -I merged the interactive rewrite into b1. There are bugs that I will have to work through before this becomes beta. - -===initial zoom=== -No matter what your initial zoom is, you can see the map at zoom 0 before the new tiles show up. That makes sense given the changes I've made. - -ok, the area that handles init options checks to see if the widget has been created before heading into intractiveTransform mode. - -===ie8=== -I *know* ie8 support is broken. I haven't even tried it yet. We will keep supporting that browser, though. - -==2012-05-22== -===mouseup=== -I'm ignoring rogue mouseup events now. Hopefully, that will clean resize up a bit on Chrome & Firefox. - -===resize=== -Seems to work like it did before. I'm going to increase the frequency (decrease the timeout) of the resize check. In the future, I want the resize in two parts, one to move stuff around in real time/animationFrame time, another to perform the final refresh. Maybe move the latter back up to 500ms? Maybe not. - -67ms is too soon, Chrome flickers. I'm bumping it back up to 500ms for now. - -This should really be part of the new interactiveTransform code. At least, moving the images around and waiting for the final setCenterAndZoom. The issue I'm seeing with tiled now is that if I pan and the resize before the new tiles come in, the map jumps from the interactive to the final center. Same with shingled. - -For now, I think I may be done enough with this to merge back into the main project. That's a lie. I disabled a bunch of stuff before doing this, like marquee zoom. Any of the immediate mode changes. - -===immediate=== -I'm going to try to tie these into the new interactiveTransform. - -===draw=== -The last obvious thing broken is moving the draw points during interactiveTransform. - -shapesContainer is no longer part of panContainer which is now only draw or measure layers. - -Scratch that, I'm not going to move the original panContainer. I need to include the draw and measure coordinates in the new interactiveTransform stuff as well. - -That works ok, I think. I might change it later depending on how was shape drawing to img elements goes. - -I still need to test scale changes with drawing but I have a feeling it's fine. Took the code from pinch zoom. - -===tiled=== -I forgot, tiled still needs some of the origin fixes I put into shingled. - -==2012-05-14== -===mouseup=== -Chrome & Firefox trigger a rogue mouseup event when maximizing the window. I don't think that's right but I suppose I have to handle it. But, for some reason, geomap in Firefox doesn't trigger the refresh. - -==2012-05-10== -===shingled=== -Much better now! Two things I was missing: 1) I needed to base calculation on the original map origin of the scale container & 2) the position is now %-based, like tiled. - -===keepAlive=== -I don't think there's a need for this any more so I removed it. I had better make sure :) Oh, right. It was for opacity. We don't want to layer semi-transparent images. - -The code's not here. I see where I set keepAlive but can't find where I delete the images. This may be a regression from, like a2. - -I probably had it chained to a line I deleted. - -Oooh, I didn't need it anymore when I added the concept of a pan container way back. Since I no longer have pan containers, I have to add keepAlive back. - -Yep, I had to add it back with the pan/zoom rewrite. - -===resize=== -For resize, I should be able to just resize each scale container. Everything else is %-based. - -==2012-05-07== -===shapes=== -I need to finish the rewrite by making sure graphic overlays move correctly. - -I might cheap out and hide the graphics for the b1 release. The geographics widget needs its own interactiveTransform method. - -===canvas=== -Do I need my blit canvas to be part of the document? I hope now, will remove it soon. - -===wow=== -I was originally moving all the servicesContainer for all services INSIDE the loop where I was moving all services. - -Also, _$servicesShapesContainer did not include the draw or primary shapes containers. I wonder if that was on purpose. It should not include the draw container because those shapes change during any change in the mouse or map. - -===shapesContainers=== -shapesContainers will eventually need the transform, but again, maybe not now. For now, I'm hiding the drawn shapes during interactiveTransform. - -===jump=== -There's still a jumpiness issue when you catch it just before/during refresh. Old tiles that have already been scaled pop into weird locations. Should I fix it now or continue with shapes? Probably, I should finish with shapes and then work on bugs. - -===pinch zoom=== -Hmm, there are issues here once I turned refresh back on. - -It's with double click zoom as well, once you start panning. - -A single hardware pinch zoom appears to work perfectly if you don't pan any time after the zoom. I end up in Africa or the Virgin Island a lot from MA on the iPad. - -Definitely a problem with refresh. Disabling the refresh timer shows that interactiveTransform still works fine. - -I'm not doing any pixelSize clamping in _setCenterAndSize. That must have originally been somewhere else. With that change, there is still the jump issue of old transformed tiles but I don't seem to end up in Africa. - -===pinch jump=== -I need to jump to the closest pixelSize, not the smallest. It will make this smoother...maybe in the future as well as it only affects when they zoom in just shy of the half-level mark. - -===shingled=== -I'm creating a new shingle for each pan, which is right, but not positioning it correctly after refresh. - -Actually, this is a much better representation of the jump issue I'm seeing in tiled. If I fix this, I may be able to fix tiled based on it. - -===data vs. parseInt=== -I'm going to guess that storing a number with $.data is much faster than trying to use parseInt on current CSS values. Although, the parseInt would only happen on refresh, while the .data call will happen with every pixel move. - -==2012-05-06== -===shinged=== -I have to get this started. Appears to work pretty well. What's left for beta? - -===non-moving divs=== -I don't think I need the transform on divs that don't move, such as the event target and content frame. I'm removing it for now. - -==2012-05-01== -===rewrite=== -I turned refresh back on and there's still that image repeating. I'm going to log some stuff and see what I can discover. - -First step, interactiveTransform is being called on every mouse move even when the mouse isn't down, that has to stop. - -===pixel-size=== -Wow, I was making a new scale container every time because I had changed to using data-pixel-size but was still testing for data-pixelSize. - -The duplication is now gone. You can still mess up the view if you start panning right at the right moment, just as it's about to refresh but I can live with that for now. - -===shingled=== -I suppose shingled is next. - -==2012-05-01== -===shingled=== -Since tiled is pretty much ready for linking to the true refresh, I can either fix shinged now or actually implement the refresh. I suppose I should try to finish the rest of the geomap widget with tiled for now. It's not fun to be unable to refresh the map in this in-between state. - -===refresh=== -Tiled services are ready to be merged into refresh. I'm going to skip the _panEnd stuff now and just go to _panFinalize. I can add the inertial pan back later. - -Calling _setCenterAndSize at the end of my timer now. Pretty fast! I'm getting weird behavior with tiles that aren't in the current view, though. And some, look like they're repeating. It all settles down after the refresh but the quarter second leading up to it there is a visible jump. - -==2012-04-27== -===transform=== -Setting the transform on the images helped iOS. Settig it on the map div itself helped Android a lot and iOS a little. - -===iOS=== -If there's anything else over the map, iOS doesn't respond very well. It doesn't let me pan (scrolling the page instead) and pinch zoom is just weird. - -Out of a whim, I didn't include the jQuery UI style sheet. iOS now works like the others. I wonder what's in the style that it doesn't like. Latest version of jQuery UI (1.8.19) still has the issue. I wonder which widget does it. - -Weird, if I take out the .button() calls, the demo works on iPad. - -iOS works fine with fixed position. It's still the .button calls. I'm sniffing out the button calls for iOS 4-5 for now. I don't have time to figure out that issue. - -===ie9=== -I've been wanting to use better features in ie9 for a while. Let's see how this goes because with the new code, I have to drop the filter. I didn't like using filter anyway. - -I cannot belive how nicely the transform scale + transform-origin work in ie9! I might investigate using them instead of the % hook on the scale container for webkit & Firefox. - -==2012-04-27== -===panzoom=== -_inOp gets set to true during pan. - -When to have the interactive center and pixelSize match the current values? Any function where timeoutInteractive is null, likely. - -I may have been moving the services' shapesContainers twice, once in _panMove and again in the service's serviceContainer.children().css call. No, the service container is the data-geo-service object. Its only children are scale containers. - -I'm not going to move the scaleContainers separately during pan...oh, I have to because they will move at different velocities. - -===transform=== -I'm attempting to add transform support for iOS. 3D CSS transforms make the images bounce around funny during scaling. At least, when I set the CSS on the scaleContainer. - -==2012-04-26== -===measure=== -In some instances, the measure tool doesn't position properly. Going to change it from a div to a span to calculate width better. The container can stay a div. Only the actual label needs to be inline. - -Fixed. I'm also clamping to [0, 0] so the measure label doesn't move past the left or top of the map. - -===pixel measure=== -I can tell I will have to add support for axisLayout=image into the measure code. The clamping is backwards. - -===centroid=== -On bad polygon geometry (hourglass is the common example), our centroid function returns weird results. I might clamp to the bbox for now as a stopgap until I fix it for real. - -That's better. Not great but not nearly as much weirdness. - -===pan/zoom=== -Back to this. I need to disable the pan pop as well as calls to refresh. - -When panning, we move the _$panContainer. It contains various top-level items (shapes/draw/measure containers). Each service moves their own content. Pan finalize resets the pan container as well as the shapes container for all services. - -I'm still doing too much in touchmove. - -Now caching the reference to services shapesContainers. - -==2012-04-24== -===pan/zoom=== -Where was I? :) Right, first disable all refreshing and attempt a the new interactive pan. - -Not all refreshing will be disabled, the function/option calls from the developer should be honored. - -===zoomTo=== -Private but never called? - -===no refresh=== -With all _setCenterAndZoom calls commented out, the pan container still jumps back to starting position. That's expected with the current code but shouldn't happen when we're done. That jump needs to wait for the full refresh. - -==2012-04-20== -===b1 docs=== -I got some more docs in. I need to take a small break and actually rework the pan/zoom engine. - -===pan/zoom=== -So it begins. I think the first thing to do is create the clearable refresh time during pan/zoom and remove the duplicate refresh code in interactivePan & interactiveScale. - -===google=== -Google Maps requests new tiles during pan when running in Chrome on the desktop, however, the mobile website waits until the user lets go of the map. - -==2012-04-12== -===polygonize=== -That's what the bbox->polygon function will be called. It's in GEOS. Their docs say: Polygonizes a set of Geometries which contain linework that represents the edges of a planar graph. - -While that's supposed to be only for linework, e.g., a LineString to Polygon, I think it's fine to extend that to bbox. It's not called polygonize in JTS, there's a Polygonizer class and a getPolygons method. I'll simplify that, too. - -===shift=== -I changed the shape value to dragBbox so I can use it in the code a little more smoothly (choosing cursors, actually switching the mode). - -==2012-04-11== -===foss=== -I gave my talk, went ok. Gotta get back to docs. - -===dragBbox=== -This mode should operate even if pannable is set to false. There's a test in the code where I have to special case that out. - -==2012-04-10== -===foss=== -I'm coding at foss4g! - -===Deferred=== -Deferred demo is done. - -==2012-03-30== - -### markdown -The new markdown file looks nice! - -### docs -Time to document the last feature that are going into b1. Actually, I want to lint the last file, tiled.js. - -### Deferred context -The last lint issue is that I shouldn't create functions in a loop. That's done when the user returns a Deferred object as the tiled service's src property. The function calls _loadImage on the service object but needs more than the url, which is all the Deferred done call gives it. How do I get the rest, such as $img, pixelSize, etc. $.proxy? But isn't that creating a function anyway, just one that lint can't see? Yes, it does. Maybe I can put the data on the Deferred object itself. I don't see why not. - -==2012-03-30== -===grunt=== -I haven't written in a while. Checking out grunt now. - -Wow, that was cool. jQuery Geo now compiles with Grunt and I also have a jQuery plugin package file! - -===graphic holes=== -With canvas, I have better control of drawing polygons with holes. It's pretty nice. I can't wait to get into WebGL. - -==2012-02-15== -===labels=== -The code already worked the way I wanted! No .geo-label div is created if you don't at least provide an empty string label. - -==2012-02-12== -===find=== -Need to implement the * selector. That was easy. $.isPlainObject thankfully returns false on strings. - -===unloaded image=== -It appears that when you pan starting on an area that has an unloaded image, i.e., empty space, this._center gets set to string values. Checking on this now. - -===shingled 0=== -To prohibit shingled maps from zooming out past 0, I had to change quite a bit of code. I now have getZoom & getPixelSize methods that will work regardless of tilingScheme. I'm also calculating pixelSizeMax when bboxMax changes and making sure the non-tiled zoom doesn't go less than 0 in two spots. That seems to do the trick. - -===service-level shape refresh=== -Shapes on services draw twice, heh. That was a tough one. Turns out, when I create the service-level geomap widgets, I wasn't setting _graphicShapes to a new array before passing the (this) object to the widget factory. All services were sharing the same _graphicShapes reference. - -==2012-02-11== -===current services=== -I need to make sure their style property is always full, that's the point of having an internal copy. This means I have to fill in visibility & opacity when I create the services based on defaults. - -=== service style=== -$.extend({ - visibility: "visible", - opacity: 1 - }, style) - -That returns what you would expect if style is undfined. - -===str src=== -I can't mod index in the template. I feel that there is a way, but it's not there yet. - -==2012-02-06== -===mousewheel=== -This needs to be updated, it doesn't work with jQuery 1.7. - -==2012-02-04== -===options=== -Right, this._options does equal this.options but only because the latter must be called so and we can minify the former for internal use. - -==2012-02-03== -===proj=== -I seem to be able to detect geodetic coordinates ok. I'm switching all of the $.geo functions to use it. So far, so good. - -==2012-02-02== -===transition=== -They look cool, but I don't think this project is ready for transitions, they have some unexpected side-effects. I would like to rewrite the interactive portion anyway. - -==2012-02-01== -===destroy=== -There's a bug with shingled services if I call destroy and try to re-create. - -===services=== -Changing the services option will destroy all service-level shapes. I'm not sure what to do about that. Eventually, I will re-use serviceContainers (and service-geomaps) based on the new services array coming in but I currently don't do that. - -===proj=== -Finally, to get rid of proj. The point is, you should be able to use projected coordinates even when $.geo.proj is not null. - -The same geodetic test applies to both bbox & coords because the first two elements of either are the x and y of some number. Nice! - -==2012-01-31== -===shapes zoom=== -Service-level shapes don't refresh while zooming and it's not going to be easy at the moment. All I can do is call geomap("refresh") on the serviceContainer which, since they're just service pseduo-map widgets, will only refresh the shapes. The problem is they don't have access to the in-between state of the zoom so the shapes don't draw correctly. I will fix this later when I re-invent the pan/zoom code for beta. For now, service-level shapes will not draw during interactive zoom. - -However, it's good to have an idea of how the new system will need to work. Each service-map widget will check the _interactiveCenter & _interactivePixelSize values to draw shapes in proper positions. - -==2012-01-30== -===geographics=== -This widget needs some updates. For now, I'm just going to add the resize function. - -Note, with canvas, you don't need to set size CSS at all. The canvas is, by default, inline-block with width and height based on the html element attributes. Also, as is shown in this fiddle, changing the runtime width & height properties of the canvas element does clear the canvas: http://jsfiddle.net/jcGY2/ - -==2012-01-28== -===service-level shapes=== -Where was I before I stopped to add Deferred & fix bugs? Right. The service-level geomap widgets should now initialize their own shapesContainer. - -===resize=== -resize is a method on the service object because shingled need to stretch the current image. - -I need to finally add resize to geographics. - -===find=== -find will have to query and include service level shapes. - -===map=== -This will be simpler if I allow services to get to the private map variables (similar to how I allow the service object to do it?). No, probably during create. - -Can you have protected properties in a jQuery UI widget? I would like to be able to pass a reference to the map during create...I could also use .data. That worked fine. I now have this._map which will be the same as this for the map object and a reference to the map object for services. Nice! On parts that need to work the same between maps and services, (such as _refreshShapes), I can just call this._map.x and it will be correct. - -===shapeStyle=== -This should be fine for services. - -==2012-01-27== -===Deferred=== -The src function will be allowed to return a Deferred (or Promise) object. If it does, geomap will wait for the done or fail events. The src function will call resolve or fail. - -===service shapes=== -The opacity method might have to stay as a service method because it must directly manipulate image elements in some cases. However, the toggle method can operate on the new service container. - -===init services=== -So, the jQuery UI widget factory udpates non-array options fine, i.e., when I get into the _create method, this.options has whatever the user supplied merged in with the default options. However, array options are not copied so any changes to the initial service option are not maintained. - -Not true, but it does unfortunately merge the first user supplied service with the default service, osm. - -===options=== -I forget why I have _options and options. They are supposed to be internal vs exteternal but they are equal references. - -==2012-01-24== -===a4=== -What's next for a4? static mode. - -===static mode=== -This shouldn't be too hard. Currently, any non-defined mode string will act close to static. That's different from how I want it to work. The mode "static" should be static and undefined modes should act like pan for now. - -The switch appears to have gone well. I can set the mode to "23" and it acts like it's in pan. That's a feature I will define more fully later and document before it's official. - -===labels=== -Time to merge labels into geographics. This is a huge step toward service-level shapes. I should be able to find all $labelsContainer references and move them into sections of geographics. - -Now that labelsContainer is part of shapesContainer, the next step is to put shapesContainer under a serviceContainer (which is inside servicesContainer). Got that? - -===service-level shapes=== -Here we go! Each serviceContainer has a div that contains all the images. The geographics widget will be a sibling of that. - -I may need a new container :/ the extra div was the tiled service's scale container. I need a container for the service/graphics elements. - -The map itself will have to manage this new container. I think the internal service objects will get this container and now append their functionality and elements to it. It will no longer have to return a new div for which the map will create a sub-geomap. - -==2012-01-23== -===addressing=== -I think address parsing (cracking) will be a useful feature for geocoding to non-Google geocoders. I might want to add that to $.geo at some point. Christian has some Python code that does it already I can port. - -==2012-01-21== -===pinch aftermath=== -Adding pinch was pretty easy. The only big issue was if a second finger touched a short time after the first. To counter, I fake as if all touch has stopped and initiate a new one. There's room to consolidate code here but I'll get to that later. - -===drawPoint=== -This acted funny with pinch zoom in that when the second finger hit late, a shape event got triggered at the first finger. - -===draw other=== -Similar issue, touchstop gets triggered after pinch zoom and a segment is added to the shape. Maybe related to calling touchstop. We get in an odd state, actually. The segment shows up but the next touch causes it to disappear and a new one appear instead. - -I'm going to put this as a bug and get back to it later. There's much more actual functionality to get into alpha 4. - -==2012-01-20== -===pinch=== -This is mostly ready for iOS. It's a little jumpy so I think I have to detect a second touch while the first one is down as long as they haven't started panning yet and move into pinch zoom. - -If the second finger is late, we still only get the touchmove event which will work great. - -===android=== -I am going to coin "hold scroll" for android to counter their lack of multitouch. When the user holds the map in the same place for between .5 seconds and before the browser takes over, the user can move the touch point vertically to start zooming as if there's a scroll wheel. - -I was going to have "expand zoom" (coined by Laura) where it works similar to "hold scroll" but instead of acting like a scroll wheel, it acted like the bbox was expanding from the hold position. In effect, a zoom in only fake pinch zoom. However, I like the zoom in/out ability of the fake wheel better. This will also work on iOS, I think and even desktop. - -===web workers=== -I eventually want the $.geo functions to allow the browser to use web workers but they'll have to be in a javascript file. Hopefully, I can use data URIs. - -I could always grab the worker js from the CDN but that would require internet access. What if it's all an internal site, like for government. Or, graphics only that doesn't need servers. - -I can use data URIs but I wasn't able to have a local variable in the function. You can, but you need all %20's instead of spaces. - -==2012-01-17== -===geomapshape=== -May be getting multiple shape events when in drawPoint mode and attached via bind("geomapshape"). - -Not just shape, all events. If you recreate a map on the same div & rebind an event to a new function, it will trigger more than once. - -===wkt=== -While not in this release, I have a need to fix WKT parsing. Finished parse LineString & (single ring) Polygons. - -===pinch=== -Next on the list is pinch zoom. I can hook this into the scroll zoom mechanics based on pinch center & ratio of initial pinch bbox to current pinch bbox to scale the tiles. - -Initially, I'm going to jump one scale level (or scale ratio) like wheel zoom. Later, when I update the whole interactive movement engine, I'm going to transition to the next scale level. - -This will tap into the _wheelLevel variable, which I should possibly rename later. - -Dropping out of multitouch (lifting one finger) will end interactive zoom & call setCenterAndZoom. - -We pick the largest ratio between x & y changes. - -==2012-01-16== -===zoom=== -Accidentally moved some code to where it didn't belong & broke interactive zoom. Fixed. - -==2012-01-12== -===getUrl=== -I would like to further have the service object's properties match html rather than css. I might rename this to just src. - -==2012-01-11== -===scroll & drag=== -I need options to disable the default behavior of scrolling and dragging. - -===html attr=== -I think my options should reflect more like HTMl attributes than css properties. Including service object options. That might make me change visibility back to visible :( At least I'm not beta yet. - -Scratch that, it's a presentation option and all presentation options should follow CSS. However, I may move it to a style property of the service object. Are there other style properties? - -Only opacity. - -===scroll=== -I would like to support two-finger vertical slide as zoom on mobile devices but I'm not ready to write that up yet. - -Hmm. Can I handle scroll without an option? I can detect page scrolling and set a timeout. If the user has been scrolling the page, we don't want to scroll the map. But, what if the user's cursor just happens to be on the map when they want to scroll the page. I'm keeping scroll, the developer should have control to turn it off all together. - -==2012-01-2== -===service=== -I'm still thinking about service-level methods. I'm not going to add the *All methods right now and I'm not going to have the single methods dive into the services (other than find, which even in jQuery digs into sub-elements not in your collection). The table I wrote below won't go into the docs. - -Almost done with the docs for this. I wonder if I can have the jQuery UI widget method find merge results when more than one element are used in the selector. Unlikely but it would be cool. I'm going to have to assume not for now but keep that in mind. - -===geo-service=== -I am going to document that all service divs have the geo-service class. So, the default service will be both .osm and .geo-service. - -===find=== -It's quite clear to me that I should be able to call find on services. That will return shapes in that service. What does calling find on the map do? Should I have it search map and all services as planned or limit it to just map shapes? I have no idea what this would do in jQuery UI widget factory: - -var shapes = $( "#map,#map .osm" ).geomap( "find", { type: "Point", coordinates: [ -71, 42 ] }, 4 ); - -What will be called, what's the return...just the first? Just the last? - -For this version, I'm going to have find on the map only return shapes appended to the map. That will match how the other functions work and document that you cannot use the comma selector with the find method. - -===proj=== -I need to get the final doc changes in for the $.geo.proj auto-handling. The definition of "map coordinates" is determined by the last use of center or bbox. The "map coordinates" are used as return values for the center, bbox, and the bbox property of the view object passed to getUrl. Now, how to write that... - -===replace=== -Removing the rather extraneous label and style methods from my to do list and adding the much more useful replace method. - -replace( existingShape, existingShape, style, label ) is the same as -append( existingShape, style, label ) but that's fine. If you want to remove existingShape and add a new one, you won't need two calls (remove & append). - -===find=== -I'm not going to add a shapes method either. I want that to be part of find. The next version of the find method should take various selector strings such as * and return an array of shapes. This also makes me want to revisit whether or not find can dig into services...I'll see what Peter thinks. - -I feel like I want users to be able to write either: - -$("#map .osm").geomap("find", "*") or -$("#map").geomap("find", ".osm *") - -append, replace and empty are very one-item specific but find is a digging query operation. I think I just convinced myself that it should be different. It should dig into the services. That's what I think devs will expect. I already can't use find with more than one target...so I'm already breaking the convention of the other three methods. - -I'm not going to support the service selector in find's selector argument at this point. But I documented how it will work with a service element selector and that seems pretty cool. - -==2012-01-01== -===offline=== -Responded to an email asking about offline support. I wrote a few things in my reply that should give him some ideas. I'll copy them here: - -I have thought of offline support. While something like that likely won't be directly part of jQuery Geo itself, there are different ways to approach it depending on needs. I have plans to put up some demos to give developers ideas but here's a short list: - -1. Using the getUrl function to cache downloaded tiles in session storage on IndexDB. Since this function in the service object can do anything you want, it's perfectly fine to check some HTML5 storage options for tiles and returning, e.g., a data URI before attempting to access the Internet. Users will get roaming charges only when the images aren't in the cache. However, the amount of images you can store in the cache is limited by what the browser sets for the cache's upper limit. Some mobile browsers allow users to increase this limit, others don't. This is an option better suited for sites that want to show large areas with many zoom levels. - -2. Pre-caching the whole tile set in HTML5's appcache. This is suited for a site that only serves a small area and not too many zoom levels. You would have to get a copy of all the tiles and list them in a cache manifest file. If the user zooms or pans outside the site's area, they can get some "no tile" image. The huge advantage is that users can first browse to the site on WiFi, the app will cache the entire map (which will take a while) but can then walk around and map tiles will instantly come from the local cache. The disadvantage is that HTML5 appcache is usually only 5MB which won't hold too many tiles. - -===remove=== -I'm still trying to decide about whether or not remove should remove all references in all services or whether I need removeAll. There is precedent for xAll methods in jQuery. I will also need empty. This is too much for a4. Maybe beta or beyond. - -method | map or service | function -========================================================================== -append( shape ) | map | appends shapes - | | only to the map -append( shape ) | service | appends shapes - | | only to the specific service -find( Point, radius ) | map | finds shapes appended - | | only to the map -find( Point, radius ) | service | finds shapes appended - | | only to the specific service -findAll( Point, radius ) | map | finds shapes appended - | | to the map or any service, - | | will not return duplicates -remove( shape ) | map | removes shapes appended - | | only to the map -remove( shape ) | service | removes shapes appended - | | only to the specific service -removeAll( shape ) | map | removes shapes appended - | | to the map or any service, - | | will remove all duplicates - -==2011-12-22== -===buffer=== -I'm going to implement buffer as an internal geo method for now & document it later. It's needed. - -==2011-12-21== -===two finger=== -So, Google has settled on two finger single tap for zoom out. Fine. - -==2011-12-09== -===measure=== -Previous measure shows up if you destroy & create map after originally double clicking to end a measure. - -In destroy, _drawCoords and _drawPixels are both empty. Where's the data come from? - -When back into the new control, _drawPixels has values. There isn't a _drawCoords. Ah, widget factory was using old data, I have to make sure everything is cleared during create, including these two arrays. - -===measure-pan=== -Problem when you pan the first time while drawing in axisLayout image. - -It's not just axisLayout image. It's also not measure, it's drawPolygon as well. Ok, this is new ;) I works fine in a3. Maybe something with the implementation of axisLayout. - -Doh! Another "don't set arrays equal to each other" issue. Does this happen to other devs? - -==2011-12-08== -===semver=== -All that chatter about what version naming to use and then the jQuery blog points to this: http://semver.org/ - -Also, here's the deal about the new plugins site: http://blog.jquery.com/2011/12/08/what-is-happening-to-the-jquery-plugins-site/ - -==2011-12-05== -===measure area=== -I have to work on the measure area tool. Something's not quite right...oh yeah, I haven't implemented it yet. - -===length=== -measureDistance should be measureLength. The measureLabels object should have a length property. - -==2011-12-01== -===getUrl=== -I was going to bring our urlFormat property over from the old code but now I think I want it to be the same property on the service object. I think getUrl can be a function, but can *also* be a string for shorthand. This will obviously be a jsrender template string. - -==2011-11-30== -===twheat=== -I'm going to keep the twitter-heat demo and also leave twheat as its own app. - -===service-level=== -Finally writing some service-level shape docs for 1.0a4. - -===wheel=== -I would like to add a wheel option. We have a wheelMode property on the internal control that can be a few different things. I would like this to be simpler. Maybe just "wheel" and have it be "on" or "off". Or a boolean? But a boolean would limit future additions. - -==2011-11-23== -===measure=== -I'm going to port measure over as pretty much how it's done in our original project, in that it will have its own dedicated label. - -===measure-label=== -Trying to make the measure label look nicer than before. I'm adding a style to the document head just for the measure tool. I'm prepending it so designers can override any of the properties. - -===jsrender=== -Pulling in jsrender for the measure label. I'm going to have to do it anyway for shapeLabel, may as well do it now. Works well for my needs, I'm going to document the measureLabels option. - -==2011-11-22== -===jQuery 1.7.1=== -I'm still using 1.6.4 and will likely release that way. I'll have to test with 1.7. The notes say that .1 fixed a bug in mousewheel event. I didn't even know they had a mousewheel event. Maybe I can stop using the wheel plugin I've been using. - -===label-container=== -Judging from the layout below, I'm going to change textContainer to .geo-label-container and have it move around exactly like the shapesContainer. More like serviceContainer because it doesn't need to be the size of the frame. - - #map .geo-map - .geo-event-target.geo-content-frame - .geo-services-container - .geo-service* - .geo-shapes-container - canvas - .geo-labels-container - .geo-label* - .geo-draw-container - canvas - .geo-measure-container - .geo-measure-label.geo-label - -===refresh polygon=== -I'm still curious why I don't use toPixel on Polygon shapes as a whole? Why the loops? Right, I was thinking toGeodetic. geomap's toPixel function only takes up to two dimensional arrays. Updated both functions. - -===pan=== -I need to pan both shapes and labels at the same time. I think I need a new container for these because drawing might be part of this as well. - -===length & area=== -Documenting and coding these because I'll need them for the measure tools. - -===LineString middle=== -There must be something in JTS that's similar to Esri's ILine.QueryPoint function but I can't find it. This is for getting the point along the line for the label. I want to add a generic function to $.geo. Ah, LineSegment.pointAlong. - -Documenting pointAlong. Also implementing it! Works pretty well. - -===line rotate=== -I would like to rotate the line label based on the current segment but that will have to wait. - -===geographics=== -I'm going to merge labeling into geographics so that I can move the tech as a whole to indivdual services. That'll come later when I need to do service-level shapes. - -==2011-11-21== -===measure=== -I started porting measureDistance today but merged the branch in after being able to draw a line. The rest of it depends on being able to draw labels. Our internal library has _labelShape specifically for measuring but I'm going to merge that into the labeling engine for this release. - -===append=== -I need to update the append docs to include label before I do anything. Done. Since it's needed right away, I'm going to start porting labels over. - -===shapesContainer=== -Can I re-use $shapesContainer for labels? I'd rather not keep track of a second div. However, I think $shapesContainer *is* a canvas element so that's not going to work. Yeah, it's a geographics widget which...no, geographics appends the canvas. I can re-use that element...but semantically, it isn't correct. - -That won't work anyway, I need these to exist at the service div level so they can be targeted by CSS. - -However, labels not associated with a service would not be in a service div and would need their own div. - -===layout=== -Currently, the layout is, e.g.: - - #map .geo-map - .geo-event-target - .geo-services-container - .geo-service - .geo-shapes-container - canvas - .geo-draw-container - canvas - ($textContainer) - -==2011-11-15== -===twheat=== -I'm going to make this a real app with its own subdomain. I would like to use paging because the first page doesn't have enough results with a geo argument. What happens when there's no further pages. Is there a "next_page" property? Is is null? - -The page will be more impressive if I try to geocode the location property to get more results. - -Heh, this will blast a lot of queries at MapQuest. I'm going to have to store ids i've already processed. - -That's soo much nicer! - -Maybe I can get a couple old pages worth as well on the first search. - -Twheat exists! - -==2011-11-14== -===a4=== -Time to start a4 docs. Hopefully this will be the last alpha. - -==2011-11-10== -===merge=== -I merged in the changes to support photos. It amounts to only a few hundred bytes minified and can be pretty useful. I couldn't find a good example service to use for the axisLayout demo. - -==2011-11-09== -===axisLayout=== -Peter likes axisLayout as well...sold! - -===first=== -Trying this out for the first time. I can get image tiles from an image server but the zoom is all wrong and it's not centered. wheel zoom is also pretty wrong. - -===bbox=== -bbox min values are negative. I suppose that makes sense because it's trying to put the top-left corner of the image in the center of the window. It should be tring to put the center of the image in the center of the window. - -===mapbox=== -MapBox uses an "official" tiling spec. In that spec the origin is in the bottom left. That doesn't mean the y-axis is flipped though but it does change how I calculate the tiling scheme. Maybe it does go up. That's awful, why would they do it different than web mercator? - -Crisis averted, maybe? It looks like V2 of the MapBox API uses top-left origin and XYZ tiling: http://mapbox.com/hosting/api/ - -Maybe not averted? Calvin is saying that TileStream itself (as in not hosted by MapBox) only has one API. That doesn't sound right. - -===getTiledZoom=== -This is wrong for image types the way we want to understand pixelSize with images. A low zoom means a low pixelSize which is opposite of maps. I seem to have fixed that. I'm getting closer. - -===refresh=== -Refresh is ignoring tiles on the bottom & right edge of the viewport. - -===top-left=== -The image still starts out in the middle of the page but you can move it around and zoom. - -===getUrl=== -I forgot that while Peter's image server determines zoom levels backwards, I was going to handle that in the getUrl function of the service and have the pixelSizes of the tilingScheme be like normal. This works much better. Now I only have the top-left issue. That's not true, zooming bounces the new image to somewhere else, i.e., isn't smooth or correct. - -===center==== -So, I realized that at geomap zoom level 0, the image is way zoomed out and my center should be the center of the full image in pixels, so pixel width /2, etc. I changed that but my tiles are still misaligned. - -Ha! I wasn't checking for undefined if you pass a zoom of 0. That means I wasn't setting the new center & pixelSize with updated values. All set. Now I'm only offset in the y location and I have a feeling that's because of the axisLayout. - -===osm=== -Somehow, the osm class i getting on the serviceContainer element even though I'm completely redoing the services array at init. - -===centerMax=== -I think for now I have to assume that at max zoom, the whole service fits in a tile and the center is in the center of the tile. I don't have a way yet to specify the center of a tiling scheme, only the top-left. - -===pan=== -Pan is backwards as well when it creates the new bbox. - -Fixed pan. - -===zoom=== -Looking good! interactiveScale is last. Then maybe I should support shingled. Wait, no, that was interactivePan, when pulling in new tiles. - -Zooming twice is a bug but that's in core jQuery Geo, not this image addition. - -===shingled=== -Here's a link to a sample shingled image: http://lib.byu.edu/mrsid/bin/image_jpeg.pl?client=sample&image=sample.sid&x=1024&y=2048&level=0&width=1024&height=480 - -Actually, there are levels so that's a tiled image. Yeah, definitely tiled because the level argument doesn't allow fractional numbers. - -===ie select=== -I think I forgot a userselect somewhere because if there are no inputs on the page and you pan, IE highlights everything in blue. Every map tile. - -Adding any input or link to the page fixes this. Also, adding this to inside the map div seems to fix it too: - - - -That fixed nothing. The issue isn't with panning, it's with shift-zoom and happens no matter what's on the page with IE9. - -==2011-11-08== -===image coords=== -I need a new property to determine the direction of the y-axis but I want it to be more generic. The difference is a different coordinate system, the side effect is the inverted ordinate axis. - -Maybe just "coordinateSystem". I don't want to confuse users with the difference between coordinateSystem and tilingScheme though. - -The full, proper term would be coordinateSystemAxisDirection or coordinateSystemAxisType. There seems to be a little precedence for CoordinateSystemAxis, found in GeoTools: http://docs.geotools.org/stable/javadocs/org/opengis/referencing/cs/CoordinateSystemAxis.html - -Nothing in JTS. - -Hmm, axisLayout? Why not, it's short and specific. axisLayout = "map" | "image". Yes. I like it. - -==2011-11-07== -===gzip=== -I added gzip to jquerygeo.com & all subdomains. jQuery Geo (minified & gzipped) is now 17k and falling! - -===move=== -I don't like that mouse move events seem laggy with this release. I need to find out what's different. I thought it was that I'm sending move events even while drawing that removing that hasn't helped. - -===drawing=== -Wow, geomap._refreshDrawing was terrible and geographics._drawLines needed a little tweaking. - -===return false=== -I didn't have any return falses at the end of my event handlers. I hope that plus the drawing fix makes panning better. - -Oops, I went too crazy and added too many and wasn't letting the browser grab events it needed. Chrome's type=number input went crazy up or down if you didn't move the mouse away. - -===chrome=== -I've done what I can. The issue appears to be with Chrome or something I'm doing with Chrome. Drawing and panning speed is tremendous in IE9 and Firefox 7. - -===geolocation=== -Wow, after any timeout, Firefox stops checking for watchPosition? Is that part of the spec? Nope, not part of the spec. Oh, it *is* part of the spec if it fails due to timeout. It does sound like it's not supposed to trigger until the position changes despite what you put in maximumAge. - -==2011-11-01== -===shapeStyle=== -Time to redo the shapeStyle example in a much more awesome way. - -Did I miss something? jQuery UI widget factory isn't complaining that shapeStyle isn't an option on the widget even though I haven't added it yet. - -New demo is super-cool! - -===refreshShapes=== -I almost had this function clear the shapes geographics until I realized that it's recursive if there's a GeometryCollection. Can't do that. - -==2011-11-01== -===refresh=== -Cleaned up the wording for append, remove & empty. Also, going to have append allow style only, refresh only, or both. - -===refreshShapes=== -Due to performance, I'm going to disable the auto refresh after interactiveScale of shapes if the number of shapes is over a certain limit, say, 255. - -==2011-10-31== -===tile paint=== -Another app I want will be tilepaint.jquerygeo.com. It won't actually use jQuery Geo but will repaint tiles on the fly for you based in an input URL and color changes. - -===fromGeodeticPos=== -There's a bug trying to convert some positions of a town near Concord in the voting demo. I wonder what's different about that geometry. - -The shape is a multipolygon which I am not handling properly. It can be a quadArray. I also removed all the $.each calls which should speed things up a bit. - -All set now. - -===ArcGIS Wrapper=== -agw.jquerygeo.com will take an ArcGIS Server endpoint and spit out the jQueryGeo you need to initialize a map to that service. It should handle both cached and dynamic services. - -==2011-10-30== -===voting=== -I'm working with Calvin Metcalf at MassDOT attempting to push all the data into jQuery Geo. I might want an option to turn off scaling vector data because it's rather slow. Maybe only do it if they have WebGL. - -Disabled it for now. - -===refresh=== -The refersh property must be made public, pushing large number of features isn't useful without out. - -==2011-10-29== -===id/class=== -I'm at WhereCamp Boston 2011 and going to try to finish Alpha 3 while I'm here starting with making id optional. - -===initOptions=== -Was getting undefined when a user passed nothing as in the simplest test. - -===class=== -So, I forgot that class is a reserved word. I'm not sure what to do about that. I can make id optional for now but I'll have to decide about class as a property name. I know as an object literal, I'm supposed to enclose the word in quotes but that's not going to look right for the user who wants to use this. I might have to call it cssClass or something. I'll find out what jQuery uses. - -Google Closure won't even minify the build with the word class used as I'm using it. When I'm creating an element using jQuery's argument that takes an object for attributes, what do they use? They require quotes. - -===id=== -I'm still storing the service state by id. Since both id and class are optional, I think I need to store it as an array. That's not true, I can store an id on the service object via $.data. The id can be $.now. I wonder if $.now actually has different values if I'm creating more than on service at the same time? I will need to test and potentially use a different means to create the id. - -===service create=== -I'm going to assume that the service doesn't already exist during create. Not sure if that's a good idea though. Maybe for now, I won't and I can make the create code smaller later after I have time to test. - -I completely forgot that I'm going to store the entire service state via $.data. That will make things a lot easier. - -Seems to work ok. - -===double click on unloaded=== -When a singled image hasn't loaded after pan and you double click on empty space, the zoomed area seems wrong. - -===fusion=== -Andres from Google is showing radius query using fusion tables. Seems like something I can do with jQuery Geo. - -===kml=== -I might have to support kml. - -===maps.jquerygeo.com=== -I should support typing a url to a geojson file to append all of the json. - -==2011-10-28== -===style=== -Both shapeStyle and drawStyle get and set a plain JavaScript object and should be widget "option"s. While changing them does have side effects, they perform no action themsevles. - -===centroid=== -I'm leaving centroid in a3 but removing support for GeometryCollection for now (in the docs & code). That can come later. - -===distance=== -No sense having the two lines that support arrays, they'll never hit a valid switch case and it's not in the docs. - -==2011-10-25== -===service state=== -I finally moved it to a $.data store on the services container. It was getting messed up moving between pages in jQuery Mobile when one of the pages had a map. - -==2011-10-21== -===resize=== -Shingled maps don't resize properly. I think I have to have a resize method in there & call it from geomap. All set, I had to mark the current scaleContainer as not being for the given scale any longer and re-center it. - -===visible=== -I can't decide about this property of the service object. I need an API audit from Bocoup :( - -Since I have opacity and visibility in shapeStyle, and I know I'm not going to change them, I think I do want to have the naming synergy because I do have opacity in service properties that I'm not going to change. Ugh, but the toggle method takes a true or false value. But so does jQuery's and that changes a CSS property from one text string to another. - -===change service object=== -Unlike the shape objects, I think it's fine if I change the service object's visibility property. It's sort of awful to see the check for undefined & I change it anyway when they use the toggle method. Why not just set it to "visible" when I create the service? - -==2011-10-15== -===draw pan=== -The current version didn't get the code ported over that disables inertia while drawing. I think I need to put that in because without it, the drawing does feel too fidgety. - -I was calling _panEnd instead of _panFinalize for the draw modes. - -===draw polygon=== -Finally ported this code over. Seems ok. - -==2011-10-14== -===maps=== -I would like to make an app that lives at maps.jquerygeo.com and has some useful functionality similar to Google maps but uses all open data. - -==2011-10-12== -===push it=== -jQuery Geo is still functional in Chrome drawing all of the census tracts of MA. That's over 55,000 points and 3,000 features. Not too bad. - -==2011-10-07== -===drawLineString=== -I've ported some initial line code and actually made it much more elegant than our internal one. - -===shingled=== -The shingled demo needs some work. - -==2011-10-06== -===bbox=== -I pushed out a great new bbox example page. It links to a live jsFiddle even so people can play with the code. - -===jQM buttons=== -I did have to make the full screen map an external page. It worked ok after that and the back button still works. - -===jQM=== -jQM has virtual buttons to handle either touch or mouse input (some devices have both at the same time): vclick, vdown, vmove & vup. However, they don't handle multi-touch so I think I'm going to have to stick with what I have at the moment. I can't require jQM just to have jQG work on mobile. - -===draw=== -Porting our shape drawing code over finally. We're getting a new geographics widget to differentiate drawing from appended shapes. - -===drawStyle=== -I forgot to write about the drawStyle method. This one might actually be a true option as it will never be service-specific. It can only apply to the map widget. - -===draw functions=== -I need to rename some things. I've been using a few old names from our internal code but they don't quite make sense with some of the newer names of public properties. Mostly, shape should mean anything added via append and draw is the actual in-process drawing. - -Two internal method names should be: _refreshShapes (instead of _drawGraphics) & _refreshDrawing (instead of _redrawShape) - -===drawPoint dblclick=== -As the docs say, a double tap will zoom in just like in pan mode and not trigger the shape event. - -===geographics=== -Oops, my underlying geographics widget is sharing the same canvas context. Flicker city! Ah, much better. - -===drawPoint=== -Because I'm delaying before I trigger the shape event, it feels slugish. Maybe I can drop the delay down to 100ms. Too fast, I'm getting the shape event. - -==2011-10-04== -===jqcon=== -I gave a presentation to jQuery Conference Boston 2011. I didn't have much time because I was sharing a block with another speaker. So, my presentation was rushed but I still think a few people interested. I will have to get better at conveying that this is not a wrapper for Google Maps or OpenLayers. We do not host any 3rd party controls. - -===jQM buttons=== -With a jQuery Mobile controlgroup or navbar on the same page as a full screen map, I get huge performance issues on Android. iOS seems ok with it. Desktop browsers are fine. The map doesn't pan while sliding your finger but it does show up in the new location when you let go. - -Removing the navbar completely didn't help. I think that unless it's a small in-page map, I'm going to have to make the page external. - -===bbox=== -To test these new bbox functions, I'm going to redo the bbox example page. - -==2011-09-30== -===json=== -I can store a tiling scheme in JSON but just realized that I can't store a service definition in JSON because of the getUrl function property. - -==2011-09-29== -===zoom=== -Documenting and adding the zoom method. - -===bbox=== -Made bbox public. It's also now storing projected coordinates. $.geo.proj can also accept bbox arguments now. - -==2011-09-28== -===disable auto-proj=== -Peter suggested (for actual GIS users) a way to disable $.geo.proj but keep the object where it is. The situation is: "I know I'm working in a projection, and I want $.geo.proj to match that projection, but I don't want it to attempt to auto-project coordinates I pass to $.geo functions or geomap because I'm going to send it projected coordinates, but I do want the object around for when I might want to un-project some coordinates to geodetic." - -That's wordy but it does make sense. - -However, instead of adding a boolean on $.geo called autoproject and telling people that they can shut it off, I'm going to test diving into arguments to determine if they are geodetic and auto-projecting myself. There will be a performance hit but I need to test if it's too much or worth the simplicity. I think I'm going to find that it's worth the simplicity. I can then remove A LOT of words from the docs about if $.geo.proj is null, blah, blah. - -That's fine for input values, but what about auto-unprojecting output values? Maybe I do need that boolean property on $.geo? Or I can store the last way center, bbox, or bboxMax were set and return values in the same format. I would rather it not be that tricky though. If I do add a property, it would only need to be for geomap. The $.geo functions are stateless. - -===wkt=== -Working on WKT.stringify/parse. There will be a $.geo.WKT object. - -Moving along, made the frame of a nice test page too. - -===destroy memory=== -A destroyed geomap remembers what was in _graphicShapes. This means that any other private property initialized with _prop: default, is remembered. There could be other issues...until I replace all indivdual properties with a single state objects. For now, I'm going to reset _graphicShapes to [] in createWidget. - -==2011-09-27== -===destroy=== -Somethings wrong with destroy, can't create after. One thing missing is that resize is called (by jQuery Mobile?) after the call to destroy which causes a script error. I have to make sure I unbind resize. Huh, I've never had to unbind a handler before. Heh, destroy erases any content you had inside the widget before you created a geomap. - -==2011-09-26== -===refactor=== -Found bugs in serviceType.destroy and graphics due to code refactor. The CDN, while wonderful, takes too long to update. I suppose it's not the best idea to put the test branch on the CDN. Done. I'll still occasionally copy test to the CDN but mostly I'm going to update the non-CDN'd version until I know things are ok. - -Alpha 3 docs online & tweeted about! - -==2011-09-24== -===resize=== -My code refactoring broke auto-resize. I wonder what else I broke :) - -==2011-09-23== -===filename=== -I renamed the compiled JS files to match what code.jquery.com has for jQuery itself and jQM. jQUI isn't on there, which is odd. - -===widget factory syntax hack=== -Testing if the syntax I want is possible with the jQuery UI widget factory pattern. I only want the one widget, but I want to be able to call some functions on other child elements. I already hit a snag. Calling .geomap("toggle") on an element that has not been initialized as a geomap widget doesn't trigger _createWidget, _create or toggle. - -===serviceTyep files=== -I'm going to split out the service type objects into their own files. That'll help me make sense of the geomap.js file. - -To do that, I had to move _serviceTypes from being an option of geomap to a propery on $.geo itself. This will help third-party service type plugins down the road. - -===widget vars=== -I think I have to move all the widget vars back into the object passed to $.widget so that they don't conflict with each other, e.g., multiple geomap widgets. As they are now, I think they're all plugin-level widgets. - -===sub-widgets=== -This is awesome. It looks like I can get the syntax I want. Now to figure out the best way to call the method in the parent geomap widget from a service widget. - -It seems like the vars created in the closure supplied to $.widget are still used by all widgets on the page. Do I really have to store state in a data object on the element? - -Yes, they are shared. Yes, I will have to figure something out. - -I just had to plaster my code with this's. I don't like it but it now supports the toggle/opacity syntax I want and *I think* also supports multiple maps on the same page (I think). That's going to increase my minified size quite a bit. I'm going to have to go back and see what I can do to clean it up but I'm choosing proper functionality over code size for the moment. - -==2011-09-21== -===docs=== -I'm trying to clean up the docs and change notational $.geo to jQuery Geo, but not mess up anywhere I mean to reference $.geo the namespace. - -===class=== -I have a better plan for service id. I'm going to keep my plan for having the presense of a name property create a hidden input but I'm going to allow the service object to have a class. The class will be applied directly to the built-in service divs. I will still apply data-service-type="tiled" or data-service-type="shingled" to the divs. To apply certain methods to specific services, you will now target the service class under the map element: - -$("#map .osm").geomap("toggle", false); // this will hide OSM. - -===service create=== -I'm going to require that the service type's create function return a jQuery collection of one item that is addressable for that service. It doesn't really HAVE to have anything in it but I'm going to store service state on it using $.data($el, "geoServiceState", {}) or something. - -===jqm=== -Upgraded to jQuery Mobile b3 & added some color to the headers of various doc pages. - -===service id=== -After talking to Peter, I'm going to allow class and id with a note that if you use id, you'll have to be careful of adding more than one map on the page. I like this plan. Also, if you do it by id, you can target it directly: - -$("#mass-gis").geomap("toggle"); - -===widget tricks=== -I'm not sure I can do the selector tricks I want with the widget factory. I may have to change my docs & design if I can't do it elegantly :( - -==2011-09-20== -===cache=== -I may be caching too aggressively. I think I should remove caching from $.geo.bbox and instead cache inside of append and clear the bbox cache in remove. I really only need it in the find method. - -===jquerygeo.com=== -It's time this project got its own nice site. Also, (mt) is faster than my previous host from places farther away than MA. - -==2011-09-18== -===shape=== -Working on the event docs. - -===name=== -I was originally going to rename id in the service objects to name so I could use it as an input name on a hidden input. However, I'm now going to require id but allow name as an optional property. If present, it will create the hidden input. This is now a future task and will not be in alpha. - -===append=== -While adding the refresh argument to append, I started thinking again how I want to implement service-level graphics. It would be very nice if I could have the map>service syntax to jQuery and call append, remove and empty on that. I think I defined the syntax a while ago...yeah, see "On shape functions" from 2011-06-02. - -The issue I have is that a page can have two maps. The default service has id=OSM. So, if I allowed $("#map #OSM") syntax, it would cause the page to have two elements with the same id, #OSM. However, $("#map [data-geo-service='OSM']") is way to wordy. I'll have to discuss this with others later as this is not an alpha feature either. - -==2011-09-16== -===foss4g=== -FOSS4G is an inspiring conference. I gave my talk and people seemed interested. There was a question about Google. I answered that it's illegal to use them and Chris Schmidt mentioned on Twitter that it's not illegal, it's just hard. We're talking different things. jQuery Geo would use Google tiles directly, which is against license. We will never host a third party widget inside the jQuery Geo div as part of the core functionality. OpenLayers wraps the official Google widget to get around the license restriction (since it's the official Google widget, there's nothing wrong with it) & keeps it up to date (or slides it around) when the user interacts with the OL map. I might do something similar as a blog post when I open up the service types plugin system but until then, but it won't be part of jQuery Geo..."here's how to do it if you want", type of thing. The developer would have to pull in the Google maps API themselves. - -===centroid=== -I'll have to see if JTS uses Point or Coordinate as a return value & match it. - -Centroid needs to use $.geo.proj for accuracy. The centroid should be calculated in web mercator & projected back to geodetic. - -===proj=== -The way we do projection is different than how GIS does it. Usually, when you define a projection, you work in non-geodetic coordinates because the coords have been projected to a flat plane. With jQuery Geo, you work in projected coordinates (I call them non-geodetic) when you set $.geo.proj to null. This can be a little confusing but I think it works. - -The first thing we would have to do internally is set $.geo.proj to null because we use pro - -===bbox proj=== -bbox might be an issue. a bbox in geodetic coordinates (lon/lat) that is a rectangle, will not be a rectangle in web mercator. That's not a problem with setting the bbox property on geomap but could prove interesting for the bbox of geometry objects. For example, the bbox of a square polygon will not be a parallelagram in geodetic coordinates. - -SUGGESTION: Calculate & cache bbox in projected coordinates -SUGGESTION: Document that lon/lat bboxes will not appear to be correct? - -===bbox cache=== -Peter and I got into a talk about caching bboxes. He's worried that we will have too many floating references to objects that cannot be collected. That is a valid point. For example: a user creates a polygon as an object literal, they then call $.geo.bbox on it, then the function ends. We will have a cache of the bbox, but most importantly the cache will reference the original polygon so the browser cannot remove it from memory. I agree that this isn't a great situation. However, the performance benefit gained by the find method is hard to ignore. Also, this only becomes a problem when the developer calls bbox directly. Even though we call it during the find method (building up cache), they are all removed when the dev removes shapes from the map with the remove method. I also know I need to research more about how $.data works with objects. I may be wrong about the reference/memory leaks. - -===point bbox cache=== -Now that I know I should cache bbox as non-geodetic, I think I should revisit my jsperf regarding caching a point. Since there's going to be much more calculation involved in $.geo.bbox, I might want to cache points. However, I think I should only cache them if $.geo.proj is not null. When it's null, non-cached points will still be faster as per my original jsperf test. - -===events=== -The new shape event will need a new event type. Position event won't cover it but it's similar. I'm not 100% sure if I should merge them. The new event type will be a shape event. - -==2011-08-24== -===utah=== -While zooming in, Chrome skips zoom level 12. I wonder if that's a bug in the control. It is. It's a rounding error in _getTiledZoom. Using floor and * instead...fixed. - -==2011-08-19== -===contains=== -Contains is spatial ref agnostic and is called by distance. - -== 2011-08-07 == -=== bbox === -I think I'm missing something from my bbox description. - -=== append === -I would like to say that devs can call append again on a shape and it will replace the existing one and clear the bbox cache. That might be a good compromise for bbox cache clearing because I don't want a method specifically for that. Maybe, I'm not sold on the word append replacing something that's already there. Does jQuery have a replace function? - -SUGGESTION: geomap - append should allow re-append of existing shapes, replacing the old one and clearing the bbox cache - -=== bbox ex === -I'm writing an odd example and I already forget if fromGeodetic can take a single position. It can, according to my docs :) - -=== from/to pos === -I keep going back and forth about coordinate vs. position in terms of words. I almost thought of changing fromGeodeticPos to fromGeodeticCoord but they /are/ called positions in the spec so I'm going to leave it. Again, it's spoken words (of which I suppose I am now including API function names) and code, which is GeoJSON object properties and arguments. Still confusing, this will never be settled so I'm dropping it. - -=== bbox cache === -Oops, I wasn't namespacing my data. I thing it has to be geoBbox because the namespaced data attribute would be data-geo-bbox. - -== 2011-08-06 == -=== alpha 2.5 === -I released a new version last week and it seems to work well. I'm happy with it. On to documenting the features of alpha3! - -=== label === -I'm going to add labels and I think I want a label argument to append, however I want both style and label to be optional. In other words, you can pass a shape and a label. The label argument will be a string of html or a jQuery collection of elements to append to a label div. The outer label div is controlled by geomap. It will have a class on it, geo-label, if devs find they need or want to control it that way, i.e., add plain text and control the label style using the class. - -=== jQuery a plain === -Is a jQuery collection a plain object? Not according to this fiddle: http://jsfiddle.net/ryanttb/4rHK5/ - -So, I will have two optional args: style and label. Style has to be a plain object. Label can be a string or jQuery object. I'll say style comes first but they can be in any order. - -=== shape props === -Even though I have args on append, I will eventually allow both style and label properties on the GeoJSON object. They're not standard but not illegal according to the spec. - -=== stored label === -For speed, I will have to build the label HTML during the call to append, whether or not I use the shapeLabel property on the map or the label supplied during append. - -=== override === -The label supplied to append will completely override the map's shapeLabel property. - -=== centroid === -While I would like a LineString's centroid to be a point along the line so I can using it for labeling, that's not the accepted definition of a centroid of a line. According to JTS, it's calculated like a polygon, except when there is a polygon as part of a GeometryCollection. In which case lines and points are ignored when calculating centroid. - -=== line label === -Checking to see if JTS has an official point-along-line function that I can add w/o creating my own name. It doesn't seem to. I just decided to not label on the centroid for lines but on the "center point" of the line. As you add more points, the label will move further along the line. - -=== envelope & bbox === -So, OGC simple features doesn't seem to define an Envelope class. The Envelope function is defined to return a Polygon, eww! - -=== ogc text align === -They do define text alignment options called HorizontalAlignment: start, center and end. Might be useful later for text label options. - -=== $.geo & proj === -Internally, I need to call the geometry ops in $.geo and I will already have a projected bbox or geometry object. I need a way to tell methods such as $.geo.expandBy to not call $.geo.proj.fromGeodetic even if $.geo.proj is not null. I think for now I will have an internal (and undocumented save for here) argument at the end called ignoreProj. If truthy, it will not call fromGeodetic. A false value or undefined will call fromGeodetic if $.geo.proj is not null. - -The documentation will always say fromGeodetic is called if $.geo.proj is not null. - -SUGGESTION: Add an internal ignoreProj argument to $.geo geometry functions. - -=== scaleBy === -I haven't used it yet buy my original port of the scaleBy function was wrong. I was calling expandBy which would make scaleBy(bbox, 1) actually increase the size of the bbox, however, scaleBy(bbox, 1) shouldn't change the size at all. Also, expandBy was wrong basing itself on center instead of just modifying the min/max values directly. - -=== geodetic bbox === -I forgot that from/toGeodetic don't currently support bboxes. What am I doing already in geomap? Ah, right. I only needed it once (the bbox property) so I'm converting to two positions by hand. I think I should make a conveniance method in $.geo.proj. fromGeodeticBbox or something. I'm not going to make it public. Devs shouldn't have to call it, they can work in whichever projection/non-projected state they set $.geo up as and the public functions can handle it. - -SUGGESTION: add private _from/_toGeodeticBbox methods - -I did remove the, "if $.geo.proj is not null X first calls fromGeodetic..." shpeal that I had in all the bbox methods because it's not accurate. I won't call from/toGeodetic, I'll call a private method. - -Actually, I should be able to detect a bbox vs any other geometry in the *Geodetic methods. It will be an array of 4 numbers, so .length == 4 and $.isArray(value[0]) == false. Maybe I'll put bbox conversion into them after all. - -== 2011-07-30 == -=== alpha 2.5 === -It's been too long since I had a chance to work on this and I want to get an alpha 2.5 release out. - -I need to push this back in an change my current branch name. I think it's alpha3 at the moment. - -=== jsperf === -I wrote a perf for point & linestring bbox cache testing. The test makes me think jQuery.data doesn't do what I think it's doing. When I cache the bbox in a local var, it's very fast but when I cache with data, it's not. - -* Here's the point test: http://jsperf.com/point-vs-bbox -* Here's the line test: http://jsperf.com/line-vs-bbox - -It's always faster to test points by themselves, i.e., don't worry about checking for a cached the bbox. - -=== branch === -I was on master, so I pushed, then created & switched to alpha2-5. - -=== opacity === -When developing the heat map example, I remember running into an issue where I couldn't get the opaicty to look right between the border and center. Maybe I fixed it somewhere else because I can't seem to reproduce that. - -I can still get it on the latest fiddle of the heat map. It's when the opacity is 1 and the strokeOpacity is 0, the stroke still shows up but it should be hidden. - -I still can't recreate this on the shapeStyle test page :( Ah, but the twitter heat example has the issue. - -Turns out I was or'ing the stroke/fillOpacity with regular opacity in _getGraphicStyle. That's not the right place to do anything with them, and never or. - -=== service opacity === -I'm going to pull in the service opacity method from AppGeo.Web as "opacity" on each service object, like refresh. - -That's done. I haven't documented/implemented what happens if you don't pass a service id. It's required. I'm not sure what I want that to do yet. - -=== visible === -When starting to think about geomap.toggle, I realize I have a naming conflict so to speak. The service object has a boolean visible property while the shape style has a string visibility property. I think I want to change the service to match the shape style. I don't think there are any attributes in HTML that pertains to visibility so I'm going to match CSS even in the service object which is more internal and less graphical. That said, I don't want to start renaming things in alpha 2.5 so that'll wait until 3. - -SUGGESTION: Rename service.visible to visibility having either "visible" or "hidden" values - -=== service props === -So, I noticed that when a service is created, I don't modify the service objects to fill all the supported properties. So, when toggle is called, there's potentially not an initial visible property set. - -I think for now, alpha 2.5, I will have the toggle function assume that there could be an undefined service.visible. The refresh method does the same. Later, though I think I might want to set defaults during _createServices. - -=== proj === -New projection code seems to work and is awesomely 150 lines shorter! - -=== resize === -I'm going to hook into the window resize event automatically but I will still need a resize method later in case the dev changes the div size/css. - -SUGGESTION: Add a resize method to let geomap know the div has changed size programatically - -I'm not sure of the correct way to kill & remake graphics now that it's a jQuery UI widget. It appears that I can call distroy & re-create it. - -Resize, is working though when getting smaller, there is a space for the scroll bars. I don't remember having that issue with the internal AppGeo.Web control. That is an issue to tackle after alpha 2.5. - -=== dbl tap === -What is a thumb? On touch devices, and other soft-dblclick devices I don't take into account that the second click/tap might be too far from the first to count as a tap. There is no move event to cancel. I'm now calculating distance between the two based on _anchor (previous) and _current ( current :). This will need testing. I'm setting it at 10px for now, line 1480 of geomap.js as of this writing. - -== 2011-07-19 == -=== wkt === -Wrote up some to-WKT code for our internal control today. WKT will also be supported by parseWKT and textify methods in $.geo. - -SUGGESTION: Support WKT with $.geo.parseWKT (like JSON.parse or $.parseJSON) and $.geo.textify (like JSON.stringify). - -=== centroid === -Wrote up some centroid code for all but GeometryCollection as well for our internal control. Code similar to this will end up in $.geo.centroid. - -== 2011-07-15 == -=== presentation === -My first real talk about $.geo went well, I think. Next up is FOSS4G in September and, possibly, jQuery Conference Boston in October & Harvard WWW in December. - -=== alpha 2.5 === -I think I want to push out a bug-fix release of the alpha 2 tech. I'll tag it as alpha 2.5 in github but overwrite the alpha2 js file on host. Well, rename the old one as alpha2.0 in case people find a bug in the new one. - -I need to write down exactly what to do for alpha 2.5. - -=== shape images === -People really want images on shapes, particularly points. I'm removing this feature from my TO DO list: -* geomap - Document and implement passing a function to shapeStyle and append that returns a geomap style object based on feature or geometry properties -because I have a much better plan that involves the label div. It will be a normal div and have a class. Each will have relative position and designers can manipulate it however they want. - -== 2011-07-12 == -=== fiddles === -Some fiddles for my demo on Wednesday: - -# show a map: -#* http://jsfiddle.net/ryanttb/A6avG/ -# show a map & zoom to boston -#* http://jsfiddle.net/ryanttb/2qBgw/ -# show a map & zoom to geolocation -#* http://jsfiddle.net/ryanttb/Pre4k/ -# add a location search -#* http://jsfiddle.net/ryanttb/3LpqG/ -# add a twitter search: rpp=100 -#* http://jsfiddle.net/ryanttb/79zTk/ -# use map center as geocode, radius=(pixelSize * width/2 ) / 1000 -#* http://jsfiddle.net/ryanttb/2PCUu/ -# change style to heat map (16x16 size 8 border-radius) -#* http://jsfiddle.net/ryanttb/PUeRc/ -# update on bboxchange -#* http://jsfiddle.net/ryanttb/8LQLW/ -# show tweets in popup -#* http://jsfiddle.net/ryanttb/y2gTh/ - -== 2011-07-07 == -=== bbox === -I added bbox caching! I even check to see if the GeoJSON object has a bbox property, which is legal. There's no way to update the bbox but that'll come later. - -=== distance === -I almost tried to have distance support taking in a Feature but that opens a whole can of worms. I'm going to fix find to only send base geometry types to distance. - -DOCUMENT: geometry methods will only take base geometry types (Point, LineString, Polygon & Multi*) or coordinate arrays - -I had some weird comment on this method, it should be documented to only take base types, as I just said. - -=== form input === -I was talking to Chris last night about what geomap does that others don't and he reminded my about the idea I had of keeping a hidden input of the shapes as WKT. This would mean that I had to have a property on geomap for the map's name and also definitely change the service object to use name instead of id for when I add service-level shapes. WKT becomes a problem though when they've added features. I suppose I would dig into the features and only pull the geometry. - -=== json === -It's been a while since alpha 2. I'm working on a demo that draws the US state boundaries as graphics. - -== 2011-06-30 == -=== min === -Srsly? I wasn't using minified jQuery in my examples? Wow. - -== 2011-06-29 == -=== alpha2 === -Released alpha 2. I don't think anyone's really using it yet though. - -== 2011-06-28 == -=== on services === -I think it would be nice to deep extend service objects that come in via the services property if a service with the given id already exists in _currentServices. This way, you could set the initial opacity of OSM by simply sending {services: [{id: "OSM", opacity: .8}]} during init. - -SUGGESTION: deep extend existing service objects when services property is set - -=== on opacity === -I was beginning to try to throw the opacity & toggle methods into alpha2 but setting the services property is too flickery. I want to do it more like the old widget but that will require adding opacity and toggle methods into the services types. That will have to wait. It will be much faster to call the opacity/toggle methods on geomap than to set the services property each time. I will have to document that. - -SUGGESTION: require opacity and toggle functions in the service type objects - -== 2011-06-27 == -=== on events === -I almost forgot that I don't want bboxchange to fire when the developer changes a property in code. Unlike jQuery UI, my events trigger only when the user does something. - -=== on alpha 2 === -I'm trying to put this together. - -== 2011-06-24 == - -=== on shape methods === -I'm almost done. I need to finish empty and then I have what I wanted for an alpha 2 release! - -=== on Point vs. coordinate === -I think I'm going to settle on using Point objects everywhere except the projection functions. Which means I need to change find to accept a Point instead of an array. This should work out because the position events already send GeoJSON objects instead of position arrays. - -=== on geometry === -contains doesn't care about projections. Lon/lat values do not need to be projected. - -I got done some of the geometry functions in $.geo but I'm leaving them private for now until I have a chance to document them and fully implement them. - -=== on proj === -Finished changing the $.geo.proj docs to explain that it will convert any GeoJSON coordinates array. I think I will also change the requirements to implement other projections by having the developer only have to override single position conversion functions (instead of worrying about the dimentionality of the passed array). Done. - -=== on find === -Now that proj is more powerful, I think I can handle find. - -== 2011-06-18 == -Accidentally coded append differently than how I documented. Will fix the code. Documentation FTW! - -I can't decide if the geometry functions in $.geo should only accept the base geometry types or not. Initially they will not. I don't want to even think about getting into $.geo.distance(multiPoint, geometryCollection). - -$.proj should go up to a three dimensional array to handle the coordinates in a Polygon. Go big or go home, I'm going to support four dimensional arrays so that I can get MultiPolygons as well. That will handle all of the GeoJSON types that have the coordinates property. If you have a GeometryCollection (geometries property), a Feature (geometry property) or a FeatureCollection (features property), then you're on your own. - -I may change every mention of "web mercator" to "spherical mercator" to be more specific. - -== 2011-06-17 == -Attempting to change drawPoint from ovals to rounded rectangles. Shortcutting to drawArc if the width/height/borderRadius are the same. - -Since I plan to make geographics public at some point, I thought I might make the drawPoint/Line/Polygon functions take actual GeoJSON shapes but I think that might conflict with some functionality internal to the geomap during digitization...I'll have to revisit this. - -I seriously need to settle on the word "position" in my code when referring to an array containing an x/y. I use coordinate a bunch because that's what I used in the old project. Oh, but the property name of the GeoJSON object is coordinates. Heh, this is so confusing :) Ok, as I have been doing: coordinates in code, position in documentation. - -I'm using cowboy's safeParse but can't tell what it's guarding against. I thought it would always give me a number but that's not the case. Guard against NaN or undefined? - -Should drawing a bbox ignore borderRadius? I haven't decided. - -You can fill and then stroke the same path, just sayin'. - -Point graphics now draw as rounded rectangles. There's weirdness if your sizes are a little off though. I should probably start clamping values to each other like width & height to borderRadius. Yeah, if either is smaller than borderRadius the drawing gets weird. Maybe I should clamp borderRadius instead. Probably. Yeah, have to clamp borderRadius to min(width, height)/2. - -I don't think you can disable fill by setting style.fill to "", but you should be allowed. It shouldn't be required to set fillOpacity to 0. - -I just dropped a couple loops out of my graphic drawing in geographics. Should help a bit :) - -== 2011-06-12 == -I'm finally pushing the renaming changes to the main project. - -=== On examples === -I talked to Boaz at Bocoup the other day. He suggested cleaning up the examples. I already had this in mind but I should probably do it sooner rather than later. Especially the simplest example. It will look nicer if I cut the div down to 256x256 to match the initial tile I think (done, it already feels better). I do need to keep the examples specific and don't want to add any HTML or JavaScript to them that does not directly relate to the feature I'm testing in the example. - -He also suggested unit tests and an API audit, both of which are great ideas and much needed by $.geo. - -=== On ovals === -Peter and I discussed how points are drawn and what width and height mean in geomap styles. We both agree that ovals are not very useful or used constructs in GIS and it would be better to have rounded rectangles. Therefore, I am dropping ovals and intead supporting a borderRadius property. Circles are still possible as long as your width, height and border radius are all the same, you will have a circle. This will be the default. - -=== On double-click zoom === -Peter and I both agree that double-click zoom should operate similar to mouse-wheel zoom in that the bbox should scale according to the placement of the mouse cursor during double-click instead of completely re-centering. You will notice that mouse-wheel feels right and double-click can be confusing. - -SUGGESTION: Double-click zoom should scale according to cursor location instead of re-centering - -=== On position events === -I cannot decide if I should officially make the geo argument passed to the position events (move, click, dblclick) a true GeoJSON Point object. The only difference would be the presense of a type property set to "Point". However, the extra pixels property that I have on the geo argument is not part of GeoJSON and will remain in memory. Also, if a developer pushes the new object to a database they are storing extra information that they don't need and will be useless later. - -Is the pixels property even that useful? The dev can call geomap.toPixels if they need it. I added the pixels property just because I had the pixels lying around in the internal handling of the event. I think I might just not pass them. It would be more useful to a developer I think to have a true GeoJSON Point object that they can send to geomap.append or a database without worrying about having extra useless data stored with it. - -SUGGESTION: Remove the pixels property from position events and add the type property to make the event argument a true GeoJSON Point - -I just updated the docs and changed the implementation. I already like this a lot better and am now thinking that the bbox event type could actually send a true GeoJSON Polygon with the bbox property set. That would be totally within the GeoJSON spec and might be useful. That's a bit of extra code on the widget's side though so for now I'm going to leave it as is. I can add that feature later since the current implementation (an object with just a bbox property) is already partially in a true Polygon's spec. - -FUTURE SUGGESTION: Send a true GeoJSON Polygon object as the geo argument of bbox events - -=== On returning jQuery collections === -I need to better design the return values of the shape methods other than find & shapeStyle. Should append, remove and emtpy return the jQuery object of the map elements that the call originated from? Probably. - -I just tested and yes, as long as you don't issue a return statement inside a jQuery UI widget method, jQuery UI will return the original jQuery collection for you. - -== 2011-06-10 == - -=== On geographics === -I am going to leave drawArc in the graphics widget. The drawPoint method will draw our default point shape (rounded rectangle) but, in the future, when custom drawing is in, a developer can use the drawArc if they want. - -=== On proj === -Peter has updated web mercator <=> geodetic code for me to drop into $.geo.proj. - -== 2011-06-06 == - -=== On renaming shape functions === -Renamed the shape functions. That was annoying but I'm glad I only had addShape implemented. - -=== On jQuery UI widgets === -The widget factory does hide methods that start _ from being called. So much for renaming drawArc to _drawArc and still calling it from geomap. - -DEPRECATED SUGGESTION: Turn geographics into a NON-jQuery UI plugin - -Did I totally get the scoping wrong for the jQuery UI widget? I have local vars in my initial plugin closure. Will they conflict if there are more than one map? - -SUGGESTION: Verify that vars local to initial closure do not conflict when multiple maps are placed - -== 2011-06-04 == - -=== drawArc === -I just realized that by dropping geographics.drawArc in favor of drawPoint I am losing the ability to draw the circles I need for digitization modes. I wonder if, before I turn DrawPoint into a box-like function, that I should copy it to _drawArc. Will jQueryUI.widget let me call it from geomap? - -=== shapes === -Chris and I were talking about merging append (previously addshape) and find into one call: shapes. If you pass a GeoJSON object or array of, it will add them. Otherwise, it will find them. Thinking about this today, I don't quite think that's the way to go. I mostly feel that calling geomap functions to manipulate shapes is closer to adding elements to a jQuery collection. In other words, to call the geomap functions you must have already wrapped an element with jQuery, $("#map").geomap("funcName"). When you wrap elements with jQuery normally, you have to call append, find, etc. Geomap will work the same with. Of course, I do still want the syntactic sugar later: $("#map").append(geoJsonObj); - -== 2011-06-02 == -Who needs a blog. I feel like the best place to keep a developer journal is in the project itself so here we go. - -=== On addShape's style argument === -I showed Peter the shapeStyle demo. He expected that the shape-specific style applied via addShape would only override properties set during addShape. Further manipulation of the base shapeStyle would cascade to the shapes for any properties not explictily set. You know, like CSS. This is obviously the correct way to go and I already forget what made me code it the other way last night. Likely that I was coding at 2am and thought that if a user was passing a style to addShape they would want ALL style properties set in stone for that shape. That is not the right idea. If they want all properties set in stone, they can override all properties in the style object sent to addShape. - -I changed the implementation before leaving work. - -=== On storing & modifying style === -My initial implementation drawing shapes in $.geo is very similar to how I did it with our internal control. I also showed Chris the shapeStyle demo and explained how you can add a style that's different from the base style on the map. He suggested that there be a way to change the style of an already added shape. I figured that I could make addShape update existing geometries instead of adding a new one but the syntax felt wrong. An updateShape method would work and could pass right through to addShape internally. - -He also suggested allowing access to the internal GeoJSON->style map (as a return value for addShape) so they can maybe change the existing styles that way. However, something doesn't feel correctly designed about that. - -We discussed attaching the style to the GeoJSON object. I already had supporting that in mind. If the user happens to have put a style property on the GeoJSON object before passing it to addShape, I would use that when drawing. A style passed to addShape would override that. The cascade would be: base style => GeoJSON object style => addShape style. A developer can keep the style property on the object even when it's stored, such as in GeoCouch, something that Guido wants a lot. - -That said, I know I'm going about this wrong. As I said, my initial implementation feels too much like the old one and I want to do something much slicker in the jQuery world. On my walk home, I realized that since I am only storing a reference to the GeoJSON object and the user supplied style I can probably connect the style object to the GeoJSON object using jQuery's data method. - -I wasn't sure if targeting a plain object is allowed in jQuery. I know it's possible but that doesn't mean I should. I remember IRC talk about it but forget the outcome. Info on ticket 8108 (http://bugs.jquery.com/ticket/8108) reveals that the DataLink plugin does this so I'm going to assume it's ok. - -This little fiddle shows that the data properties don't show up with stringify http://jsfiddle.net/ryanttb/PetpJ/ but I'm going to do more research to see if it changes the object in a way devs will notice. - -The data method doesn't natively support namespacing. I could do it myself using a period but I would like to follow what jQuery Mobile is doing with their data attribute stuff. They use data-jm-role which I believe equates to the call .data("jmRole") but I need to check up on that as well. So if I were to do data-geo-style, that would be .data("geoStyle"). I can live with that. - -SUGGESTION: Store $.geo styles via $(geoJsonObj).data("geoStyle", style) - -=== On shape functions === -Again, the shape functions feel very old and were grabbed from my internal control. Tonight I was thinking about a new way to do this and it involves being able to wrap GeoJSON objects with jQuery collections and intercept $.fn calls such as .css. Also, non-jQuery UI functions can be added to the geomap widget's div to replace the old addShape method. - -For example: $("#map").geomap("addShape", geoJson) could be $("#map").append(geoJson). - -How would I add shapes to specific services in the future? $("#map [data-geo-service='OSM']").append(geoJson) maybe. - -This might be going too far. Perhaps the old way is fine but use newer names (without the Shape suffix): $("#map").geomap("append", geoJsonObj), $("#map").geomap("append", "OSM", geoJsonObj), $("#map").geomap("remove", geoJsonObj) and $("#map").geomap("empty"). - -SUGGESTION: Rename the shape manipulation methods - -The methods also need to take arrays of GeoJSON objects as returned by databases and jQuery collections of GeoJSON objects as possibly returned by the find method. - -SUGGESTION: Shape manipulation methods should handle arrays - -Looking back at the above code, I feel like maybe if I really can get the selector-based way to work, e.g., intercept the append call on the geomap widget, I could target the services using a class. They are divs inside the map, I should be able to trap them: - -$("#map .OSM").append(geoJsonObj); - -That does look really nice. - -SUGGESTION: (future) Trap existing jQuery calls: append, remove and emtpy, on both the widget element and the service elements as syntactic sugar, forward them to geomap calls - -However, using the class selector feels wrong. Especially if I'm telling them to use the id property when creating the service objects. I could switch it to name when creating the service objects, then: - -$("#map [name='OSM']").append(geoJsonObj); - -I need to find out if any of this is possible as soon as possible. It's still shorter than calling geomap. I would have to warn users to make sure the space is there, this needs to be a descendant selector. - -SUGGESTION: Use name instead of id in the service objects. - -=== On finding shapes === -So you can append and remove shapes. Fine. But I also want a better way to search for shapes. Chris and I mulled over a selector-based way. I think I still want the simplicity of $("#map").geomap("find", position, pixelTol). That will cover a lot of use cases, users click maps a lot. - -However, there should be other ways to get at your shapes in a UI widget way: -$("#map").geomap("find", [-67, 43], 8); // find all shapes within 8px of the map position (special case) -$("#map").geomap("find", "[type='Point']"); // Finds all points -$("#map").geomap("find", "[name='OSM'] *"); // all shapes in the OSM service (future) -$("#map").geomap("find", ":intersects(wkt(POINT(-67 43)))"); // Advanced spatial filter, OGC selector names (way future) - -Here's how they would look with the future jQuery syntactic sugar: -$("#map").find([-67, 43], 8); // find all shapes within 8px of the map position (special case) -$("#map").find("[type='Point']"); // Finds all points -$("#map [name='OSM']").find(); // all shapes in the OSM service (future) -$("#map").find(":intersects(wkt(POINT(-67 43)))"); // Advanced spatial filter, OGC selector names (way future) - diff --git a/libs/js/jquery-geo-1.0b2/docs/404.html b/libs/js/jquery-geo-1.0b2/docs/404.html deleted file mode 100755 index b5ea1ac..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/404.html +++ /dev/null @@ -1,22 +0,0 @@ - -not found - - - - - - -
-

Not found

-

:(

-
\ No newline at end of file diff --git a/libs/js/jquery-geo-1.0b2/docs/css/handheld.css b/libs/js/jquery-geo-1.0b2/docs/css/handheld.css deleted file mode 100755 index 0b8202e..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/css/handheld.css +++ /dev/null @@ -1,8 +0,0 @@ -* { - float: none; - background: #fff; - color: #000; -} - - -body { font-size: 80%; } \ No newline at end of file diff --git a/libs/js/jquery-geo-1.0b2/docs/css/style.css b/libs/js/jquery-geo-1.0b2/docs/css/style.css deleted file mode 100755 index 39b4f7c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/css/style.css +++ /dev/null @@ -1,159 +0,0 @@ -/* HTML5 ✰ Boilerplate */ - -html, body, div, span, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, -small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, figcaption, figure, -footer, header, hgroup, menu, nav, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} - -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} - -blockquote, q { quotes: none; } -blockquote:before, blockquote:after, -q:before, q:after { content: ""; content: none; } -ins { background-color: #ff9; color: #000; text-decoration: none; } -mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; } -del { text-decoration: line-through; } -abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; } -table { border-collapse: collapse; border-spacing: 0; } -hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } -input, select { vertical-align: middle; } - -body { font:13px/1.231 sans-serif; *font-size:small; } -select, input, textarea, button { font:99% sans-serif; } -pre, code, kbd, samp { font-family: monospace, sans-serif; } - -html { overflow-y: scroll; } -a:hover, a:active { outline: none; } -ul, ol { margin-left: 2em; } -ol { list-style-type: decimal; } -nav ul, nav li { margin: 0; list-style:none; list-style-image: none; } -small { font-size: 85%; } -strong, th { font-weight: bold; } -td { vertical-align: top; } -sub, sup { font-size: 75%; line-height: 0; position: relative; } -sup { top: -0.5em; } -sub { bottom: -0.25em; } - -pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; padding: 15px; } -textarea { overflow: auto; } -.ie6 legend, .ie7 legend { margin-left: -7px; } -input[type="radio"] { vertical-align: text-bottom; } -input[type="checkbox"] { vertical-align: bottom; } -.ie7 input[type="checkbox"] { vertical-align: baseline; } -.ie6 input { vertical-align: text-bottom; } -label, input[type="button"], input[type="submit"], input[type="image"], button { cursor: pointer; } -button, input, select, textarea { margin: 0; } -input:valid, textarea:valid { } -input:invalid, textarea:invalid { border-radius: 1px; -moz-box-shadow: 0px 0px 5px red; -webkit-box-shadow: 0px 0px 5px red; box-shadow: 0px 0px 5px red; } -.no-boxshadow input:invalid, .no-boxshadow textarea:invalid { background-color: #f0dddd; } - - -button { width: auto; overflow: visible; } -.ie7 img { -ms-interpolation-mode: bicubic; } - -body, select, input, textarea { color: #444; } -h1, h2, h3, h4, h5, h6 { font-weight: bold; } - -/* jQuery Mobile f theme */ -.ui-bar-f { - background: rgb(116, 176, 66); border: 1px solid rgb(86, 160, 14); color: rgb(255, 255, 255); font-weight: bold; text-shadow: 0 -1px 1px #234403; -} -.ui-bar-f { - color: rgb(255, 255, 255); -} -.ui-bar-f .ui-link-inherit { - color: rgb(255, 255, 255); -} -.ui-bar-f .ui-link { - color: rgb(255, 255, 255); font-weight: bold; -} - - - /* Primary Styles - Author: Ryan Westphal - */ - -h1 img { width: 24px; height: 24px; margin-right: 4px; vertical-align: middle; } -div>h2 { font-size: 1.1em; margin: .5em 0; text-decoration: underline; } -p { margin: .5em 0; } -th { text-align: right; padding: .5em 1em .5em 0; } -td { padding: .5em 0; } -b { font-weight: bold; } -i { font-style: italic; } -h4 { font-style: italic; font-weight: normal; } -ul { margin-bottom: .5em; } - -.geomap-indoc -{ - height: 240px; - position: relative; - width: 98%; -} - -.objectProperties th { text-align: left; } -.objectProperties td { padding: .25em .5em; } -.objectProperties tr:nth-child(2n+1) { background: #bbb; } - -code .comment { color: #393; } - -blockquote -{ - margin: 8px; - font-style: italic; -} - -.ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; } -.hidden { display: none; visibility: hidden; } -.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } -.visuallyhidden.focusable:active, -.visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } -.invisible { visibility: hidden; } -.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; } -.clearfix:after { clear: both; } -.clearfix { zoom: 1; } - - -@media all and (orientation:portrait) { - -} - -@media all and (orientation:landscape) { - -} - -@media screen and (max-device-width: 480px) { - - /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */ -} - - -@media print { - * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important; - -ms-filter: none !important; } - a, a:visited { color: #444 !important; text-decoration: underline; } - a[href]:after { content: " (" attr(href) ")"; } - abbr[title]:after { content: " (" attr(title) ")"; } - .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } - pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } - thead { display: table-header-group; } - tr, img { page-break-inside: avoid; } - @page { margin: 0.5cm; } - p, h2, h3 { orphans: 3; widows: 3; } - h2, h3{ page-break-after: avoid; } -} - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/all-shingled.html b/libs/js/jquery-geo-1.0b2/docs/examples/all-shingled.html deleted file mode 100755 index 5d9ee53..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/all-shingled.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - everything shingled - - - - - - - - -
-
-
-
- - -

shingled

- -

The everything demo, shingled edition!

- -
-

info

- - - - - - -
- -
- -
-

basics

- - - -
-

scroll

-
- - -
-
-
- -
-

mode

- - -
- - - -
- -
- - - -
-

toggle

- -
- - -
-
- -
-

zoom

- - - - -
- -
-
- - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/all-tiled.html b/libs/js/jquery-geo-1.0b2/docs/examples/all-tiled.html deleted file mode 100755 index 928fb80..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/all-tiled.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - everything tiled - - - - - - - - -
-
-
-
- - -

tiled

- -

The everything demo, tiled edition!

- -
-

info

- - - - - - -
- -
- -
-

basics

- - - -
-

scroll

-
- - -
-
-
- -
-

mode

- - -
- - - -
- -
- - - -
-

toggle

- -
- - -
-
- -
-

zoom

- - - - -
- -
-
- - - - - - - - - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/append.html b/libs/js/jquery-geo-1.0b2/docs/examples/append.html deleted file mode 100755 index ed24f96..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/append.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - append test - - - - - - - -
-
-
-
- -

append

-

This page tests geomap's append method and some style and refresh arguments.

-

A geomap widget is initialized to the continental US and a point is placed in Massachusetts. A line extends from MA to South Jersey where a triangle covers an area. For points, geomap draws a pixel-based oval around the map coordinate. Since the size of the oval is based on pixels, it will be the same size at all scales. The pixel length of lines and size of polygons changes at different scales because each point that makes up the shapes is locked at specific map coordinates. The stroke width for all shapes will be the same number of pixels at all scales.

-

All the geometry is stored in a single GeometryCollection. This example first draws the entire collection with a broad stroked, off-white style to create a halo effect behind the real shapes. This makes them a little easier to see on the map. Then we draw each individual shape again with color. The first two have the default style which is red. For the last one, we change the color to blue.

-
-
- - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/appendservice.html b/libs/js/jquery-geo-1.0b2/docs/examples/appendservice.html deleted file mode 100755 index d326ec5..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/appendservice.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - append to service test - - - - - - - -
-
-
-
- -

append to service

-

This page is similar to the regular append example but tests appending shapes to a specific service instead of the map itself. The result, however, should look exactly the same.

-
-
- - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/basemaps.html b/libs/js/jquery-geo-1.0b2/docs/examples/basemaps.html deleted file mode 100755 index 3f21aa9..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/basemaps.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - basemap switcher example - - - - - - - - -
-
-
-
- - -

bassemap switcher

- -
- - -
- -
-
- - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/bbox.html b/libs/js/jquery-geo-1.0b2/docs/examples/bbox.html deleted file mode 100755 index 4464a61..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/bbox.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - bbox examples - - - - - - - - - -
-
-
-
- -

bbox

-

This example tests getting and setting the bbox property on the geomap widget as well as calling various $.geo bbox functions.

- -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
)
.geomap( "option", "bbox" )
$.geo.proj.fromGeodetic( bbox )
$.geo.proj.toGeodetic( bbox )
$.geo.center( bbox )
$.geo.width( bbox )
$.geo.height( bbox )
-
-
-

For this example, the functions below operate on the above text input only. After using them, you can click set to update the map and other info.

-
- - - - - -
$.geo.expandBy( bbox, , )
-
-
- - - - - -
$.geo.scaleBy( bbox, )
-
-

This last function, reaspect, forces an aspect ratio (calculation of width divided height) onto the bbox. You can run this but it will be difficult to visually see the effects because the geomap widget will automatically reaspect again to fit the bbox back into the viewport.

-

Common aspect ratio values: 16:9 = 16/9 ~ 1.78:1 & 4:3 = 4/3 ~ 1.33:1

-
- - - - - -
$.geo.reaspect( bbox, )
-
-
-
-
- - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/bostock.html b/libs/js/jquery-geo-1.0b2/docs/examples/bostock.html deleted file mode 100755 index 5eca514..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/bostock.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Bostock demo - - - - - - - - -
-
-
-
- -

Bostock demo

-

Inspired by: D3 + Leaflet

-
-
- - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/census.html b/libs/js/jquery-geo-1.0b2/docs/examples/census.html deleted file mode 100755 index 97be907..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/census.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - Census - - - - - - - - -
- - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/center.html b/libs/js/jquery-geo-1.0b2/docs/examples/center.html deleted file mode 100755 index b0d59b6..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/center.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - center/zoom example - - - - - - - - - -
-
-
-
- -

center & zoom example

-

This page tests getting and setting the center & zoom options as well as getting the read-only pixelSize.

-

The center option is a GeoJSON position. The zoom option for a tiled service a whole number from zero to the number of levels defined by the tilingScheme minus one. The pixelSize is the number of map units that fit in a single pixel of the current view. By default, pixelSize is in meters because the default map service is in web mercator meters.

-

runtime options

-

Change the center or zoom option and click set to update the map.

-
- - -
-
- - -
-

actual values

-

The center option is in geodetic cooridinates, [lon, lat], but the internal center is in map units, web mercator by default.

- - - - - - - - - - - - - - - - - - - - - -
.geomap( "option", "center" )
$.geo.proj.toGeodetic( center )
internal center, always projected
.geomap( "option", "zoom" )
.geomap( "option", "pixelSize" )
-
-
- - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/css/style.css b/libs/js/jquery-geo-1.0b2/docs/examples/css/style.css deleted file mode 100755 index 974d08f..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/css/style.css +++ /dev/null @@ -1,86 +0,0 @@ -.links -{ - float: right; -} - -.docLink -{ - background: url(../../images/$.geo-logo-small.png) right no-repeat; - color: #7f0000; - display: block; - font-size: 24px; - font-weight: bold; - padding-right: 24px; - text-decoration: none; - text-transform: uppercase; -} - -.fiddleLink -{ - display: block; - font-weight: bold; - margin: 4px; - text-align: right; - text-decoration: none; -} - -.fiddleLink img -{ - border: none; - vertical-align: middle; -} - -.mobile-shrink -{ - font-size: .6em; -} - -.not-mobile -{ - display: none; -} - -@media only screen and (min-width: 800px) -{ - .info - { - width: 45% !important; - position: fixed; - right: 16px; - top: 16px; - } - - .mobile-shrink - { - font-size: 1em; - } - - .not-mobile - { - display: block; - } -} - -html -{ - font:13px/1.231 Calibri,Arial,sans-serif; *font-size:small; -} - -.info -{ - background: #fff; - border-radius: 8px; - box-shadow: -4px 4px #444; - opacity: .8; - padding: 8px; - width: 90%; -} - -fieldset { border: none; } - -legend { - font-size: 14px; - font-weight: bold; -} - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/defer.html b/libs/js/jquery-geo-1.0b2/docs/examples/defer.html deleted file mode 100755 index 8ba89d7..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/defer.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - defer example - - - - - - - - -
-
-
-
- -

defer

-

The src function in this demo returns a jQuery Defer object so it can download the tile ahead of time and draw the bbox on it before passing the final image to the map widget as a data URL.

-

This demo does not work in IE8.

-
-
- - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/destroy.html b/libs/js/jquery-geo-1.0b2/docs/examples/destroy.html deleted file mode 100755 index ca2f92c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/destroy.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - destroy example - - - - - - - - - -
-
-
- < docs -

- destroy

-

- This example allows you to create and destroy the geomap widget and test that everything is returned to normal.

- - -
-
-
- - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/drag.html b/libs/js/jquery-geo-1.0b2/docs/examples/drag.html deleted file mode 100755 index 3573cc8..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/drag.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - drag example - - - - - - - - -
-
-
-
- - -

drag

- -

There are currently two drag modes: dragBox and dragCircle. This demo tests only dragBox when set as the mode during init.

-
-
- - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/draw.html b/libs/js/jquery-geo-1.0b2/docs/examples/draw.html deleted file mode 100755 index 5ae4583..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/draw.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - drawing examples - - - - - - - - - -
-
-
-
- -

drawing

-

This example tests the three shape drawing modes: drawPoint, drawLineString and drawPolygon. Choose a tool below and start tapping!

-

Double-tap to add the last point and end lines & polygons.

-

You can remove individual points while drawing lines & polygons with the escape key.

-
- - - -
-
-
- - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/drawStyle.html b/libs/js/jquery-geo-1.0b2/docs/examples/drawStyle.html deleted file mode 100755 index cd539d1..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/drawStyle.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - drawStyle test - - - - - - - - -
-
-
-
- -

drawStyle

-

This page tests various style properties using the drawStyle option to change the style displayed when a user is drawing shapes in drawLineString and drawPolygon modes.

-
- - - -
-
-
- geomap drawStyle option -
- - -
-
- - -
-
- - - -
-
- - - -
-
- - -
-
-
- - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/empty.html b/libs/js/jquery-geo-1.0b2/docs/examples/empty.html deleted file mode 100755 index 69b54de..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/empty.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - geomap empty test - - - - - - -
- < docs -

- geomap empty test

-

- Click the map to add points, click the Empty button to remove them all at once.

- -
-
-
- - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/emptyservice.html b/libs/js/jquery-geo-1.0b2/docs/examples/emptyservice.html deleted file mode 100755 index 1e9e708..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/emptyservice.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - geomap empty service test - - - - - - -
- < docs -

geomap empty service test

-

This page is similar to the regular empty example but tests removing all shapes from a specific service instead of the map itself.

- -
-
-
- - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/events.html b/libs/js/jquery-geo-1.0b2/docs/examples/events.html deleted file mode 100755 index 63e2bf3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/events.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - events example - - - - - - - -
-
-
-
- -

events

-

The basic interaction events are: move, click, dblclick, and bboxchange. jQuery Geo triggers then when a user interacts with the map.

- - - - - - - - - - - - - - - - - - - - - - - - - -
- event (time) - - geo argument -
- move () - -
- click () - -
- dblclick () - -
- bboxchange () - -
-
-
- - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/find.html b/libs/js/jquery-geo-1.0b2/docs/examples/find.html deleted file mode 100755 index be10258..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/find.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - geomap find test - - - - < docs -

geomap find test

-
-
-

Click the geometry!

-
    - -
    - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/findservice.html b/libs/js/jquery-geo-1.0b2/docs/examples/findservice.html deleted file mode 100755 index 9030006..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/findservice.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - geomap find service test - - - - < docs -

    geomap find service test

    -
    -
    -

    Click the geometry!

    -
      - -
      - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/geo-geometry.html b/libs/js/jquery-geo-1.0b2/docs/examples/geo-geometry.html deleted file mode 100755 index 0496cec..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/geo-geometry.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - geometry function examples - - - - - - - - - -
      -
      -
      -
      - -

      - geometry functions

      -

      This example appends a few Points, LineStrings, and Polygons. It then calculates some relationships and info about the shapes using the geometry functions in the $.geo namespace. The red box is the bbox of all red shapes.

      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      distance
      pt, pt
      pt, line
      pt, poly
      line, pt
      line, line
      line, poly
      poly, pt
      poly, line
      poly, poly
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      contains
      pt, pt
      pt, line
      pt, poly
      line, pt
      line, line
      line, poly
      poly, pt
      poly, line
      poly, poly
      -
      -
      - - - - - - - - - - - - - - - - - - - - - -
      contains
      poly, pt
      poly, line
      poly, poly
      poly, poly
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      centroid
      pt
      line
      poly
      poly
      poly
      -
      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/geometry.html b/libs/js/jquery-geo-1.0b2/docs/examples/geometry.html deleted file mode 100755 index 3d6ba94..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/geometry.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - proj test - - - - - - - -
      - < docs -

      - proj test

      -

      - This page has a couple basic interactive tests of the default $.geo.proj object.

      -

      - direct conversion

      -

      - Enter a lon/lat in the top inputs (remember, longitude is first here and throughout jQuery Geo but usually spoken second) & click fromGeodetic to convert it to web mercator and store the new values in the bottom two inputs. Click toGeodetic to reverse.

      - - - - - - -

      - osm nominatim

      -

      - Enter a search term in the input and click search. If successful, geodetic & web mercator coordinates are written to the inputs above. This example uses MapQuest's OSM API: http://open.mapquestapi.com/nominatim.

      - - -

      - status

      -

      - Status result for any test.

      -
      - ready
      -
      - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/hurricane.html b/libs/js/jquery-geo-1.0b2/docs/examples/hurricane.html deleted file mode 100755 index f41408d..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/hurricane.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - hurricane - - - - - - - - -
      -
      - -
      -
      - < docs -

      Hurricane tracking

      -

      Displaying a snapshot of storm data extracted from stormpulse.com

      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/image.html b/libs/js/jquery-geo-1.0b2/docs/examples/image.html deleted file mode 100755 index 3c53ed3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/image.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - image example - - - - - - - -
      -
      -
      -
      - -

      axisLayout: "image"

      -

      Viewing a GigaPan image from the 2012 Olympic Games in London with jQuery Geo.

      -

      Inspired by: Beach Volleyball GigaPan

      -
      -
      - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/img/ajax-loader.gif b/libs/js/jquery-geo-1.0b2/docs/examples/img/ajax-loader.gif deleted file mode 100755 index e100531a3d90950b5d30e418a532ba48f572b3d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 673 zcmZ?wbhEHb6krfw_{6~Q|NsAb28IWR4lQtU0x~uvB^_vLIx%UI;(u;G*N|Xm#{gF& zJp*P&1_lPje^Smxsfi`2DGKG8B^e5dS&0=n`H3ldnR#jX42nNlIJtnTbbuIWv;YGG zvoXi6JO2z$d1ebIb69am&SCePk;dt|(eThNk(md#=_MRFRCqx*TEg<~GImP|9(J$n z=N>>?FwHRmnd8@^s36_KvwOp{E|)^5z>ow(NreO-*J!B~H8NXE@4royU~f>kF7c?% zS#p!Aik1*IgUmQ~87XU@ay&8N%#<*Fw$@}BzAut~A3dECXRI!e`M`B%^In-_E3}y+ z--`cXY(C6yv@%6%{(cs0Mgjenq^f<&sBPk#Ibrdw-OD&z6?s?;UD^|61XsB=ZMZ1U zoD>xM*;d}bLPx6q#F8RQAFO^e;@DNBuI=?aMdX9TXP-tMwX(wrF-aj)T3dF?Wkfn@ zoe-L1lcsRN2bPDNB8 zb~7$DE-^4L^m3s900VkSL_t(oN5z$0PZLoPhW#b}2o*mA(FjB_h!(^TDvH(uR$4$1 zK_XZX3dPcj0)5--#kFEB=pQ4D!Kv$A5_p{G>9NuKQP zbmpCRPfzwN0`Om9lM4x(Tu1^EhN#7uPyFZkJWzpcUo@P?1hf_GoKr}XwEay47--7Y zpuI>tFOas>z=h&H^NQ3!=kc_VaOgLnM6(37x)|l!R+z%p`6D&ZRjQkj_M%i}n97jX zE!u!n2Y#C&oF)z1t0FbfU6wv0uEWW26{Lt#KJIllpe}P0JZ3%HPe={)R2W#)H@sMx zjYl^xqk8XpSW?&GwVaOBfY)MVapmn0C838~tQ4msHPCC# zVNu?wwg{I_6~bf9SMI&`V)QqZEB8cqO@VTyRib)MM{1zYmd`?hot9k1fJ%GWA(SRA zMORf`K;Ew3$m&Q9v}A8#vF~3mN&=%UOEYyh9e27KQKye(b;344E8sYoAj*7$Hs80e zpQoOH@%L{~zGF3PY3o>>unjaCHYp|^Uh|03>FBL1!Ow|_sVAVX-VF1$2s9fvvpQiL zAgrlTIBnR1i67rZd0>3}@DAqW<#6bt*?!`m45+K{bnuEO4~zkKjra~MgUgh__7hSA z?p#e!s&_}CK4-fq_l+-~#!;z_QZ_5sry@0QEs2V!B-MzXysQUlxxrgFYei;-S8#-0r0)#G7|JsrX5 z@O9<$d$+p@Z(ok0wO|+9t0FbP9Uv;soFv$Ev0}4DiZ@>&{)$z2HZ-7^81lBD*KrJ0 z;)LXSRip;|zum!bWW>Rd9;Xe7;1F!S>pqPz^U|CfMXmkZ?zt z0rx!hEcDxKh7)Wu7&PGGNh3zQ%|1|Ww!;ZFDT4-eT5|BPuT_EW!x>Jn$xxtyp6Wb> saEB9YGE`{rzYHhXt<8 diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/img/jsfiddle.png b/libs/js/jquery-geo-1.0b2/docs/examples/img/jsfiddle.png deleted file mode 100755 index 082c0abd89a1e0d62435b2a43b327520bd1a78f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 459 zcmV;+0W|)JP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+?oJh00E00BEmL_t(IPo>lAN&-<32k?2Do**hJx=>*+ zQb|Th(ZxRW3Q0GySkW#N1VJB!sL0r$+7D7hn6x34EXtylq4e!vGjKwwEpQip?ChMG zIlBjz=>u`g5r($pth+JahIE`@p*0F|qCZqVxQSup9p^Uik z2qT?`{aV3{cJZT@x+fw~qK9`dtv6)tcWG|$c)w`}DalpWb4*?18rXK?9=T!}JcNt) z&oh!&cvzwIfnEKfCQqIIHL(0k1@n8?HM^=cb?2d(TnQ&vS?OWaF}4cE)8}G_#7_7v z{Gl_cRW;N;8V1vEETo=_7z`%l*~!kSDQBeCscj?##?zCgEz|$PpXyuErH4_gZv{&A zss9(N9%>n0h8xuEU4$FdG_(LWY#JnYuB=LTM4(21BWYH!vA;A{jYpauP6!t#^Z4xZ~#}vKJCUD$bk&V<2YUe z^opWTaTo9;T>)@f63+!715(K>j^lMN2m%!!04FkfbW?#8SOGs|%ygEXh@VEoaNe@; zR!o-DFLId!YqRu&Xc*4VZ$|hZ-Z41yTNPd{5|ZavqFFefETkME^3JM#5dk(E+UYdet)gi6`J6s6b9(txTfUe>VpzVJ=YablF0{=Ha-L~u;ppAF~I68pUd!X(>qW5i#sTIg=Kw63% z$_lKFWVJ{t&xKVpYdYiABGJo@ro*pxDFsNLU(E+w3q6)gq@tPkf*^1KA9&A!#^n5F z#OcLZBe9o<1>a^*d+$kO@&bGZl0IbxQp$D-X&TJd%mIjI;R8?$q2iO}^g_N;f9Wl2xsGQ0_H`eGA^u5bsq1V4>~GHxg@AdKKJf+O z$%HV(M - - - - Inset map example - - - - - - - - -
      -
      -
      -
      -
      -
      -
      -
      -
      - -

      Inset map example

      -

      Add an inset map to display the current bbox against a larger area. The inset map, in this example, is a pre-rendered image drawn a shingled service. You can click the inset map to recenter the main map.

      - Inspired by MapGeo -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/insetmap.html b/libs/js/jquery-geo-1.0b2/docs/examples/insetmap.html deleted file mode 100755 index 97b2b99..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/insetmap.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - inset map example - - - - - - - - -
      -
      -
      -
      -
      - -
      - -

      inset map

      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/isGeodetic.html b/libs/js/jquery-geo-1.0b2/docs/examples/isGeodetic.html deleted file mode 100755 index 2f649ef..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/isGeodetic.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - TEMPLATE example - - - - - - - - -
      -
      -
      -
      - -

      Is Geodetic?

      - - - - - - - - - - - -
      [-71.05, 42.36]
      [-8102018.97, 5011809.33]
      [-72.78, 40.99, -69.33, 43.69]
      [-8102018.97, 5011809.33, -7718610.83, 5418454.32]
      [[-72.78, 43.32], [-71.33, 42.43]]
      [[-8102018.97, 5011809.33], [-7718610.83, 5418454.32]]
      [[[-72.78, 43.32], [-71.33, 42.43], [-70.12, 43.16], [-72.78, 43.32]]]
      [[[-8102018.97, 5011809.33], [-7718610.83, 5418454.32], [-8102018.83, 5418454.32], [-8102018.97, 5011809.33]]]
      [[[[-72.78, 43.32], [-71.33, 42.43], [-70.12, 43.16], [-72.78, 43.32]]]]
      [[[[-8102018.97, 5011809.33], [-7718610.83, 5418454.32], [-8102018.83, 5418454.32], [-8102018.97, 5011809.33]]]]
      -
      -
      - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/jqm.html b/libs/js/jquery-geo-1.0b2/docs/examples/jqm.html deleted file mode 100755 index 0d7d3de..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/jqm.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - TEMPLATE example - - - - - - - - - - -
      -
      -

      Amherst

      -
      - -
      -
      -

      Which map would you like?

      - -
      -
      -
      - -
      -
      -

      Parcel App

      - Select Tab -
      - -
      -
      -
      -
      - - -
      -

       

      -
      -
      - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/js/all-shingled.js b/libs/js/jquery-geo-1.0b2/docs/examples/js/all-shingled.js deleted file mode 100755 index 164bc18..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/js/all-shingled.js +++ /dev/null @@ -1,269 +0,0 @@ -$(function () { - // Firefox likes to cache form values during refresh - $( "form" )[ 0 ].reset( ); - - $( "form" ).submit( function( ) { - // also, we don't want the form to actually submit - return false; - } ); - - // set proj to null because we don't have the code for this projection - // and are working entirely in map units - - $.geo.proj = null; - - // define two shingled services - var services = [ - // define a basemap service - { - id: "massgis_basemap", - type: "shingled", - src: "http://giswebservices.massgis.state.ma.us/geoserver/wms?LAYERS=massgis_basemap&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&SRS=EPSG%3A26986&BBOX={{:bbox}}&WIDTH={{:width}}&HEIGHT={{:height}}", - attr: "© 2011 Commonwealth of Massachusetts" - }, - - // define a second service as a layer on top of the basemap - // we use this service as the target when "target" is set to service in this demo - { - id: "massgis_hydrography", - type: "shingled", - src: "http://giswebservices.massgis.state.ma.us/geoserver/wms?LAYERS=massgis%3AGISDATA.MAJPOND_POLY,massgis%3AGISDATA.MAJSTRM_ARC&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&SRS=EPSG%3A26986&BBOX={{:bbox}}&WIDTH={{:width}}&HEIGHT={{:height}}", - style: { - opacity: .8 - } - } - ]; - - - // create a map without a tilingScheme & with the two shingled services - var map = $( "#map" ).geomap( { - // add a cursor for our custom mode: remove - cursors: { remove: "crosshair" }, - - // use the services array defined above - services: services, - - // you must set bboxMax for shingled services for the zoom property to mean anything - bboxMax: [ 31789.1658, 790194.4183, 337250.8970, 961865.1338 ], - - // shingled services do not have a tilingScheme - tilingScheme: null, - - // center & zoom values that fit MassGIS's projection - center: [ 235670.21967, 900771.290247 ], - zoom: 4, - - // the Charles River is too large after zoom level 8 - zoomMax: 8, - - loadstart: function( ) { - // we can show an indicator when the map widget is loading images via the loadstart event - $("#indicator").show( ); - }, - - loadend: function( ) { - // we can hide the indicator when the map widget is done loading images via the loadend event - $("#indicator").hide( ); - }, - - bboxchange: function( e, geo ) { - // when the bbox changes, update the info section with new option values - updateInfo( ); - }, - - shape: function( e, geo ) { - // both the measure and draw/drag modes trigger the shape event - // but we only want to append for the draw & drag - if ( map.geomap( "option", "mode" ).substr( 0, 3 ) == "dra" ) { - // when the user draws or drags a shape, show it on the map - // the shape event triggers when the user finishes drawing a shape - // the geo argument is a GeoJSON object representing the shape - - // for this example, we'll append it to the map forcing an - // individual style that matches the current drawStyle - - // make a copy of the current drawStyle - var drawStyle = $.extend( { }, map.geomap( "option", "drawStyle" ) ); - - // grab the label (if any) from the input - var label = $( "#shapeLabels input" ).val( ); - - // append the shape using that style - // however, depending on which target is checked, we will append the shape to either the map widget itself or a specific map service - if ( $( "#clickTargetWidget" ).is( ":checked" ) ) { - // if the map is our target, just append the shape to the map - // if there's a label entered, used it - map.geomap( "append", geo, drawStyle, label ); - } else { - // otherwise, grab a reference to a service - // ( by id in this case ) and append the shape to that - // the value of the remaining radio buttons matches the id of a service - // if there's a label entered, used it - var serviceToAppend = $( "#" + $( "input[name='clickTarget']:checked" ).val( ) ); - - $( serviceToAppend ).geomap( "append", geo, drawStyle, label ); - - // also note, that the label is controlled seperately from the shape, by CSS, rather than by jQuery Geo shapeStyle objects - // if you look at the CSS, you will notice: - // - // #massgis_hydrography { color: blue; } - // - // which makes all labels on the hydro service blue text - } - } - }, - - click: function( e, geo ) { - if ( map.geomap( "option", "mode" ) == "remove" ) { - // when the user clicks the map while in our custom mode, remove, - // we will search for shapes on either the map widget itself - // ( and, by design, all map services) or a single, specific map service - - // we'll use a nice, fat 5px radius for the searches here, that's what the (, 5) is below - - // however, in this demo, we remove any shapes found from either the map or service - - // if the map is our target, grab the map reference - // otherwise, grab a reference to a service, in this case, by id - var target = $( "#clickTargetWidget" ).is( ":checked" ) ? map : $( "#" + $( "input[name='clickTarget']:checked" ).val( ) ); - - // by design, calling find on the map itself returns all shapes at that location - // even if they have been appended to a service - // when target is the service, find is limited to shapes that have been appended there - var shapes = target.geomap( "find", geo, 3 ); - - // even though we potentially found service-level shapes with the find method, - // calling remove on the map does not remove from all services - // however, here we're calling remove on the same target where we found the shapes - // (note: remove can take an array of shapes, which the find method returns) - target.geomap( "remove", shapes ); - } - } - } ); - - // jQuery UI for pretty button - // (except iOS 5, for some reason) - // (also, don't use user agent sniffing like this, will have to figure out the issue) - if (!navigator.userAgent.match(/OS [4-5](_\d)+ like Mac OS X/i)) { - $( "button, #togglePannable" ).button( ); - } - $( ".modes, .scrollOptions, .clickTargets, .toggleTargets" ).buttonset( ); - - $( "#toggle-info" ).click( function( ) { - // show or hide some map info such as bbox, center and zoom - $( "#mapInfo" ).toggle( ); - } ); - - $( "#togglePannable" ).click( function( ) { - // change the pannable option to allow users to pan or not pan your map - map.geomap( "option", "pannable", $( this ).is( ":checked" ) ); - } ); - - $( ".scrollOptions input" ).click( function( ) { - // set the map's scroll option based on value of the input clicked - // currently, default and scroll are the same; the only other option is off - var scrollValue = $( this ).val( ); - map.geomap( "option", "scroll", scrollValue ); - - } ); - - $( "#change-mode").click( function( ) { - // show or hide the mode options - $( "#modeOptions" ).toggle( ); - } ); - - $( ".modes input" ).click( function () { - // set the map's mode option based on value of the input clicked - var modeValue = $( this ).val( ); - map.geomap( "option", "mode", modeValue ); - - // if mode is one of the draw/drag modes (or remove), show the target section, otherwise hide it - $( "#clickTarget" ).toggle( modeValue.substr( 0, 3 ) === "dra" || modeValue === "remove" ); - - // if mode is one of the draw/drag modes, - // show the label inputs & shape style as well - $( "#shapeLabels, #drawStyle" ).toggle( modeValue.substr( 0, 3 ) === "dra" ); - - // also display the current mode on the button - $( "#change-mode .ui-button-text" ).text( modeValue ); - - // hide the mode options - $( "#modeOptions" ).hide( ); - } ); - - $( "#drawStyle input" ).change( function( ) { - // when an input of the drawStyle area changes, - // immediately set the property of geomap's drawStyle option - - // keep in mind that the three point-only styles (width, height & borderRadius) - // cannot be seen because with drawPoint, the shape event triggers immediately - // without drawing a shape - // this example, however, does use them when appending the shape after a click - - // first, we can grab a jQuery reference to the input that changed - var $this = $( this ); - - // next, we can create an object that represents this change - // this example doesn't, but you can set more than one property - // on geomap's drawStyle option at a time - var styleOption = { }; - styleOption[ $this.attr( "name" ) ] = $this.val(); - - map.geomap( "option", "drawStyle", styleOption ); - } ); - - - $( ".toggleTargets input" ).click( function( ) { - // when a service is toggled, we tell the geomap widget to toggle it - // the value of each checkbox input equals the id of a service - var checkboxClicked = $( this ); - var serviceToToggle = $( "#" + checkboxClicked.val( ) ); - - // toggle the service, shapes on the service will also be toggled - serviceToToggle.geomap( "toggle" ); - } ); - - $( "#zoomOut" ).button( "option", { - // just icons for the zoom buttons - icons: { primary: "ui-icon-minus" }, - text: false - } ).click( function( ) { - // use the zoom method to zoom out - map.geomap( "zoom", -1 ); - } ); - - $( "#zoomIn" ).button( "option", { - // just icons for the zoom buttons - icons: { primary: "ui-icon-plus" }, - text: false - } ).click( function( ) { - // also use the zoom method to zoom in - map.geomap( "zoom", +1 ); - } ); - - // update the info section with initial option values - updateInfo( ); - - function updateInfo( ) { - // update the info section with option values - $( "#mapInfo td" ).each( function( ) { - // a reference to the current option td element - var optionCell = $( this ); - - // since each td has a data-option attribute, - // jQuery can extract the option value via the data function - var optionValue = map.geomap( "option", optionCell.data( "option" ) ); - - if ( $.isArray( optionValue ) ) { - // display array values a little nicer - $.each( optionValue, function( i ) { - optionValue[ i ] = this.toFixed( 2 ); - } ); - optionCell.text( "[ " + optionValue.join( ", " ) + " ]" ); - } else { - optionCell.text( optionValue ); - } - } ); - } -}); - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/js/all-tiled.js b/libs/js/jquery-geo-1.0b2/docs/examples/js/all-tiled.js deleted file mode 100755 index acb31e5..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/js/all-tiled.js +++ /dev/null @@ -1,273 +0,0 @@ -$(function () { - // Firefox likes to cache form values during refresh - $( "form" )[ 0 ].reset( ); - - $( "form" ).submit( function( ) { - // also, we don't want the form to actually submit - return false; - } ); - - // define two tiled services - var services = [ - // a free basemap tile set from MapQuest - { - id: "mapquest-open", - type: "tiled", - src: function( view ) { - return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png"; - }, - attr: 'Tiles Courtesy of MapQuest ' - }, - - // define a second service as a layer on top of the basemap - // we use this service as the target when "target" is set to service in this demo - { - id: "broadband-speedtest", - type: "tiled", - src: "http://www.broadbandmap.gov/StamenTiles/speedtest/speedtest/download/{{:zoom}}/{{:tile.column}}/{{:tile.row}}.png", - attr: "Speed Test data maintained by the NTIA, in collaboration with the FCC" - } - ]; - - // create a map with a tilingScheme & with the two tiled services - var map = $( "#map" ).geomap( { - // add a cursor for our custom mode: remove - cursors: { remove: "crosshair" }, - - // use the services array defined above - services: services, - - // these tiled services are in jQuery Geo's default tilingScheme, web mercator - // we don't need to change it but will write it here in comments, for this demo - /* - tilingScheme: { - tileWidth: 256, - tileHeight: 256, - levels: 18, - basePixelSize: 156543.03392799936, - pixelSizes: null, - origin: [ -20037508.342787, 20037508.342787 ] - }, - */ - - // center & zoom values that default to showing the contenental United States of America - center: [ -89.34, 38.84 ], - zoom: 5, - - // the speedtest service only supports zooming out to level 3, lock the map to that min zoom - zoomMin: 3, - - // the speedtest service only zooming in to level 10, lock the map to that max zoom - zoomMax: 10, - - loadstart: function( ) { - // we can show an indicator when the map widget is loading images via the loadstart event - $("#indicator").show( ); - }, - - loadend: function( ) { - // we can hide the indicator when the map widget is done loading images via the loadend event - $("#indicator").hide( ); - }, - - bboxchange: function( e, geo ) { - // when the bbox changes, update the info section with new option values - updateInfo( ); - }, - - shape: function( e, geo ) { - // both the measure and draw/drag modes trigger the shape event - // but we only want to append for the draw & drag - if ( map.geomap( "option", "mode" ).substr( 0, 3 ) == "dra" ) { - // when the user draws or drags a shape, show it on the map - // the shape event triggers when the user finishes drawing a shape - // the geo argument is a GeoJSON object representing the shape - - // for this example, we'll append it to the map forcing an - // individual style that matches the current drawStyle - - // make a copy of the current drawStyle - var drawStyle = $.extend( { }, map.geomap( "option", "drawStyle" ) ); - - // grab the label (if any) from the input - var label = $( "#shapeLabels input" ).val( ); - - // append the shape using that style - // however, depending on which target is checked, we will append the shape to either the map widget itself or a specific map service - if ( $( "#clickTargetWidget" ).is( ":checked" ) ) { - // if the map is our target, just append the shape to the map - // if there's a label entered, used it - map.geomap( "append", geo, drawStyle, label ); - } else { - // otherwise, grab a reference to a service - // ( by id in this case ) and append the shape to that - // the value of the remaining radio buttons matches the id of a service - // if there's a label entered, used it - var serviceToAppend = $( "#" + $( "input[name='clickTarget']:checked" ).val( ) ); - - $( serviceToAppend ).geomap( "append", geo, drawStyle, label ); - - // also note, that the label is controlled seperately from the shape, by CSS, rather than by jQuery Geo shapeStyle objects - // if you look at the CSS, you will notice: - // - // #broadband-speedtest { color: purple; font-weight: bold; } - // - // which makes all labels on the speedtest service blue text - } - } - }, - - click: function( e, geo ) { - if ( map.geomap( "option", "mode" ) == "remove" ) { - // when the user clicks the map while in our custom mode, remove, - // we will search for shapes on either the map widget itself - // (and, by design, all map services) or a single, specific map service - - // we'll use a nice, fat 5px radius for the searches here, that's what the (, 5) is below - - // however, in this demo, we remove any shapes found from either the map or service - - // if the map is our target, grab the map reference - // otherwise, grab a reference to a service, in this case, by id - var target = $( "#clickTargetWidget" ).is( ":checked" ) ? map : $( "#" + $( "input[name='clickTarget']:checked" ).val( ) ); - - // by design, calling find on the map itself returns all shapes at that location - // even if they have been appended to a service - // when target is the service, find is limited to shapes that have been appended there - var shapes = target.geomap( "find", geo, 3 ); - - // even though we potentially found service-level shapes with the find method, - // calling remove on the map does not remove from all services - // however, here we're calling remove on the same target where we found the shapes - // (note: remove can take an array of shapes, which the find method returns) - target.geomap( "remove", shapes ); - } - } - } ); - - // jQuery UI for pretty button - // (except iOS 5, for some reason) - // (also, don't use user agent sniffing like this, will have to figure out the issue) - if (!navigator.userAgent.match(/OS [4-5](_\d)+ like Mac OS X/i)) { - $( "button, #togglePannable" ).button( ); - } - $( ".modes, .scrollOptions, .clickTargets, .toggleTargets" ).buttonset( ); - - $( "#toggle-info" ).click( function( ) { - // show or hide some map info such as bbox, center and zoom - $( "#mapInfo" ).toggle( ); - } ); - - $( "#togglePannable" ).click( function( ) { - // change the pannable option to allow users to pan or not pan your map - map.geomap( "option", "pannable", $( this ).is( ":checked" ) ); - } ); - - $( ".scrollOptions input" ).click( function( ) { - // set the map's scroll option based on value of the input clicked - // currently, default and scroll are the same; the only other option is off - var scrollValue = $( this ).val( ); - map.geomap( "option", "scroll", scrollValue ); - - } ); - - $( "#change-mode").click( function( ) { - // show or hide the mode options - $( "#modeOptions" ).toggle( ); - } ); - - $( ".modes input" ).click( function () { - // set the map's mode option based on value of the input clicked - var modeValue = $( this ).val( ); - map.geomap( "option", "mode", modeValue ); - - // if mode is one of the draw/drag modes (or remove), show the target section, otherwise hide it - $( "#clickTarget" ).toggle( modeValue.substr( 0, 3 ) === "dra" || modeValue === "remove" ); - - // if mode is one of the draw/drag modes, - // show the label inputs & shape style as well - $( "#shapeLabels, #drawStyle" ).toggle( modeValue.substr( 0, 3 ) === "dra" ); - - // also display the current mode on the button - $( "#change-mode .ui-button-text" ).text( modeValue ); - - // hide the mode options - $( "#modeOptions" ).hide( ); - } ); - - $( "#drawStyle input" ).change( function( ) { - // when an input of the drawStyle area changes, - // immediately set the property of geomap's drawStyle option - - // keep in mind that the three point-only styles (width, height & borderRadius) - // cannot be seen because with drawPoint, the shape event triggers immediately - // without drawing a shape - // this example, however, does use them when appending the shape after a click - - // first, we can grab a jQuery reference to the input that changed - var $this = $( this ); - - // next, we can create an object that represents this change - // this example doesn't, but you can set more than one property - // on geomap's drawStyle option at a time - var styleOption = { }; - styleOption[ $this.attr( "name" ) ] = $this.val(); - - map.geomap( "option", "drawStyle", styleOption ); - } ); - - - $( ".toggleTargets input" ).click( function( ) { - // when a service is toggled, we tell the geomap widget to toggle it - // the value of each checkbox input equals the id of a service - var checkboxClicked = $( this ); - var serviceToToggle = $( "#" + checkboxClicked.val( ) ); - - // toggle the service, shapes on the service will also be toggled - serviceToToggle.geomap( "toggle" ); - } ); - - $( "#zoomOut" ).button( "option", { - // just icons for the zoom buttons - icons: { primary: "ui-icon-minus" }, - text: false - } ).click( function( ) { - // use the zoom method to zoom out - map.geomap( "zoom", -1 ); - } ); - - $( "#zoomIn" ).button( "option", { - // just icons for the zoom buttons - icons: { primary: "ui-icon-plus" }, - text: false - } ).click( function( ) { - // also use the zoom method to zoom in - map.geomap( "zoom", +1 ); - } ); - - // update the info section with initial option values - updateInfo( ); - - function updateInfo( ) { - // update the info section with option values - $( "#mapInfo td" ).each( function( ) { - // a reference to the current option td element - var optionCell = $( this ); - - // since each td has a data-option attribute, - // jQuery can extract the option value via the data function - var optionValue = map.geomap( "option", optionCell.data( "option" ) ); - - if ( $.isArray( optionValue ) ) { - // display array values a little nicer - $.each( optionValue, function( i ) { - optionValue[ i ] = this.toFixed( 2 ); - } ); - optionCell.text( "[ " + optionValue.join( ", " ) + " ]" ); - } else { - optionCell.text( optionValue ); - } - } ); - } -}); - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/js/iecors.js b/libs/js/jquery-geo-1.0b2/docs/examples/js/iecors.js deleted file mode 100755 index 3dce2a4..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/js/iecors.js +++ /dev/null @@ -1,55 +0,0 @@ -$.ajaxTransport( function( options, originalOptions, jqXHR ) { - var xdr; - - return { - send: function( _, completeCallback ) { - xdr = new XDomainRequest(); - - xdr.onload = function() { - var responses = { - text: xdr.responseText - }; - - // force status code to 200, XDomainRequest rejects all other successful status codes - if (xdr.contentType.match(/\/xml/)){ - // there is no responseXML in XDomainRequest, so we have to create it manually - var dom = new ActiveXObject('Microsoft.XMLDOM'); - dom.async = false; - dom.loadXML(xdr.responseText); - responses.xml = dom; - - if($(dom).children('error').length != 0) { - var $error = $(dom).find('error'); - completeCallback(parseInt($error.attr('response_code')), $error.attr('message_key'), responses); - } else { - completeCallback(200, 'success', responses); - } - } else if (xdr.contentType.match(/\/json/)) { - options.dataTypes.push("json"); - completeCallback(200, 'success', responses); - } else { - completeCallback(200, 'success', responses); - // see bug https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=334804 - } - }; - - xdr.onprogress = function() { }; - - xdr.onerror = xdr.ontimeout = function() { - var responses = { - text: xdr.responseText - }; - completeCallback(400, 'failed', responses); - }; - - xdr.open(options.type, options.url); - xdr.send(options.data); - }, - abort: function() { - if(xdr) { - xdr.abort(); - } - } - }; -}); - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/js/json2.min.js b/libs/js/jquery-geo-1.0b2/docs/examples/js/json2.min.js deleted file mode 100755 index 0bdcc5e..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/js/json2.min.js +++ /dev/null @@ -1 +0,0 @@ -var JSON;if(!JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i - - - - KML example - - - - - - - -
      -
      -
      -
      - -

      KML

      -

      Example of parsing a simple KML file as GeoJSON points to append.

      -
      -
      - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/label.html b/libs/js/jquery-geo-1.0b2/docs/examples/label.html deleted file mode 100755 index d12d5c8..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/label.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - label examples - - - - - - - - - -
      -
      -
      -
      - -

      label

      -

      This example builds on the drawing example by appending a label with shapes. Enter label text (HTML is ok), choose a tool below, and start labelling!

      - -
      - - - -
      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/labelservice.html b/libs/js/jquery-geo-1.0b2/docs/examples/labelservice.html deleted file mode 100755 index d926417..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/labelservice.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - label service examples - - - - - - - - - -
      -
      -
      -
      - -

      label service

      -

      This page is similar to the regular label example but tests appending labeled shapes to a specific service instead of the map itself.

      - -
      - - - -
      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/logo.html b/libs/js/jquery-geo-1.0b2/docs/examples/logo.html deleted file mode 100755 index b0800e6..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/logo.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - jQuery Geo logo - - - - - - - - - -
      -
      -
      -
      - < docs -

      - jQuery Geo logos!

      -

      This demo uses jQuery Geo to draw its own logo at the top left of the map. Single-click the map to make more logos! The shapes created for the logo are based on the pixelSize of the current scale so your map's current zoom determines the Earth-size of the logo. When you zoom in, the points of the individual logos will spread out.

      -
      -
      - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/marker.html b/libs/js/jquery-geo-1.0b2/docs/examples/marker.html deleted file mode 100755 index 8bdc69f..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/marker.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - marker example - - - - - - - -
      -
      -
      -

      markers

      -
      -
      -
      - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/markers.html b/libs/js/jquery-geo-1.0b2/docs/examples/markers.html deleted file mode 100755 index 1a99097..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/markers.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - Marker drawing techniques - - - - - - - - - - -
      -
      -
      - -

      Marker drawing techniques

      -

      There are two reasonable ways to draw point markers. This example demos them. Check out the jsFiddle for docs.

      -
      - technique - - -
      -
      - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/measure.html b/libs/js/jquery-geo-1.0b2/docs/examples/measure.html deleted file mode 100755 index d720bbf..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/measure.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - measure example - - - - - - - - -
      -
      -
      -
      - -

      measure

      -

      This example tests the two measure modes: measureLength, and measureArea. Choose a tool below and start measuring!

      -
      - - -
      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/mobile.html b/libs/js/jquery-geo-1.0b2/docs/examples/mobile.html deleted file mode 100755 index 0c3f2f2..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/mobile.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - mobile - - - - - - - - -
      -
      -
      -
      - < docs -

      mobile

      -

      A full window div...geomap called, zoomed in to level 6.

      -

      Add a meta viewport tag to your head element and you're good to go.

      -
      -
      - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/mode-zoom.html b/libs/js/jquery-geo-1.0b2/docs/examples/mode-zoom.html deleted file mode 100755 index 75d0f1d..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/mode-zoom.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - zoom mode example - - - - - - - - - -
      -
      -
      -
      - -

      - zoom mode

      -

      When a geomap widget's mode option is "zoom", you can your your mouse to draw a rectangle. jQuery Geo will change the bbox of the map to match the rectangle as closely as possible based on the tiling scheme and viewport size.

      -

      This mode is more useful for dynamic map services and may be more familiar to GIS professionals.

      -

      Hint: in pan or any of the draw modes, you can hold the shift key to temporarily switch to zoom mode.

      -
      - - -
      -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/opacity.html b/libs/js/jquery-geo-1.0b2/docs/examples/opacity.html deleted file mode 100755 index 0b87cf7..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/opacity.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - opacity - - - - - - - - - -
      -
      -
      -
      - -

      opacity & toggle

      -

      The slider calls geomap's opacity method targeting the OSM service. The default service object doesn't have an id but it does have a class, osm, that we can reference using $(".osm"). The button calls the toggle method. I've matched the map div's background color to OSM's water color for effect.

      - - -
      -
      - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/panscroll.html b/libs/js/jquery-geo-1.0b2/docs/examples/panscroll.html deleted file mode 100755 index 3f16a28..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/panscroll.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - panning & scroll example - - - - - - - - -
      -
      -
      -
      - -

      panning & scroll

      - -

      The panning option can remove a user's ability to pan the map. The scroll option can remove a user's ability to use the mouse wheel to zoom.

      - -

      scroll options default and zoom work the same.

      - -
      - pannable (click to toggle) - -
      - -
      - scroll -
      - - - -
      -
      - - - -
      -
      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/proj.html b/libs/js/jquery-geo-1.0b2/docs/examples/proj.html deleted file mode 100755 index 3d6ba94..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/proj.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - proj test - - - - - - - -
      - < docs -

      - proj test

      -

      - This page has a couple basic interactive tests of the default $.geo.proj object.

      -

      - direct conversion

      -

      - Enter a lon/lat in the top inputs (remember, longitude is first here and throughout jQuery Geo but usually spoken second) & click fromGeodetic to convert it to web mercator and store the new values in the bottom two inputs. Click toGeodetic to reverse.

      - - - - - - -

      - osm nominatim

      -

      - Enter a search term in the input and click search. If successful, geodetic & web mercator coordinates are written to the inputs above. This example uses MapQuest's OSM API: http://open.mapquestapi.com/nominatim.

      - - -

      - status

      -

      - Status result for any test.

      -
      - ready
      -
      - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/refresh.html b/libs/js/jquery-geo-1.0b2/docs/examples/refresh.html deleted file mode 100755 index 4f66238..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/refresh.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - refresh example - - - - - - - -
      -
      -
      -
      - -

      refresh

      -

      The refresh method can: -

      -

      -

      All versions redraw appended shapes. Calling refresh on individual services will redraw only shapes on that service

      -
      -
      - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/remove.html b/libs/js/jquery-geo-1.0b2/docs/examples/remove.html deleted file mode 100755 index 8bdeafa..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/remove.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - geomap remove test - - - - - < docs -

      geomap remove test

      -

      Click on the buttons to the right to call geomap.remove on points one at a time.

      -
      -
      -
        - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/removeservice.html b/libs/js/jquery-geo-1.0b2/docs/examples/removeservice.html deleted file mode 100755 index cb473be..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/removeservice.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - geomap remove service test - - - - - < docs -

        geomap remove service test

        -

        Similar to the regular remove example but tests removing shapes from a specific service instead of the map itself.

        -
          -
        -
        -
        - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/services.html b/libs/js/jquery-geo-1.0b2/docs/examples/services.html deleted file mode 100755 index 6895f7a..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/services.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - services example - - - - - - - - - -
        -
        -
        -
        - -

        services

        -

        This example tests setting the service object array, i.e., the geomap services option, in different ways.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/shapeStyle.html b/libs/js/jquery-geo-1.0b2/docs/examples/shapeStyle.html deleted file mode 100755 index c4fd120..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/shapeStyle.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - shapeStyle test - - - - - - - - -
        -
        -
        -
        - -

        shapeStyle

        -

        This page tests various style properties using the shapeStyle option to change the default style or and passing a shape-specific style to the append method.

        -
        -
        - base geomap shapeStyle option -
        - - -
        -
        - - -
        -
        - - - -
        -
        - - - -
        -
        - - -
        -
        -
        - specific append style argument -
        - - -
        -
        - - -
        -
        - - - -
        -
        - - - -
        -
        - -
        -
        -
        - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/shapeStyleservice.html b/libs/js/jquery-geo-1.0b2/docs/examples/shapeStyleservice.html deleted file mode 100755 index b11f93b..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/shapeStyleservice.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - shapeStyle service test - - - - - - - - -
        -
        -
        -
        - -

        shapeStyle service

        -

        This page is similar to the regular shapeStyle example but tests changing the style of a specific service instead of the map itself.

        -
        -
        - base geomap shapeStyle option -
        - - -
        -
        - - -
        -
        - - - -
        -
        - - - -
        -
        - - -
        -
        -
        - specific append style argument -
        - - -
        -
        - - -
        -
        - - - -
        -
        - - - -
        -
        - -
        -
        -
        - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/shingled.html b/libs/js/jquery-geo-1.0b2/docs/examples/shingled.html deleted file mode 100755 index 8601933..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/shingled.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - shingled example - - - - - - - - - -
        -
        -
        -
        - -

        - shingled

        -

        This page tests geomap with shingled services, i.e., fully dynamic services that to not use a tilingScheme. Dynamic services can be set to any scale.

        -

        If all shingled services are in the same projection, they can be layered and turned on and off at any time by updating and re-setting the services option of the geomap widget or by using the toggle convenience method.

        -

        The toggle method is preferred because it is faster and you can use it on specific services, e.g., $("#massgis_interiorforest").geomap("toggle").

        -

        These services are hosted by MassGIS.

        -
        - - -
        - -
        -
        - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/simplest.html b/libs/js/jquery-geo-1.0b2/docs/examples/simplest.html deleted file mode 100755 index 0cc201f..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/simplest.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - simplest - - - - - - -
        - < docs -

        simplest

        -

        A 256x256 pixel div...geomap called with no arguments.

        -
        -
        - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/spocode.html b/libs/js/jquery-geo-1.0b2/docs/examples/spocode.html deleted file mode 100755 index 9f0612b..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/spocode.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - Geeky Boating Elk - - - - - - - -
        -
        -

        Geeky Boating Elk

        -

        Where an elk can find good WiFi and a boat launch but not get shot.

        -
        -
        -

        Legend

        - - - - - - -
        1.5 — 3 Mbps wireless
        3 — 6 Mbps wireless
        6 — 10 Mbps wireless
        Elk Hunt Area
        Boat Launch
        -
        -
        - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/static.html b/libs/js/jquery-geo-1.0b2/docs/examples/static.html deleted file mode 100755 index a8aa250..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/static.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - static mode example - - - - - - - - -
        -
        -
        -
        - -

        static mode

        -

        When the mode option is set to "static" a developer can create a map that the user can see but cannot change.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/stringsrc.html b/libs/js/jquery-geo-1.0b2/docs/examples/stringsrc.html deleted file mode 100755 index 4563e47..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/stringsrc.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - string src example - - - - - - - - -
        -
        -
        -
        - -

        string service src

        -

        This example shows how you can set a service's src property to a jsRender template string.

        -

        The src property of the service object for this map is set to:

        -

        "http://tile.openstreetmap.org/{{:zoom}}/{{:tile.column}}/{{:tile.row}}.png"

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/template.html b/libs/js/jquery-geo-1.0b2/docs/examples/template.html deleted file mode 100755 index 303ba1b..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/template.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - TEMPLATE example - - - - - - - - -
        -
        -
        -
        - -

        TEMPLATE

        -

        -
        -
        - - - - - - - - - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/tiger.html b/libs/js/jquery-geo-1.0b2/docs/examples/tiger.html deleted file mode 100755 index 171ab5b..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/tiger.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - TIGER polygon example - - - - - - - -
        -
        -
        -
        - -

        TIGER polygons

        -

        - - -

        -
        -
        - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/tiledservices.html b/libs/js/jquery-geo-1.0b2/docs/examples/tiledservices.html deleted file mode 100755 index 37f5e86..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/tiledservices.html +++ /dev/null @@ -1,239 +0,0 @@ - - - - tiled services test - - - - -
        - < docs -

        tiled services test

        - -

        This page tests initializing geomap with different services that support the same tilingScheme.

        - -

        - So long as all services support the current tiling scheme, they are interchangeabe without worrying about the tilingScheme property.

        -

        - Dynamic services can be layered on top of tiled services as they don't require a tilingScheme at all, however you have to make sure the map units match, e.g., the dynamic service accepts a geodetic (lon/lat) bounding box or you set $.proj to null and work entirely in a specific projection's map units.

        -

        - service examples

        -

        - Choose a services array and click set via init to refresh the page and re-initialize the map (including center & zoom properties) or set via property to change only the services property at runtime.

        -
        -
        - -
        [
        -  {
        -    id: "OSM",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://tile.openstreetmap.org/"
        -       + view.zoom + "/"
        -       + view.tile.column + "/"
        -       + view.tile.row
        -       + ".png";
        -    },
        -    attr: "© OpenStreetMap & contributors, CC-BY-SA"
        -  }
        -]
        - -
        [
        -  {
        -    id: "OSM_MapQuest",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/"
        -       + view.zoom + "/"
        -       + view.tile.column + "/"
        -       + view.tile.row
        -       + ".png";
        -    },
        -    attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
        -  }
        -]
        - -
        [
        -  {
        -    id: "Ortho_MapQuest",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/"
        -       + view.zoom + "/"
        -       + view.tile.column + "/"
        -       + view.tile.row
        -       + ".png";
        -    },
        -    attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
        -  }
        -]
        - -
        [
        -  {
        -    id: "Ortho_MapQuest",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/"
        -       + view.zoom + "/"
        -       + view.tile.column + "/"
        -       + view.tile.row
        -       + ".png";
        -    },
        -    attr: "Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
        -  },
        -  {
        -    id: "OSM_MapQuest",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/"
        -       + view.zoom + "/"
        -       + view.tile.column + "/"
        -       + view.tile.row
        -       + ".png";
        -    },
        -    style: { opacity: .3 }
        -  }
        -]
        -
        - - -
        -
        -
        -
        - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/tilingScheme.html b/libs/js/jquery-geo-1.0b2/docs/examples/tilingScheme.html deleted file mode 100755 index c05fae9..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/tilingScheme.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - tilingScheme test - - - - -
        - < docs -

        - tilingScheme test

        -

        - This page tests initializing geomap with services requiring different tilingSchemes.

        -

        - Dynamic services are not yet implemented but will be able to be layered on top of tiled services as they don't require a tilingScheme at all.

        -

        - For this example, I have set $.geo.proj to null and am setting the center in real map units. This is because the second service, New Jersey, is not in web mercator and geomap does not provide a built-in conversion from lon/lat.

        -

        - The New Jersey service is a tiled service with an ArcGIS Server REST endpoint. The level stops of an ArcGIS Server tile cache are often not a power of two and therefore cannot be calculated. We list them all out by using the pixelSizes property of the tilingScheme instead of specifying basePixelSize and levels properties.

        -

        - examples

        -

        - Choose a service/tilingScheme combo and click set to refresh the page and re-initialize the map.

        -
        -
        - -
        services: [
        -  {
        -    id: "OSM",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://tile.openstreetmap.org/"
        -       + view.zoom + "/"
        -       + view.tile.column + "/"
        -       + view.tile.row
        -       + ".png";
        -    },
        -    attr: "© OpenStreetMap & contributors, CC-BY-SA"
        -  }
        -],
        -tilingScheme: {
        -  tileWidth: 256,
        -  tileHeight: 256,
        -  levels: 18,
        -  basePixelSize: 156543.03392799936,
        -  origin: [-20037508.342787, 20037508.342787]
        -}
        - -
        services: [
        -  {
        -    id: "NewJersey",
        -    type: "tiled",
        -    src: function (view) {
        -      return "http://njgin.state.nj.us/ArcGIS/rest/services/Basemap/basemap/MapServer/tile/"
        -       + view.zoom + "/"
        -       + view.tile.row + "/"
        -       + view.tile.column;
        -    }
        -  }
        -],
        -tilingScheme: {
        -  tileWidth: 512,
        -  tileHeight: 512,
        -  pixelSizes: [
        -    3472.22222222222,
        -    2604.16666666667,
        -    2170.13888888889,
        -    1562.5,
        -    976.5625,
        -    494.791666666667,
        -    260.416666666667,
        -    130.208333333333,
        -    65.1041666666667,
        -    32.5520833333333,
        -    21.7013888888889,
        -    10.8506944444444,
        -    5.20833333333333,
        -    2.08333333333333,
        -    1.04166666666667
        -  ],
        -  origin: [-842000, 1440000]
        -}
        -
        - - -
        -
        -
        -
        - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/tracking.html b/libs/js/jquery-geo-1.0b2/docs/examples/tracking.html deleted file mode 100755 index c5713fd..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/tracking.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - GPS Tracking - - - - - - - -
        -
        -
        -
        - < docs -

        GPS Tracking

        -

        This simple demo continually follows your location at zoom level 15 showing the Esri World Street Map tiles. It now shows the geolocation accuracy buffer.

        -

        - Inspired by Royce Simpson

        -
        -
        - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/twheat/css/style.css b/libs/js/jquery-geo-1.0b2/docs/examples/twheat/css/style.css deleted file mode 100755 index 8a22008..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/twheat/css/style.css +++ /dev/null @@ -1,133 +0,0 @@ -html -{ - font:13px/1.231 Calibri,Arial,sans-serif; *font-size:small; -} - -.links -{ - float: right; -} - -.docLink -{ - background: url(../img/$.geo-logo-small.png) left no-repeat; - color: #7f0000; - display: block; - font-size: 24px; - font-weight: bold; - padding: 0 24px; - text-decoration: none; -} - -.info -{ - background: #fff; - border-radius: 8px; - box-shadow: -4px 4px #444; - opacity: .8; - padding: 8px; - position: absolute !important; - right: 16px; - top: 16px; -} - -.not-mobile -{ - display: none; -} - -@media only screen and (min-width: 800px) -{ - .not-mobile - { - display: block; - } -} - -h1 -{ - margin-right: 256px; -} - -.two -{ - color: #7f0000; -} - -h2 -{ - font-style: italic; - margin-left: 1rem; -} - -#map -{ - position: fixed; - bottom: 0; - left: 0; - right: 0; - top: 0; -} -#popup -{ - background: #fff; - border: solid 1px #444; - border-radius: 8px; - display: none; - max-height: 80%; - padding: 4px; - position: absolute; - opacity: .8; - overflow: hidden; - width: 30%; -} -#popup p -{ - border-top: 2px solid #444; - margin: 0; - padding: 0; -} -#popup p:first-child -{ - border-top: none; -} -#content -{ - background: #fefefe; - border: 2px solid #444; - border-radius: 8px; - padding: 4px; - position: relative; - display: inline-block; -} -#content label span -{ - display: inline-block; - text-align: right; - width: 10rem; -} -#content button -{ - width: 6rem; -} - -#zoom -{ - text-align: right; -} - -#tweetButton -{ - display: inline-block; -} - -.tweet-search-info -{ - float: right; - margin-top: 1rem; -} - -.tweet-search-info img -{ - vertical-align: middle; -} diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/twheat/img/$.geo-logo-small.png b/libs/js/jquery-geo-1.0b2/docs/examples/twheat/img/$.geo-logo-small.png deleted file mode 100755 index 1a9ad855a830267e4a3fdd1c2a6bf49f5ac60402..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1472 zcmV;x1wZN2bPDNB8 zb~7$DE;u(kfL#Cp1wBbbK~zXfy;Xfs({&hUY_bhq9yG+g@!K04;20-xirtJL%^%``*h<>~oS z^NnR(*R{LfU(fS>-aaq$^ZP%4o~7CJ_S6)*ubz9>tfbXZ6l34>YyEx2U4|@rn=Xld z!e*t7i|>Ew1zOt^I*COt+hP_8*SDu6&$vISXIU=OHZyj?n;g!T=Gd4#XNLZ<`{V8< z24S6;da;JbD{h~YoH(vQYhr@ZA`+cGnv(PPO{xiB+q> z9Up(Ec}7$dPCALiabu~O&p&=JGZT*H=0YPy{oIk7qIqBwQwUeztJ4jQ?%oY|cJ72d zbLNcJ@cAq4TFuxwYI(fR&lVR0i4T;OL6b!Ml|z>lN@8ZAAgxoSx-#T;!^o~(a0G{} z;Z5J*&}r|T+AQGDb;iUD4tqRsv%MW$ad9ISspKhl_TsU7)`^72POe!4qdh(F_13Lm zrKnS$Y{TOuW|2!%Y*NYP-#a?sHV(HxJst2|&w7>^?lo{@a)Tngy*@M)$Y5k$K2GkIzI1=Jv@A*ip9bL;zPYf1q>4J$;+MEpj4QwLg9tCrP7~j_`Jh?D+;GS zfCB-!fBS0+W5A^0Qa?Ya3=F(>xa1X~HwlZ-t&tJw6)e_y60cyh2k-=HZyZ79;DCv> zVPU$i^fbOt=AUvq8MR@e+hoG($&-ien#7HGBBnPP3kFpO1$|gfr^5~oXUHrNyx*NU zUo>GEVS&sRnQZjC(o*=LvJxDTkymXo>I83rt_(f*t!dLfK3-4&m&|53wrm+7b|2Vg z#cKAhUdcoq$WRALWDm<{Q&ULDbG=$E47pq|f?)O~CyyW&8Qx@MmB7eko+iZ!o4&88 zfGRe7*ccFS5o4ztsjzQt63IZLQsHqf$OszO#5qr&(nL|CXV$NWvzsrxj<>H;s zmeOdW{syLit9A>=b z9C~%DzcnI4kB=^s21aJURjX1_?8(W#YYn}H`D|;1G6+418Y7tCyy z$$oqfnc|L%gED{rF}9GeO{s+b>}=>%M-Mi~sH>eB^K`rOmnWe`ypFUkcW9IJ6WVfD z?h>9aLQ}d?|j7F#mWaDOxTa|3~AhG#R^78?yejQJle8gDl z8)RSIkvWVewJHHAeCo@M8{v9uD}1qT9T*u5cmua`C=@`Pm{9d-ULKf2r)_AN9sg*c zA8vHu2A{lgqhZD=bj&wbU+nq-ez;A7BaJ#!3_NJynyZ<535^zwCNSV^q{OZ1PRBSUgZG680fYx&Ny8-#tRR4#fY2s9Gva)um7WZ;Sua aq<;XvzA!gYQb=3?0000>K!A3J8n_~hp$FE0GLAr%!_l9R(E`?5kAqj?(3JE^0(NZgFWVV*xf14=5-k@+@ z;!&Hkg^mIwj6nT_E#;>&)i8 zGRIbEGey1?|HIgPnBQn+iq!o5EKsAEk&OcSElE}Tlu_HnH*><`Tf3KWwkqG!FOjRqSyJ9p2|)%1dy!-i}Q&^dShec%+lIVUuB z7UR2Hg#}X+I_@UUxoa}5)zR&!fyjh}+1nU-Sq?b}%r - - - - Twheat - - - - - - -
        -
        - -
        -
        -
        - - -
        -
        - - - -
        -
        - - -
        -
        - - no tweets mapped yet :( -
        -
        -
        -
        - -

        Twheat! 2

        -

        A Twitter Heat Map

        -
        -
        - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/twheat/js/twheat.js b/libs/js/jquery-geo-1.0b2/docs/examples/twheat/js/twheat.js deleted file mode 100755 index 1f4a47c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/twheat/js/twheat.js +++ /dev/null @@ -1,452 +0,0 @@ -$(function () { - var map = null, - checkedIds = [], //< list of tweet ids we've checked - appendedCount = 0, //< number of tweets we successfully appended - searchTerm = "", //< last search term - searching = false, - currentXhr = null, //< an ajax request reference if we need to cancel - - twitterButtonHtml = ' - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/usastates.html b/libs/js/jquery-geo-1.0b2/docs/examples/usastates.html deleted file mode 100755 index 141518d..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/usastates.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - USA States - - - - - - - -
        -
        -
        -
        - -

        USA States

        -

        This map reads USA state boundary data as a GeoJSON FeatureCollection and draws it on top of OpenStreetMap.

        -

        Click a state to change its color!

        -
        -
        - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/utah/apple-touch-icon.png b/libs/js/jquery-geo-1.0b2/docs/examples/utah/apple-touch-icon.png deleted file mode 100755 index 8bcff2de3c3a387559ca2586260509dffd4cd4e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2875 zcmeH}`#%$m7ssbfCYMC|<{lLavsP-NTyhVS%Y$MpOmb;VbBoFt&7gwNCPP z3P+t!LOCUcxCh;-3MWvK3Mtq^+O6oI%&S57Qn4j@w{AV8-6OS83NvY>lD4|4lDcln zi*8ycv#p2OHo)p`qA*|5_&u5854Xg;67f8Z+0)G&Vs;O)n4=u#IEOXR%^78~Mp-O2 zhcnLNuvwfB9M%UuXDj$ZK93_7GDSiTpU3}=P{`*C=eI)m8HTWE27_s#p@#R zx_FDNz5e6B3;f>~*!M)OVQW|#fo)WO02Ci038?YhZhK>MPWD%NVhPR?Uy+MetDiQ z22Cyyy7GhXMesAAWjXJYR9wO??g-ztp_OPu^elH2?WJU_Kb@MG3}6r*^2RfUb!X~M zK9(SsFzk_7=ccQ^^}#d(_K%$(rWd%gJX873ZO^DCbG4=C+ZWAPf$P%0s z1_bdFtSBVuKIhN`q}F35EgLzd5xi?=tXy6U{8i>0$DQtu`$#JmdAI$#>;Ju%k=z?~ zl1PPR>n?$>fBg1zLQtAJ?0NKFy?)}%LVUSd={M&+kFNRR5W2J{w6XM=DY8>x>BU)seQc7%j6f?UQWI>ZzGN+z~9Uf1eGIWGST|h(EhG=Io#!& zEO^K8&7srl%5Nqq>0KuvcOz5%9itX`#)P6%WRH{C#66K`jksUbP-hS@+5pXPJ+BuZ zb1g<#xZQZX9CaFlNXgHo4wwYT23a_KemU>0ca_*-GSood+3B%jwPFN5)6#vMQI{X} z=g&7`Bc(k))Uy-syXA+6e_9R8{v@x(JFNzeYFVtVb!|QuXAkx}laqi-(i=I|SMU18 zOmOu;^5vNr)Y6 zDepkKR6-+n{;+H`PGZ3E?WzQxLJ+Sdm)NQC){M_Dvv&=lECbOy0mC(amK^{;*UwRV z`N~+~h%D~_Q9~8F0@dj`XF!LgPC@6j+yc*L9r_Wq4bU7SVWi%Q-!%y(Dz|UkFh7ME zChV&4No{s-K8OIA2J6iV}+0DYuOqi4Kc_aX@@V)`uM;Gg8Smk@UOVU-bE<{bM&1O-(8hELW6OhJ;Q2wg0sFmiD z^w@B)e$g@m!1Gx<0tn6D`90xwyjruu>${2)3O7_0*<2m-keKr5zO$0=XTR$q56MBS zJ6c=vkj_pjhDhx+a8J6wrO}bv$CZc?>TZkUs82Yf+nW5FbLY^Z&V(;=0yk|S0I0T2 zUA_k6W?Rjzu`iZ%t%u6a!bV+!g7#dS^3nJ41gaL7}tA2b%mp3s`9Y^Rr11};_m8LF>*SCXO^ zkj!gQ35QlgSF;aRWIT$KpV!|etjPD7P>}~QQFSDy=Mss%;mf54NQ3YO&b=;KWt+;YkI`(|ku=z>A% z`lE+u?}Vpybr!aE)J`9FwN|SJ8J=~p@^v1p|()@yenFtAu047!a8)4tsl z^XI2BMw;{RE0~mNoYZNo%cxX(PZU&$d}5;3jyic(&fQe^M3z?bLR18{h`Q%+T4o&i z3TXcPn)l&2`AO9XC611Ny{+QHBkfpKy?7AwGrcwWv}VS&n}$ZzzO#SLIwySfD@07A zr=LQtrjDMB?K9F1s?fsNWGMk>1ot|sZVM~gPepl1zHlX;u}h*3z8-VGY%Le(#AVHE zsiXp(5BPG|rTiRH?0i#FEbvW8kA$9C43xe%54|1FZJSau3m{s5WE6#LelGvP@|Tay zl52QKY!rM=igXU6b?Yr9`!CODrAWv&-C)|ScZBe!Ij=8T;Y-Zi z-|cNM6fhS1F*9D>c6>X z4)fgy7#~WlFb;Ir#3J|nr#(Zl^2Jsd>OC%(dk49u6yMX6a1HDg|2 zMhRmnaPdp5j5XS{sZXt!a@U3NoI{9VV1{p7Z+vTN%UtaDSt3NuT-v?$+FNf-&AiE> z&O?)jyh_YPvah;r@CF~mhggRu<~SrH-g~W^rWs$n+`kF|i-#D4FW8r3mwac9wWed< zVjH&*e@S>0@z&eca9HVIDKhCMys=iL*6>9yz}yT&PQ~udXn(uB oN=jvYK94!weGxljqO?x@2F**c>~GJ1pRf2K|C8JKir)OpPxC9dzW@LL diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/utah/img/BaseMapSelectorSprite-v1.1.png b/libs/js/jquery-geo-1.0b2/docs/examples/utah/img/BaseMapSelectorSprite-v1.1.png deleted file mode 100755 index 84a7a8a2f2fe1b9116259865434580fb05199447..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48795 zcma%ibyQT}7w-V`rMtUZ8l*!?LP|hD=@#j(p&O*T8$_g)?(RlFV(63{y5?Pf@Bg=+ zYjFma3~#3R}ct; z;NJ%VC@Y5)1VUH0k(JfZ`0VKB==#~wiB?Hgme$F|(aOfo5(M)4ldEN|t#wE&al3vc z^DZ(l<(;D@5h|^wOiUnQA~QQ38m@9AUEwm(`yM=bc`(IrK_pUKT;Nxt_Z*nf=u0R& zbVYF?#gWmYkDI>5w!hnN_a(5SrYZ8je;tTfAw!L~5i-<2xVgji zCJ3F;351K@`_N<6wx&6 z4Og#sCK+Fl0L}(%9JnuuM8MU;p1mfqt0yM~;~KGzIgh%K;q+!^+b_FQl}>L!piMXb znHLW32J%2Lx#k$wHTld-S-e3Ib_Ijgpi!q4LFh~J>x6wO(rBX^cm4p^*wz?Ou@YI9>f1;YB z?^iNw(PJmvevj`QCztgV##c%oC6mN9z%&cD*n)CAB1uADgKED>BKRh9els*jx_QTf ztLN6ebqfMrwmJ69v!Wseeh%53@`RsBJu4J2fdZ|RlAJ*xBRNJc?a>CQAyg1Zt{{lL zR+{3fhm@lmnX>1<)gFu|6Twg!#{OOzTp4tWKuQ-AwjaSVtl<;2RO}|)^KYmGy5D~e zPjiy7+E#ZXoV2Ya8!`dE%29_R1B`~G?6Nz9Jt;Z0DN|G6NN7thW#*bm79f>4- zPya6QwIZ)(v^MPrMXE~)7etW=gSV}TV#6T5;HU6*1>TgP`u7s^n7?FOz6p_szAeI- zws7OkiYG3}o_6_3F7Z{caDTe;GtQrQN!cNu?gLU3{(d_iuE9Q;I$;j9Wb?5)`X88; zgXFb3Kakp@uFa?FJi+)u^4(~HU{4uZQ)+2NJrzB*CB<*Fl#Bv+f6#=`kV4=0vd|}g zd-s#M74N>E)QpceLQj!{;WvIf0XMF1q-?(sBYu=DA4^LDqEcOn_ALJF+gS%qhC_~u zYym}bhUAey7Pj>$A}JiSuZF{Ra(DW6_;)CF=q~lqbIsm3m)vP>v1*QfQ6}5P-4)nH zw#?v@{!pByx%RD48}D`eCz-0kM$MY{5#I;|+_OX`LWq^#l~xs{&XIp6`Fv|rbKusB zx0Xt+mOiaJJ9emWkbZ!4<%x+EP82c}Y0XNOO^QNlP3B2jlc7>ZHWx!Sq|GD5dz`VK ziIeI0L65zW9YT~iik_;R%A88U&aGYXz3lt?cZ?6P4`bT#6-HWq)o(xWYi(Dc&8Jm< z_@1kAtVN+^T_N@@;=A=XM{TJR|Bug6$RGPu`qX7h-WSvvZ?_N9VwjUPcyZ9#VpWE_ z2fglRuA5kfc(Au+JX5vBNPMp-6p`gu=GSe|gr!(Xp=@V3-{rWeq3yGlr^EcC*9p(q zw%91j1XNmhEe&kHr=_RqRVr4#uT(hh5Uf5a&n@eaZ~OQdge^U!%woWzU>!gCU+%uv zvesHTdO5MGgy?lO*LT}eio!NI&n}1Z(~P`Mqrf~B$MSXWj{OHpKkjGkXZwfpYXwX_ zS>myYD*bgnV5>0%Fx94MA5|W%-7ixyo-GM+56dx+0Z7FPhOum z8oxC*TPoG>d@B2R+Su+8_DSSpsosZAh7E74a;unrw^g;3KZm_BuDaA-nhF+e*!;;Hk}N#A^PyKt5aEM}F7ozG2yo_q#Jv82PC@w$LB` z>ayxV*1z@{xXrl}b*mO@n@T;u-rZW>eXbIdai zgUSXlz%AfD@EK5fAQOT$QdE$1kUrw$oezYrD^5yu#qy?p`9%6_L5nnzbbN4C@NQ2P z-RI%I2~~8r`x%polQ!648vX~rr%_DzOk?`|F;+!J&$Y*%dUwh81%DO`3 z9^}&G*0Zg7)kSJJm0z<5ia&>K?l1|=+g-- zVk>tGW80S`gL~M}$-8i}_bRNMxPl9xLp1G;N~D@_%DFTy`#0jROqT?nOmXPmy;Qx{ z^xQLoGm%TO2JF;omx}DFK1qKQ+h2P#4)B+9?6!omR3x;kV5zKSi{=q$dC=PPNr-mv zh9o5>ILmyeQ%!EPKC<4k@)-MJ8CL%?;1JWqO`VD|V%w1Lv4aC z{xW?C&!vzgii)l#Tp>v(3Rq%Y_1dL~a2)N*Tuu2|QQ6;OF=aJtb-1_AnWvAP_C0+s z9oqqG`Oi-*sLs!m>l^tM?(_-Pm9~&Z*_Pri@#c2R@{!32F)8g5?JMmEZNbyowO^)- zcMdbB6u#{@0)H1)^xJQrB}Y0}J|KKhU9eiPd{laDxRt7o`hIwq_GoWdrDpGZGK4gX z^o+uQ-MH8?zd$uBp{*JJ`_-`m_7F|yOYWH`Czc@AhuECKEe0n!@14V2H0Uigmgpak zuf9JvQRZkosH~~DzsO`=X1&eU%6il{({EKDmz?>1wC?kyutI~ABOw0KTN$Q3V)N%P zcrMxca_VbtYObF@*Zr!=N>QWlzWF5d3y$MiE3Vt-tUNqsU#wkh(%`b$?XrGlmq52! zH>*a}*#5}vNc<&vPJO5?r!A|x#lW`Z)TiT@uhs1#MV`>)+Es`51u^{hLY|1kS_jO> z@pj<$8cMw8@51stIo7u9$#PoNuHJ5Z_2xu+S#~XAK}!E+b?Iz1;7hk>0c>Vf;TAb8 zWa=gHIvz*%zxd4fv2d*L<2+$W5s@t^m*>N$a@i@1Dds$qm!g-kY7$~@|GS0b#mSkB znZoqT^yDskNa^!Y_c2+`%3$vxb?1l|Kd;f1&f`gs=c*^wSuqqxeFs7tzzY9-Uw5rF zUH+I%mYfU+BW1vz%=tN20K5sdmR6Mpf$HKQkMEO#uW8K{HB~_%A0`keFa!j;hXb#N zAdou`2y|ou0*PjTKqQVy#shCbpoT^zIcaULKYyP+zn<9mK%@NDjU`2Nv4s{VZaq#9 z4|(P!5($JEU(?Gg7tx{Bdzec9xi-UE!mT|f`faq*jovS|fvPlA640!sk2Bp@-9bdR|Bipwj)M)xXDYEbZ>a%rwFDb(|F#Pr= zhR^RSmpg21V24DeqC&vD70SVV9#sUi-NI~#_3*yG`Tfu(|h;sRV z%fI(8!zuY+zT-Uo-b+Koqp#55M}kVpumwNk z92&=pOcRHUDoX;sVFOQU_!ScQ8gpTS+b31QG#&5ecE#d#6KnhA6f2jbB{cjvS(~Ea zy6p%N=PT3}H*(b=%Ok}K+}1ZSh@W1?thPfE7i<@&$yM7^KjZ{qbRhT$${G?pad%#D zUcg?Yx!2o%2&gjTDi$4!z9&Q|ppP;oZLY@Xj`zP}@PC-gpFO)p>%(1XoDqoS!OYCb zDbcCKlgH~kD^BUH=fIEZKetWMBt-vDxfH)bJG!ch)2D+vS1rP!DW=SZG(1Q%nn5A% zT)*pD-_F6|a_!7N-Ks&UX0Z<@E}**I~&77%!b)#!b5uQ+jZ;vlnj69BIKnAor_Ykr%FiE=Ci5ji_OXOLFNINz{G%%B(2~OCE42F+Ge~7(;3z*)Rpn6$ z?<6eR1};NTR=u{}1s&Gt?V4EGgJupkyzq4RMraf1$M?K%8uA|$UuNA6Su$0EwcSLi z+zb^^gSZ3)g@l%ump3>2BHH0Ek9VE%xQKLMQ&O{!#Gq&Yd|Fgo852_E_k^3m*saw# z(hGKiZ0TbqnrsG(rOS3jHsqSh0;+w^lqs65rNjF$;Kx=Qw8;GWR62K9kRmfDu(!9D zk(U?OS5mg=O&$9-#Hi->;yjR+m!5}FFR{q5#&vu2L#wTRj#xn2)`e_yqZ+MyQQp+8 zv0v(dZ_F^Qg>_|g*v3_hR?0i?m-Ma|iof%XBG2<8F6Nf#E#hV16#-s+;=%+}gm8RP z&B7GMB)T%If+F1AmLJ?}XJcXJ?2F$+A?OqhwZqC99@e_@AN=@ zJi;D-NkPE>1VOHkK4eYo4Iu@l5t91F?_H96I?j`8pZL>`hzhJlf*hj6-J5?me6 z*p0!m4KT=I1GmfNINN9`Uz`J7SZ|%mY-=213W6M7c#5K7fdCd8QQUL_yA18N5R~Pc zP>cID{@QP560UZ6jmpF;dYLH(M>65SbyyEpccassU`S|e#UZZZpA+}*j`nz1$nAG{ zAPwax`xQC*o43`+^>uYUTOkoYYHGG0C8cpqKI;5MaL1Ar+SaH-bDN{pOj1+|X1$3v z>Waq=hSa@jSe82=kCF>UiomXK>Fn9tV-D#F>=EJ9s$|M>A^;oPAHdnzk& z3}dpAW(8rGOpsB{kO_~8t821;lS5ryUC_Qa4GxIwd6`1I**)UPD>1Bm@_lBu+(^R7 z!t0l-Z0OePz?jOU`sGT%qmb9$syQJ)874n+7MFmV{NGcALdL>syk3U`-sw=*e<4K_Kr2THKTbsu|dY|KqG7pLPlwM=gYN8s-qJqL0W$0@)J|}{W zi&h2CI$Ad2@lPvr(_e~6{N>3rd zknnYH!@)gf>;yZ-D_glW;$we`6*fOc(BEsHyH0g?bAmYm5%(iPP)+9pd#(`)8`GLU z4$(m2>*ylWYGQdjpg#otu=#Ti?Zzd{fBtLjOc|jI6tY!Y*!1g^l+gE~OV>GZ+X=PF zl#-AP3sLz_J&>x?@$V|rbrDI)I8)Nq7T1W!+q3P~(^{ulfs<{7?qY7q39G7}%Ul!# zZy4wIcQH9)?n&@I_-@zcaE}N_VGw>KYG_$u38Gud5>|-}eQK{Zx?xZ$;+22I`UCSV zx6#h;-CLVqwyaGN+e)8rSjo^-_`@i`UYb19M7_L9>S-e4QtGbdBZH%&jhv)c*{D<& zq%QD5PPaLe;zcW4Uy6m>yH(vzx!nVfSO*vbf=SZ~6Q-<{l@$*r5*=9Tt_NpnX(_KKN&WA&2XqB)Z_2G`X|McK85)$rMNYp;PJeGkcNX=yQ4 z^SnBE-+2-1hzsuF(cW_r;mgDX3hn2oDpTppjUFV*p&lMg%Aw7(m$k03yE|bS)b9)I zz|=g=3f(Z(3r>}@+UFE$et7n z86w?syXTkf8f~s0=Sw5f8x_+pRcLZb#Xr&|{v^#OE!QL~)~R}LJHPB?0?kgG3owIRKLgbFV0KKKRxk zRWMuCBMU1=0n;aL z8zL^_Z(^At$3)9aaWrZtrK*sj{P#k>%$zrmN4KxuaTkcMSL%7_`3KcZmqKDP*DAQ>WaS z%Qq;{m^4Ku|20m(a=Uo9?%6pt`$F_aH4?n>pTk(2i={(VFB_o>~aN8ZUp*h!9n!%s*pZ< z6_&`=$l87018E)ohy|`pLFVB3F|ZZ28~{F3W`jU!B&UK}ygfWT!U+;ID+DNWPgJFWF-^=1pxi8G z8Pt*#;W&PXvGNE2Ue+AaRhat*2a%f`p?k~L`BaUrH%7N4*xlo_;I;k_!A4LPejT%i zJ5zL+mR{Vz-+plJ1XZgzrFMm<&){Vnicl4$11RKiZ&aX13lBx;mECU$n?i`=1x&|K4y5dbqb3|N` zwH{3%jU@iJ-*woS$TuD(%WUw$2udqt#FW0qZRu@mz?3akh{uj0?Bh9TLjvx2-oELI z;GrA&qWhso8zADEF8K+FKX$5D=@c*9(UD{O7g;RU&|~;3IPMK{i?cu31>Ed@j^f z5f|LIf9%or^AqQ~*ESY0F)`41GRlBCWA5N^x;=*ixuzLkbyk|$TQq)0b%mJ_YB#)7-@2>yKULp_mPBvgnmxCMp7F17LV&b&8JDL(Y__xQH(w>}U|?yU9CZ}wK$tVg2I^9}33O{?FY84 z2!s=d7!^^~S*5LI(V%L&6{O#ek{iDt(-Sm#C52##Ufs9QfPCdr88%~5AF(-sL#&7S zFRuZ@m}WV!{!R!N-GUSkS=wMZ98WPU97N{Z9kjpQ$`vMKDjZFLi40I+Oa_6uBAvA| zoi*n3Ehnx%)S>#rYaei4y#1%X{WSwmkRjR%#X+vA&tPAx{F^T6>KD6v+yY$t4j+BdwFS z`SNgwH3kRd3F*S#pvB6{^x={x?$6o&YH>Q@^Q?x-HE|AFGkb6HbDNgp?&fZL2ITW#DGS7t*g;o~N( zwgNEymo;BPbm!z&ZT9yS+TjiB5~mwR2kW+lifjOjl}#Hr;h~K#qVsfg{E9Mt=r+9T z(pNOtXm7Ac#b@qjXzl7sKnG4$4wH?*#`2AvuyS2m#SR7?Z-cr$;eV%EJfDfJ^Sr)l zO-V#q>Koi2iW&Gm)1%-}@2#>(NjGK`H~#7gS$LhI`FGy)!0pdLnY80{x!!nT=%176 zh!QOu@hKKlmM!97O9G!HH+H4U<$^W)hM%3IS5F*M0h^Xd1WZ3m!fZ%oew!quQ<3k`Nxia{DRj>!unI6q;e(92{BvVtu_R%K>1cfkwu{xy zd*fsVi%jWbcwhuuisJ(rz?z!=EHG@<0L(uD)tFb?3X0{LgL1z+I*mxf?>eV$ZfzZg6S^yo2`{m zDms~KY3bL8`h`r_3PXH?Mo9KZvva$D5zgY08okkQblsjM!iHBFzW`XhKZ-z`od}qR zfMC-H`4TVuiG#S#K0EXTAnD-*i5_hefR5$U4ya$6(RPCG=o4u(RR95PyS7cA>5SJA zcw4 zEbT%l!mG=tA}|xG$2=;0YS6M)$wC&37n~XIW<793smotI*MEwsBV%BA}a%CfIC* zA+*}?M$&Uog%WRKM9tG`;!|M}1X0UxC}e1wZ}*_zI<8up`-NQY2q5Yo+RYmWMD-Jrq`f5=>;#jn3%v9F;sBcA?^c0m|dD1mn?HOlXjAupseRK zOX^6$GICZaU8qb3G9s3tO=t%~RW9<%yUNuLf26*8vi#g#jIM`QJM2vKg}86*-9sW4 z9bC=^Ie&!qZO*ZXz-L_nXjS+CmztW+!NCE|a@>ciDHyLJqDZh|8Vi=F{pZMDNCw&jqm3}<}KV7c3ca<6QE zi>5IeCPXGbPmbjP?TFAoCzI1FlW$lDs|IR*)-*Y0mSN+VE1UU}G_jkRMX|q}ZbUC8 z6qcxLX3JbJVRC(AcnWPBdq%nS+N&G7tEzz`^Br%LbI9lqq4jlZY`T1quPc2OUQ7zka>`b0Sz~qsdAr47odZvVy>0{04`H zGPAO_dc!bSON9Y3BRe}=7J0%b^`w<6!U`KFs0F1=Vv04i0FeLe3)iq(c`#f29t8mm z|3+p1%uN&!nJj%aNpRk*Eb2kv*aO;euH2AdN64c-Wxx@o)##=|z(cvfC-=^)6=N2W zG!(ER?!zgL5t|#HZlNZd8(l&n-rOz=Z+wO<8$)W?tT)fGTigPCT;PJkJ0=0ie+G83FrY zy}bPV@|6?KDjfhi094N9az_b03^A)LQMoi6I%f1uoe}@9068Ep)92FC_u@cuQe<)E zOFWeD6E)@J=E+}wsv<6@_64@1yLM*(Vd1#_DN|Puy3RN+Lp+&la=0$>aE;6jA0LysuCpbVn2X}=hPTJG){UWLZ4oVe^Pz0ZSh zS-&^Tzt9Yux436OC`d{AH%xE-eiTqOx3;zxcF@<;+t{1PrWE(W4eX1+Y3TS+s==Bt zVFgGO0Q&m9xG3WBcge}K*r=x1hMYw`uVmQ{=%XridOLv7L34ybE$a4JSjjuZutVW3 z4`zsF1<+eI08KDQ%rj013Q3kJ3)@7)1X($=j@avbuSdq-&@D< znbrU50mu7h*_!v2NbnoeCPeDh=E>iqqE$LE+RUou%Z%BICSU5hFoHp)HiXggX=%EV zCG?3Zrk_NU=eAX7GRk?3n2)?ST2TKRyQMzgc#-w^f)z(4*{j?2Qn{2#SXe=)ibeMJ zz&?HA7{`07jz#$V>f@JV3J6?3U{tF*p3Y4(E$n{gs&ILIojTlzjcF*3YI`u2B1hO6 zuvA(M;!aLZ=sLb@R!pDWMws%WA_Dr25_59j^SW8xFu*;5_Ic1csiiI<&z?#iw}RQX z@hA2e;3S<14A~Pvoo(e6nf4b;$reP`Qbowr4VOzk+lWK=Z*sGrMr)qX9lM?d=lGMC z;`-)K^UjA514+1z_x^701MW`QnvKil6&f+k`p{@;2INT?A^OE9_Uz@tQ*i~&%F0^g zv0uxAC0bFn2ra10mX$8D7d0rn;!vE6?h@%?P11JEw)uqGlM7nhdZCq)qSqRPo4~o_ z{r4|{_8!X&XUwk!cZc?SWYd~>^K5Z=rg|ZLEH+)mvJ$Ix=45GwfmeRp?P=0HXAv#q z5sqZN;COM!Q->tfNM2l0ax(RmZg{GF`CO?{4Nk`bHOrKMDg+ADP5sZGq1DF#pAB~t zmB>lp;N*0^Jv9WB@?3O`oXd4Bz7Z3 zK}A#TdALS-x>D~PySl=JrIJ+}xAY!gvOq3f^R3!C!?+<3PMJj_pHYj-mI;=8|8P(L zJA&^dr>^HqQ#24j^Xt1AnV%=@Ji}qr@MUPcxNruFf7c~5HBQ-fwtN`d)eg6TqG&GSd)B+6jynR6AQYzB|3@rLY6Auq!mP|R+o+Ymzc^mhV zo7KI&G2ETP2FedxBwfRR^edMol6FgRm9)Ux-;|aY($bX#W22`!3 zKT8{>HU89)9oyB*+vGB3oGaI-I8=~heHGWaCH-fI}IUD!;#swXQ+oKa>8F5k5;9Zw6 z2)isjzFaJJ6Sv`ZW(_3mTf)}JRC~8rO~)jEz;wEnBZ8C7}kUon7M_kh`|(7 z629Twx3l?~*I1?@i8J0euG~rAQ_i#OJ7JFjiqh|#4t99Urf87fZU1G-@5eNqK8Br0 z!HJ_F!LHm=Au4|?l$nUn#CLX)BJMViq2(q_tVEZJvOKUQ#FmP9D{j5T>rL^yosneL zQr1*ugASim^Q4yo$gS9 zg0i|frz_#&p^8xqlT!{NZZLCGMX5jy3GBX2XzgXUPQVjR45Ioh{=CH^e6@tu+8SR8 zj4QBT`dPsC2jwWt{D;-C&}A^4(@PzH`(p=9Lr1-0`P$Z8*VBK|3VW#TQLpH8TH=ud z0mQaDp2<%s8Njf~V;WBKMYtbXu836oRy{~{yLU*r?%B#&y zN<*_xkbegT4(ZeMtZ3WVUblwc=M8T;z5<=f85+z3k2Zr=wDJuPOc|hx5JsC$^S4zI^yE z<3e$Ivff6RP+Dctb~Sy-CgkBPUF3BIAKto14} zM;1k@RZajl!?b(uex9$xH>+BdB#AIiwp|Sm`;8Vm2m9$SznWdor~yld1utSTb`9Bs zE4Mg>oAkPRqdmP0T{wcl4IusdA{Ev|AEY=9@^j_^BoC%%kzG# z=7q1d3Z?)*iWhO+qr{k!R5P);^HX8Vi3$jv zjwUM7cuwC%dY-<*xoDkH06J?kKL_s{iK#7+ygXH z5$CP`ge=D_=EZ8mVm*$_mMOnDpgRB{CW5kEf_u-KS{fJ7M1-BUz@?ftiZfq+eUgUcfc!4{s9w7YBB_@&Osq;i2id1OOa@YSnVeL5P<$;+J4TS|(Ra|kA8X7t38qE3M% zdGI4{>cATRZO$|uAIKSsqw^Q{uMO%{miG2kVwn~Yvz+5}ZXQ&_xEx98uC>C2&zHY% z{S~`DS$}a!GLsytt9ikvj%Iks%=q@5Fw-r|r9!TFz1#kEl-tNvlq{`a_*txL zBnSz%B$L>d!eU$z7`=#wk~nnb7N#!c|FtDd)~y#;1xsBKELu-7t!HF;KPmBj?0Cn; zJJ07bGrk|`^h3L^TZKe!>X%=m05}1Ll%1m^zo6h-(r`) z!{5_^hvI2y_;POBS50^#_uFNP=MFboxvqV3fg}N79(!#?u_!Vp|6H*@U2XaIXYgw) z0)Y2tZkcv8Yz&AN70+}x+Fynt0^YDi!$*TfOGuFnd#ag>k57h{|BwEtmj_*=L6vvd zDon#As&;c0-tL*MQxd8*YkjtN({oCC+xHl*>`-KD$*WR#4h0BbfYJ&@L^^>~eZcx&fst&GKT^bqXt$ z=-;Jvh_u~$}aj|eg=erHgu zH0eW~Q)2Y3RO=d7D}JbdVBzu4BdpnF!qIuOk|OQu^AT>pIETtGDO6U%p&5?k(}IbR z%BGL40r975xfK^mdwV#}M~CISsv!oFG3BoyS_NRY_P~hr8ra6A`|Jou4dlLoCJJS> zSmlH>N?lEjj}-HpHv5n2YQER6UxU~3JPI_Ufmi@0MoJIu`gN5~C8^e&tbCY+8uap# z@Ah=f+}YW=ImkMT8K|cnfCT|{k(9|;s%dclsuZ{FI3qgJze^p^7X18jgO2Mv>qbLR za1L%CRn*kAIEcLgtI+s)bO;ovf2<#>TnDKc`1NWSu;Y6UB!dc5B2n0Y&* zT=>4i8dXCs+pxORGxn2x#G7PBPNWG8Ckc{8m{Ro=ypL0Z3=o5)Y{dWVuh!|QODa0POZP73d|d? zyr#Q&ocqZN2 z7a&sr4Bw;c2dCxd;Y0@U`<>*zYvq;3sL1fmpNq$Ie)-qe?$yxtk+n8Yzy#gF_(+_d z7S2bBfq~ISxOurdMuUTMH>l3VC+VJIG*!NKb3eW>_0Gg&`gN|1AclXuPt#=@$dt6k#?tG25!!RS>(f#FovIcXzb{TtQ;(PBJ8Rr$^^0>!H7Q3T(Kvr#AmCf z*7h+F=BfMg{9d+wo;hsIkZD+jqdn|=kcxbPs*wUqV2C+aMRV99BVTIRmAgGKRf+aj z^Fhn`!}0jjHMbw5U4}v`*3A;D?~x9W2H2Xf(CT|xUr%Z+vypw!snY`tN@X@6c(k&z z0-(Bn&5nCLUzvx-ELen7*s)QC3ZexS@u z|GLE$hJ1SlE!SfUu%LE|$2=0oUigw48yj0Fr~VORv;5;W|8C}Y7_dL9 zt?n^E(E!F(=UMX9J}+j-;o;#X{aoJH!Mve0eI2OSOab_514U|MuZlwUKV-lp?o9=@ z1qib-gqmzF@v^6)pLITRC7U~sPX85N`0J z8pAg=3j;8T*?W${>Wr-HU0B!C7$N#VJQ(6z0Lb#ki#5R16~rv`&2!=gpMB`?UAJd;^XMAv^}8(>oJ0_PlRCe&foCVa0Ad0;tL@8Y!ZD#Ihk2DQ18|)kBB=rCjPx zGE}Ma_PL3TkbsrQ^@Sd=T{puK4mI|-ZlRku*KLrk0rkz2BuY`|P+WPw^j@begMn#6 z8CG#s+%Fg0>;NKM++TkbYIeEji-@DzOYgiSLJt$K@=4b1y5{`-dr{cuQg|qihACAk z*dal&G$E_ImUH^Q!W7}&K}UZ9`;3()M;s^=@T~yb;_u(TwJj|pzkd_gv|pkNIj;9F z?H-=+me5Fi(W+S#@xHXcv?9AbO3|bgbwgF1`?h%8TrCD!1*kO;>jnAEusfv}lhOH5%^b zKR3X!$5bxYvxR`L#DUN7V%LlOy8k0q;~)LdvLM1>8NqmRFAF}hzdwC6c7w+gV zbH&1Q%gAC386vz4gv4l6`lz7rprFln0^B?6vHAvnaQ0=DMDFLK#o?WX4E*Z$Yc8Q0 zqy2*l0`bSo7{Ej$*oS6XiA$mx0VgM)GNWWc3**G=Nrt(%9>09f7r zU8SF*%miduUlXE0VP-O@YI))#fVKj}VHDSD7LVgOzM-f99T(O&GNQyWwsm*0-RBoy zsasRu*eKXutzD&qCj(^703vX5VjqfY(XdPxvsW>cN6y#Su>3cni0Q-d)023)TK~nYGSDtIPOp#KfAT0aSAKVtiyo8m zj~TG_6mh>1FusrN3I|$-B`!NzjeR(s7Xk^?KfM$sM*MmePyyV7*9(TO-|05{o*+y6 zcCRimmXoL@y^7=2;Yj+KprdD=AOVsdo|369)$en*mI( z%mx%wSoN_1U=(VVs}0QB#qoooz(9)d>+5*3tr1?%#sZQNKt%uF;{@95iBtO#{9A6K z|Gd*^>W^viqPb;y96*XbZo9U&HgMk?P%r`I|C>%_U*;u16As;c6gAvC;?Y2lA%beA z!JenuEnW4a@T!vEdITHTxwKpm@D}dD|AIo#P<+} zbUt{Zuc9(_J{53_qf}0yGWFq30lp!%zcr8zjQ@D(<6=N}089)Ho|yN7`PN*dj@Ix= z3Qneaa$Txy68*FbhD}NIsdwEXbxJ-{Y>)=hMuS_;w-2K=;!D3^fg3~Lof&NG4U9o9 zY>f+fq|nIce=oLN-pEr+-GX8JB(*Fq2d!`IJ0_dpCtbTso5efj??u-4xIlfzApjEqp24Yhq1K4_AkUPK@2ZY!?A) z_s>Gx9VG(BIAE~$MK3qn{}ZHu&?cZ+wjjY|Z?23cN#tivv08D&ZE(Q{RzFlK&yFKVJq~yg>oKyamp_;Qo}vh|tSjyf7ffjf5nBRgL5SK)D^e=-=O93<>L=CY9ow`jx#X z!hg?^hD$4psq#|;&kaQ!9;MF5%P+f#FE`7ejo)>asI)sAAKzeqHRB%kE>dd*c4uw; zrWCW4zPo`?QzZk@FmgTbyzhomEi%|Z!b+Vp_}&;R3@rT@PNpZpvHEZ<&rWT$^< zSSVUMoB4TwBriVD8RsCK(%pn zz>`a2u%6P&%C{bJUH<-I=5Jj zqpdLKPi(YO=N%_1m$Rlt|I|Oxi_`4a#7Dd+bS+RO04w9MqZ;OWl&co%^}E>760cR; zJ0>faSEP)gUTh9w6e1u(-7D;MKN{;ZB#*tX)=pp;K5+z9SJ&V;P9pBOilDbp#^XPs zl`Bp`WlCSLSoo@@BQuhH`h@QYPe$U7|vL+`4EWP1F;1?HKkOuQ~O{axE%+X^Wx zk_K@xTMLu<2*i(=Q#H>Isw;5s5{uT43P}*7TLiGkXkBc+EU+)cdWBRj*cDMAdpbaw z2lJQ09G-TZ*VE~;C$_vVt}k3#o_gNBa+2_Db``7lLwnKY;?)0#v9k=T@`=_yCEXz1AT0uJLb_wqA<_-ff^>Ixm&7JT1!<&P z1Vmc8yFt3&;eXz*=eo`(xJ2~X&&;fuS?j)k3#Hi92OU*EPq{{TK9O=p1d--54lyQl z#Y+Tniau}94`d_A&&gUB1H4*0CnnY%0&)Fg@o^)6FfpiFK?~R-Wf$?d>b#^E``r4Ta;6O_pX0Hh;S`0V)h*nV zH(FJ6?NzG8oNz-{B}GU~m~nzSeyE5S10Fi0c*LSbtnGd7)(VQqwL0E-y=kEHgv0r7 zqtE%xtyBx*c_5VWYwfdKww11o5>FL3dq-H9-(m*HFq`Sqx<{*Ey-vwUl)y22Re$MO z6%Bcvl%WaIUhvCd=}d}p5ur{efcAQlQ?ENTKS#-m68%n-7W=k&7-c(5xhiAnyb@2M z2VuV79DlIdR0o}9lpVv`Qigdt9`2K%2h9ba#7Yx}A!Ake{=_aOLY|Flv;!e`0-mrtC+5^$Xjm*6k#tEiP4ZArs|*a6 zi~*l0GDL~++Rjcmzp1r<_lAt`!vclK(&N4V<0~1t=?`$9L^vBTIIVaEYv&9~HcRlJ z2D!fYl} z7b`-egTc^DY30ww`y02ci;xqE-nFR1g@u(MsWa2Pl!!=>lgg;?2S=HWnKuG$vgMN` zaeqQonGtBD&~R9Mf;jUhZN{jPzD*u|yj-MgS`cY<5WPr52!V(87;7Q1S!Fh!fsByptrh(4q;`C)UM{o$LK???Ao-& z`ycTIvPE@{g-T>OWaVzLT3_YAFVROZfHyx!KC*)y2Gc|{o6^94Z8A~`2`{T+!KUJu zqs?CHm=|i>D;RO327v;l1E)xLa=7K5T})J;TMmY*89;p#@}iv5oEH3!vGmqls~Znm5&mY)8}vecg~b(LLOlLY)E)fsu~_2#kv>F z&2FjcaxBn8+26+t|4}rF`|Fi0cDduqr@ixX^erM;EB1Y0_z_C?mgJk0=;*8cuZ#?F z7RgE*B(Id5HhbQ1mkG(UNfSziG#4S$63!k@k3b--#a$q(k0D}X$icHR`W?a_AabXO zp#@6)>_d{48!WG>ZLaUT(w|!qWMGA_)iO6v`l#MJSZ2vxH2Un=GqMq|Q;5j_WT6wzQC{di_obMl z%NyJ$qO;jP@kK%{w#~ z(7IIa`$1JzeI%oc-5{f*F#7dxhqvE)uY;2Oxk8s;Wmm-5`PZ7j4LW7yarZt3V`+pfNT60HUpUR7e?&zS1=~CezsAV^kx(#Ay^%l}^AC48A+CCGky)9oDdJR7y6)B9IOSI+EB_+$0{hLeF zIba;4FSA_H@o2!+Ye?V)z3j(BWixph^VWLUDs01(eQPFO30`P&8a?IJAy@KQ8UMCi>t*unnJpE6c zGKAT~zu98OsKHeONGhNFv#w_lHKWY76OlpAr!MwTAx4ZgC_<4|-jltrdqZigj8GOQ zm%)N~q$m^@l^t*^KM#Yw1`3#~s~)46X44eJLj|~-uHwI6oLBxy zQ?Uz+S>v-X*tp+4SCL@IioosAZtOYX*HH!MJ0d2KCF5nY3uU#_f|g&g7M_qDC4uK-s$%nVkJ|e4#6lL$f0E(G(hC zfa|B4A7hsXe@yOwqr_X!7YT`+*x*oeAx4yt)IguB@83}8uaC4RwJZN#UDwpPd;fN` z6bCPiHt~#Q-P!yTLso#?S!AsUex8?Yc51nWmtlBFDr}NM75bLn`35Q9idPSaGjJ?Q z;>?l;E#Rd|WPVh{TkkSZtR*tK{T{(HO@TkugRA&ECAMTy$4shGip!s-B$Cc#G8dCN zxL!?~mQE}#?Ub!6R$9|tmo3PQM~fzoVfumPS=xkr7}~cHQ*URnDeEJzx5=8Uk{s#c zpB;&z_*B+a%rE4p86&F@XdF>Q%C+9}$EKkdjfooT`g?fsSKq&Vh5>QGgxJklIyl79 z%f=@;CYg_u4um4aS&!J)u@n!U-Plv~g~>ug7W0+r>cv0%bahCV!KpeiFIjMBmxNlp zP_2lgwd3B|cX+LXl|2yEn(zfnv~PIdKg8tMALZckgPiseZyjw9(~yvRIjs{t=l)HKy4&NnPo1{hZXzkNf6U|i;#o*qsNxOMbsQy?Cu=FKw zUkaj;Visr3e33YARf|kGwuXe*dEsV;N;Bnp(h@KYA#!D7vwJq-*^sAKp+J z3d>tl67F*n)_8snrG`ok9jVf19#XnJ7k?PTOcI6&qLZ!+q84>irNCT<@Ra^P z(Hk+Sqs!U%=fE0R84IJjwR7(^t7=hbgWzI~Np@4mR9Wd_=<2_^)_<9lb=wvhNqXac zagB$6K@KN8WntSKb`%;D`}Wu77%HuMWBbMzi=^I!NfqYRxIsmnPGE z`#)XyPgbWZf2ovi*9AQE3wpRIzWPea?31d2Ln^rl^&q+4`-X!9GQVXmQBi4*)9rum z5X~AgbTe!8;sTiQV1n&ur2M}1XT`9Tj%v!1_uO0y(CAfkuVp|Jn6b<4h@UQ-nwhQW z^Mv8AJ7<#QOHTLxwtB-Vaq$Xna07qFPGAvn@dd>X#Q5?9%Gq*k;82;_+3`TAx>e9Z z@1jZDI=>GH+&hfx^$YtNUNm=vd*%CUCnT|G!G7F&ap|pIf}OpM`D<%vFTy@6TfP_{ z`+!+;3fpUDh;BLKg4W8hbFUsHEJ3A=dm7 zrx?kPWYne}XuGW>5{5T$t*VICeLMo?nNt|m5CGytlR5EAO4V=71Go3nxgkF& z2a00+=|9U4mzz$I%vJJe^HhY@J@$D`C+N#F5)VY-4(}P8TRF)0^iW|~&YjFLR(yiB zy7rJlv6{&ewGT8Q#y&nV`W#xrHg&TQ-JHCgsGj5mxez(AZZT%86e-EoCPZL;ev&*^ zRiU>XCCd45T5w_J=yS+&q%);{+`bgxdafWu_q<^BK9zOw~?r9dn4q0IAPkhA-oFlgykEYM{jEP4(5dBO>2i$ys8$W$9)@{_-=zsdt1>o+AJAfno`#N?I2|v@AU+Mb zP67F?Q>gy;shvv{^BV8QeEDy7$4CAS(wH4T)XIao-6XG3uIG+@%@sG6%Jq@*BMl0^ zMKuOwx+LlI3Qtty`7FaPBnr(vAQ>}1?=_86{+$jERp0u2`M9X)!AS;E`x1 zz`c&pJmL`kGLDR-#()+apfB=B%&G>1e2f%I23Hi)29xR;{9<({j~JN@k8M-w8a3tE3F=-&!xWzeixR0b1faYu9|a3UGJ{$=@E z%xijZP9w_!GWYG4e z$HJ025c3vl#VQ3u4N9>5s?<8l5XI1_p9VApCW4!bUu5(HB5*D@Ok=Gm>8nTSo!_B} zKMBD63g7s|m~5|C>p*+)C8i<^BGk*I1ai7gk&DJzQbJNEc^vdVU`kBXF%(Y(E2*mqn%k*#hq_eKU+I% z5TeTU)vGq4)*t>y&A9Q%(d#!nfhOA9201_jYB$$)*}AaH|5~&BX69j~&{JC|XwG)9 zr}vj(Fk@8Lg0pcml|t{3`J5X#>Xt4XXp}pckO}ErX%3q8pm^ zc(EU%@ci328Cjn|F@Z!1%A`IU4o4A&*S3}HLV@1Meqzpu?DkER@^xj(w8s3@aZAFk8zn6rA%0)g z(+x*jt}Nm}n}+bPqj13iWIRqt%eBb+So(6AQFqQ!T)gjP|CISPEMxoZo->*d9(r};sfm#c+{fv1-Vy~|+o8W; z0FlnF4wU_7W^}w-IRpia$1(cLnKFr zxM9>3H)P$Jlsowaqg1Hy!-S0b8led&cX;~@V9ZwN`rD*-0iTR;pfc^_4b^G zEQelOYFGEt*(7C>vHQf<^pRKp7wXjin!(){jkurOnE9JNIeTOCt)GdZF2~hI@GXMT z$@Fz;9x+b7_HJw%D-&hKv34Ph8(ga?b%i{1X4I%^vEmey3a&0(9y z72F1ypUanwxsWR%;i=1L*N1L-q0-`J{SWkqC9-7a>b|q0=L6BwsVdY&4-H}5y zi~V^0c+pO-R(P3>;&U$OuSi#BrX!G5QUwat7j8h98&t6;S3KexYx~Y`paJOEs_T8i zCu61EcJ+XT#Aive|EeuwuW>u<&)FG7oCIhavH(!##CKVWTb%AGNj$z&3tR#uVR03E zNPe6x_ZTC4=OeC^OE{>(04t;l1=-Os6WlO7vs6;XpIg6*oC}@HZzmCNMg!#Jy@Ex; zfIjt&l7(H61WXF|W@3-0?Qu45O~zjTyKE&#W*#u>PS=uSu@82g3I)mGOVd*B5bQg2 zY;fxcEipwf^h*Va1ts9^XeRl!hts-1AT$zDs7#q+Q!Xum(G}T1Z<07@aT09&?uULt zy<$YZewNrcroaJJNn!kj#0481N?@P+!<~v%UA9XzB`^#fxTS+?nt0K#_v1z5$f4^H z;G~J@FkAN0t`{3uEYkGg?$W^TL&MVA%`CElqjx%Ncs;YBBF<`k199(0{Gd43LupQ~H ze+k@vzb)Y_T@Z&U6Ug&=Fz7&Ktj-Td$qGqaj3f*g*+1?;!YVkGg7b+-_bweFC@e2_ z6xkO{W_Y3FBe7Qrb%k>b_}GGidH^oQfLEqz^IsNlqZ!IykQUZT^%c`um;H1AFXW1tn0{H&d#>9b#zJ! zU2!E6Ud~Q@5l|X_zl<#>z?*58#fge0iKCQ(YGnHBN+wbcnv&w77Gb7m#l7BfCdBsD z)@mCGujus~-Yc(PcDiV!z zW>DnOrPi*FSJKbeZnlbk0(J%>}C77U-VjuY>-G;a}0#=_cDbVQTQp(d=|IT^QD~`Hp9A>A>vP0p zX(5po*{JZH4udaN_|F#L!xHuDo1l zNR>s(^u{}=ci;Lj6lLT$VIQ%w`geDafBmK4=))N^$Epq$`rbF8n7NhfACw%Qvr6#F zH&DjF%40!btec6`>vk){OdJB zfWc_xiZCenePXhwmW)4sj5|N)nePlRg>nB^6WYwMOJ*2z{WN0Xd4jzcE6uS8WUo0Z z3Px8pLa_-^%B9ijc%i0oQgq@~+JNB%j7IPg<{_oF`fZ*$%?g+ON*l-Yd2sT4$70da zaX!VB6a-4+BknjB7zTw$O;>H+V$qXj(*kxb=}PFMv%_UqFS5xv^m^%`Tdt=ABhxI9B1a>bI*tC;Z;u&|A*anm^N#5b@hLv zw;YNgx;|fqto3=kVHvmPNe}pntE@8|g>rbln=Q-Sh{*0$`d* zCIK;Y6-z$`7Ml6q_*kV?%+aI1h!;I!z?pJL8eCU{CMlQ77gKooijyD}ePU3Dy6s|B zXF?KF7zmuC=MF25XKmY61X9gv+9XTIH%G1raj4l(K9yE}q8M(yl5PVfn%7NfjYjay zioIH`KaH22*DhSMhA77x*`ZPi-%gD;$l`L>X1$NN_yiUF>^=dp&RYGf{zHHK^?Z6; z*sJFxNf_^zXe%Xe5)}#?rN8gcx^1{7hbi%9cSBy9lZev*$!(|)nq-aG(a1S6Ci3AS z7QQO9I~M8d-rf(j9!*coL1ivsK}r9SPB;9NpOzl~%7znOwunB>bz`o~QoRpJikAF- z+o-8_fuEN;sXeCK7!(<;&UiBcY7L(@k&09JwbFPc$*bqb79kSd)$9mMW^Nzx-yFXY z@I}JbX0LdeIAqD3&Nfj`o-+8{>s}=63E+61LkUr0I!3tr1sr;qAN@Uo-u1Ik%sURZ=BuzuRc72BrO0koDO2juTF@ zyWXxR9|bYKYlUU3m@X}?*l5B0euXR1A22x85rtKa6E zm_6mNQe;o}QY!t#DHGhLz+Dn-FhJ?w#n~~2)N7jP&>YJFvFqFX6WpvA`|>#caoj(M zG0DR(dL!IDGe=O2JC*4e+2=I=@%f%!gChzaYY@N@`Jcr<#1}f8`JD#f?7sZ#%^_S& zV7$gcFx-!~**E>!d%p1^VMFlp^W{wu>vJE2(pQqX-YXiK11MLmqBjN(^UXb4uBnC} z#9*o=3B&Z5+J*}Zsed?+_1XI@OWR^CGVSat2#}~U&C&bh^Y@Ugkkx}Q8A{`*Ww%BA zkH0^n5YnPC4R`gI%9RY%W@Gt18r?hpc`XkV6^d#FL=Md;zeo z4;_U^$f(a(T%XPHQ5T@e56GKt3p5;lFdY!tQ4BI4gK1_-u!QboYPb964Fp2kpyO0X zax9rS*%qZ*lJIH_@^7$*WGI#Rta$Voe)c&Drw8t-|JlrBS@*m>Kf;xvb)yTWMhbz+ zGNwusU;`FsPhICdrCCE_$ z&}umCJ#Zs1c{sYK+Wjes5vLXH?F%ZvCPuZ_$UPgN?q?R@|DrQO_5#TTeA#c^Fuie>VV zOg;zm&MGc|%tto!=nmf~CE{H|?anb+J#xi0E$&AG4($qzrCi5+Xx#y(enBo@6kWdt zvLOoC=eT)eD18Nfa>Mu0s?7R)tJCxH)n%j(3%>E3|ElbRrK+WBW@Ka%pe3rTZN%T` z`F)mgdCBI^DUmn@1tsfrV~2lkek2JKFP(a(G;&xg{u8B=M+rBK9_Poa=!CjI0@>vP z+)?1ZHMd+{>ALDy!ZcIB8jOsU|*lRFqbeQ(`=hzo}|8q%{fgpuM;69I9G& zoHjGxZDaZzzFh2uPJa@9L@UBaG67b>7wCl0-LqT7rhBShpWKw4WfCIWy{{oqe7XJ( z%8^6JPO~t6CZX-Q{k~#Ur?J?2_zCoLRKtdh%Qs*2j=+cnb-Hfcl_rXuoR!UD49MR! zZC}TD$x{uA9MV#QqmNsi0z++G^2C{0*=99$ox8zbgj7VHlJRt-aAMAPvE`V6h}v*%dWFSKAs-{UxcE7UMs9W$fGTCbel`2f zKU#`TvJnzzZ}ItW8fte$V`I0SoxNEJKJ&P-t36gRVcO2f-ZgWX+MnmY1mu6Rnc3L^ zr8XlMCcz+tONl@dl%S{MW4B*DUc7(%`Bt$MJ@vLL5*Nh(7kAXszp7LKD5k|;}A zUFpsSwI`S?mD^a?r7w3QLgJVsMYvXB6mI3X6|QuY1T4br{mFd*xKRsjXp~Q}m`5}4 z5E!6#F|W4Yy?VT6#y;Z1`Qe_)o%4sLxJRDB^vG-`Ba7xe`7b|WgYoT)CU7$YTIo)O zS8Y?1hYj`Lf0?H2!7Gugh;vjBjSu(pmgg>_7RB?kIUKvK#=Je370ASO() zarQ1%urb!Xt!nrP9N;W0$uKF81ypB)PZG66MLKoVh52B|KSk1yExLuGm331Jt20iJqAdR=xeY zYUmZtl;;r`j#IyLMfJ{M$s80}1uxShi)3IBWs)?p*H(45zc?98w69v>Nd=`PYWmk} zw!=DsRvw3H(bDdlV!p%(Qlloa0gm=}duJ;<{3-Hsi$et*tEh=Lb$_zz zzaLFCw(!I<;G3>Ea6EcIv}5Y*na5+?io?U-YX&bkNf}|TdU|%gVCl$gjwm^Kjmx`4 zhbd8!Tllp!M|Qrbm749O>=?!E^MLot6l*<+Yj-(IcejdKQ6Ah95hR%ResC3ZqgW$6 zfv*^RU!}?0Hp~Ho@AzR)5dy#%TH_(p`cCzJ#CJhas?hgLHdZbD)Ni~i0DK?w{>K4Q z-2JxSTV-6ECFyiFeeRhF#XP_;V5YYxB?6vnsf z@n)It=hETqrs_R*=RMQXi15OKO)`*7P_4{sabMct%^0&j8-iarfBTm&&GR;g?`j3d zPYU>p>Q0Q*R1b8%$Ev@ba#!8 z6MnQ9+o8za8ryLJ{87X2;d2LtcL9oYy&aUeQna4*;v!u5Ota~5-~N(+67fPPrb|(u z*YW9)vCY;~aG&0Gkt1Z?4q0c48>zGt8d@Ja$FTcbpP7->#rv|BrVI6X2_b_bB|&8I zo|O6+hH%m~yEyK0qdoG0J%v8e=Fib8D_4CG&ij-}&yZgl-mbXsVBS!O_+BB8&8=1Y78=b4y1xa+lQ7;9ljbym?0gjw4!~!D3Fw+h`$&m2b9cImFcybt>Mmn3SA)L4=3*Cbc<5HNVO5U!$ey)b2F`T}Ot_oc`% z27_N?HuYAu%@GGm*ng;t7qPc5820vD*)`tV*?scHIb2(C^xU5}qY%6&+1raoQXf6s z&(Ey-ClNuD30=JvVRq9Ke@d{N-6t$|(0?Rc^1P(n59#dM$E=Z!ON8n`7Kk3F9#DCBsYe{63j;ch}h-t$9&~U^9mv$=fl3 zL`=b?LoAp|lE)rZVqewPWJMon6LD)>0=~K*p8WAXTA5~fxWZ|V+-qL{N6I}zm^hLN zazg3?CHAz6!S!>JnPg4&wDh=L9jXF`9|Fp=&C8MQ-NM~Ih}A50W9i$?tt<|(HdGkB zw>_s#PQ@fJ({Yg;+dpgcIbf{I5pZ^{@wu!Mm5mD6%6-JloJWFgBdNhj^kL9@RVZ*L zQ~j4?c}kk@_?&FKBRTV-`u5H7!wGGpUDA0SPyH9Y={MvnvQn+^jV_TgO-k)c(lS*d zE&zGKNs?bA#pm+TEs67(IYz~lL|{Rg4|_;lj!-&8O{%U+k~=Y97w88scNi}{J!^bcU>o`zf@bt_gAoB1E^wY*GF!}GhesM-Lee_ zJ=Q#~9+h>R%D=Jx!~V(4&L>8_LJl|NuHU__U)MhL|v4^1x4Ep5{X>Ma!sS(#>5 z8=n}TQc4N~PqIE;C>@<95VV-RefgZWxTD_gCKx`;VwoTNUYvN48?6Nnfte74fdDOz zN>JXnS-P2g8G};zpBw`PHdRLNB{GFzeSl>TUDh7CyA`D2O6B3*W2xF}$9B(-qT~)~ z8q6Oar!RY6ij!Ey#Hu8euUlaOfg###j<}C9?RFt4ZwcvZHOMowQ2g9IaKnzXCy>TV z!c~fQE#-mH7Q)eD7BEX}lc~!CKkSST*|6&Do){`(nm%y zWI52e1e(3z#EKp&e>u_7E6>mT4AdePW>(3UZX`DuEz8#XfcwJOyHu(9XnYsT<8kb5 zQW;^LSMdHnRt#Bca$1vic-1MF5Og%(ys}LB5=NYneO?^{yLk{`F7zc zfrxP2u@2*}l@ZaaWBt%}&FI^%!kx-MN0;a_;)*r+*U2t6^Nvt(l8i39X!1z)sCF$G zEr*dcMs9mkb*oX7qz7SLqDM?K0Czepa{dKZ&n?ADh3S_-MhK9z44N!A16C=+i@0Kf z5L)67M(YFRgBdXC^_kzlLCCbQu9vaT03xM@NbqhDbI< zl%;8Y29XyI9uVWTuBvU7P8i08Ca8t%Xmhn1L4#<-Sa{ZVcADZ+Mjid>Uz~Y_vH#|O zE@r%qY(laXrw&y`cop#`&HM*@Wz*^>hU68^#?|?8* z7otppp5;m$NsK59g%oFe`|W%;t;5U5n-JD}bw)x*<~S|CywEz_fm20b-O_375x}UP z^sy0e$92nP7?WY64tVmQ!v`v?_huY@{jmHEEmGWCK3m|KuXrKoDqg- z8Fg+GZ=0TeEQB>)zjKCs=1U2C&r&r0DI=TC)@Hrh`m880*YVgu6uY=dzF4#5s8PE< z)gRCZbp5m_4JuH2kdLc7sY=Y!;k3WYvbR_ zD-s4vK*5pnDd34sopZW$W`B4{aVVAb`zBRdBfosR&izcEk1p|-=^Hft4;=&0Z14h1 zX3kpSol%tY2XVU<$H;3>f)X5tWeI`|8x+d4>1I=Jj)if?A$X`M-^1qYN-PQr3y&Ts z56ZQ}OelV$1jDD23pLZ7FT&Z!o!m04Rk5~dk7XuU{C?_lVpW4hbbMu zAKj&fHwfxpiYg^LkauMV?4x!QxM50lqn1v-7=k&4lh12W7?lgeUcBr1s}$sr_Y23W zPIp3YNL!_8#%Dd`Yn-JOl1W6&>L<1Fvz11z7cbNZd+ltM5T8BJn@-jidQy*NxDB z$vz6dc_aTHZUh&Ji{5KkaOn4M02c#vcu-n=cvyP8l~N1Y`}s8;5YY1O)|vi4%ckva zA-CdysiTq+;MBi$19S+IT&u86%!xt40@?xQwaf*GBDvrP(K`p z1L(m=09^%;JU}@6BJuy5}Rm_-{%C%72qjBISvj05-8A>MefhWt+IXs z@Eic0cgLfMi}}7Iz8Nc4poSvK)W^eZKgN8UDO@~$g*ac>xHL>e3p5GP;-|(vfP6g; z0XQvSvIp4t{taLNQwA|+(gp~eh5^U|j1;|W9KgOXrw?Y7^n*Y7pXL_tQ7gbW0ZTEM zIRQ^jrluw+N4lAxpWlB)K4F>z&r*NlnnZt<^|fTq<#i9LU1bq7@o&h-bZ8%Tds@l4}UyA_~zuYg&|_XA%uvj zw?q&pD)g6>Gmp(eb<}#8PoNvW64zWsKC5T%&$4}A`%z#0mD|9u&%z@4*Q`f_W;6La z^Y89;ZiH{DYg4QvAulorr6cGfqTw((DSjJs`1*d>`gG5EWZi1@2P>HNS7(dL+jmAK z&84?Xk6RC)oOR2!mR!S4p62YiSL-7cl!eNBze2K#r3puu2#Zl+Wkd=;cKlJpeQjV<0u7xc6A}>?%ATgV@(D4s+hPq zZjh8#k8)^GC{{NyH4Or8?8^lw+UA&mJ)O2a+HY(8Emy124Dwyu+stZ&Tmk~nB!;^c z>Id4To4*a!b?wzh|8OV;dO#1AtG^9xbxoAvYmNY|($;(~6c3g&z#Id2FMr%^+JxUC zFztfJ>q`jTmq5Ty)2Ki73IKnF3%~||zd7&mZtHsYUHib`tM=bhZ5KSi*XnuFOZ-1! z0l2t;K5*?c?@~ zdReSib}i_JRn6G6*;Z-&ZphuJ!4IQV5xs{Di#`hBh~9CQs^mSv<~L;h)@41;MrFa; z0^Gl1^_ACo*O+l@oI*mspHTl4eYBX8B6lk|r%e6;F1Ia74Q_2G18m>V432@b&J(=r zHy_tg!D0v6>O^{3ZNOM@b4$ByJ@S2q;YJU?cYc#qUcZ+b8v0CVcn#oAdryT9TTYd8 zJyy}+$YPQGufqMORip}-pX}i+Tf#>x;H%F`v=Q*PI<0g)1FZ%4eQ#VuXDSWi%F0-h z7)*eEcC9bod4HPA(C^v;ux+mT^X~drKP4>e1}PMerTuEijjoB;+jCp;y;NgOeR?49 zD@(VnOKZgbC&Yj^FLZa@{Ylh67hr*&#LzXvB7>lD2Y7pso4PiTLBELp3u2~M>z}(j zA5mU?@DG3%5MU7D79SrjPeJe^;#zj73;0{-@FJ|*VbRNV@oJb>yVh%5;V@{j)( zFWb_=0_FtN43e-G@G>^ms2}+OYyxo5E^LGA(@-6Ot(%dF33MtFXX)MFX9uh!=HiS` z`oi^f<2#Oz_m^w@%8#uWGl)9JUc>efGJvxLc3N4IFd+8@Gewak%y-H*dIZ$ygw7{4 ztjayt6J<##DT~$1IC*$_d!vaP_bQric%=KBZpL|ZZNtLDL4=<7+{%$-xjtBWuorna ziC??*>kL}3f@e#GF6r9yAtFCD2?@uh1hv_x6|>;J6uafgA2%L92_g=FjY5mN=;MXD zfW`l6eoLe;6oVMpWVfk7cmXA}EmBI#13g{6I8R`3_c-oE0f(^CtH``7w5MJx$ACu| z2>J!&0mCX--Qd5K6VsDzPUH?-;|DYOvk@n#zX{1FoniEVc>C0a!lv#&W>Hee2cI=^ zp~t&ZpH+gq|h3UW(q2ixz{aiP3(H@w9Z|0D6E( z(IeS>?iMkZ->K`90O&pC`j@R66Y94;aVnI=0Gm6wAcz7(rdp=yaoD&8UY`Ys1mIHw zaM{xmye?n5Dfg3=Wa&LVb`)JxN(up%dvI5Ia*_fUEwP~o>}dC>af>R~=byX?=*)8= z$O-sKLO0umy<)o#^vhc!mv3q+D?3is`fhs$m`KxNJkzb#xNb9ib6Tm9;C1&NT%N*@ zg+;Mw5pZmaeVsIQaY-2+9esEl*L4O<8O-iup?HUe!HvOmFjY*zJOp!pjUOA(o`BwM z+^QT1MxVfQ0C_~^e|HiT&^+|)6+65BYmcTxHYx^-+zijE_1f==>gr!7RiRI)VPG+z zJX#Ag`2~jWrmhRXOdcS$_Io)(p4E?8PYhM?AWip2t8@S*1{MibKp(Y#i*XnDG~gKk zPE}hpTL1e?J~{5<2_C6hB6fcc5HvbZg+L!Wbtq_F5HLw9n*D;U81TB6cS`e~w zjp5*}3SZ85^8vRo5i#-gI+N&3o(F(UZe+gCT?r*NTn1!8B=HWg(_JolfB0{Hl%MlZ zhIif==Nj(~q0c7196m)2%0K#f`fox*#p!av{RzJTCJk72UaiU$eL$|D0OGZ*$UnTN zJ|$19+I#Vo%5TfvuT(Sw{VbUjtcBL)(NVQ8lQwD*i{(fZ)YL~z*n3JsI8Z;LSJa5e z;$n5W2kq%Yy2%VHkxaSEAU+<%|Ba822Xj)APp`s<$oM4~zg{T;Ba2zEgB_kn1YbD23w(uNE|` z0Iv(gj%clUhZp&j$+HnY^(umLwLWRK#3gfew80pY<=KY1x~qVL2-59`O?wU=8?){InZzL1IX69H7}@WqR$jtWRzpmt;^ReUQnd@Tw}gjdeg6` z_7%=897#c7Zy?YA!4nKS_5HT2CwT3kQ(+0%=>Rwq;8&q6K{U&8f`|DF4#e!!aS!FN7kr#2i$c>dhY#gj0 z(9rCtVGk(ZK<|M6HsPt+OAFzG%{58e(fzuk+o=T41fL7f;E)EQiN7fJVS->23>P`0 z{qyNfH-Ngyex2MsdIfMD@}O@D4vta!vsddcmWE-H;UrX4$be)CwqAbM-3gv^>0(X)sZa?A6XF&;Prj&ED9Iq! zyfi6)ehW@LvnrN`V8eJgJ#2sU1G@~E3__Rl&VVdb(2kMbN{BSyEC1^p-)SVr0U~a; z=?rJ-Onr(!=Z)q%Ft0UeaRIRzyshyi993xlzyLakmG?P#`ChK{)CKD4AII8;lv+*@6 z*wA`+Jo{kTZ>MFuP)oVCWS2b1AfKQ<<^bx>*=FF_#~%kWPwOKvNp^O2&^`j}43Uv& zGBPrb6s1Oawd7gE)qT~*w!O$0BiFPcLl5B#d*4{05iD4YOURhcB!ZrZ3X1V_{EMnQZ;ms=*Z_DF0D=ag|8^7gbHb z-U~Y0-bnKDTJm}P3b5PCHU~Te1jgPcG3-!lnOzoEMXDr*?5iWpj>-FZFVwNWd#Gx8 zUb`N-mH`f5;83Iv5@Y&a<`t()f{Lc%*vb2 zDOK7Ee(Q1aiM1VSZUe{=X~ zZYbaGzVO)YuqWDC_b%3VmtQz`Gsxdmm0%&-%{Nq6gAc%(l(3*Erng?Fw`ADn(x}%&1^?ghT#tBCN>a-oYK5!K znm*mW?u&m`=5`e^8&L_ycU^w8jI8f(Sa1wApwg4rOq6N)lsL@w!FE`_SP;vSX-;%^ z25<#PA;!5RNEB!wN>oqSoengTww*7ezY#qpyKKF8c-Zu&-n75f-%Sm0*yVKQSqatn z?)0$w)TYv+Pt}=6GSHYgVPY`Js~@&*jgYC14hi?aiI3_=cPEFp1>gmn)ZlRq%ycYw zDhkUlE9z{d1q`Nbq#sx6h=$yt%UGv{M?U1q$yh>(G?7j&QB3cSi&Q?@;A85dhNPe- z(>=4A?A|6^N+hAIX*bF6=p%`5Tl+p9`Rscuugc}_v-Mwu%B+d4Ayy`6jnzFOOyXLE zg*@RhaOY95_3$6uFx``5{ot*jQR}C(R7aIpr zKY#eeHpeZ<^q#V$KdZ=ImcuHOvW`ef=}o0N$Ss(}+L6I?A_J|81Y#3OgrS!dmRddBHple2IqTzW$?Ys1+faf>TcjO_Djye0DcOWVRMgjF1SMQlp;sN- zgvE4T3km#Dq^~?GZ&5v#D97i|>#Z4Oz9Lo7U~5$H5)kQeRYSV2id0@YmZ1lh5?ZT_ z@06UaCMff*53J%>1@`>-R%>S1%-xqs-2!dY>XM7(3`>L|*V#PpOVmV2FH0oT!0Psx zDOHQ(lF#0-3RS&4jwxWrY)EbX412a(G^mNVn+hi@V6}tGCi(SwAzdgJ8SRU*kLX1E zG6-$AEA*J}^eHgk8{WeYi@GOO!L08Fa0>{>Xc^BS&O<~i>cl&qkZ}?X)@1Z}sqVW; z3%Zx6q2?@yE2({I5;R3Lk!ERHTJMJ6BId8Sk4z{nt!=J)_LlC|_c zs|&ABe)gHOquswtSg;Wau@D032l*xP-$oIkmlJ3faH+46M%rRV2IV@Hr48(B2$RL4 zOTOrL>{mT)(i}h@ekT^e_S~#nG9R-n%u=wEfrScx*a?>(btSQcOTJp7{0j?8*vX2T z5RjC}r?Be6ipGJ$RE0;`Q4#g+-& zg2u?q&!q6y-}E6f_(_e+pUA$Gp)Tn;(P02F!BOHGC{3xrHyIxfd- zaRF5Nb1S}%-weE3_Y@*}D$01-XnENa9gOIrKR@S#>gDoCtdq#F z(Ghyax^R~XkV60V=^AjNl}&$w;K)rgg^saTD`*Y`WqV}vPu_6S|etE20V!a-iMK+bP z^=dXrpk!&wbJ(jtmik-v=DbM)oQAFPE-MpT!G}5&da$|MKhB&)UWmtskbmQ2{ru2- z2FR!j#)n^CbL*02O%ANPo@-Esh{AVZYpc`VjE2xxk~gG4YA2;%xwFFi1ki4A?HP|u zK2S-lf;ZV`iSGxdf09@B`QH1#^EpV@D1VMv2Ysh@?v6}vH6Tj|u_>5pfMaB*f5a9k z(MyKd;z#%SK8899=DS~E&%d?=RF2rFT=Vc0p=E1)^s;UMGz9c@{m}+l%&uOe#DLDU zo0eEKQVy>ae3zv+_*vOw0a`{)X3=0x(HiXlSjOBHU6##ICGO>!^rgTsYPu5!7s1!n)67JEZa~P)@MN3k5&ToZP zIP`gqM?(_&>8Dq5b~mFBM!oXu3%LmY@^eDe(cI9GfW_wz*`^Jw7L(r0K5kUZ*6D-> z?#n*^V9;rT-j{KaWta@tt_UQ%qU)bk9J9`sl7gV!$hw)t>uaA^qbQ#w{4dOMbWc>k zlOg$h2dJ#7Um@{h=l(~v|jGgnW2GGy$}7Fbc5bg$s7wipdNPG_SW#NKh4N;OWkeMbBrURb4%lp zJoG#Js%-aYGciirJrt2sujm@MF8i9~=&obPTM84_(0oWm!#->Fd+jeCT4s4<4*4JN zxg?05j6qHgGMkcLS-bi$fQ;%G~LQ#|Q#S26?2i;ec zTcy0!vE0FIN~6Y|LsC;$cqHX#{;8&MM87M{n$kPS5AIp0ep50*#N2+AnyfZf7A6 zk;F0qG+JMd1pH{$L#TF;{x4g<>SS+1xq#lmsW-&@yj7|K~0lpTLvv^PoR;Z2=M_&jJET zz3s`TL?l(OWp#$mx6I-z4GnXC=2QHaz?%xVeeo-^%IvYdY8I8oAxrXWua(9w@^`>0 zf5G22O2H;NAi-jxh`qlVZmJXp?t3*UaK2tCjPfx?M^;!aQ-!i)8J~YM% zY|(GU>L<(E2b#+~Df8`{y?F59QmCv_o0MiM@R*Hr?L@-s)z>KBa3B2C)6eM{zSf!4 zLweG3&TM;+yRX(33cK%wlh^#Xb0c|7(zC$&msvMjYT@9VAo5HnJYx;@8@I+nXyu_m z*hM2a+NF^U9)6s9DXt|JR?qe7@wQhyzE{0^>7jVaFu7C%RnX#ErCqj>pS% z5g6*32cfD%dLZhV^PW5|!kH6a1Gzx9yl|=zs89&Iq1+X<-WYtW zw!V2q&VFCdnuK3NF&kQ`jWykAdUgqnRdx9b%2;!>$?U{5p-Hd;ZGNz8W(^^?1aYba z>DyoU`OiqoQI`ZX*>8M>02)+#%;yn(do;KZyjy$}vF~Je9V}UocePT4y|fDAToZJfy@Z&P_7#?YvxC2Z)bqvBN4)Y3BTQ0M-ge>%+ph7li{PI(Mpyx*8wod+)G6SKeZ!DTI?B(6>pxMUqo@B6Ys}BLIJMlM4t`J+A3O2j zMZc^ANxA$*3^3H1@?TRq|FWlZHGAGQY&^R=-x<7Wh@WlItzmXaLNK-PU8O72VyuJc znS6Wq3yPbdv-7o2R@X;6no-?_VMkf}Hx-i4Z@kW~f_F$SD);N;UPtK*{Wzuc6>`PW zzZ-BwV_w-LTO6L5y9kH`QklJIZww_n5F8{M1#^>?a%ikeNGltbN@!ydgMs|8$0lJ9Dk*j>1{%j+9_n9cK=Z*Jv z?xx4#^}h3U1KZ~{7N+CT@K+D_CA%5w=Cef_d6|?X##UZxw}9`x$>AFh;>jhpV&?7z z$JzV_!PfJ_3yPU4p{~;LKCxN_#XstR*0Z1*p^7{4DdS6O1Jgftr+k~HfhNxbFTVl0 zwnpN6tk;r?L;34(^i8#~irP^WeIQ+0(l}oJVjnYhTqut-hRHwnUz(BL>w9ys!#XS} zwo$l#-Mf3n-j2VwCD4A<3YnZls<$H9=P#kTi86jfB|IivwcDQuJ?-P@{HTjI?W3_` zs+pu6WW1`+@K#pD0CdtqWRQ7U0Q(0l3qrUN#@6<%0H*L})+0wA(x+ar!0X3lL?6x! z?HYC|?bVx@u8i-vjwYFxQ;6ORv9d<)T;z9+ZT_Z9diXt7&XaA=<1A(^k@3Pxw0z8Y z_GoPRa23+89H~&w41qq0v&s3iLEJwpWKuBmBgoh_`6zUsmDADwDHzRo;FSQ#jqpmR zg~o+q3>y${VO4aw@Ts5^VLW7g=%ik&)sU~XVyCE~MSz9qsu+CRa|igdrgLvmp==1M~T!?06Tj)-Gjz~SUJ%3rDiBGike)z8uL$46GWQMarLDd$f`OO)EFf1J!6@Aup){BolAS+elaHT7Yoe+i58`k+rW z;EHem$F`^E#H^x}sw(a&noK!Asm?^;-q0&mA3#lTGMaz{%);_+!Nc#zZ%1HXzyz_C zhwlS$=8o}Sf37nTnq@J|f02}(i|EwB!pm_7)1JXTnWUaRXo5;^pKu*r9b*LG6DTqZ zOS>>IL;VweBmraHxQ@KOCWVOWtcX;rTkG?!YNlksg;WRF z^CW#vXVQWwpoKXYj(>7VL$r>b{#89Jsqw`Hyh13fW2Z1i%5G27gZ)%yMpiyVmw=G-BO+ah*(oRE&k}-8ytGCa>Ap zgk?#W@+53qw>MC9yi^+KSk}J*{TxX!K@6>5;CVD`9ai-MB-mEWRQxapS(_rk(rEu4 zG3d``1-X+3BSS#M3*^ZyERgS(Tpv@13q?O#Z`ZcVf7q;*Ef`Bn2s5U!`p`8H3@bZ) zmqVRC-2$85Ym^V#7o_Pp;fCe;ZS;k#2B8YHE?H9N$ng)M6sW&vOWy~{#RRj2h)7L^ z^m7QqlY+P&;1O@=Kkw-UC-7NgW@m*Nvk_5q#CbXc3qKp(I*Gx#(7PXI6Z=58KygKW zBOb*A#FOZU zvZvMXUfMR>UN64&smT3%Np$_2(40ZEV`{X#zN@Tdz@jH&Lbha={x6;;F^UI$pRSA& z1e>AK5-<2#eR$3M72gUsO!@$nOR8m*J)rH{2lG!_7|XAGQl&@oVOBCPG^U5**wD}@ zz}M2q{!3pVqc6=BGO04go7c7ZqG}iU)B~6`H01j{%V%a zYPwFCYw_qn1$jZ~36c&jy!tS$BF$_TI!Bi#ORJJ+Y1(&ZOgH}Vzti^J*mTUr!<|U< zy=5LGjE)JwS1itLvq7tx@~3Tjd{%Oi_GQ~hp1pP+H8Gt2`L6IJ_5(#O7{jLV2F%H^ z+10!@l~-l3e12TI9Eh{qbcufGT*C2jKAPZvJvD)xMjJlHUL5~Niy#k(E-to5E8l8U zuorOQHO}L`JmQ+oEH5yPnK_;eqsifejH-X262{2-pQO0(evflxs+BcClp64x7Sz-< z?hOv;r}FgH5>e)}K|kmY%9zF{B-v}Q1zNo9?twj$4Eg?WHE6d}Pd7`uwyqwP<>a0f z^vE}&reEv-cK2_4vbf?B#92tvcr^+Mbz8uBTyb2-cscK4)hSw`b2Dzm)P$NJSx)Xg zC=&Qi#_1nWAV`d6OFc7LM6Xb^wsmN?v;JDltFp3ojfQ3lyjw~KY2nAje5T9oqbGk9 zV2)HUIGlJd7khC9a7Fe}eLBfJ`wTGJ)hDn&YYJSAMC&ovOG zi{WJe-2JHWW6h0>*_^Sq`-*gVZhTy54SSHlgB;Lbe9Yri{rCCGsXo)tx6;7u>?~uA zI9)53?H%)=9;ULAV{(?F%xsEQfXwY}nk04T`yu0J*o^%=p_YfqCikaR52(jQ%YbN= zM3KMyzY6~5QYJc1u%y=7`m-LGa+NC>xV5_J9g(ELps}x?2_?_8j z47q4=31`Ni(&EYLTW{l(y>IiC5CEU!VUsQ&9VL)2-3I@}Ik{eEOIcjfy%rNa12e|38$|R9FNX zn!fAo_F0_R&9B=ygv*8kK8CK3Z|G%8nc`rewa_5k1JF3jXZPX!|{le&$t$X&IFAAlr7>dD`XYnhu(v63CB+ut_7 ze!aeyzdSo2+2W3U)bPa#z3?<3yhuE~we73jZS=F2Sz>1=XOj{9CuUm|93ex*jzv9`Zrtq8!h%MDe@}gmW-sF`gqwta)kFNJU28j zu|0ilBKn%dMV7hs^057v6^R1_6q1@rs>_4c@^m4^owV#8Hapk70j44DRvkXnTkRd; zc1a6^fIL3+G=27G^3=a7Mbg^q*)Fd?GCMqt^4tFTGI2&;v0TKq%<3IqSYsO`pQ){= zOMGhf8)F$SS$MwNg4lmE-oI*qU#Pa-rx+SlLQNmr(1OZW23MbNuW#2wvP*;6xYMwh#X{*tKYNNOpM4 z8_V-FbPeSAsMH5sg>%JfrXr2Z%cOIy-?xy#&ZiaMt{BM6HS~<{KiTB7K6uXBKVWY6 zzcv5I`IgG&_8;zIG8j2P`krRCau#rdp6Z_LKMIc`;fRR(h7PF_v9d$AYS%LJ#HH-E z0*XqTe43;h4GU!w(uM_85|mU_kE@>idiI((czN*CJl`4slWOt#C6Zs$C^5RBUJ9-B zdU-4poj>!Q@MTF#l?IsElMW=|Xtt3>r&Dkul~Q!m>mJa@fb#|1swkhh%Oe;?=Fx<2p*5UdkUIS+#aJ-TK+c;d>I+)kGL*EXlR&MF!a!a$im6qQSzl4ADjS;oeO zU4gJ?qin7)BZxXZpwd)$SypC{fJU|Fw3k5n@1!o6gM9~mq&np<7XEta{E=}b=TKgJ z4}mV(hu)u|{xKSbvCxr0e-)VL_XqKD->3~Hs7pA-rTOlDkb7D5@~N9mo$k$HHNnkI zxAX1Ik`H@+P{ZKzGCoOp`NikpTd*!QCpWc2s^qfjvzJw7%q^0)EL&T=BKNKNsZ{_! zx`er^$K!v7NOd#V9PE5weW@)GAg6Z{v)-8*r)jx72>uT>mY|fu+3zwa_d28?#~JBp z-w``3pKx|Th)kU(n+cYnvohO+Y6(#;qC{l0L?`Y$RY*f(vj)2Gd0&EAA^%%lRkx>) z!KEgO=r2FT6=A!ZahxAff5>S%w)%?{F3HDIC@5#$PeVNg1ctyY9~@FOp(FF(!Cb(G zj~jOA(B3GzF3Ypy+dKp5Pmy*l>J@QVB!J1z)ZnsoeLAhjONpSXEN&Z=cjU4cbnhCd)9p1 z=xqD<8(-2G9#;0{T?mJt1J0D-iATT`_1Ccy2bWv0eAteo=v=Me)h9vv8a^Mwg4qV$ zGJIW%M%h!k37AsZELo*#mFXT{7v=jWP-!<+{_dAUYk7oMUv5wD4ftmKGfo470N{Di z4=^p+(g2L%i-uj~hS=*%;;tilU9w%V65vi6xS#>J6=13XY{|bj9SgtxItD-wbaWG3 zn+i`i1!|7Icmz(nj{k-MPNKJAsWchK>0zAf)*08NHG3b$gI|pKn<Wg(;QSTIU{dHe72eJ>o4a?R1wcgSFg@* zSGwE39sm12tlGqjYQ?>sAn`xfy&YM*tbE;m;u&mp1QF9oFe@i%_K<<)%O-T_uI_^{}*@bzuZRL$F2Ie@O1fP3`pI7Tgan7x@88TorSvcmyo zok3JIvIc~q6*L;%B;oYsz79H9!25&ISsL501c6P!W8)KmwuByF$)LdeX^Wc24fs|^ zh)cE8pm?j-WKgr-v>i^)!AxT3I>?T@FJVxs%yL&wWrx&}m9Cu-0&`D6g!`+@I%6mq z#RnKUF3{*En!O)eIs3E>y{h;WCXrCkd~#~l|q4W6c~8I>Oh=x5(JTWN)Jt?HjK zq7Jz5uy8Q%M5yhK%oC`q$PK&@J6G#30jH45mNu&Oo+_Ev(NR< zUd|y5FxXF#=|$Cdz7_MmnPF+A_CJ$EDtY0Z{7MewM7VGLH(3k+JlDUt^J8CX!AONVeT#meqD-A}d{#yPtI7a>4MMl8r zOIQ5T?zehjDbla;b9~I*dJqh8%Kq&qkucM_K~iqLY;C7EqvL7dh9t{nlN*g_+{1g^ zA@?~5C1{*fYkb*sm*o5K-M5M`$!Rto$~mo!xiG&!Z#kVp;Y;^@^s~V|dXT}1(ltyB zvl8XYFb9sfh<$sF#@>dJ@PP74Crq`McuC7@eV?r|FWS_#fZQRq5w2aE{AoE6q$yZ6 zTeYT9SolEE60tCW`q7+BWOWS?Ik^Kk27owJvj==?zScPND5+zc^DPhlHtfm7chaB)Z-Up85rfS|n#X6fzEx3C&a;W^gFKkv!Rby$Ktr#+(m*>+hD zCiCcOMz*Viya}r(zOxO}UR<{R%bQ$|H_RRoL>rc`C=xtgic-4F@-R;E~if; za>^^Mu4%ntAeYpvD%8GPM-U5!^*w=GYSuG4>LJ;X%o7dl{d?wS4jSX`zY%Z<=UAER zVup&$IsmOKp}Qw7Ilme^u*6bP#^H_uz%%$ZHs5|f|UTywgc1okht}=Ej$)9 zm-lkN|9nMTb+QgoL;~}+Up(PbN(W{Gj20L};Gzo3HQg~^fWLMCjNQW*2S2KpZQCjO zz`WjW?8b@swZ%0APMsQMxj2`PY0kf+v9sIJ`(6`w!WvR1U(jar(N-l5&|u{#`@<&; zoEOC!=bq+WRf{A9O35`)Td!lk6laDr-9vx1u&J}r#wJ>1=D`+ElnFq?RmH4RC#kCl zANSwU0dTY~g#VpjHWX5SYZrNk)v$2iccZPw6bexI0t?EOkns7`n0EHs=2W7_Ky`F( z6G9lxm+nxwL-T_1AI^l~Pj~EIn+~SLYMvyx^Y#^Ak`LQ3pFU5jgn&LB?XWNWp^2i= z8Z1 zIy-=Gn6N&yvSBXAQ)%TZ_#+UYDL!8mz_aNZfv?l4j6ld{&J3*R3DoAfM-_tiE7?QAprky<3+(~DjizZVht8)X&koye?=6LRf z!KVctOL~i7-mp#%3(yM5+;i8MpZkb1*ALb>>u2@rP6FKRoVDy;>?=NZ1;k_<8VZy^ zTei_(5v*(HwPf`t>x;vE;@a+*EqNxU>HVg`STamqD>*zYEMY* zHsxjYvq2AjO%&?15FIC%e#d0R#+tm$&Q?r!u)=jZJ$1qG$ApMu=Z4(2-^ebBmCU}= z2FIU4<(JDDbTN0h9R{Qmg}Fp$C2d zF=^cUMc!XL=zhs$%$mc3&Vwm_F_e)n-UvZW=ok9Hxo-4`}*Yxl#-T?-cN4Ad3VdFw|&BSx#(9v9EAZd2GE_j{y*Wgze;Vm2ct zrBjW^&{u-VADd5VCnW1+94->a7-SEttBH&15 zN*qX$0J?-MP4o45E#V%qG;Rn~YhR>g?7+!<`k(I1x)vlOYlA&Wb`nJKr%ncX@b_-8 zd&ra7GT5l>?gLrYdvLQT{=uqtf{#AaTgbV==;S7VPZuQ|EK zhzEc26v~xE>9dWQR$6D|e`ewSR`{sLBNT2fen8s1B`-O)AM3fa-I%oOKsOCQ$EA(* zznC^HdFG_W8z?or;7j_YJcYk-d&|Vu{z-?FI}av1G}=x}VY`MgzrW_9mdpM~Q_`Se z?-$)BX5)F9L?R`SdCNe3@Glrv+Vrh$=K6Utuljwec2Xeb00>+tWK*7LAvW=&mqVst z$!?N-`hy)=n=yxK_i+_v}63`Du#Z2!L?NWw|8e$&{br>QzoL*+xl(RC=I}&I|B+^&-vj4n^t< z7$V0T3&sF(ElDuhV`WSgs6P_lxlEwr5$<-;;|DzaC+v7(YQT4)mC6$Lvpp|*(=GC3 zNDd)M=|$BMBu?Fth4i`ATI|XM5-5}8u5SCKC?H;xRSs#o$#eAJ8LLhkcQk(`^L<$8 z!a|y&1_lKfk!M?Ed&ufJCyjsz6%Vzpk#be9bjI=QCLmu4Y1bZ>^8o-;F?&2V*4j+V zIXCPaG2q}nDxZ#>L$uYn?^9aJ20P7tu(J^VUBgd`?{RFuRaBkJ9Sf4=TweMsFt+ng zrpD^UxsG!$aJ9um?xhdlkFuMZUw!e*X_vJFlcRI3iq(_;jonDzpEwuB&3^1?GJrT{ z^U1#HD#tuc&02uzEX5wVw+0HsMxWsPazt!pCpz|ih3=X6RI3;GL#}zMX1l5ZTRgtc z)rTLGR$}-pOWpQaVy#SqR=gf{*}7RL%&zn414->#sGH~uzN>Z0v+*`YZf_)qpTYVc zcqM@lx@=rz-L2Mow0fjQ%C?wKKS1`C2HUWrKHb|~Nf^|DS!?N1!AOSH?< zycEMa;_ADW_tdMFbL^C0uP`sR+RL*JIIA&p^*z}BhYLe`ELBOvb!=Q`Q@dxmt58GS zf`HNE9M>n^y(J``Y2%Z`OV4_$Us%ck`iUX74fr1nznG#*belN(oMJQ!3m;RA_bmKD z9R%Dz)*%%fpwYlCwI++CgDS$kjUIg=A>`yY8++UY%Xn$o7gugZrhDa@dajvXT+Q?CM^nSyN>} z-;mg&>jghCiR8gn%;BJ$drj}EcjMCTQnqeQSD=xAvsX4nlUHE#)}W;zF~fqmX5?s$ z2k&%|YziJI5FS&{m3(EMP2`6$73Q4UmbTc&&f@16dhWTOsjKV-*8Fm61v)((aHzK9 z-opl4#5~dDg2^34){BvLTK9joc=EfF<_3jwGe5_zv&8Ow=S=T9mstQy$p?gdvGzf% zWBm!onII`1&iCww6aAbGK6yOazWGqw>n}PZjdd%w@e-8%M|-e_c~E!w>A4DMZJtgu zqN*|kLy#YxRm%)Xbf z?P@jOK+V$10jl%K{h=#e@2Y|%AauiY^}(D~xpy{z%D4_SLAf&Cn%&9(om0d2Q5 zz%}^cQXE_tYO{EoXF*;+^;VWp*yu4Wt3m|*-`&&DPKQopZ82XG-xA$JfDSTo-Buo1 z?CIl1CS=xa9-rUpMCZgy@!edm1Ca3w8?gT~P#EFVKBvCNg@hf7AeZ>xg#PH8UF)ce zRQYTDjjAKzZp-QiJ+3=?t1bknK)VgOUC;OWNBCjeXS(M-=fMoMp0vkxG~od+ zHJd~@ujhx!J7mT2;uv6{kD1S-{(n6BB$R11#kg{Niy(>caQQ)ay{s8HI2mdpDW$n( ze_+Fx2pLBtvJFqcJAV#8+W!2C2x$pACst={24{K?1PdK6+Triq{=k&2YzlM)18q5N zrghEdV0`TIb)IF^b~}?;*4nGeOwH9%eZBwpIKablPDK0Y^zFb>W}0e`raMds+4$f$JpLJDf$9vFcTD#| ziLB90Of8{lOFP89){hi${q7*%I-=B7(vEROzHzlK4rC}hf0rFTb+#V0RgnzG8tHVJ z^tFzLjOCq0$~*7<)jvcJp9-*a-@O2|FJ*jk2;e>{lD~;91|~$-xPE-1^~9u%UKj8A zemP_s$-h^W(%5nUMBW28x1iR9AETV;=8XLaHkKQRoF{ei{-N-()izX#}}y77?o?(5$G z*{^#EfNn%>BQX-+r!04s7=>2oIAuZA;UO`B$3J)Uz|PRZZPM;%dP%95P5>lI|xJseB@? zz591w?NxKLBod%PM;sR)g;xw#rDnhzn=+m)Zb0RLDX?jRf6@)60yD4Vwz7#9y zjTQ=1=TJi2K6yhV?O(vY+ps4i@}{ugeIKBw|HA-`PTV;@QZq49G0IGgxy@q<|E!@E zik_JVl%N-j8zLsvFI;%{?%`QfnzDq&g)4MCXG8i`!F{BRiMWP`hZAgY1g&vmyu7^F zA|+q*?!pG9k}A{z_uad9E1kCeo8MGh@~q1gXC!chy4chF0!TwiI@E>L}C2!6ZgD7em8X8~EVa?zF4ktrVNh<02%lOD=3)PJG@Jul9 zgh38`05~97>z&{^NJXIzubNf)_B@8`ef7qDuX&wxxU7spTJn6Ok6?ar# z$aU`57kVwPh!~=(aeIzunPhBt??P&~9*T%Mu~*+I3hhL$I_T@YO1t;2rZ6f*wp}-! z&G$T;LN(xf=J4L`xvYWazk@M=Ro$|$(lM8O-DK3$!5TC?G!*{dOR=#0p3~24-i%)X z{FJ@LXnpR8)l^V6Fd7ApeXHjM{-fGd=tj1OA*ADMruP@YZ;HC69X z6iHz!(E-uSld``SJ1BW$fmsD6Q6;u=OTMtxrXl_E0qF*C-xdr+<@??5?=}A*J}7Ln zg`fje9yK(NihsOmbEhHaAE)GO*ODe6ks{$Uu)6B+UssWRHefFbw8Ct z>}dt5x%kISxx6T%TXKrO0+v0`pT{vU0jAYqbNEa!(6JFVDvnH~%%>Mfm{vaAz(|~p z*=io32vM}Si_CMd=?L2Q^bs*z_yBoOwB=*e13DOx5{X1a)-g}c+KV=Fty9xYgBy0i z?{jB}F1)Cbg>>TS4rhxy+IHYYc9q&fBVV>71-f`Ulo6?)O8u_v3}kx;^^LtDNZu`7=gqh6^ZFVDN1@=(j538o&1b`Zup$@2c_mv#5W_JB?p{yqBTNm=Jk)*Lc1&75AcZ*r^yqFpqLsLngTb z8`EEd#>jzk~Tq;FgO}CEEdDKznM4UCezBW5+iSP6o zIffC)d+J9wOVYd)6%pC5%z8OEIOzT})Doj(mBJiGCZ=K@Z%?Ag9rAj0!QfzBKD~X< z(5`G^Yh2G1b{c-m&k_TdBl(V~ zo6teM0uBl}V?uV~;d{m70%?theV3Qr$283kTs)psod98Yt7T+0dliTpkbs4s(uODJ zH@mk#T05h*hgGkloud0o?H4t6vHA;&LeNnU$0Q0uCJzUujHhvv)PcA>3BG0 zB$AZdqIl;|G&yL0srhI%f2#AW(vp38DL!V3Pv4KxoVcKR?zHXhr)NGVElIQYpRQ2W zN*XUVd#|ai-JCT?UciU<0LJm(VwvNg-xyH+gZ~P#n*nD6|3>qKYrD=@Xd=$w#3u*3 z6*tX%`f$lR{Y7wZ{*RMeXrLDO{gXuPZ*Sx?;jKTPcr&h61yG(#_{ph7qU(+bYhs~q zej)z=7Cmap`6mDNTGxw_EApTB&F)nA^`6ZwoY;xk#W5cl6vF<|-MmK`i5~aQmFkGN z!bM)=IJ*HahSt}Yt=>;jGX5xR!_tNm$}=yD$G?9LYi?|?fTlK$UjLNE>yW;c`~j}(eA&zS#L>H?o73@*QfrD;f`=bf&w%1OhGgG~ zB5n>J1)5iWsc0r^tZ=-EcYoDSIY-5;I@+w@vUiycD3s~CW{+9;-i&rVDoGroQdN*>!1pX{=S4KUHnN*d}p&suvqC-H?y8qKL&Qqrsj;XU-McS1VLtPHkD zmONrG%@|7V>V$k2t`@+An5`vI<^!!|UC<`+u_Vrw@ej-3S#JvB-u?nDh2Y$De6Rci z54tK3;`y{wi*cqqHW@`gC$eV|i-};W8=`5ZMOvE77e?nV@Z81q8Q3JeZ4t$3O&z_{jclXx4yU~x$})*&}y`8F5nLEqyONcc8#X(^Zx_W0nWAn diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/utah/index.html b/libs/js/jquery-geo-1.0b2/docs/examples/utah/index.html deleted file mode 100755 index a51d564..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/utah/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - Atlas Utah! - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/jquery.watermark.min.js b/libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/jquery.watermark.min.js deleted file mode 100755 index 4cc6e43..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/jquery.watermark.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - Watermark v3.1.3 (March 22, 2011) plugin for jQuery - http://jquery-watermark.googlecode.com/ - Copyright (c) 2009-2011 Todd Northrop - http://www.speednet.biz/ - Dual licensed under the MIT or GPL Version 2 licenses. -*/ -(function(a,h,y){var w="function",v="password",j="maxLength",n="type",b="",c=true,u="placeholder",i=false,t="watermark",g=t,f="watermarkClass",q="watermarkFocus",l="watermarkSubmit",o="watermarkMaxLength",e="watermarkPassword",d="watermarkText",k=/\r/g,s="input:data("+g+"),textarea:data("+g+")",m="input:text,input:password,input[type=search],input:not([type]),textarea",p=["Page_ClientValidate"],r=i,x=u in document.createElement("input");a.watermark=a.watermark||{version:"3.1.3",runOnce:c,options:{className:t,useNative:c,hideBeforeUnload:c},hide:function(b){a(b).filter(s).each(function(){a.watermark._hide(a(this))})},_hide:function(a,r){var p=a[0],q=(p.value||b).replace(k,b),l=a.data(d)||b,m=a.data(o)||0,i=a.data(f);if(l.length&&q==l){p.value=b;if(a.data(e))if((a.attr(n)||b)==="text"){var g=a.data(e)||[],c=a.parent()||[];if(g.length&&c.length){c[0].removeChild(a[0]);c[0].appendChild(g[0]);a=g}}if(m){a.attr(j,m);a.removeData(o)}if(r){a.attr("autocomplete","off");h.setTimeout(function(){a.select()},1)}}i&&a.removeClass(i)},show:function(b){a(b).filter(s).each(function(){a.watermark._show(a(this))})},_show:function(g){var p=g[0],u=(p.value||b).replace(k,b),h=g.data(d)||b,s=g.attr(n)||b,t=g.data(f);if((u.length==0||u==h)&&!g.data(q)){r=c;if(g.data(e))if(s===v){var m=g.data(e)||[],l=g.parent()||[];if(m.length&&l.length){l[0].removeChild(g[0]);l[0].appendChild(m[0]);g=m;g.attr(j,h.length);p=g[0]}}if(s==="text"||s==="search"){var i=g.attr(j)||0;if(i>0&&h.length>i){g.data(o,i);g.attr(j,h.length)}}t&&g.addClass(t);p.value=h}else a.watermark._hide(g)},hideAll:function(){if(r){a.watermark.hide(m);r=i}},showAll:function(){a.watermark.show(m)}};a.fn.watermark=a.fn.watermark||function(p,o){var t="string";if(!this.length)return this;var s=i,r=typeof p===t;if(r)p=p.replace(k,b);if(typeof o==="object"){s=typeof o.className===t;o=a.extend({},a.watermark.options,o)}else if(typeof o===t){s=c;o=a.extend({},a.watermark.options,{className:o})}else o=a.watermark.options;if(typeof o.useNative!==w)o.useNative=o.useNative?function(){return c}:function(){return i};return this.each(function(){var B="dragleave",A="dragenter",z=this,i=a(z);if(!i.is(m))return;if(i.data(g)){if(r||s){a.watermark._hide(i);r&&i.data(d,p);s&&i.data(f,o.className)}}else{if(x&&o.useNative.call(z,i)&&(i.attr("tagName")||b)!=="TEXTAREA"){r&&i.attr(u,p);return}i.data(d,r?p:b);i.data(f,o.className);i.data(g,1);if((i.attr(n)||b)===v){var C=i.wrap("").parent(),t=a(C.html().replace(/type=["']?password["']?/i,'type="text"'));t.data(d,i.data(d));t.data(f,i.data(f));t.data(g,1);t.attr(j,p.length);t.focus(function(){a.watermark._hide(t,c)}).bind(A,function(){a.watermark._hide(t)}).bind("dragend",function(){h.setTimeout(function(){t.blur()},1)});i.blur(function(){a.watermark._show(i)}).bind(B,function(){a.watermark._show(i)});t.data(e,i);i.data(e,t)}else i.focus(function(){i.data(q,1);a.watermark._hide(i,c)}).blur(function(){i.data(q,0);a.watermark._show(i)}).bind(A,function(){a.watermark._hide(i)}).bind(B,function(){a.watermark._show(i)}).bind("dragend",function(){h.setTimeout(function(){a.watermark._show(i)},1)}).bind("drop",function(e){var c=i[0],a=e.originalEvent.dataTransfer.getData("Text");if((c.value||b).replace(k,b).replace(a,b)===i.data(d))c.value=a;i.focus()});if(z.form){var w=z.form,y=a(w);if(!y.data(l)){y.submit(a.watermark.hideAll);if(w.submit){y.data(l,w.submit);w.submit=function(c,b){return function(){var d=b.data(l);a.watermark.hideAll();if(d.apply)d.apply(c,Array.prototype.slice.call(arguments));else d()}}(w,y)}else{y.data(l,1);w.submit=function(b){return function(){a.watermark.hideAll();delete b.submit;b.submit()}}(w)}}}}a.watermark._show(i)})};if(a.watermark.runOnce){a.watermark.runOnce=i;a.extend(a.expr[":"],{data:function(c,d,b){return!!a.data(c,b[3])}});(function(c){a.fn.val=function(){var e=this;if(!e.length)return arguments.length?e:y;if(!arguments.length)if(e.data(g)){var f=(e[0].value||b).replace(k,b);return f===(e.data(d)||b)?b:f}else return c.apply(e,arguments);else{c.apply(e,arguments);a.watermark.show(e);return e}}})(a.fn.val);p.length&&a(function(){for(var b,c,d=p.length-1;d>=0;d--){b=p[d];c=h[b];if(typeof c===w)h[b]=function(b){return function(){a.watermark.hideAll();return b.apply(null,Array.prototype.slice.call(arguments))}}(c)}});a(h).bind("beforeunload",function(){a.watermark.options.hideBeforeUnload&&a.watermark.hideAll()})}})(jQuery,window); \ No newline at end of file diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/modernizr-1.7.min.js b/libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/modernizr-1.7.min.js deleted file mode 100755 index 6f54850..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/utah/js/libs/modernizr-1.7.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Modernizr v1.7 www.modernizr.com -window.Modernizr=function(a,b,c){function G(){e.input=function(a){for(var b=0,c=a.length;b7)},r.history=function(){return !!(a.history&&history.pushState)},r.draganddrop=function(){return x("dragstart")&&x("drop")},r.websockets=function(){return"WebSocket"in a},r.rgba=function(){A("background-color:rgba(150,255,150,.5)");return D(k.backgroundColor,"rgba")},r.hsla=function(){A("background-color:hsla(120,40%,100%,.5)");return D(k.backgroundColor,"rgba")||D(k.backgroundColor,"hsla")},r.multiplebgs=function(){A("background:url(//:),url(//:),red url(//:)");return(new RegExp("(url\\s*\\(.*?){3}")).test(k.background)},r.backgroundsize=function(){return F("backgroundSize")},r.borderimage=function(){return F("borderImage")},r.borderradius=function(){return F("borderRadius","",function(a){return D(a,"orderRadius")})},r.boxshadow=function(){return F("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){B("opacity:.55");return/^0.55$/.test(k.opacity)},r.cssanimations=function(){return F("animationName")},r.csscolumns=function(){return F("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";A((a+o.join(b+a)+o.join(c+a)).slice(0,-a.length));return D(k.backgroundImage,"gradient")},r.cssreflections=function(){return F("boxReflect")},r.csstransforms=function(){return!!E(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},r.csstransforms3d=function(){var a=!!E(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=w("@media ("+o.join("transform-3d),(")+"modernizr)"));return a},r.csstransitions=function(){return F("transitionProperty")},r.fontface=function(){var a,c,d=h||g,e=b.createElement("style"),f=b.implementation||{hasFeature:function(){return!1}};e.type="text/css",d.insertBefore(e,d.firstChild),a=e.sheet||e.styleSheet;var i=f.hasFeature("CSS2","")?function(b){if(!a||!b)return!1;var c=!1;try{a.insertRule(b,0),c=/src/i.test(a.cssRules[0].cssText),a.deleteRule(a.cssRules.length-1)}catch(d){}return c}:function(b){if(!a||!b)return!1;a.cssText=b;return a.cssText.length!==0&&/src/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(b.split(" ")[0])===0};c=i('@font-face { font-family: "font"; src: url(data:,); }'),d.removeChild(e);return c},r.video=function(){var a=b.createElement("video"),c=!!a.canPlayType;if(c){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return c},r.audio=function(){var a=b.createElement("audio"),c=!!a.canPlayType;c&&(c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;"));return c},r.localstorage=function(){try{return!!localStorage.getItem}catch(a){return!1}},r.sessionstorage=function(){try{return!!sessionStorage.getItem}catch(a){return!1}},r.webWorkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");a.innerHTML="";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var H in r)z(r,H)&&(v=H.toLowerCase(),e[v]=r[H](),u.push((e[v]?"":"no-")+v));e.input||G(),e.crosswindowmessaging=e.postmessage,e.historymanagement=e.history,e.addTest=function(a,b){a=a.toLowerCase();if(!e[a]){b=!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b;return e}},A(""),j=l=null,f&&a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="";return a.childNodes.length!==1}()&&function(a,b){function p(a,b){var c=-1,d=a.length,e,f=[];while(++cspan").text("" + geo.coordinates); - } - } ); - - $("input[value='UtahBaseMap-Lite']").prop("checked", true); - - $("#pnlSearch form").submit(function (e) { - e.preventDefault(); - - var address = $(this).find("input").val().replace(/,\s*UT/i, ""), - addressParts = address.split(","); - - if (addressParts.length >= 2) { - address = address.replace(addressParts[addressParts.length - 1], "").replace(",", ""); - $.ajax({ - url: "http://mapserv.utah.gov/wsut/Geocode.svc/appgeo/street(" + $.trim(address) + ")zone(" + $.trim(addressParts[addressParts.length - 1]) + ")", - dataType: "jsonp", - success: function (result) { - $("#map").geomap("option", { - center: [result.UTM_X, result.UTM_Y], - zoom: 13 - }); - }, - error: function (xhr) { - displayMessage(xhr.statusText); - } - }); - } else { - displayMessage("Please enter both a street address and either a city or zip separated by a comma"); - } - - return false; - }); - - $("#pnlSearch input").watermark("street addres, city or zip"); - - $.geo.proj = null; - $("#map").geomap(options); - - function displayMessage(msg) { - $("#infoBar").html(msg).fadeTo(0, 1.0).delay(5000).fadeOut("slow"); - } - - function makeService(name, tileSize) { - return { - services: [ - { - type: "tiled", - src: "http://mapserv.utah.gov/ArcGIS/rest/services/" + name + "/MapServer/tile/{{:zoom}}/{{:tile.row}}/{{:tile.column}}", - attr: "© AGRC" - } - ], - tilingScheme: { - tileWidth: tileSize, - tileHeight: tileSize, - pixelSizes: [ - 4891.96999883583, - 2445.98499994708, - 1222.99250010583, - 611.496250052917, - 305.748124894166, - 152.8740625, - 76.4370312632292, - 38.2185156316146, - 19.1092578131615, - 9.55462890525781, - 4.77731445262891, - 2.38865722657904, - 1.19432861315723, - 0.597164306578613, - 0.298582153289307 - ], - origin: [-5120900, 9998100] - } - } - } -}); diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/voting.html b/libs/js/jquery-geo-1.0b2/docs/examples/voting.html deleted file mode 100755 index 8d5c029..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/voting.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - Voting districts example - - - - - - - - - -
        -
        -
        -
        - -
        -
        - basemap transparency -
        -
        -
        - demographic color -
        -
        -
        -
        -
        -
        -
        -
        -

        Voting Districts by %

        -
        - - - - - -
        -

        -
        -

        Once the data has loaded (which may take a while, even on broadband connections), you can dynamically change the demographic display color. You can also click a voting district to zoom in and see details.

        -
        -
        -
        - - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/wkt.html b/libs/js/jquery-geo-1.0b2/docs/examples/wkt.html deleted file mode 100755 index 20a05c3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/wkt.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - WKT parse/stringify example - - - - - - - - - -
        -
        -
        -
        - < docs -

        WKT parse & stringify

        -

        This example uses $.geo.WKT.stringify to turn your drawn GeoJSON objects into WKT. The Parse button uses $.geo.WKT.parse to read valid WKT from the text box and add shapes to the map.

        -
        -POINT (-71.070554128125 42.36859979580157)
        -LINESTRING (-71.570554128125 42.36859979580157, -71.63097893281248 42.47605758571917, -71.3645604757813 42.50036207893463)
        -POLYGON ((-71.070554128125 42.36859979580157, -71.13097893281248 42.47605758571917, -70.8645604757813 42.50036207893463))
        -MULTIPOINT (-71.070554128125 42.36859979580157, -71.13097893281248 42.47605758571917, -70.8645604757813 42.50036207893463)
        -MULTIPOINT ((-71.070554128125 42.36859979580157),(-71.13097893281248 42.47605758571917),(-70.8645604757813 42.50036207893463))
        -MULTIPOLYGON (((-71.070554128125 42.36859979580157, -71.13097893281248 42.47605758571917, -70.8645604757813 42.50036207893463)))
        -MULTILINESTRING ((-71.070554128125 42.36859979580157, -71.13097893281248 42.47605758571917, -70.8645604757813 42.50036207893463))
        -GEOMETRYCOLLECTION (POINT (-71.070554128125 42.36859979580157),LINESTRING (-71.570554128125 42.36859979580157, -71.63097893281248 42.47605758571917, -71.3645604757813 42.50036207893463),POLYGON ((-71.070554128125 42.86859979580157, -71.13097893281248 42.97605758571917, -70.8645604757813 43.00036207893463)))
        -
        - - - -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/xkcd.html b/libs/js/jquery-geo-1.0b2/docs/examples/xkcd.html deleted file mode 100755 index 2967172..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/xkcd.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - xkcd - Click and Drag - - - - - - - -
        -
        -
        -
        - -

        Click and Drag

        -

        The xkcd comic as a jQuery Geo map.

        -

        Tiles created by @dividuum

        -
        -
        - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/examples/zoom.html b/libs/js/jquery-geo-1.0b2/docs/examples/zoom.html deleted file mode 100755 index aa5d5f9..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/examples/zoom.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - zoom example - - - - - - - - - -
        -
        -
        -
        - < docs -

        - zoom

        -

        - This example uses the zoom method (as opposed to the zoom option) to change the zoom by relative amounts. Input a number of levels by which to change and click zoom. Negative values zoom out.

        - -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/area.html b/libs/js/jquery-geo-1.0b2/docs/geo/area.html deleted file mode 100755 index 6b0eb2d..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/area.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - area | $.geo - - - - - - - - - - - -
        -
        -

        area

        -
        - -
        - - - - - - - - - - - - - -
        return typeNumber
        syntax$.geo.area( Object shape ( GeoJSON object ) )
        usage
        var area = $.geo.area( {
        -      type: "Polygon",
        -      coordinates: [[
        -        [-75, 39.7],
        -        [-74.8, 39.3],
        -        [-75.2, 39.3],
        -        [-75, 39.7]
        -      ]]
        -} )
        -

        The area method calculates the area of a basic GeoJSON geometry object and returns it in non-geodetic units. The basic shapes are Point, LineString and Polygon. If you are using geomap with its default map service, the area is in square meters because the default projection is web mercator meters.

        -

        While you can pass any basic geometry, this function returns the area of Polygon objects and 0 for objects of other shape types.

        -

        If the argument is not a basic GeoJSON geometry object, this function returns undefined.

        -

        This function is similar to Geometry.getArea in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/bbox.html b/libs/js/jquery-geo-1.0b2/docs/geo/bbox.html deleted file mode 100755 index 8ac16c2..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/bbox.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - bbox | $.geo - - - - - - - - - - - -
        -
        -

        bbox

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON bounding box )
        syntax$.geo.bbox( Object shape ( GeoJSON object ) )
        usage
        var bbox = $.geo.bbox( {
        -  type: "LineString", coordinates: [
        -    [ -71, 40 ], [ -70.5, 41 ]
        -  ]
        -} )
        -

        The bbox method calculates the smallest box that will contain all the positions in the passed-in shape. The shape can be any GeoJSON geometry object from Point to GeometryCollection.

        -

        The GeoJSON spec allows for each geometry type to have a bbox property. The $.geo.bbox method will honor that property and assume it is accurate. It will return the value of that property before attempting to calculate the bbox itself. If you wish to force $.geo.bbox to calculate the bbox, you will have to manually delete the bbox property from the geometry object.

        -
        var shape = {
        -  type: "LineString", coordinates: [
        -    [ -71, 40 ], [ -70.5, 41 ]
        -  ],
        -  bbox: [ -71, 40, -70.5, 41 ]
        -};
        -var bboxFromProperty = $.geo.bbox(shape);
        -delete shape.bbox;
        -var calculatedBbox = $.geo.bbox(shape);
        -
        -

        If the argument is not a basic GeoJSON geometry object, this function returns undefined.

        - -

        This function is similar to Geometry.getEnvelope in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/center.html b/libs/js/jquery-geo-1.0b2/docs/geo/center.html deleted file mode 100755 index 71fe04c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/center.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - center | $.geo - - - - - - - - - - - -
        -
        -

        center

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON position )
        syntax$.geo.center( Array bbox ( GeoJSON bounding box ) )
        usage
        var bboxCenter = $.geo.center( bbox )
        -

        The center method calculates the center of a bbox and returns it as a GeoJSON position.

        -

        It operates on bounding boxes and should not be confused with the centroid function, which operates on GeoJSON geometry objects.

        -

        This function is called Envelope.centre in JTS (I assume because JTS is built in British Columbia).

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/centroid.html b/libs/js/jquery-geo-1.0b2/docs/geo/centroid.html deleted file mode 100755 index 76fa16c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/centroid.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - centroid | $.geo - - - - - - - - - - - -
        -
        -

        centroid

        -
        - -
        - - - - - - - - - - - - - -
        return typeObject ( GeoJSON Point )
        syntax$.geo.centroid( Object shape ( GeoJSON object ) )
        usage
        var centroid = $.geo.centroid( {
        -      type: "Polygon",
        -      coordinates: [[
        -        [-75, 39.7],
        -        [-74.8, 39.3],
        -        [-75.2, 39.3],
        -        [-75, 39.7]
        -      ]]
        -} )
        -

        The centroid method calculates the center of mass for the passed-in basic GeoJSON geometry object. The basic geometry types are Point, LineString and Polygon.

        -

        Technically, only Polygons can be considered to have mass. However, a centroid can be calculated for other geometry types. This method operates on LineStrings as if they were closed polygons and the centroid will likely not lie along the line. The centroid of a Point is a clone of the Point.

        - -

        If the argument is not a basic GeoJSON geometry object, this function returns undefined.

        -

        This function is similar to Geometry.getCentroid in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/contains.html b/libs/js/jquery-geo-1.0b2/docs/geo/contains.html deleted file mode 100755 index 0492f68..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/contains.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - contains | $.geo - - - - - - - - - - - -
        -
        -

        contains

        -
        - -
        - - - - - - - - - - - - - -
        return typeBoolean
        syntax$.geo.contains( Object shape1 ( GeoJSON object ), Object shape2 ( GeoJSON object ) )
        usage
        var contains = $.geo.contains(
        -  {
        -    type: "Polygon", coordinates: [[
        -      [-71.06, 42.3425],
        -      [-71.06, 42.3475],
        -      [-71.04, 42.3475],
        -      [-71.04, 42.3425],
        -      [-71.06, 42.3425]
        -    ]]
        -  },
        -  { type: "Point", "coordinates": [ -71, 40 ] }
        -)
        -

        The contains method determines if the first basic GeoJSON geometry completely contains a second one. The basic shapes are Point, LineString and Polygon however Point and LineString geometries cannot contain other geometries so the only situation that has a possibility of returning true is when the first argument is a Polygon.

        -

        If either argument is not a basic GeoJSON geometry object, this function returns undefined.

        -

        This function is similar to Geometry.contains in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/distance.html b/libs/js/jquery-geo-1.0b2/docs/geo/distance.html deleted file mode 100755 index 1041843..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/distance.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - distance | $.geo - - - - - - - - - - - -
        -
        -

        distance

        -
        - -
        - - - - - - - - - - - - - -
        return typeNumber
        syntax$.geo.distance( Object shape1 ( GeoJSON object ), Object shape2 ( GeoJSON object ) )
        usage
        var distanceBetween = $.geo.distance(
        -  { type: "Point", "coordinates": [ -71, 40 ] },
        -  { type: "Point", "coordinates": [ -70.5, 41 ] }
        -)
        -

        The distance method calculates the distance between two basic GeoJSON geometry objects and returns it in non-geodetic units. The basic shapes are Point, LineString and Polygon. If you are using geomap with its default map service, the distance is in meters because the default projection is web mercator meters.

        -

        If either argument is not a basic GeoJSON geometry object, this function returns undefined.

        -

        This function is similar to Geometry.distance in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/expandBy.html b/libs/js/jquery-geo-1.0b2/docs/geo/expandBy.html deleted file mode 100755 index 21684f2..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/expandBy.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - expandBy | $.geo - - - - - - - - - - - -
        -
        -

        expandBy

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON bounding box )
        syntax$.geo.expandBy( Array bbox ( GeoJSON bounding box ), Number dx, Number dy )
        usage
        var largerBbox = $.geo.expandBy( bbox, 20, 20 )
        -

        The expandBy method creates a new bbox with the same center as the original but having a width and height that is modified by the dx and dy arguments respectively.

        -

        The dx and dy arguments are non-geodetic map units. If you are using geomap with its default map service, these are in meters because the default projection is web mercator meters. If, for example, you are working in a different projection such as NAD83 / New Jersey feet, this function will expand or contract the bbox by feet.

        -

        The dx and dy arguments can be positive, negative or zero and will modify the width or height of the bbox accordingly.

        -

        This function is similar to Envelope.expandBy in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/height.html b/libs/js/jquery-geo-1.0b2/docs/geo/height.html deleted file mode 100755 index eb5cf46..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/height.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - height | $.geo - - - - - - - - - - - -
        -
        -

        height

        -
        - -
        - - - - - - - - - - - - - -
        return typeNumber
        syntax$.geo.height( Array bbox ( GeoJSON bounding box )
        usage
        var height = $.geo.height( [ -71.1, 42.3, -71.0, 42.4 ] )
        -

        The height method returns the true height of a bbox in non-geodetic map units. If you are using geomap with its default map service, the height is in meters because the default projection is web mercator meters.

        -

        This function is similar to Envelope.getHeight in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/include.html b/libs/js/jquery-geo-1.0b2/docs/geo/include.html deleted file mode 100755 index 8288a4c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/include.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - include | $.geo - - - - - - - - - - - -
        -
        -

        include

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON bounding box )
        syntax$.geo.include( null | Array bbox ( GeoJSON bounding box ), Array position ( GeoJSON position ) | Array bbox ( GeoJSON bounding box ) )
        usage
        var bboxOfCoord = $.geo.include( null, [ -70, 42 ] );
        -var sameAsSecondArgument = $.geo.include( null, [ -71, 41, -69, 43 ] );
        -var includeCoord = $.geo.include( bbox, [ -70, 42 ] );
        -var includeBbox = $.geo.include( bbox, [ -71, 41, -69, 43 ] );
        - -

        The include method expands a bbox to include either a coordinate or another bbox. The expanded bbox is returned.

        - -

        If the first argument is null or undefined, the result is a new bbox and will contain the second argument.

        - -

        For efficency, if the first argument is a valid bbox, it is modified in-place and a reference is returned.

        - -

        If the second argument is not a coordinate or bbox, this function returns the first argument.

        - -

        This function is similar to Envelope.expandToInclude in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/index.html b/libs/js/jquery-geo-1.0b2/docs/geo/index.html deleted file mode 100755 index c86e8cc..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/index.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - geo namespace | $.geo - - - - - - - - - - - -
        -
        -

        geo namespace

        -
        - -
        -

        The $.geo namespace contains all geometry functions implemented in the plugin and an object having the plugin's four projection functions.

        -

        projection

        -

        The $.geo namespace has a property named proj which is a JavaScript object having four functions: fromGeodetic, fromGeodeticPos, toGeodetic, and toGeodeticPos. These four functions allow all $.geo static bbox/geometry functions, geomap widget properties, geomap widget events & geomap widget methods (collectively referred to as plugin functions from now on) to work in geodetic (lon, lat) coordinates.

        - -

        geometry operations

        -

        Geometry isn't much fun if you can't do anything with it. These functions help you analyze and manipulate bounding boxes and GeoJSON geometry objects. You call them directly from the $.geo namespace:

        -
        $.geo.distance( point1, point2 )
        - -

        Except for a few name changes and switching from an object-oriented API to a function-based one, jQuery Geo attempts to follow the names and behavior of the Java Topology Suite (JTS), which is the de-facto standard for geometry library APIs. JTS itself is an implementation of the OGC Simple Features specification but has made design decisions that improve the API for developers. The most notable of which is having Envelope (called bbox in jQuery Geo and GeoJSON) be its own class type.

        -

        bbox functions

        -

        These functions operate on GeoJSON bounding box array, i.e., a JavaScript array having four values:

        -
          -
        • minimum x/longitude
        • -
        • minimum y/latitude
        • -
        • maximum x/longitude
        • -
        • maximum y/latitude
        • -
        - -

        geometry object functions

        -

        These functions operate on GeoJSON geometry objects: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. They do not operate on Feature or FeatureCollection objects, you have to call these functions on the geometry properties of Feature objects.

        -

        The geometry functions allow you to analyze relationships between geometries such as their distance apart as well as obtain information about them such as bounding box and center point, called the centroid. This section will eventually expand to cover all of the important spatial operations available in the Java Topology Suite.

        - -
        -
        - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/length.html b/libs/js/jquery-geo-1.0b2/docs/geo/length.html deleted file mode 100755 index 9dbd648..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/length.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - length | $.geo - - - - - - - - - - - -
        -
        -

        length

        -
        - -
        - - - - - - - - - - - - - -
        return typeNumber
        syntax$.geo.length( Object shape ( GeoJSON object ) )
        usage
        var length = $.geo.length( {
        -      type: "LineString",
        -      coordinates: [[
        -        [-75, 39.7],
        -        [-74.8, 39.3],
        -        [-75.2, 39.3]
        -      ]]
        -} )
        -

        The length method calculates the length of a basic GeoJSON geometry object and returns it in non-geodetic units. The basic shapes are Point, LineString and Polygon. If you are using geomap with its default map service, the length is in meters because the default projection is web mercator meters.

        -

        This function returns 0 for Point objects, the length of LineString objects and the perimeter of Polygon objects.

        -

        If the argument is not a basic GeoJSON geometry object, this function returns undefined.

        -

        This function is similar to Geometry.getLength in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/pointAlong.html b/libs/js/jquery-geo-1.0b2/docs/geo/pointAlong.html deleted file mode 100755 index b3c7614..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/pointAlong.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - pointAlong | $.geo - - - - - - - - - - - -
        -
        -

        pointAlong

        -
        - -
        - - - - - - - - - - - - - -
        return typeObject ( GeoJSON Point )
        syntax$.geo.pointAlong( Object shape ( GeoJSON object ), Number percentage )
        usage
        var pointAlong = $.geo.pointAlong( {
        -      type: "LineString",
        -      coordinates: [[
        -        [-75, 39.7],
        -        [-74.8, 39.3],
        -        [-75.2, 39.3]
        -      ]]
        -}, .5 )
        -

        The pointAlong method calculates a Point that lies a given fraction along the passed-in basic GeoJSON geometry object. The basic geometry types are Point, LineString and Polygon. A percentage of 0.0 returns the first Point; a percentage of 1.0 returns the last.

        -

        Technically, only LineStrings can be used properly in this calculation. However, pointAlong can be calculated for other geometry types. With Point objects, pointAlong will always return a copy of the original Point. For Polygon objects, pointAlong operates on the Polygon's perimeter (outer ring), i.e., myPolygon.coordinates[0]. For Polygons, percentage values of 0.0 and 1.0 will return the same Point.

        -

        If the argument is not a basic GeoJSON geometry object, this function returns undefined.

        -

        This function is similar to LineSegment.pointAlong in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/polygonize.html b/libs/js/jquery-geo-1.0b2/docs/geo/polygonize.html deleted file mode 100755 index b0edade..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/polygonize.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - polygonize | $.geo - - - - - - - - - - - -
        -
        -

        polygonize

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON Polygon )
        syntax$.geo.polygonize( Array bbox ( GeoJSON bounding box ) )
        usage
        var polygon = $.geo.polygonize( bbox )
        - -

        The polygonize method creates a new Polygon with an outer ring that matches the rectangle covered by the bbox. The Polygon is closed and will have five coordinates.

        - -

        This function is a simplification/adaptation of the Polygonizer class in JTS. While the JTS object operates on the line work of geometry objects, this function operates on bounding boxes.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/proj.html b/libs/js/jquery-geo-1.0b2/docs/geo/proj.html deleted file mode 100755 index 4959f14..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/proj.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - $.geo.proj object | jQuery Geo - - - - - - - - - - - -
        -
        -

        $.geo.proj object

        -
        - -
        -

        The $.geo namespace has a property named proj which is a JavaScript object having four functions: fromGeodetic, fromGeodeticPos, toGeodetic, and toGeodeticPos. These four functions allow all $.geo static bbox/geometry functions, geomap widget properties, geomap widget events & geomap widget methods (collectively referred to as plugin functions from now on) to work in geodetic (lon, lat) coordinates.

        -

        Consider the following example:

        -
          -
        • assume you are using the default map service
        • -
        • you call $.geo.distance passing two geodetic Point objects, i.e., the GeoJSON position in each point is an array where coordinates[0] is the longitude and coordinates[1] is latitude
        • -
        -

        jQuery Geo will first convert the points to map units, a process called projection. jQuery Geo needs projected coordinates to properly calculate some relationships between shapes. After converting the points, $.geo.distance can then calculate the distance between them. This distance will be in meters because the default map service is web mercator meters.

        -

        In order to work directly in map units, you used to have to set $.geo.proj to null. While still valid, you no longer have to do this. You can leave $.geo.proj set to, e.g., web mercator meters and send either projected web mercator GeoJSON geometry objects or geodetic (lon, lat) objects to $.geo functions. The return value will depend on the type of arguments passed.

        -

        The geomap widget keeps track of how you set options. For example, if you set the map's center using geodetic coordinates, geodetic coordinates will then be returned when you ask for the center later. They will also be used when the geomap widget triggers events such as bboxchange or shape.

        -

        The default $.geo.proj object comes pre-built with functions that quickly convert between geodetic coordinates and web mercator meters so you can start using lon, lat right away with the default OpenStreetMap-based tiles. If your map service uses a different projection you can roll your own $.geo.proj object and continue to have the option to use geodetic coordinates. Read Other projections below for information on how to do that.

        - -

        Usage

        -

        The two base functions, fromGeodetic and toGeodetic, can take and return: a single bounding box, a single GeoJSON position (Point.coordinates), an array of GeoJSON positions (MultiPoint.coordinates or LineString.coordinates), an array of arrays of positions (MultiLineString.coordinates or Polygon.coordinates) or an array of arrays of arrays of positions (MultiPolygon.coordinates). In other words, the $.geo.proj functions convert the coordinates property of any of the GeoJSON geometry types. For example, you can use the following to convert the position contained in a GeoJSON point object:

        -
        var geodeticPoint = {
        -  type: "Point",
        -  coordinates: [ -73.5100, 41.3500 ]
        -};
        -
        -var projectedCoords = $.geo.proj.fromGeodetic( geodeticPoint.coordinates );
        - -

        However, a LineString's coordinates property is an array of positions which you can also pass to the fromGeodetic method to get an array converted positions

        - -
        var projectedLineStringCoords = $.geo.proj.fromGeodetic( geodeticLineString.coordinates );
        - -

        To convert a set of projected GeoJSON positions back to web mercator, call toGeodetic.

        - -
        var geodeticLineString = {
        -  type: "LineString",
        -  coordinates: $.geo.proj.toGeodetic( projectedLineStringCoords  )
        -};
        - -

        Other projections

        - -

        The $.geo.proj object allows you to use geodetic coordinates with whichever coordinate system or projection you want in any plugin function. If you pass a geodetic Polygon to $.geo.bbox, the returned bounding box will be in geodetic coordinates.

        - -

        If you are working in a projection other than the default web mercator meters but still wish to use geodetic coordinates, you will have to update the $.geo.proj object so that it can convert between geodetic coordinates and ones in your projection.

        - -

        However, if you don't need to work in longitude, latitude at all, you can ignore $.geo.proj and use projected coordinates throughout your project. You also still have the option to set $.geo.proj to null for completeness and remind yourself that you are limited to projected coordinates. If you are working in Massachusetts Mainland State Plane meters for example, you can pass a Polygon of that projection to any plugin function and you will get results in that projection. This includes all $.geo functions and geomap options & methods.

        - -
        $.geo.proj = null; // not required but reminds us that jQuery Geo can't use lon, lat in this project
        -
        -$('map').geomap( {
        -  tilingScheme: null,
        -  bboxMax: [ 31790, 790195, 337250, 961865 ],
        -  bbox: [ 235644, 894775, 237775, 898523 ],
        -  services: [ /* service object that supports MA State Plane */ ]
        -} );
        - -

        jQuery Geo uses the four $.geo.proj functions throughout to convert between geodetic and projected coordinates. However, fromGeodeticPos and toGeodeticPos handle the conversion of individual GeoJSON positions and are used by fromGeodetic and toGeodetic. You can extend $.geo.proj with your own implementations of fromGeodeticPos and toGeodeticPos to change the internal projection used by all plugin functions and still use geodetic (lon, lat) coordinates as arguments and return values.

        - -

        Please note that you must extend $.geo.proj with new functionality instead of replacing it wholesale with a new object. You need to keep the original fromGeodetic and toGeodetic functions intact.

        - -
        $.extend($.geo.proj, {
        -  fromGeodeticPos: function( coordinate ) {
        -    var converted = [];
        -    // convert the GeoJSON lon/lat position to MA State Plane
        -    return converted;
        -  },
        -
        -  toGeodeticPos: function( coordinate ) {
        -    var converted = [];
        -    // convert the GeoJSON MA State Plane position to lon/lat
        -    return converted;
        -  }
        -});
        -
        -$('map').geomap( {
        -  tilingScheme: null,
        -
        -  // notice that with a custom $.geo.proj object,
        -  // these properties can be in geodetic coordinates
        -  bboxMax: [ -73.5100, 41.3500, -69.8600, 42.8900 ],
        -  bbox: [ -71.098709, 42.330322, -71.072617, 42.351608 ],
        -
        -  // the services option must still be in map coordinates
        -  // see geomap's services property docs for more info
        -  services: [ /* service object that supports MA State Plane */ ]
        -} );
        -

        Implementing custom from/to GeodeticPos functions is currently beyond the scope of this documentation but reading up on Proj4js is a good start.

        -
        -
        - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/reaspect.html b/libs/js/jquery-geo-1.0b2/docs/geo/reaspect.html deleted file mode 100755 index 76c11d1..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/reaspect.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - reaspect | $.geo - - - - - - - - - - - -
        -
        -

        reaspect

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON bounding box )
        syntax$.geo.reaspect( Array bbox ( GeoJSON bounding box ), Number ratio )
        usage
        var widescreenBbox = $.geo.reaspect( bbox, 16 / 9 )
        -

        The reaspect method creates a new bbox with the same center as the original but forcing the ratio of width to height to a specific value.

        -

        If the original width is greater than the original height (think a landscape printout) then the width of the new bbox will be the same as the original but the new height will change to fit the ratio. If the original height is greater than the original width (think a portrait printout) then the new bbox height will remain unchanged but the width will to fit the ratio.

        -

        This function is not defined in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/recenter.html b/libs/js/jquery-geo-1.0b2/docs/geo/recenter.html deleted file mode 100755 index 7dfda39..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/recenter.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - recenter | $.geo - - - - - - - - - - - -
        -
        -

        recenter

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON bounding box )
        syntax$.geo.recenter( Array bbox ( GeoJSON bounding box ), Array (GeoJSON position) )
        usage
        var moved = $.geo.recenter( bbox, [ -70, 42 ] )
        - -

        The recenter method creates a new bbox with the same width and height as the original but moving the center to a new location.

        - -

        This function is not defined in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/scaleBy.html b/libs/js/jquery-geo-1.0b2/docs/geo/scaleBy.html deleted file mode 100755 index 74bf39f..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/scaleBy.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - scaleBy | $.geo - - - - - - - - - - - -
        -
        -

        scaleBy

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray ( GeoJSON bounding box )
        syntax$.geo.scaleBy( Array bbox ( GeoJSON bounding box ), Number scale )
        usage
        var twiceAsBig = $.geo.scaleBy( bbox, 2 )
        -

        The scaleBy method creates a new bbox with the same center as the original but having a width and height that are both multiplied by the scale argument.

        -

        The scale argument is a percentage increase or decrease. This means that supplying 2 will increase the size of the bbox by 200%, which if thinking in terms of a map's view, would zoom out. Supplying .5 will decrease the size of the bbox to half its original size.

        -

        The scale argument must be greater than zero.

        -

        This function is not defined in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geo/width.html b/libs/js/jquery-geo-1.0b2/docs/geo/width.html deleted file mode 100755 index 29cc308..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geo/width.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - width | $.geo - - - - - - - - - - - -
        -
        -

        width

        -
        - -
        - - - - - - - - - - - - - -
        return typeNumber
        syntax$.geo.width( Array bbox ( GeoJSON bounding box )
        usage
        var width = $.geo.width( [ -71.1, 42.3, -71.0, 42.4 ] )
        -

        The width method returns the true width of a bbox in non-geodetic units. If you are using geomap with its default map service, the width is in meters because the default projection is web mercator meters.

        -

        This function is similar to Envelope.getWidth in JTS.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geographics/index.html b/libs/js/jquery-geo-1.0b2/docs/geographics/index.html deleted file mode 100755 index 70a31ec..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geographics/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - geographics | $.geo - - - - - - -
        -
        -

        geographics widget

        -
        - -
        -

        The geographics widget in $.geo handles all shape drawing. The geomap widget uses it internally and you can use it outside of geomap to draw GeoJSON geometry that has already been converted to pixel coordinates onto any element.

        -
        .geographics( options )
        -

        options

        -

        The options argument is a JavaScript object that configures the graphics widget during the first instantiation on a div. No options are required. By default the graphics widget will draw all shapes with a dark red outline and mostly transparent red fill.

        - -

        methods

        -

        The geographics widget provides methods to draw various GeoJSON geometries on the canvas. Remember that the geometries must have either already been converted to pixel coordinates or created initially with a pixel coordinate system in mind.

        - -
        -
        - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/append.html b/libs/js/jquery-geo-1.0b2/docs/geomap/append.html deleted file mode 100755 index b411b78..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/append.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - append | geomap - - - - - - - - - - - -
        -
        -

        append

        -
        - -
        - - - - - - - - - - - - - -
        return typejQuery collection
        syntax.geomap( "append", Object shape ( GeoJSON object ) | Array<Object> shapes [ , Object style ( geomap style ) ] [ , String label ] [ , Boolean refresh ] )
        usage
        // a single point, no style, no label, refresh immediately
        -$(map or service selector).geomap( "append", { type: "Point", coordinates: [ -71, 40 ] } )
        -
        -// a single line, don't refresh yet
        -$(map or service selector).geomap( "append", {
        -  type: "LineString",
        -  coordinates: [ [ -71, 40 ], [ -71.5, 41 ] ]
        -}, false )
        -
        -// a polygon with a style
        -$(map or service selector).geomap( "append", {
        -  type: "Polygon",
        -  coordinates: [ [ 
        -    [-75, 39.7],
        -    [-74.8, 39.3],
        -    [-75.2, 39.3],
        -    [-75, 39.7]
        -  ] ]
        -}, { stroke: "#11117f", strokeWidth: "3px" } )
        -
        -// an array of geometry objects with a style, don't refresh yet
        -$(map or service selector).geomap( "append", [ 
        -  { type: "Point", coordinates: [ -71, 40 ] },
        -  { type: "Point", coordinates: [ -70, 39.5 ] },
        -], { color: "green", strokeWidth: "3px" }, false )
        -
        -// a point feature with a label
        -$(map or service selector).geomap( "append", {
        -  type: "Feature",
        -  geometry: {
        -    type: "Point",
        -    coordinates: [ -71, 40 ]
        -  }
        -}, "My Point" )
        -
        -// a point with a label, don't refresh yet
        -$(map or service selector).geomap( "append", { type: "Point", coordinates: [ -71, 40 ] }, "My Point (don't refresh yet)", false )
        -
        -// a point with a style & label
        -$(map or service selector).geomap( "append", { type: "Point", coordinates: [ -71, 40 ] }, { color: "#00f" }, "Blue Point" )
        -
        -// a collection of features with a style, each point will get a separate label, don't refresh yet
        -$(map or service selector).geomap( "append", {
        -    type: "FeatureCollection"
        -    features: [ {
        -      type: "Feature",
        -      geometry: {
        -        type: "Point",
        -        coordinates: [ -71, 40 ]
        -      }
        -    }, {
        -      type: "Feature",
        -      geometry: {
        -        type: "Point",
        -        coordinates: [ -71.2, 40.3 ]
        -      }
        -    } ]
        -  },
        -  { color: "#00f" },
        -  '<span style="color: #44f;">Blue Point</span>',
        -  false
        -)
        - -

        The append method adds one shape or an array of shapes to the map. In this documentation, the word shape means a GeoJSON geometry object or a GeoJSON Feature. A FeatureCollection is treated as an array of shapes.

        - -

        When you append more than one shape by using an array or a FeatureCollection, each shape in the array or FeatureCollection's features property is added as a separate shape whereas the other collection geometry types, e.g., MultiPoint, are added as a single shape. This is an important distinction when considering the find method and labels. The find method can potentially return only one shape from an array or one feature of a FeatureCollection but will return all shapes in a MultiPoint (as a reference to the original MultiPoint object supplied to append) even if only one of the coordinates in the MultiPoint intersects the find position. For labeling, each shape in an array and each feature in a FeatureCollection get their own label, however all polygons in a MultiPolygon will share the same label.

        - -

        The geomap widget maintains a reference to your shape. You can use the same object in calls to remove in order to remove the shape from the map at any time.

        - -

        The jQuery UI widget factory returns the original jQuery collection to maintain call chaining.

        - - - -

        styling

        - -

        The optional style argument modifies how geomap draws the specific geometry or feature you are adding. Properties supplied in this style will override ones of the same name in geomap's base shapeStyle. Properties not referenced are inheritied from the base style and can change with future changes to the shapeStyle option. Please see the shapeStyle method documentation for information about what properties are valid for this object.

        - -

        labeling

        - -

        The optional label argument will display a label near the shape. Labels are a powerful way to add text, pixel-based graphics, or other HTML and CSS effects to the map. The label string can be any text or HTML. For example, consider the following:

        - -
          -
        • - you append a Point shape setting its style to have zero for width and height: -
          { width: "0px", height: "0px" }
          -
        • - -
        • - you also supply a label of nothing more than a div element with a class: -
          '<div class="marker"></div>'
          -
        • - -
        • - in a CSS style sheet, you give the marker class a width, height, background image and negative relative position: -
          .marker
          -{
          -  width: 8px;
          -  height: 8px;
          -  background: url(../img/marker.png);
          -  position: relative;
          -  left: -4px;
          -  top: -4px;
          -}
          -
        • -
        - -

        In the above example, marker.png will be centered on every point added with a similar label. The regular shape style will not show because the point style has no size.

        - -

        For Point shapes, the top-left of the label is positioned at the Point's only coordinate. For LineString shapes, the label is usually positioned 50% along the shape but will be forced into view if its usual position is out of the map's current bbox. For Polygon shapes, the label is usually positioned at the centroid but will be forced into view if its usual position is out of the map's current bbox. All other non-basic shape types use the shape's centroid.

        - -

        The geomap widget uses a div to position the labels. The div exists inside a container for the service. The div has the CSS class: geo-label. You can use this design to apply regular CSS style to all labels or all labels within a service. The following snippets show examples of using this, assuming the main map div has the id "map" and the default map service (which has the CSS class "osm") has not been changed.

        - -

        JavaScript

        - -
        /* add a point to the map itself */
        -$( "#map" ).geomap( "append", { type: "Point", coordinates: [ -71, 40 ] }, "map point" );
        -
        -/* add a point to the default map service */
        -$( "#map .osm" ).geomap( "append", { type: "Point", coordinates: [ -70, 40 ] }, "service point" );
        -
        - -

        CSS

        - -
        /* turn the color of all labels blue */
        -#map .geo-label { color: blue; }
        -
        -/* make labels on the default basemap service bold */
        -#map .osm .geo-label { font-weight: bold; }
        - -

        One caveat is that, to keep performance high, jQuery Geo will not create the .geo-label container if you do not at least pass an empty string as the label. So, if you want to do something similar to the marker example above, but using the already provided .geo-label div, you will need to pass an empty string as the label.

        - -

        Each .geo-label div is absolutely positioned to the correct location in the map view. Please keep that in mind because changing the position, left or top CSS properties on the .geo-label class may affect your labels drastically.

        - -

        delaying refresh

        - -

        The optional refresh argument determines if geomap refreshes the map graphics after this call to append. It defaults to true. If you pass false, geomap will add the shape internally but not immediately redraw the graphics. The changes will display if the user moves the map or you call geomap's refresh method.

        -

        service-level shapes

        -

        The geomap widget allows you to append a shape to a specific service. You do this by targeting a service inside a map instead of the map itself for your call to geomap's append method. For example, the default map service has the CSS class: osm. We can append a shape to that service specifically by using jQuery to target the service:

        -
        $( "#map .osm" ).geomap( "append", shape );
        -

        Some of the important advantages with this syntax are:

        -
          -
        • you can show or hide shapes as you toggle a service because shapes attached to a service are only visible if the service is visible
        • -
        • service-level shapes draw in the order of their service in the services option which gives you finer control over how they look
        • -
        • shapes on the map itself always draw above service-level shapes
        • -
        • you can style shapes differently depending on their service using a service-level shapeStyle option
        • -
        -

        duplicate shapes

        -

        You can add the same GeoJSON object to more than one service, which allows you to give the same object two different styles at the same time. To do this, call append twice with the same object. Once on one service (or the map itself) and a second time on a different service.

        -

        You can also do this at the same time by using the comma selector in one call to append:

        -
        // set the basemap service's shapeStyle option to a white halo effect
        -$( "#map .osm" ).geomap( "option", "shapeStyle", { strokeWidth: "8px", color: "#dedede" } );
        -
        -// append the shape to both the map widget and basemap service
        -$( "#map,#map .osm" ).geomap( "append", shape );
        -

        updating

        -

        If you attempt to add a shape to the map or a service where it already exists, the shape will remain but you will update (or remove) the shape's style or label.

        -
        // add the shape with a green color
        -$( "#map" ).append( shape, { color: "green" } );
        -
        -// change the color to blue (shape is the same object as before in this case)
        -$( "#map" ).append( shape, { color: "blue" } );
        -

        Changing the type of geometry, e.g., from Point to LineString, or coordinates of a shape you have appended is not recommended and geomap's behavior is currently undefined. If you wish to do either of these, you should first call remove on the original object and append on a new one.

        - - -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/axisLayout.html b/libs/js/jquery-geo-1.0b2/docs/geomap/axisLayout.html deleted file mode 100755 index c92ab81..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/axisLayout.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - axisLayout | geomap - - - - - - - - - - - -
        -
        -

        axisLayout

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeString
        default"map"
        init
        $( selector ).geomap( { axisLayout: "map" } );
        get
        var axisLayout = $( selector ).geomap( "option", "axisLayout" );
        set
        $( selector ).geomap( "option", "axisLayout", "image" );
        -

        The axisLayout option determines direction of the coordinate system axes. It can be "map" or "image".

        -

        Maps have a traditional mathematical coordinate system where the ordinate-axis (y-axis) points up. However, graphical images flip the y-axis so that moving down increases in value, which is appropriate in graphic contexts. This is important when you are connecting to a service supplying non-georeferenced (computer graphic) images and want your map control to match that coordinate system layout.

        -

        You will rarely have to change this unless you are using an graphic image server such as LizardTech Image Server or you just want to use the geomap widget to draw pixel-oriented graphics.

        -

        This option will affect pixel-to-map coordinate calculation for all service types, i.e., tiled & shingled services.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/bbox.html b/libs/js/jquery-geo-1.0b2/docs/geomap/bbox.html deleted file mode 100755 index e93d803..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/bbox.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - bbox | geomap - - - - - - - - - - - -
        -
        -

        bbox

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeArray ( GeoJSON bounding box )
        default[ -180, -85, 180, 85 ]
        init
        $( selector ).geomap( { bbox: [ -71, 40, -69, 44 ] } );
        get
        var bbox = $( selector ).geomap( "option", "bbox" );
        set
        $( selector ).geomap( "option", "bbox", [ -122, 42, -118, 46 ] );
        -

        The bbox property calculates or modifies the bounding box of the map view the user currently sees. The geomap widget creates the bounding box based on the current center point, map zoom and size of the map view.

        -

        When you set a new bbox, the center and zoom properties are set as close as they can be based on the services you've added and the size of the map view.

        -

        For example, if you have a cached service with specific zoom levels, the map widget will have to pick a zoom level even though it may result in a bbox that is quite different from the one passed. When your services are fully dynamic, i.e., they allow arbitrary zoom levels, the final bbox will not likely match the one passed either due to ratio differences between the requested bbox and the map view's size. The map will attempt to pick a bounding box that best fits the one you request.

        -

        This property is a JavaScript array consisting of four values which can be thought of as: minx, miny, maxx and maxy of the current map view in map units and in that order. By default the values are in geodetic coordinates, e.g., bbox[0] is the longitude of the left of the current map view, bbox[1] is the latitude of the bottom, bbox[2] is the longitude of the right and bbox[3] is the latitude of the top. You can change the default when you initialize the widget by passing projected coordinates as the bbox option.

        -

        Setting a new bbox will refresh the map services.

        -

        If you attempt to initialize both center and bbox at the same time when creating a geomap widget, center will override bbox.

        -

        If you attempt to initialize both zoom and bbox at the same time when creating a geomap widget, bbox will be applied and zoom will modify the final bbox.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/bboxMax.html b/libs/js/jquery-geo-1.0b2/docs/geomap/bboxMax.html deleted file mode 100755 index dcf1cb9..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/bboxMax.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - bboxMax | geomap - - - - - - - - - - - -
        -
        -

        bboxMax

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeArray ( GeoJSON bounding box )
        default[ -180, -85, 180, 85 ]
        init
        $( selector ).geomap( { bboxMax: [ -71, 40, -69, 44 ] } );
        get
        var bboxMax = $( selector ).geomap( "option", "bboxMax" );
        set
        $( selector ).geomap( "option", "bboxMax", [ -75.696, 38.804, -73.696, 41.287 ] );
        -

        The bboxMax option defines a bounding box that surrounds all of the data you wish to show in non-tiled maps, i.e., you have set the tilingScheme option to null. Users can pan the map once they reach bboxMax but cannot zoom out further.

        -

        This option is a JavaScript array consisting of four values which can be thought of as: minx, miny, maxx and maxy of the maximum map view you wish to allow in map units and in that order.

        -

        A bboxMax option must be set properly for shingled (dynamic) services since the value of the map's zoom is based on a ratio between the current bbox and bboxMax.

        -

        Setting a new bboxMax will refresh the map services and reset what zoom level 0 means.

        -

        If you set tilingScheme to null, you must explicitly set bboxMax.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/center.html b/libs/js/jquery-geo-1.0b2/docs/geomap/center.html deleted file mode 100755 index d49739c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/center.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - center | geomap - - - - - - - - - - - -
        -
        -

        center

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeArray (GeoJSON position)
        default[ 0, 0 ]
        init
        $( selector ).geomap( { center: [ 0, 0 ] } );
        get
        var center = $( selector ).geomap( "option", "center" );
        set
        $( selector ).geomap( "option", "center", [ -71.037598, 42.363281 ] );
        -

        The center property gets or sets the center point of the map. By default the value is in geodetic coordinates, e.g., longitude, latitude. You can change the default when you initialize the widget by passing projected coordinates as the center option.

        -

        Setting a new center point will refresh the map services.

        -

        If you attempt to initialize both center and bbox at the same time when creating a geomap widget, center will override bbox.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/cursors.html b/libs/js/jquery-geo-1.0b2/docs/geomap/cursors.html deleted file mode 100755 index 44efa9e..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/cursors.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - cursors | geomap - - - - - - - - - - - -
        -
        -

        cursors

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeObject (map of geomap mode to CSS cursor)
        default
        {
        -  static: "default",
        -  pan: "move",
        -  zoom: "crosshair",
        -  drawPoint: "crosshair",
        -  drawLineString: "crosshair",
        -  drawPolygon: "crosshair",
        -  measureLength: "crosshair",
        -  measureArea: "crosshair"
        -}
        init
        $( selector ).geomap( { cursors: { pan: "move" } } );
        get
        var cursors = $( selector ).geomap( "option", "cursors" );
        set
        $( selector ).geomap( "option", "cursors", { pan: "pointer" } );
        -

        The cursors property controls which cursors appear when users move the mouse over the geomap div in any given mode.

        -

        The developer may change each geomap mode's cursor separately during both initialization of the widget or any time after.

        -

        Sometimes the geomap widget will override the selected mode's cursor, e.g., when a user starts panning in other modes the cursor will switch to the pan mode cursor temporarily.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/destroy.html b/libs/js/jquery-geo-1.0b2/docs/geomap/destroy.html deleted file mode 100755 index b667b11..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/destroy.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - destroy | geomap - - - - - - - - - - - -
        -
        -

        destroy

        -
        - -
        - - - - - - - - - - - - - -
        return typeundefined
        syntax.geomap( "destroy" )
        usage
        $("#map").geomap( "destroy" )
        -

        - Every good widget will clean up after itself. Call destroy to turn your interactive map back to a boring old div. Any content inside the div before you initialized geomap will remain intact.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/drawStyle.html b/libs/js/jquery-geo-1.0b2/docs/geomap/drawStyle.html deleted file mode 100755 index 7fae574..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/drawStyle.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - drawStyle | geomap - - - - - - - - - - - -
        -
        -

        drawStyle

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeObject ( geomap style )
        default
        {
        -  borderRadius: "8px",
        -  color: "#7f0000",
        -  fillOpacity: .2,
        -  height: "8px",
        -  opacity: 1,
        -  strokeOpacity: 1,
        -  strokeWidth: "2px",
        -  visibility: "visible",
        -  width: "8px"
        -}
        -
        init
        $( map selector ).geomap( { drawStyle: { color: "green" } } );
        get
        var drawStyle = $( map selector ).geomap( "option", "drawStyle" );
        set
        $( map selector ).geomap( "option", "drawStyle", { strokeWidth: "4px" } );
        -

        The drawStyle option retrieves or updates the style of incomplete lines and polygons as they are being drawn. This differs from the shapeStyle option which updates the style of shapes that you've appended to the map.

        -

        This option affects both the draw modes (drawPoint, drawLineString, and drawPolygon) and the measure modes (measureLength, and measureArea).

        -

        This option changes specific properties of the internal style object. If you init or set an incomplete style object, only the style properties you reference are updated.

        -

        Please see the style section at the bottom of the geomap widget page for more information about the style object.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/empty.html b/libs/js/jquery-geo-1.0b2/docs/geomap/empty.html deleted file mode 100755 index 6dca203..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/empty.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - empty | geomap - - - - - - - - - - - -
        -
        -

        empty

        -
        - -
        - - - - - - - - - - - - - -
        return typejQuery collection
        syntax.geomap( "empty" [ , Boolean refresh ] )
        usage
        $( map or service selector ).geomap( "empty" )
        -$( map or service selector ).geomap( "empty", false )
        -

        The empty method removes all shapes previously added with the append method.

        -

        The jQuery UI widget factory returns the original jQuery collection to maintain call chaining.

        -

        delaying refresh

        -

        The optional refresh argument determines if geomap refreshes the map graphics after this call to empty. It defaults to true. If you pass false, geomap will remove all shapes internally but not immediately redraw the graphics. The changes will display if the user moves the map or you call geomap's refresh method.

        -

        service-level shapes

        -

        Similar to how you can remove shapes from specific services, you can empty specific services of all shapes as well.

        -

        You do this by targeting a service inside a map instead of the map itself for your call to geomap's empty method. For example, the default map service has the CSS class: osm. We can remove all shapes from that service specifically by using jQuery to target the service:

        -
        $( "#map .osm" ).geomap( "empty" );
        -

        Calling empty on the map widget will not remove shapes that have been appended to services.

        -

        To remove all shapes from the map and all services, you can use the comma selector and the built-in geo-service CSS class:

        -
        // empty the map widget and any services
        -$( "#map,#map .geo-service" ).geomap( "empty" );
        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/find.html b/libs/js/jquery-geo-1.0b2/docs/geomap/find.html deleted file mode 100755 index 43bd251..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/find.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - find | geomap - - - - - - - - - - - -
        -
        -

        find

        -
        - -
        - - - - - - - - - - - - - - - - - -
        return typeArray<Object> ( GeoJSON objects )
        syntax.geomap( "find", Object point (GeoJSON Point), Number pixelTolerance )
        .geomap( "find", shape selector )
        usage
        var existingShape = $( map or service selector ).geomap( "find", { type: "Point", coordinates: [ -71.098709, 42.330322 ] }, 8 )
        -
        -var allShapes = $( map or service selector ).geomap( "find", "*" )
        -

        The find method allows you to search for shapes appended to the map and/or services. There are two distinct ways to call this method.

        -

        geometry search

        - -

        The find method can take a single GeoJSON map point and return all shapes within a pixel radius of the given location that have been added with append. If there are no shapes at the location, this method returns an empty array.

        - -

        The pixelTolerance argument is always in pixels. This allows for pixel-based searches regardless of the map's current zoom. A high-zoom search is finer than a low-zoom one because at lower zoom levels, i.e., the map is zoomed out more, the Earth-size of a pixel is greater causing this search to reach out farther from the supplied position.

        - -

        Duplicate shape references are included in the return value. For example, if you have appended the same GeoJSON object to both the map and a specific service, and then call find at that location, the returned array will contain two, identical shape references.

        - -

        selector search

        - -

        The find method can also take a single string. The string is in CSS selector syntax but currently only one selector is supported: *. Use the * selector to return an array of all shapes that have been appended to the map or service. If there are no shapes on the map or service, this method returns an empty array. Searching for all shapes at the map level will return all shapes that have been appended to the map or any service.

        - -

        Duplicate shape references are included in the return value. For example, if you have appended the same GeoJSON object to both the map and a specific service, and then call find( "*" ) at the map level, the returned array will contain two, identical shape references.

        - -

        The shape selector cannot include service ids or classes. To search for shapes within a specific service, see below.

        - -

        service-level shapes

        - -

        Similar to how you can append shapes to specific services, you can find shapes in specific services as well.

        - -

        You do this by targeting a service inside a map instead of the map itself for your call to geomap's find method. For example, the default map service has the CSS class: osm. We can find a shape from that service specifically by using jQuery to target the service:

        - -
        var osmShapes = $( "#map .osm" ).geomap( "find", [ -71, 42 ], 8 );
        - -

        However, unlike the other three shape methods, shapes appended to a specific service will be returned by calling find on the map itself. In this way, calling find on the map is a deep search for shapes on all services. For example, after this sequence the shapes variable will contain the shape even though it was appended to a service specifically:

        - -

        var point = {
        -      type: "Point",
        -      coordinates: [ -71, 42 ]
        -    };
        -
        -// add the shape to the osm service
        -$( "#map .osm" ).geomap( "append", point );
        -
        -// use the original point to search for shapes on the map widget
        -var shapes = $( "#map" ).geomap( "find", point, 3 );
        - -

        Another difference between the find method and the append, remove, and empty methods, is that the find method cannot currently be used on multiple targets simultaneously. For example, the return value of the following is undefined:

        - -
        // attempt to search the osm service and a second service at the same time
        -var shapes = $( "#map .osm,#map .massgis" ).geomap( "find", point, 8 );
        - -

        To find shapes in two specific services without searching all services you should use two find calls:

        - -
        // find shapes on the default service and a second service
        -var osmShapes = $( "#map .osm" ).geomap( "find", point, 8 ),
        -    massgisShapes = $( "#map .massgis" ).geomap( "find", point, 8 );
        - -

        The selector-based version also follows this requirement. You cannot target more than one element with the initial selector and you cannot use the shape selector to search services. A multi-service selector-based search would be the same as above but with "*" instead of: point, 8.

        - -
        // the following are invalid and their return value is undefined
        -var multiTarget = $( "#map .massgis,#map .osm" ).geomap( "find", "*" );
        -var shapeSubSelector = $( "#map" ).geomap( "find", ".massgis *" );
        -
        -// proper way to get all shapes from multiple services
        -var osmShapes = $( "#map .osm" ).geomap( "find", "*" ),
        -    massgisShapes = $( "#map .massgis" ).geomap( "find", "*" );
        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapbbox.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomapbbox.html deleted file mode 100755 index 13ab744..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapbbox.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - bboxchange | geomap - - - - - - - - - - - -
        -
        -

        bboxchange

        -
        - -
        - - - - - - - - - - - - - -
        typebboxchange
        init
        $( selector ).geomap( {
        -  bboxchange: function( e, geo ) { }
        -} );
        bind
        $( selector ).bind( "geomapbboxchange", function( e, geo ) { } );
        -} );
        -

        The bboxchange event triggers any time user interaction causes a change in the current bbox of the map widget. This includes pan, wheel zoom, double-click zoom, etc. The geomap does not trigger this event when you update the bbox programmatically.

        -

        The geo argument is an object containing a bbox property which the new bbox.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapclick.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomapclick.html deleted file mode 100755 index 098a150..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapclick.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - click | geomap - - - - - - - - - - - -
        -
        -

        click

        -
        - -
        - - - - - - - - - - - - - -
        typeposition
        init
        $( selector ).geomap( {
        -  click: function( e, geo ) { }
        -} );
        bind
        $( selector ).bind( "geomapclick", function( e, geo ) { } );
        -} );
        -

        The click event triggers when the user clicks or taps a point on the map and then lets go at the same point within a short time threashold. However, it only triggers if the user is not currently performing some other action which might be handled internally by the widget.

        -

        The geo argument is a GeoJSON Point object of the clicked location in map coordinates.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapdblclick.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomapdblclick.html deleted file mode 100755 index 74eb0be..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapdblclick.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - dblclick | geomap - - - - - - - - - - - -
        -
        -

        dblclick

        -
        - -
        - - - - - - - - - - - - - -
        typeposition
        init
        $( selector ).geomap( {
        -  dblclick: function( e, geo ) { }
        -} );
        bind
        $( selector ).bind( "geomapdblclick", function( e, geo ) { } );
        -} );
        -

        The dblclick event triggers when the user double-clicks or double-taps a point on the map. However, it only triggers if the user is not currently performing some other action which might be handled internally by the widget.

        -

        The geo argument is a GeoJSON Point object of the clicked location in map coordinates.

        -

        The default action for a double-click/tap is to zoom the map in one level. However, as a developer you can override this by calling e.preventDefault() in your callback.

        -
        $( "#map" ).geomap( {
        -  dblclick: function( e, geo ) { e.preventDefault(); }
        -} );
        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadend.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadend.html deleted file mode 100755 index c61f026..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadend.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - loadend | geomap - - - - - - - - - - - -
        -
        -

        loadend

        -
        - -
        - - - - - - - - - - - - - -
        typeload
        init
        $( map selector ).geomap( {
        -  loadend: function( e, geo ) { }
        -} );
        bind
        $( map selector ).bind( "geomaploadend", function( e, geo ) { } );
        -} );
        - -

        The loadend event triggers after a loadstart event when the geomap widget has finished loading all pending images. It only triggers once regardless of the number of images loaded. It will not be triggered again until after another loadstart event.

        - -

        The geo argument is currently undefined for this event.

        - -

        You can use this event to hide an indicator that your website is busy downloading images.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadstart.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadstart.html deleted file mode 100755 index 46cee4c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomaploadstart.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - loadstart | geomap - - - - - - - - - - - -
        -
        -

        loadstart

        -
        - -
        - - - - - - - - - - - - - -
        typeload
        init
        $( map selector ).geomap( {
        -  loadstart: function( e, geo ) { }
        -} );
        bind
        $( map selector ).bind( "geomaploadstart", function( e, geo ) { } );
        -} );
        - -

        The loadstart event triggers when the geomap widget begins to load new images. It only triggers once regardless of the number of images about to be loaded. It will not be triggered again until after all pending images have been loaded (the image queue returns to zero) and a change in the map requires more images.

        - -

        The geo argument is currently undefined for this event.

        - -

        You can use this event to show an indicator that your website is busy downloading images.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapmove.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomapmove.html deleted file mode 100755 index 55da454..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapmove.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - move | geomap - - - - - - - - - - - -
        -
        -

        move

        -
        - -
        - - - - - - - - - - - - - -
        typeposition
        init
        $( selector ).geomap( {
        -  move: function( e, geo ) { }
        -} );
        bind
        $( selector ).bind( "geomapmove", function( e, geo ) { } );
        -} );
        -

        The move event triggers when the user moves the mouse cursor while the cursor is over the map. However, it only triggers if the user is not currently performing some other action such as panning.

        -

        The geo argument is a GeoJSON Point object of the location under the mouse cursor in map coordinates.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapshape.html b/libs/js/jquery-geo-1.0b2/docs/geomap/geomapshape.html deleted file mode 100755 index f2661dd..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/geomapshape.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - shape | jQuery Geo - - - - - - - - - - - -
        -
        -

        shape

        -
        - -
        - - - - - - - - - - - - - -
        typeshape
        init
        $( selector ).geomap( {
        -  shape: function( e, geo ) { }
        -} );
        bind
        $( selector ).bind( "geomapshape", function( e, geo ) { } );
        -} );
        -

        The shape event triggers when the user measures a length, or area, or draws a point, line or polygon. He or she does this by tapping the map in specific ways while the geomap mode property is set to: measureLength, measureArea, drawPoint, drawLineString or drawPolygon.

        -

        When mode is drawPoint, a single tap of the map triggers this event passing a GeoJSON Point object of the tapped location in map coordinates.

        -

        When mode is measureLength or drawLineString, the first single tap begins a line. Subsequent single taps add points to the line. A double-tap on the map adds a final point and triggers this event passing a GeoJSON LineString object of the measured length or sketched line in map coordinates.

        -

        When mode is measureArea or drawPolygon, the first single tap begins a polygon. Subsequent single taps add points to the polygon. A double-tap on the map adds a final point and triggers this event passing a GeoJSON Polygon object of the measured area or sketched polygon in map coordinates.

        -

        While measuring or drawing a shape, the user can pan the map by dragging or zoom the map with the mouse wheel. This will not interrupt their current measuring or drawing.

        -

        If you allow users to both measure and draw in your app, be sure to check the mode option in your event handler to determine if this event was triggered by measuring or by drawing. For example, you may want to append the shape to the map during drawPolygon but not during measureArea.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/images/map.png b/libs/js/jquery-geo-1.0b2/docs/geomap/images/map.png deleted file mode 100755 index d41dc4d6e420bdb951514ccee218e12666c7f875..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5005 zcmd6r`9G9j^uV7PS+b2KSz;`ONR*Jhv3;^<%bJ}~wi-#4rYu>8q_JktpfuJ-S;i6> z!q_sl%*fIdrXe&W`98kif8u*y?|bff&fV|1=a(nh#`-c3rx+&y06b=<#&%#m50(-R z7EsGnXLNuS1Zj8K5U3%E{{TOZ1Q=Ku06_gyuD{-_0Kfv+SUQ-1eudKt=g%peS39o- zq6wm9sHh2 zeZ75S?)k<)@I^nqiB3Tlq~FA(BQcpEF$LMkg6x=r{1|LD5?d65%SYmhV(_3*7DK8* zk{XcYrWkTd45d2;oq{gNkH;3pW6MC$xQcjO1seA{9`_oJtHBUn#}jHW_y#ng1=Kiv z10LUmCmcc`wBQLX1VTHZw$Ra;tw_nz1_XNL~!RIB+@`HX@Eo;CXo*zlgCNqNfKqUmpo1;Pm(EzP$;ux z3YAQmrBJ982DO()CDW)B8kNRaBr#Td8LK4PB85hyFlb~3s8`91RSJ{Q%Vdz4pt0G@ z+$0?^dk>hPCes#apfC<$Fjm1rW2`bjVKQjUL(ODv(wLiI#W(=j18pWK2YVm~pny;A z|BslJJUdL3qv575NC4pNJ}eMoSd|~>6pb)(j<65A9&y+Ewm)Fw9TXa&Y;EEo6?s8f zU0Gu!4(AF0unjX~1BWONdf`(y`$lDZv3Bt}DSxJgX7kMx|Mlk?-b zC9!Dyoy>DWd-je|MT!5_ra?)1% zVAxAOqr@QfX?iq0W;>&qT5dK-E_ujQt$(_uK1iEq844M$OXFlgJ$L03^fofdEs^`FMaSbtK&GyR_u^ z)nna!A)k>DZSj8K{u}6VA`m6b5ttBlP7CGxf#b*JchbBl$<<~c20|E|N-0O$U9VciIgx*{(x`817Z9!6g!OwY~Hx952yT4!9{ z+zQffG)@PetCDc=5 z%MMEUFSfluUH0y?=drI`qC-oVCXJkGcaKK_tu5#7x}EqIi4pv1w6(e6|5-}#Z+v)u zv#I!}urXcum7E*&(08dKp-+M*Yu{-m_oH};I{qEch5uYC^IS}9ZEewo7uQw>`1$#5 zjqdF9^b8KJt%>i+5Ab|&*VWOvaN)xF^ZNSw+S;nOD=Ue#*00ZW{H?cn*7G;b#&cVt zk~@;3;Uc#`WlHWn?6eV9Is+pOku1?qDL6!tlmE={93!T0ebjrGqoa$CG zRpq03`?N;sREPY5>~L2HkG{=^N5iy}{3*t=0^-Y4BC>Cf51>YkLTxvs1#S)W&phfD zJL>KZuN|(8NO@v7KDM&*eLa%;bCo!d(%`_$;rYydW{{s*_SRW)ckf-?K+iMUfglWe z=N__YetBrQx7w|;p=o=2n}-{nhCi-=lJNC~VOTet+I*sQmSx8iaxBO6K9wa4OE#x| z_AleuljF3)#FTa7^3Oxp6+Ehw(-K5NIqLt#eknk0|Bfwz#=fbQ;*orwv-EN3Y~Q%^ zcjvz&^ZeG^-=uz7Cq_PFzttwZ&k@rUbcL+b*Hs~ z2Q1|aN{d6XY{S$g92)Hl_&rQSUmjD?=rmI1g*}Go)%#6oLRwjOZHGp(Z91ctOni?7 zTb(W`KNaiyDR^@Al7nDJB@mJYgP&ss_SkJv;UW90<6k^>?@eg0Is^o?-APJVBtHD4gvGZZ1~28Bd?X#C1H zX$SdzW;!!F$?pRc?rw`>`EU{{l6N*)rQ}(Ig#3mPCjYEUBuYNcpn{)ICA>Y=t~phu zq@h&tb_aiF9Hdh)nommIO(3B2IP1Cl9sIz^>*)3Pf6$&dGiW*85dw)-qV}&t{=06m zuxc>l!Ok}?uZwz`;Gr7TA~R;d1^IO6fz5Qx58%~wrU|5&1C_@0mcR?ZWcDQ;V3fy$ z214gl-2^-lGjr|>5U`IX%j;$IdhjLo`McXvFu9{P(>`L&cRARimOo8YJH@sO9;vE` zlWCMqjSh#ZvIn)6Ku|(|6=Om`Gz7=XTcR=EuRfehuXi4??T_Qwiu^PPRIXKPB zQtp3vD%SP95zzrYz5F|oFNZ1=9zo!tPm3&*RHSg+N0Z9@``WeK8#PW+|6Cd2!}?of zOO|Yxc0?Zho7vnx2dfe3gdM?=k2xF05jd@cF35eg%UmruADplWMAWY_m|vMfbi@Jj}8Fot_eL_gK0IJ^^4 z4A>o?GZ!5b@laro3U?Z^p%*!MOy>vq%)|?ezZ3sCAKv0>nqGxr0R~1!(RZ{9LyeB| z@p&jN0OdlN2B?<%0w(;Ac}6=e_|{@h%JL#yrA3eAc7)k>zU|{0YmnvY@%UdK5NOyG zY%%`vx?mZ%EqBiEH5XUSlSG|G3l`_ZUwx|eH?kC>sRQ9Vuzz6`NIw(}o-k@%Q|$NN zz9)BKS#SdfD>p$2j1yJb{LCp9VB7H_{d(a+;|Fc?aR+99I(M`3VGuhZSUb2acsV}} zv+}=8_%v4dr0D;bC9NHXVQY|u|0epSYndL7w|Ev>oU4#BlUar83Hf!>C8D!0*sM*j z>R4ts^$Y-Hm!=)pF41PW+A|{ksXpjMcida;GdlC*i-9*okrh#h)QXo8`Wqgdahr?Z zQy^dNjTIF>t9RTCIrboltw0_&mZ5B_=+zVRZ4F-Vl&e}zbI3u1!#mum&_J#h*Ge0Eva@)rZE*Ev48mcwpv};8EV4MHZ!_(_JC;q;HzsG=0sE;HDZZ(VcWdo5|WR#6S*-f|sfMdP< zE_dt zYkklDFW$g)LWYw?>XFfYskXW$bG9rN?|MPx+2JasF$)sqwPqy0yDAoZQ{ z{_^A_WJdPc205RtR$tWq)_{-a&UNJ}(5glPeNzn8!r{QfaP+62NVyHFla?}%7Au9RYq3GRok>OW<7f6`~1 z6jh75lVl#n8@nR;8i(5-it$3EaO)LjaMhjGK)kA78-(zPzSJ6#e(h%webSh7flH(c z^CYA-;CIRABvPQ#J@$}Qt`lWK2w{=%^$?~myc{Dv4LMxoVMbm8S&**B3|iLV%FQM$k%^D&hE1q*jkH=OhF!I1a)DL+Uf?B(IZlh z2ZX<1$K0Ph*=42nTIl1@Zsv<;kB1bcS~X5<**VU0afS&CVgm!f6vkPJ&ekL^tT&s& z^gk{XzNglYX^c+GrIb1=f8M!P#MoZ%Vp8VKS|w_Vy4y0n zAL(qa5!g6tMILjss!^^sZ_vMzQ;qv*8*2GHtIY_FPNtyra)jw80*z%|R?lj@z?L_? z*m-1{;G5FTpI>J_=}wfP8ZV!)FuN2j^H9xl%Mq7I{40E1AmD9r>7{8kzl+NiiY)w! z#2HHZaT!;O&rP?8f*T%nq{u@TSY#xe%XPbj;M`+NqIqwECx4_Cc(ImiYlz@ar6Gd3Qk;7)Vq5tEcRb^+hdsa7YVpZ z>G$sF*?~tskZa#`L|?H@zjbM`YAKKyk&pgHvF>@ahPqRAE|q)q0!PKfvm{5BntpE0 zIh4`~dy()PEh~L{Erh0uRCUC80YsSmf{i20+NvYIvFyi^N5rty`lE~d^y}?%I$pl} zyNU%zoX&X~)2%?im{8A3Ms?N{$wUKZ$R(PIjZV|uP-Nz~QU0cY+M;QfE1jzVQC z<_4Yo+3&;TA8ec&bPlt!?M!TWt>>2%>sp*|U0fM_ ze2n!?RYtK~euqb98LC2c`IdtGL9C+kR%X17;PKTuH?`WzDt7+p=U=L@G@0CT!OfJc zT$a2^gI7@Z=qLt7?_l?sJ3Cf&Ydw__M!Mt}W;H79nwU?%z7kQ5w7EeEUX-#&z@uK^ z6BM{|oe0J9s@huBmv=q_Zu_bRl1J&t9I*ZTMAV_ZlxC|(pmVYBU4~M g%l(g#kl#P{$Uz%Cs^Is=;ZF=R6KmrdL$AmG1Nt?5nE(I) diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/index.html b/libs/js/jquery-geo-1.0b2/docs/geomap/index.html deleted file mode 100755 index 4edeaee..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/index.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - geomap | jQuery Geo - - - - - - - - - - - -
        -
        -

        geomap widget

        -
        - -
        -

        Once you have an HTML element to target, you can call the geographic map widget's function.

        - -
        .geomap( options )
        - -

        overview

        - -

        The widget creates an interactive map. Users can pan and zoom on desktop and mobile browsers against many different cached tile sets or dynamic map servers. Developers can handle events triggered by user action.

        - -
        - -

        options

        - -

        The options argument is a JavaScript object that configures the map widget during the first instantiation on a div. No options are required. By default the map will show the whole world using the mapquest open tile set.

        - -

        After initializing a map with your first geomap call, you can get or set most of these options using the following syntax:

        - -
        // get the current value of a single option
        -var optionValue = $( map selector ).geomap( "option", optionName );
        -
        -// set a new value for a single option
        -$( map selector ).geomap( "option", optionName, newValue );
        -
        -// set new values for multiple options at the same time
        -$( map selector ).geomap( "option", {
        -  optionName: newValue,
        -  optionName: newValue
        -} );
        - -

        One exception is pixelSize, which is read-only.

        - -

        The map view refreshes when you change these options: bbox, center, services, tilingScheme, bboxMax, & zoom.

        - - - -

        projection

        - -

        The geomap widget will match how you use projection with map units. The map unit type (projected or geodetic) you used when you last set the bbox, bboxMax, or the center option will be used as output for options and as values for arguments. If you never set the bbox or center options, the geomap widget will return geodetic coordinates.

        - -

        For example, if you set the map's center option using geodetic coordinates (a longitude, latitude array), future requests for the value of the map's center or bbox options will be returned in geodetic coordinates. However, if you later set the bbox option using web mercator, future requests for the center or bbox options will be returned in that projection.

        - -

        Changing bbox or center will affect all options and arguments that use map units. The options and arguments involved are:

        - -
          -
        • bbox option
        • -
        • bboxMax option
        • -
        • center option
        • -
        • bbox property of the services object's src argument
        • -
        • GeoJSON objects passed as the geo argument in all events
        • -
        • return value of the toMap method
        • -
        - -

        To avoid confusion, it is recommended to stick to one map unit type for any single map widget.

        - -

        The geomap widget will use the $.geo.proj object when needed to convert between geodetic and projected coordinates.

        - -

        events

        - -

        All event callbacks receive two arguments: the original browser event and an object specific to the map action.

        - -

        The map unit type (projected or geodetic) of the map event arguments depends on the way you initialize the map widget. If you have set the center or bbox option using geodetic coordinates, the event arguments will also be in geodetic coordinates.

        - -

        Like jQuery UI widgets, geomap triggers events directly on the original map div.

        - -

        Programatic changes to options do not trigger events.

        - -

        The dblclick event is special in that you can prevent the default action, zoom-in one level, by calling e.preventDefault() in your callback. This is currently the only geomap event that you can prevent the default action. Calling preventDefault in the callback of any other geomap event has undefined results.

        - -

        There are four geomap event types. The type of event determines what is sent to your event handler as the second argument, geo.

        - -

        position events

        - -

        With position events the geo argument to your callback is a GeoJSON Point object having two properties: type & coordinates. The coordinates property is a single GeoJSON position, i.e., an array containing the x/longitude and y/latitude value.

        - -

        The geo argument to your callback is a true GeoJSON object and you can pass this object directly to the append method. You can also send it directly to a database for storage knowing that there are no non-GeoJSON properties wasting space.

        - - - -

        bbox events

        - -

        With bbox events the geo argument to your callback is an object with single property, bbox, which is a GeoJSON bounding box.

        - - - -

        shape events

        - -

        With shape events, the geo argument to your callback is a GeoJSON geometry object having two properties: type & coordinates. The object type will be either Point, LineString or Polygon depending on the current geomap mode: measureLength, measureArea, drawPoint, drawLineString, and drawPolygon.

        - -

        The geo argument to your callback is a true GeoJSON object and you can pass this object directly to the append method. You can also send it directly to a database for storage knowing that there are no non-GeoJSON properties wasting space.

        - - - -

        load events

        - -

        With load events, the geo argument is currently undefined. You can add the argument to your handler's argument list if you wish but attempting to access any property on it will cause a JavaScript error.

        - - - -

        methods

        - -

        The geomap widget provides some methods to help make interacting map data a little easier.

        - -

        unit conversion

        - -

        Convert positions between pixel and map coordinates.

        - -

        map methods

        -

        These methods update the map widget as a whole.

        - -

        service modification

        -

        Methods that help update objects in the services array.

        - -

        shapes

        -

        These methods manage geometry or features drawn on the geomap widget itself or on individual servies within the map.

        - -

        The find method allows you to search for shapes appended to the map. Its syntax and service-level operation is slightly different than the other three shape methods so the link is visually broken out from the rest.

        - -

        style

        -

        A geomap style is an object whose properties follow a subset of SVG styling properties. The specific styles that geomap recognizes and to which geometry they apply are listed below.

        -

        Use the drawStyle option of the geomap widget to define the style used on incomplete lines and polygons as they are being drawn when mode is drawLineString or drawPolygon.

        -

        Use the shapeStyle option to define the style of shapes drawn after being appended to the map via the append method.

        -

        Please note that in drawPoint mode, the shape event is triggered immediately and so no shape will appear until you append a point to the map at which time the shapeStyle will be used.

        -

        geomap style properties

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        propertydefaultdescription
        borderRadius"8px"The radii of a quarter ellipse that defines the shape of the corner of the outer border of a box drawn around Point shapes, which means it turns your boxes into curved rectangles. If the width, height and borderRadius properties of a style are the same (the default), the point is drawn as a circle.
        color#7f0000An indirect, fallback value for the fill and stroke properties if they are not set.
        fillundefinedColor to use when drawing the interior of a shape. The area to be drawn consists of any areas inside the outline of the shape. By default, fill will use the value of the color property.
        fillOpacity.2Specifies the opacity of the drawing operation used to draw the interior of a shape. The final fill opacity also depends on the value of the opacity property.
        height"8px"The height of a box drawn around Point shapes. Currently only pixel values are allowed. If either width or height are zero, no shape is drawn for the Point.
        opacity1The object opacity of the entire shape. This is a multiplicative operation when determining the final fillOpacity and strokeOpacity where any fill or stroke operation is made even more translucent if this value is below 1.0.
        strokeundefinedColor to use when drawing along the outline of a shape. By default, stroke will use the value of the color property.
        strokeOpacity1Specifies the opacity of the drawing operation used to draw the outline of a shape. The final stroke opacity also depends on the value of the opacity property.
        strokeWidth"2px"The width of the stroke of a shape. A zero value causes no stroke to be drawn. Currently only pixel values are allowed.
        visibility"visible"Determines if the shape is drawn ("visible") or not drawn ("hidden") on the map. Shapes that are hidden can still be returned by the find method.
        width"8px"The width of a rounded rectangle drawn around Point shapes. Currently only pixel values are allowed. If either width or height are zero, no shape is drawn for the Point.
        -

        All properties apply to Point shapes which means that you can adjust the stroke and fill of the box surrounding the point location.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/measureLabels.html b/libs/js/jquery-geo-1.0b2/docs/geomap/measureLabels.html deleted file mode 100755 index d9f65e7..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/measureLabels.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - measureLabels | geomap - - - - - - - - - - - -
        -
        -

        measureLabels

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeObject
        default
        {
        -  length: "{{:length}} m",
        -  area: "{{:area}} sq m"
        -}
        init
        $( selector ).geomap( { measureLabels: { length: "{{:length}} meters" } } );
        get
        var measureLabels = $( selector ).geomap( "option", "measureLabels" );
        set
        $( selector ).geomap( "option", "measureLabels", { area: "{{:area}} square meters" } );
        - -

        The measureLabels option controls how the length or area text is formatted when displayed on the map during measuring.

        - -

        In the label strings, the {{: }} syntax is used as a placeholder for the current length or area. All other text is displayed verbatim.

        - -

        Note: Alpha releases used a {{= }} syntax but there is a breaking change in the beta version due to changes in jsRender. Please use the new {{: }} syntax.

        - -

        The developer may change each measureLabels option separately during both initialization of the widget or any time after.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/mode.html b/libs/js/jquery-geo-1.0b2/docs/geomap/mode.html deleted file mode 100755 index 93042d6..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/mode.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - - mode | geomap - - - - - - - - - - - -
        -
        -

        mode

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeString
        default"pan"
        init
        $( selector ).geomap( { mode: "pan" } );
        get
        var mode = $( selector ).geomap( "option", "mode" );
        set
        $( selector ).geomap( "option", "mode", "drawPoint" );
        - -

        The mode option determines how the map responds to user interaction and which events jQuery Geo triggers for the developer.

        - -

        jQuery Geo puts these modes into four small groups:

        - -

        modes

        - - -

        basic

        - -

        Basic modes are most common to what people expect to be able to do with a map: drag it around, zoom it in and out, or just have it sit there an look pretty.

        - -
          -
        • static
        • -
        • pan
        • -
        • zoom
        • -
        - -

        drag

        - -

        Drag modes disable panning and turn single swipes into shape events.

        - -
          -
        • dragBox
        • -
        - -

        draw

        - -

        Draw modes turn user clicks into shape events, panning is allowed.

        - -
          -
        • drawPoint
        • -
        • drawLineString
        • -
        • drawPolygon
        • -
        - -

        measure

        - -

        Measure modes display length and area based on clicks and drags.

        - -
          -
        • measureLength
        • -
        • measureArea
        • -
        - -

        You are free to set mode to any other string, this is called custom modes in jQuery Geo and described at the end of this page.

        - -

        related options

        - -

        Each mode has a matching property on the cursors option. For example, to change the cursor for drawPoint mode to an I-beam, you can initialize the geomap widget like this:

        - -
        $( selector ).geomap( { cursors: { drawPoint: "text" } } )
        - -

        The drawStyle option determines how shapes look while being drawn in all of the draw, drag, and measure modes.

        - -

        The measureLabels option determines how the text is formatted while using the measure modes.

        - -

        You can remove a user's ability to pan the map by setting the panning option to false. Yes, you can disable panning even when mode is set to "pan".

        - -

        You can shut off mouse wheel scroll in any mode by setting the scroll option to "off".

        - -

        However, when mode is static, setting panning to true or scroll to "zoom" will not enable panning or mouse wheel zoom. In static mode, the geomap widget ignores the panning and scroll options.

        - -

        style

        -

        The label containing the measure length or area text has the geo-measure-label CSS class. To change how the measure text looks, you can update properties in that rule:

        - -
        .geo-measure-label { font-size: 1.5em; }
        - -

        static

        - -

        user experience

        -

        The default cursor is the default arrow pointer.

        - -

        The map widget displays tiles and map images as normal but the user cannot interact with them, e.g., the user can't pan or zoom in any way, even if the pannable option is set to true.

        - -

        As a developer, you can still call geomap methods and set options in order to change the static map's appearance. Events are not triggered when you change the map programmatically.

        - -

        events

        -

        All regular browser events bubble up to parent elements and eventually the document. No widget-specific events trigger. You are free to handle events on the map div as normal events, e.g., click, but you won't get the geo argument. You can ask the map widget for information such as map locations based on the pixel arguments in the event. See the Inset example for help with this.

        - -

        pan

        -

        user experience

        -

        The default cursor is an open hand in browsers that support data URIs and a four point arrow otherwise.

        - -

        The user can drag the map to pan. The map will continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. They can also double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        events

        -

        In pan mode, the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively panning
        • -
        • click – when the user clicks or taps a point on the map without initiating a pan, i.e., they let go of the map at the same point and within a short time threshold
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map
        • -
        • bboxchange – when the user changes the bbox by panning or zooming
        • -
        - -

        zoom

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can perform a marquee zoom by clicking and holding one point and dragging the mouse cursor. A box will form. When the user lets go of the mouse, the map will zoom to the closest approximation of the bbox of the drawn shape.

        -

        Shingled (dynamic) services are only limited by the ratio between the size of the drawn shape and the map div's current size. Cached services are limited to those as well but also specific map zoom levels so the final bbox will not be as close.

        -

        The user can also zoom in or out with the scroll wheel as well as double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        -

        This is not a very useful mode for mobile applications but provides a more exact method of zooming into an area for desktop users who want it.

        - -

        events

        -

        In zoom mode the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively performing a marquee zoom
        • -
        • click – when the user clicks or taps a point on the map without initiating a marquee zoom, i.e., they let go of the map at the same point and within a short time threshold
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map
        • -
        • bboxchange – when the user changes the bbox by zooming
        • -
        - -

        dragBox

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        Similar to zoom, in this mode the user can click and hold one point and then drag the mouse cursor. A box will form. When the user lets go of the mouse, jQuery Geo will trigger a shape event passing a GeoJSON Polygon representation of the dragged bbox as the geo argument. The Polygon object also has the GeoJSON the bbox property.

        - -

        The user can also click the map instead of dragging a box. In this case, jQuery Geo will still trigger a shape event, but this time it will pass a GeoJSON Point representing the clicked location. The Point object will also have the bbox property with the min and max values matching each other, i.e., bbox[0] (minx) = bbox[2] (maxx) and bbox[1] (miny) = bbox[3] (maxy).

        - -

        The user cannot pan the map while in dragBox mode. The user can zoom in or out with the scroll wheel as well as double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        events

        -

        In dragBox mode the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively dragging a bbox
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map
        • -
        • bboxchange – when the user changes the bbox by zooming
        • -
        • shape – when the user lets go of the mouse after dragging to make a bbox, jQuery Geo will send a GeoJSON Polygon object to the developer; this Polygon object has a bbox property which is set to the bbox of the rectangle drawn
        • -
        - -

        dragCircle

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can click and hold one point and then drag the mouse cursor. A circle will form from the center outward. When the user lets go of the mouse, jQuery Geo will trigger a shape event passing a GeoJSON Polygon representation of the dragged circle as the geo argument. The Polygon object also has the GeoJSON the bbox property.

        - -

        The user can also click the map instead of dragging a circle. In this case, jQuery Geo will still trigger a shape event, but this time it will pass a GeoJSON Point representing the clicked location. The Point object will also have the bbox property with the min and max values matching each other, i.e., bbox[0] (minx) = bbox[2] (maxx) and bbox[1] (miny) = bbox[3] (maxy).

        - -

        The user cannot pan the map while in dragCircle mode. The user can zoom in or out with the scroll wheel as well as double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        events

        -

        In dragCircle mode the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively dragging a circle
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map
        • -
        • bboxchange – when the user changes the bbox by zooming
        • -
        • shape – when the user lets go of the mouse after dragging to make a circle, jQuery Geo will send a GeoJSON Polygon object to the developer; this Polygon object has a bbox property which is set to the bbox of the circle drawn
        • -
        - -

        drawPoint

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can digitize a Point shape by single-clicking or tapping the map. Apart from the default cursor, this mode is similar to pan in that the user can drag the map to pan. However, to allow a user more accuracy during digitization, the map will not continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. They can also double-click or double-tap to zoom in one level.

        - -

        A visual point will appear temporarily until they either let go to draw the point or begin panning.

        - -

        Similar to pan mode, the user can drag the map to pan. However, to allow a user more accuracy during digitization, the map will not continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. They can also double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        events

        -

        In drawPoint mode, the geomap widget triggers the following events on the original map div. Note that the shape event replaces the click event.

        -
          -
        • move – when the user moves the mouse above the map but is not actively panning
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map
        • -
        • bboxchange – when the user changes the bbox by panning or zooming
        • -
        • shape – when the user clicks or taps a point on the map, this action will send a GeoJSON Point object to the developer
        • -
        - -

        drawLineString

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can digitize a LineString shape. The first single-click or tap on the map will begin the shape drawing. Once initialized, subsequent single-clicks will add points to the LineString. Finally, a double-click or tap will end the digitization and trigger the shape event.

        - -

        On a non-touch device a visual line will follow the mouse cursor from the last point to show the user the next segment of the line they will draw. On all devices, the next segment becomes visible when the user confirms the next point location by clicking or tapping. At any point, the user can hit the escape key to remove one point or, if there is only one point, stop drawing the shape alltogether.

        - -

        Similar to pan mode, the user can drag the map to pan, even while drawing a shape. However, to allow a user more accuracy during digitization, the map will not continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. While not drawing, they can also double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        events

        -

        In drawLineString mode, the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively panning, this event triggers even while drawing a shape
        • -
        • click – when the user clicks or taps a point on the map without initiating a pan, this event triggers even while drawing a shape
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map but is not actively drawing
        • -
        • bboxchange – when the user changes the bbox by panning or zooming
        • -
        • shape – when the user double-clicks or taps a point on the map after beginning a drawing operation with a single click, this action will send a GeoJSON LineString object to the developer
        • -
        - -

        drawPolygon

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can digitize a Polygon shape. The first single-click or tap on the map will begin the shape drawing. Once initialized, subsequent single-clicks will add points to the Polygon. Finally, a double-click or tap will end the digitization and trigger the shape event.

        - -

        On a non-touch device two visual lines will follow the mouse cursor. One from the last point to show the user the next segment of the Polygon they will draw, the other from the first point to show the user an extra segment that will complete the Polygon. On all devices, the next segment becomes visible when the user confirms the next point location by clicking or tapping. At any point, the user can hit the escape key to remove one point or, if there is only one point, stop drawing the shape alltogether.

        - -

        Similar to pan mode, the user can drag the map to pan, even while drawing a shape. However, to allow a user more accuracy during digitization, the map will not continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. While not drawing, they can also double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        events

        -

        In drawPolygon mode, the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively panning, this event triggers even while drawing a shape
        • -
        • click – when the user clicks or taps a point on the map without initiating a pan, this event triggers even while drawing a shape
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map but is not actively drawing
        • -
        • bboxchange – when the user changes the bbox by panning or zooming
        • -
        • shape – when the user double-clicks or taps a point on the map after beginning a drawing operation with a single click, this action will send a GeoJSON Polygon object to the developer
        • -
        - -

        measureLength

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can visually measure the length of lines on the map. The first single-click or tap on the map will begin the measurement. Once initialized, subsequent single-clicks or taps will add points to a LineString being measured. Whenever the mouse moves, a label follows the cursor which displays the total length so far. Touch devices will only see an updated measurment when they add a new point. A double-click or tap will end the measurement and remove all graphics and labels.

        - -

        On a non-touch device a visual line will follow the mouse cursor from the last point to show the user the next segment of the line they are measuring and update the measurement. On all devices, the next segment becomes visible when the user confirms the next point location by clicking or tapping. At any point, the user can hit the escape key to remove one point or, if there is only one point, stop measuring alltogether.

        - -

        Similar to pan mode, the user can drag the map to pan, even while measuring. The map will continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. While not measuring, they can also double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        By default the unit of measurment is meters because the default projection is web mercator meters. If you change the tilingScheme (on tiled services) or switch to a shingled service, the unit of measurment will be based on your new service's units.

        -

        events

        -

        In measureLength mode, the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively panning, this event triggers even while measuring
        • -
        • click – when the user clicks or taps a point on the map without initiating a pan, this event triggers even while measuring
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map but is not actively measuring
        • -
        • bboxchange – when the user changes the bbox by panning or zooming
        • -
        • shape – when the user double-clicks or taps a point on the map after beginning a measure operation with a single click, this action will send a GeoJSON LineString object to the developer
        • -
        - -

        measureArea

        - -

        user experience

        -

        The default cursor is a crosshair.

        - -

        In this mode the user can visually measure an area on the map. The first single-click or tap on the map will begin the measurement. Once initialized, subsequent single-clicks or taps will add points to a Polygon being measured. Whenever the mouse moves, a label follows the center of the polygon that displays the total area so far. Touch devices will only see an updated measurment when they add a new point. A double-click or tap will end the measurement and remove all graphics and labels.

        - -

        On a non-touch device two visual lines will follow the mouse cursor. One from the last point to show the user the next segment of the Polygon they will draw, the other from the first point to show the user an extra segment that will complete the Polygon we need to calculate area. On all devices, the next segment becomes visible when the user confirms the next point location by clicking or tapping. At any point, the user can hit the escape key to remove one point or, if there is only one point, stop measuring alltogether.

        - -

        Similar to pan mode, the user can drag the map to pan, even while measuring. The map will continue panning a little after the user lets go. They can zoom in or out with the scroll wheel. While not measuring, they can also double-click or double-tap to zoom in one level. On some multitouch devices, users can use two fingers to "pinch zoom" (currently not available on Android).

        - -

        The user can hold the shift key to temporarily switch to zoom mode.

        - -

        By default the unit of measurment is meters because the default projection is web mercator meters. If you change the tilingScheme (on tiled services) or switch to a shingled service, the unit of measurment will be based on your new service's units.

        - -

        events

        - -

        In measureArea mode, the geomap widget triggers the following events on the original map div.

        -
          -
        • move – when the user moves the mouse above the map but is not actively panning, this event triggers even while measuring
        • -
        • click – when the user clicks or taps a point on the map without initiating a pan, this event triggers even while measuring
        • -
        • dblclick – when the user double-clicks or double-taps a point on the map but is not actively measuring
        • -
        • bboxchange – when the user changes the bbox by panning or zooming
        • -
        • shape – when the user double-clicks or taps a point on the map after beginning a measure operation with a single click, this action will send a GeoJSON Polygon object to the developer
        • -
        - -

        custom modes

        - -

        As mentioned above, you can also set mode to any other string. It will behave exactly like pan mode. However, you can set a different cursor:

        - -
        var map = $( "#map" ).geomap( {
        -  mode: "click",
        -  cursors: { click: "crosshair" }
        -} );
        - -

        The above example creates a new custom mode, click, and sets the geomap widget to that mode during initialization. When the widget is in this mode, it will behave exactly like pan, but have a crosshair. This means you will get all the same events as pan: move, click, dblclick & bboxchange. A mode like this is useful if you want to give users more accuracy when clicking the map.

        - -

        Custom modes will still allow panning. While panning, the cursor will temporarily switch to the pan cursor. You can disable panning for your mode by setting the widget's panning option to false whenever you change the mode option.

        - -
        function setMode( mode ) {
        -  map.geomap( "option", {
        -    mode: mode,
        -    panning: mode !== "click"
        -  } );
        -}
        - -

        In this last example, we create a new map with two modes, find and remove. They both trigger the click event so we can check our current mode and behave differently depending on which one is set, or do nothing if we're not in find or remove mode.

        - -
        var map = $( "#map" ).geomap( {
        -  mode: "drawPoint",
        -  cursors: {
        -    find: "crosshair",
        -    remove: "crosshair"
        -  },
        -  shape: function( e, geo ) {
        -    // only the draw modes trigger this event
        -    map.geomap( "append", geo );
        -  },
        -  click: function( e, geo ) {
        -    switch( map.geomap( "option", "mode" ) ) {
        -      case "find":
        -        // search for shapes but just alert the user
        -        var shapes = map.geomap( "find", geo, 3 );
        -        if ( shapes.length > 0 ) {
        -          alert( "Found " + shapes.length + " shape(s) !" );
        -        }
        -        break;
        -
        -      case "remove":
        -        // search for shapes and remove one of them
        -        var shapes = map.geomap( "find", geo, 3 );
        -        if ( shapes.length > 0 ) {
        -          map.geomap( "remove", shapes[ 0 ] );
        -        }
        -        break;
        -
        -      default:
        -        // ignore the click event for all other modes: pan, zoom, etc.
        -        break;
        -    }
        -  }
        -} );
        - -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/opacity.html b/libs/js/jquery-geo-1.0b2/docs/geomap/opacity.html deleted file mode 100755 index 6ba22b6..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/opacity.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - opacity | geomap - - - - - - - - - - - -
        -
        -

        opacity

        -
        - -
        - - - - - - - - - - - - - -
        return typeundefined
        syntax$( map or service selector ).geomap( "opacity", Number opacity )
        usage
        $("#map").geomap( "opacity", .5 )
        -$("#map .osm").geomap( "opacity", .7 )
        -
        -

        This method sets the value of the opacity property of service objects in the services array.

        -

        It will also update the opacity of all images already requested by the service.

        -

        If you call opacity directly on geomap's div element, it will apply to all services. You can target individual services using a CSS selector based on the map div id and the class supplied for the service in its service object or just the id of the service if supplied in its service object.

        -
        // for example, given the following as the map div
        -<div id="map"></div>
        -
        -// and initializing geomap with the following services
        -$("#map").geomap({
        -  services: [
        -    {
        -      id: "water",
        -      class: "mass-gis",
        -      type: "shingled",
        -      src: function ( view ) { return null; }
        -    },
        -    {
        -      id: "towns",
        -      class: "mass-gis",
        -      type: "shingled",
        -      src: function ( view ) { return null; }
        -    },
        -    {
        -      id: "harbor-cruise",
        -      type: "shingled",
        -      src: function ( view ) { return null; }
        -    }
        -  ]
        -});
        -
        -// you can later change the opacity of all services
        -$("#map").geomap("opacity", .8);
        -
        -// all mass-gis services
        -$("#map .mass-gis").geomap("opacity", .5);
        -
        -// or a specific service
        -$("#harbor-cruise").geomap("opacity", 1.0);
        -

        This is much faster than changing a service object's opacity value yourself and updating geomap's services property.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/pannable.html b/libs/js/jquery-geo-1.0b2/docs/geomap/pannable.html deleted file mode 100755 index dcd4c4d..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/pannable.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - pannable | geomap - - - - - - - - - - - -
        -
        -

        pannable

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeBoolean
        defaulttrue
        init
        $( map selector ).geomap( { pannable: true } );
        get
        var pannable = $( map selector ).geomap( "option", "pannable" );
        set
        $( map selector ).geomap( "option", "pannable", false );
        - -

        The pannable option determines whether or not a user can pan the map.

        - -

        When true, the default, users can drag the map image or tiles to change the bbox in any mode except for "static". For example, they can pan the map in the middle of drawing a polygon with the drawPolygon mode.

        - -

        When false, a user's dragging of the map image will not cause it to move regardless of what mode the widget is in. Developers can still make programatic changes to the bbox, such as setting options and calling methods.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/pixelSize.html b/libs/js/jquery-geo-1.0b2/docs/geomap/pixelSize.html deleted file mode 100755 index f460454..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/pixelSize.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - pixelSize | geomap - - - - - - - - - - - -
        -
        -

        pixelSize

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeNumber
        default156543.03392799936
        initcannot be initialized
        get
        var pixelSize = $( selector ).geomap( "option", "pixelSize" );
        setread only
        -

        The pixel size is the number of map units a single pixel occupies in the current view. A more interesting way to think of it is the Earth-size of the pixel.

        -

        Because the default internal projection is web mercator meters, the default return value for pixelSize is in meters even if you set other map values in geodetic coordinates, e.g., lon/lat. The unit type will always match the type you set on tilingScheme for tiled maps or bboxMax for shingled (dynamic) maps. For more information on how the plugin handles projections, please read the geo section of this documentation.

        -

        The map's pixel size is read-only. To change it you will need to use one of the mutable properties such as bbox, center or zoom.

        -

        pixelSize is calculated based on tilingScheme & zoom for tiled maps. It is based on the bbox/bboxMax ratio for shingled maps.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/refresh.html b/libs/js/jquery-geo-1.0b2/docs/geomap/refresh.html deleted file mode 100755 index ee604b3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/refresh.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - refresh | geomap - - - - - - - - - - - -
        -
        -

        refresh

        -
        - -
        - - - - - - - - - - - - - -
        return typeundefined
        syntax$( map or service selector ).geomap( "refresh" [ , Boolean force ] )
        usage
        $("#map").geomap( "refresh" )
        -
        -$("#map").geomap( "refresh", true )
        -
        -$("#map .my-dynamic-service").geomap( "refresh", true )
        - -

        This method refreshes one or more services and shapes in the map. Usually, changing geomap options or calling methods automatically refreshes the map appropriately. However, you can call this after you have added or removed shapes to geomap by passing false as the refresh argument to the append, remove, or empty methods. This method is also useful in the case of dynamic server data.

        - -

        Without a service selector, all services on the map will be refreshed.

        - -

        The force option will re-request images for tiles already in the map view. Keep in mind, though, that this does not guarantee you will get updated images. See the Dynamic Data section below for tips.

        - -

        Dynamic Data

        - -

        There are three factors that can prevent jQuery Geo from getting a fresh image from a web server.

        - -
          -
        • if the user does not interact with the map and you do not call refresh, jQuery Geo will not request new images
        • -
        • if the user does interact with the map, you call refresh with no arguments, or you call .geomap( "refresh", false ): -
            -
          • for tiled services: jQuery Geo will only request images for tiles that it does not already have
          • -
          • for shingeld services: a new image is always requested but the browser may supply a cached image
          • -
          -
        • -
        • if you call .geomap( "refresh", true ), jQuery Geo will: -
            -
          • for tiled services: request a new image for existing tiles but the web browser is free to supply a cached image instead of retriving one from the web server
          • -
          • for shinged services: this is also true; if the final image URL is the same as a previous image URL the browser may supply a cached image
          • -
          -
        • -
        - -

        A web browser will normally cache images that have already been loaded. On top of that, jQuery Geo will not, by default, request images for tiles that it has already placed. In the case of dynamic data, where you want to update what's on the map without requiring a pan or zoom or also update tiles that have already been placed, you have a couple options.

        - -

        use uncachable URLs

        - -

        The first option is to use a function for the src property of your service object. In that function, return a different URL every time even if all of the properties of the view object are the same as a previous call. If we were to use jQuery's implementation of the cache option in $.ajax as inspiration, our src function could look similar to:

        - -
        src: function( view ) {
        -  return "my.dynamic.tile.service/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png?_=" + $.now( );
        -}
        - -

        The _ input in the query string will be a different number on every request, regardless of the value of zoom, column, and row. Most services will ignore extraneous query string inputs and the web browser will not be able to cache the image.

        - -

        use the Cache-Control HTTP header

        - -

        Another way to achieve the same result without modifying your image URLs is to use the HTTP header: Cache-Control. By returning this header with the no-cache value, you can tell the web browser to not cache the image. Then, when you call .geomap( "refresh", true ), the web browser will re-request images for tiles even if it has done so one already. This option is only possible if you have some control over the web server that supplies map images. How to add the header is specific to your web server and beyond the scope of these docs. It can usually be done in the web server's configuration file or in the web service itself where you generate the images.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/remove.html b/libs/js/jquery-geo-1.0b2/docs/geomap/remove.html deleted file mode 100755 index dc19501..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/remove.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - remove | geomap - - - - - - - - - - - -
        -
        -

        remove

        -
        - -
        - - - - - - - - - - - - - -
        return typejQuery collection
        syntax.geomap( "remove", Object shape ( GeoJSON object ) | Array<Object> shapes [ , Boolean refresh ] )
        usage
        $( map or service selector ).geomap( "remove", existingShape )
        -$( map or service selector ).geomap( "remove", existingShape, false )
        -$( map or service selector ).geomap( "remove", [ existingShape1, existingShape2 ] )
        - -

        The remove method removes a shape (or array of shapes) that you have previously added with the append method. The existing shapes can be an object references used in a call to append which you have held on to or ones that you retrieved by using the find method.

        - -

        The jQuery UI widget factory returns the original jQuery collection to maintain call chaining.

        - -

        delaying refresh

        -

        The optional refresh argument determines if geomap refreshes the map graphics after this call to remove. It defaults to true. If you pass false, geomap will remove the shape internally but not immediately redraw the graphics. The changes will display if the user moves the map or you call geomap's refresh method.

        -

        If the shape is not found on the specified service, the map is not changed and will not be refreshed even if you pass true for the refresh argument.

        -

        service-level shapes

        -

        Similar to how you can append shapes to specific services, you can remove shapes from specific services as well.

        -

        You do this by targeting a service inside a map instead of the map itself for your call to geomap's remove method. For example, the default map service has the CSS class: osm. We can remove a shape from that service specifically by using jQuery to target the service:

        -
        $( "#map .osm" ).geomap( "remove", shape );
        -

        Shapes appended to a specific service will not be removed by calling remove on the map itself. For example, the shape will remain after this sequence:

        -

        $( "#map .osm" ).geomap( "append", shape );
        -$( "#map" ).geomap( "remove", shape );
        -

        To remove all references to a shape from the map and all services, you can use the comma selector and the built-in geo-service CSS class:

        -
        // remove the shape from both the map widget and any services
        -$( "#map,#map .geo-service" ).geomap( "remove", shape );
        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/resize.html b/libs/js/jquery-geo-1.0b2/docs/geomap/resize.html deleted file mode 100755 index c9336ab..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/resize.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - resize | geomap - - - - - - - - - - - -
        -
        -

        resize

        -
        - -
        - - - - - - - - - - - - - -
        return typeundefined
        syntax.geomap( "resize" )
        usage
        $("#map").geomap( "resize" )
        -

        - This method tells the geomap widget to recalculate its frame and adjust its bbox to fit a new size. The map will maintain its center point and pixel size and expand or contract to fill the new surroundings.

        -

        - The geomap widget watches the browser window for you. If your map widget's div position is related to the window in some way, geomap will automatically resize to fit when the window size changes. If the map widget's div is not related to the window and you manually change its size, you need to call resize so that the map can adjust.

        -

        - This method refreshes the map.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/scroll.html b/libs/js/jquery-geo-1.0b2/docs/geomap/scroll.html deleted file mode 100755 index fbf91a1..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/scroll.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - scroll | geomap - - - - - - - - - - - -
        -
        -

        scroll

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeString
        default"default"
        init
        $( map selector ).geomap( { scroll: "default" } );
        get
        var scroll = $( map selector ).geomap( "option", "scroll" );
        set
        $( map selector ).geomap( "option", "scroll", "off" );
        - -

        The scroll option determines what the map widget does when the user rotates a mouse wheel. There are currently three values: default, zoom, and off. However, default is currently the same as zoom.

        - -

        When scroll is default or zoom, users can use a mouse wheel to zoom the map in or out.

        - -

        When set to off, mouse wheel scrolling is ignored. This is useful when the document itself or a section that contains the map requires scrolling due to content. A desktop user will expect to be able to use the mouse wheel to scroll the document and you don't want the map to interfere. For example, if the user's mouse cursor is over a map that's part of a long document, there's a greater chance they will want the mouse wheel to scroll document instead of zooming the map. Set the scroll property to "off" to ensure the wheel will work as expected.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/services.html b/libs/js/jquery-geo-1.0b2/docs/geomap/services.html deleted file mode 100755 index e30e6bf..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/services.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - services | geomap - - - - - - - - - - - -
        -
        -

        services

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        typeArray
        default
        [ {
        -  "class": "osm",
        -  type: "tiled",
        -  src: function( view ) {
        -    return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
        -  },
        -  attr: "<p>Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'></p>"
        -} ] );
        init
        $( selector ).geomap( { services: [ {
        -  "class": "osm",
        -  type: "tiled",
        -  src: function( view ) {
        -    return "http://tile.openstreetmap.org/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
        -  },
        -  attr: "&copy; OpenStreetMap &amp; contributors, CC-BY-SA",
        -  style: {
        -    visibility: "visible",
        -    opacity: 1.0
        -  }
        -} ] } );
        get
        var services = $( selector ).geomap( "option", "services" );
        set
        $( selector ).geomap( "option", "services", [ {
        -  id: "openstreetmap",
        -  type: "tiled",
        -  src: function( view ) {
        -    return "http://tile.openstreetmap.org/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
        -  },
        -  attr: "&copy; OpenStreetMap &amp; contributors, CC-BY-SA"
        -} ]
        - -

        The services option is an array of service objects. The service objects are JavaScript objects that control how the geomap widget displays map images.

        - -

        service object

        - -

        A service object has six properties, two of which are required. The id and class properties are optional but at least one is recommended so you can target specific services with the toggle and opacity methods.

        -

        id

        -

        Each service can have an id that distinguishes it from other service objects in the array. The id is a string and must be follow the HTML element id naming conditions. If present, the id must be unique across all services in all maps as well as unique from any other HTML element on the page. The default service object of a geomap widget does not have an id.

        -

        class

        -

        Each service can have a class as well. The class is a string and must be follow the CSS class naming conditions. You can consider this as the class of images the service will supply and usually name it after the service, such as osm, mass-gis, etc. The default service object of a geomap widget has the class: osm.

        -

        All services also get the class geo-service whether you supply a class to the service object or not. Therefore, the default service is both .osm (as part of its service object) and .geo-service (as added by the widget).

        -

        Unfortunately, class is a reserved word in JavaScript. When you specify class in your service object, you must quote the word class. This is exactly how it's done in jQuery itself when applying attributes to an element based on an object. To quote the jQuery API:

        -
        The name "class" must be quoted since it is a JavaScript reserved word, and "className" cannot be used since it is not the correct attribute name.
        -

        type

        -

        A service object has a type property which is either "tiled" or "shingled". Tiled servies will get one image request per tile needed to fill a given view when the map refreshes. The tile request's bbox will only be the size of the given tile. Shingled services will get only one image request each time the map refreshes and the bbox will be the extent of the whole map view.

        -

        src

        -

        The src property of a service object can be one of the following three options:

        -
          -
        • a function that accepts an object specifying information about the current image request which returns a URL to an image or null to indicate that no image is available or required
        • -
        • a function that accepts an object specifying information about the current image request which returns a jQuery Promise object and, later, calls either resolve passing a URL to an image or reject to indicate that no image is available
        • -
        • a template string that the geomap widget can use to build a URL itself
        • -
        -

        For tiled services, the image is placed at the tile location specified. For shingled services, the image will fill the whole map view.

        -

        If the browser's request of the image results in a 404 status the map will not show that tile or image.

        -

        When src is a function, the argument to that function has the following properties:

        - - - - - - - - - - - - - - - - - - - -
        bbox (Array)A GeoJSON bounding box of the current tile or image in map units. The map unit type (projected or geodetic) depends on how you last set the bbox or center options on the geomap widget.
        width (Number)The width of the tile or image in pixels.
        height (Number)The height of the tile or image in pixels.
        zoom (Number)The current zoom level of the map during this request.
        tile (Object)If the service is tiled, this object has column and row properties specifying the location of the tile of this request in the current zoom, otherwise it is null.
        index (Number)A whole number which is usually incremented between requests that you can use to cycle image URLs to different index, e.g., if there are four servers hosting the same tile images named tile0, tile1, tile2 and tile3 you can target them in your src function with the string: "tile" + (view.index % 4).
        -

        You can use the properties of this argument to build and return a URL (or initiate an AJAX request and return a Promise).

        -

        For more infomration about returning a jQuery Promise, please read the section on Deferred Objects in the jQuery API documentation. It might useful to know that, as of jQuery 1.5, the $.ajax method returns a Promise object. If your ajax call returns a URL to an image, your src function can look something like this:

        -
        src: function ( view ) { return $.ajax( { ... } ); }
        -

        When src is a string, those same properties can be used in the template by surrounding each property with: {{:propertyName}}.

        - -

        The default value for src is a function because it is slightly faster than rendering a template and we have better control of the view.index property. However, as an example, we can rewrite the default src function as a template string:

        - -

        Note: Alpha releases used a {{= }} syntax but there is a breaking change in the beta version due to changes in jsRender. Please use the new {{: }} syntax.

        - -
        src: "http://otile1.mqcdn.com/tiles/1.0.0/osm/{{:zoom}}/{{:tile.column}}/{{:tile.row}}.png"
        - -

        A couple advantages of using a string are that it is more concise and, unlike a function, can be stored as JSON.

        - -

        You do not have to have template parameters in the string, so if you want a static map image, you can set src to a static URL.

        - -

        attr

        - -

        The attr property is optional. It stands for attribution and is a way to give credit to the source of your map imagery. It defaults to an empty string if not specified in a service object. When present, the map widget displays the HTML provided on the bottom-left corner of the map when the service is visible. Users can click links but cannot interact with all other text or images.

        -

        style

        -

        The style property is optional. It contains presentation options for the service.

        - -

        The visibility property defaults to "visible". It determines whether or not the map will show images from this service while refreshing. You can change the visibility of a service either by changing the visibility property of the service object to "visible" or "hidden" and then setting geomap's services option or by using the toggle method of the geomap widget. The latter is recommended because it is a lot faster and does not cause services to be recreated.

        - -

        The opacity defaults to 1.0. It determines how transparent a service is when it is visible. Valid values are floating point numbers between 0 and 1 inclusive. Services with an opacity of 0 will not show on the map even if visible is true. You can change the opacity of a service either by changing the opacity property of the service object and then setting geomap's services option or by using the opacity method of the geomap widget. The latter is recommended because it is a lot faster and does not cause services to be recreated.

        - -

        modifying services

        - -

        By default, the geomap widget starts with one service object in the services array. The default service object will display OpenStreetMap data via mapquest open tiles. Setting the services option will replace all existing services with a new set that you specify. You can set a specific part of of a specific service by getting the current array, modifying, adding, or deleting one of the service objects and then re-setting the services option with the modified array.

        - -

        Note: It is always better to set the services option once, during init, rather than adding or modifying services after the map has been created. Some of the following samples show that it is possible to modify the services option after map initialization through the services option even though it's not recommended.

        - -
        // create a map
        -var map = $( "#map" ).geomap( );
        -
        -// get the current services array
        -var services = map.geomap( "option", "services" );
        -
        -// add a service
        -services.push( {
        -  id: "Ortho_MapQuest",
        -  type: "tiled",
        -  src: function (view) {
        -    return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
        -  },
        -  attr: "<p>Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest<a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'><p>"
        -} );
        -
        -// hide the first service in the services array
        -services[ 0 ].style.visibility = "hidden";
        -
        -// re-set the services option
        -map.geomap( "option", "services", services );
        - -

        The following code is more efficient than the last sample:

        - -
        // build an array of service objects ahead of time
        -var services = [ {
        -  id: "OSM",
        -  type: "tiled",
        -  src: "http://tile.openstreetmap.org/{{:zoom}}/{{:tile.column}}/{{:tile.row}}.png",
        -  attr: "&copy; OpenStreetMap &amp; contributors, CC-BY-SA"
        -  style: { visibility: "hidden" } // default to hidden
        -}, {
        -  id: "Ortho_MapQuest",
        -  type: "tiled",
        -  src: function (view) {
        -    return "http://oatile" + ((view.index % 4) + 1) + ".mqcdn.com/naip/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png";
        -  },
        -  attr: "<p>Tiles Courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest<a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'><p>"
        -} ];
        -
        -// create a map with all services in place
        -var map = $( "#map" ).geomap( { services: services } );
        - -

        To change visibility or opacity of a service after you have created the map, you should use the toggle or opacity methods. -

        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/shapeStyle.html b/libs/js/jquery-geo-1.0b2/docs/geomap/shapeStyle.html deleted file mode 100755 index 7a77baa..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/shapeStyle.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - shapeStyle | geomap - - - - - - - - - - - -
        -
        -

        shapeStyle

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeObject ( geomap style )
        default
        {
        -  borderRadius: "8px",
        -  color: "#7f0000",
        -  fillOpacity: .2,
        -  height: "8px",
        -  opacity: 1,
        -  strokeOpacity: 1,
        -  strokeWidth: "2px",
        -  visibility: "visible",
        -  width: "8px"
        -}
        -
        init
        $( map or service selector ).geomap( { shapeStyle: { color: "green" } } );
        get
        var shapeStyle = $( map or service selector ).geomap( "option", "shapeStyle" );
        set
        $( map or service selector ).geomap( "option", "shapeStyle", { strokeWidth: "4px" } );
        -

        The shapeStyle option retrieves or updates the base style of shapes appended to the map.

        -

        This differs from the drawStyle option which defines the style of incomplete lines and polygons as they are being drawn.

        -

        Two extra color properties, stroke and fill, are not defined by default and use the value of the color property until they are defined individually.

        -

        This option changes specific properties of the internal base style. If you send an incomplete style object, only the style properties you reference are updated.

        -

        Similar to CSS, you can override this style on a per-shape basis by passing a different style to the append method.

        -

        Changing this base style will update how geomap draws existing shapes that do not have their own style. For shapes that do have their own style, changing the base shapeStyle will update any style properties not referenced in the shape-specific style. For example, assume the following:

        -
          -
        1. - the base shapeStyle starts with its initial style having a red stroke color and strokeWidth of 2px -
          $( "#map" ).geomap( );
          -
        2. -
        3. - you call append with a style that increases the stroke width to 4px but does not supply a stroke color -
          $( "#map" ).geomap(
          -  "append",
          -  { type: "Point", coordinates: [ -71, 42 ] },
          -  { strokeWidth: "4px" }
          -);
          -
        4. -
        5. - you later change the base shapeStyle's stroke color to blue -
          $( "#map" ).geomap( "option", "shapeStyle", { stroke: "#00f" } );
          -
        6. -
        -

        The shape described in the above example will draw with a blue stroke color and a strokeWidth of 4px.

        -

        You can also set a base style for a specific service. These are called service-level styles and apply only to service-level shapes. To do this, target a service inside a map instead of the map itself for your call to geomap's shapeStyle option. To expand upon the above example, consider the following additional steps:

        -
          -
        1. - you change the shapeStyle option of the default service specifically so that points are twice as long as usual; the default service has the CSS class: osm -
          $( "#map .osm" ).geomap( "option", "shapeStyle", { width: "16px" } )
          -
        2. -
        3. - you append a second point directly to the default .osm service -
          $( "#map .osm" ).geomap( 
          -  "append",
          -  { type: "Point", coordinates: [ -70.5, 42.5 ] }
          -);
          -
        4. -
        -

        This second point will:

        -
          -
        • have a blue stroke color because it cascades from the base shapeStyle for the map as a whole (which you set with your first call to shapeStyle)
        • -
        • have a strokeWidth of only 2px because it is unaffected by the style applied to the first shape during the first append call
        • -
        • have a width of 16px which it gets from the shapeStyle of the service where it was appended
        • -
        -

        This is the only option that can be applied to services. All other options require a reference to the original map element.

        -

        When called with a second argument to set the shapeStyle, the jQuery UI widget factory returns the original jQuery collection to maintain call chaining.

        -

        Please see the style section at the bottom of the geomap widget page for more information about the style object.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/shift.html b/libs/js/jquery-geo-1.0b2/docs/geomap/shift.html deleted file mode 100755 index 8580bc3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/shift.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - shift | geomap - - - - - - - - - - - -
        -
        -

        shift

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeString
        default"default"
        init
        $( map selector ).geomap( { shift: "default" } );
        get
        var shift = $( map selector ).geomap( "option", "shift" );
        set
        $( map selector ).geomap( "option", "shift", "off" );
        - -

        The shift option determines how the shift key affects the map during drag operations in different modes. There are currently four values: zoom, dragBox, default, and off.

        - -

        zoom

        - -

        When shift is set to zoom and a user holds the shift key before holding the mouse button down, the map temporarily switches to zoom mode. In this state the user can perform a marquee zoom by clicking and holding one point and dragging the mouse cursor. A box will form. When the user lets go of the mouse, the map will zoom to the closest approximation of the bbox of the drawn shape.

        - -

        dragBox

        - -

        When shift is set to dragBox and a user holds the shift key before holding the mouse button down, the map temporarily switches to dragBox mode. In this state the user can click and hold one point and then drag the mouse cursor. A box will form. When the user lets go of the mouse, jQuery Geo will trigger a shape event passing a GeoJSON Polygon representation of the dragged bbox as the geo argument. The Polygon object also has the GeoJSON the bbox property.

        - -

        default

        - -

        When shift is set to default, it behaves like dragBox when the mode option is dragBox and behaves like zoom in all other modes. For example, a shift-drag in pan mode will temporarily switch the map to zoom mode (thus zooming the map and triggering a bboxchange event) while a shift-drag in dragBox mode will stay in dragBox mode (thus triggering a shape event).

        - -

        off

        - -

        When shift is set to off, the shift key is ignored. For example, if mode is pan and the user holds the shift key and begins to drag, the map will pan as normal.

        - -

        static maps

        - -

        When the map's mode option is set to static, the map ignores all user interaction so the shift key is also ignored.

        - -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/tilingScheme.html b/libs/js/jquery-geo-1.0b2/docs/geomap/tilingScheme.html deleted file mode 100755 index 440819d..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/tilingScheme.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - tilingScheme | geomap - - - - - - - - - - - -
        -
        -

        tilingScheme

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeObject
        default
        {
        -  tileWidth: 256,
        -  tileHeight: 256,
        -  levels: 18,
        -  basePixelSize: 156543.03392799936,
        -  pixelSizes: null,
        -  origin: [ -20037508.342787, 20037508.342787 ]
        -}
        init
        $( selector ).geomap( { tilingScheme: {
        -  tileWidth: 256,
        -  tileHeight: 256,
        -  levels: 18,
        -  basePixelSize: 156543.03392799936,
        -  pixelSizes: null,
        -  origin: [ -20037508.342787, 20037508.342787 ]
        -} } );
        get
        var tilingScheme = $( selector ).geomap( "option", "tilingScheme" );
        set
        $( selector ).geomap( "option", "tilingScheme", null );
        - -

        The tilingScheme property defines a grid that the geomap widget can use to build a map view as adjacent tiles instead of a single, full image each time.

        - -

        Only tiled services will get a non-null tile property as an argument to their src method or template. Shingled services, even when layered on top of a tiled map will only get bbox data.

        - -

        When a tilingScheme is set, the geomap widget will limit the user to specific zoom levels defined by the tiling scheme.

        - -

        If you set tilingScheme to null, you must explicitly set bboxMax.

        - -

        Also, if you are using only shingled services you must set tilingScheme to null, and therefore explicitly set bboxMax.

        - -

        You can set the map widget to be fully dynamic and allow any arbitrary zoom level by setting the tilingScheme to null. This is only useful if all of your services are backed by live spatial data and can produce map images at any scale.

        - -

        This is one of the few places where you must use non-geodetic (i.e., non-lon/lat) units even if you are using longitude & latitude for properties such as center or bbox. You must use projected units when defining a tiling scheme. The default map tiles use web mercator meters.

        - -

        All tilingScheme objects have the first three of the following properties. Apart from those, a tilingScheme object must have either just the pixelSizes property or both basePixelSize & levels.

        - - - - - - - - -
        tileWidth (Number)the width in pixels of a single tile
        tileHeight (Number)the height in pixels of a single tile
        origin (Array<Number>)a GeoJSON position for the top-left corner of the map tiles in map units, this is used to correctly position tiles into the map view
        pixelSizes (Array<Number>)an array of all pixel sizes (called resolutions on Esri's products) hosted by the map service, each one represents a zoom level therefore the total number of zoom levels equals the length of the pixelSizes array
        basePixelSize (Number)the pixelSize represented by the tiles on zoom level 0, used when each pixelSize is a power of two smaller than the previous one
        levels (Number)the total number of pixelSizes allowed, used in conjuction with basePixelSize to determine how far a user is allowed to zoom
        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/toMap.html b/libs/js/jquery-geo-1.0b2/docs/geomap/toMap.html deleted file mode 100755 index 8b334ea..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/toMap.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - toMap | geomap - - - - - - - - - - - -
        -
        -

        toMap

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray (GeoJSON positions)
        syntax.geomap( "toMap", Array pixelPositions )
        usage
        var mapPos = $("#map").geomap( "toMap", [ 120, 240 ] )
        -var mapPositions = $("#map").geomap( "toMap", [ [ 120, 240 ], [ 192, 48 ] ] )
        -

        The toMap method takes a single pixel position (which is an array of two values: the left and top of the pixel), an array of pixel positions, an array of arrays of pixel positions, or an array of arrays of arrays of pixel positions. In other words, it accepts the pixel representation of the coordinates of any geometry up to MultiPolygon. It returns the map coordinates for all of the pixel positions.

        -

        The return coordinates are in projected map units if you have previously set the bbox or center options using projected coordinates. Otherwise, they are in geodetic (lon, lat) coordinates.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/toPixel.html b/libs/js/jquery-geo-1.0b2/docs/geomap/toPixel.html deleted file mode 100755 index 1ec09b0..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/toPixel.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - toPixel | geomap - - - - - - - - - - - -
        -
        -

        toPixel

        -
        - -
        - - - - - - - - - - - - - -
        return typeArray (GeoJSON positions)
        syntax.geomap( "toPixel", Array mapPositions )
        usage
        var pixelPos = $("#map").geomap( "toPixel", [ -71.098709, 42.330322 ] )
        -var pixelPositions = $("#map").geomap( "toPixel", [ [ -71.098709, 42.330322 ], [ -71.072617, 42.351608 ] ] )
        -

        The toPixel method takes a single GeoJSON position (Point.coordinates), an array of GeoJSON positions (MultiPoint.coordinates or LineString.coordinates), an array of arrays of positions (MultiLineString.coordinates or Polygon.coordinates) or an array of arrays of arrays of positions (MultiPolygon.coordinates). It returns the pixel coordinates for all of the map positions.

        -

        You can pass geodetic (lon, lat) or projected coordinates regardless of how you last set the bbox or center options.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/toggle.html b/libs/js/jquery-geo-1.0b2/docs/geomap/toggle.html deleted file mode 100755 index 5fed83c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/toggle.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - toggle | geomap - - - - - - - - - - - -
        -
        -

        toggle

        -
        - -
        - - - - - - - - - - - - - -
        return typeundefined
        syntax$( map or service selector ).geomap( "toggle" [ , Boolean show_or_hide ] )
        usage
        $("#map").geomap( "toggle" )
        -$("#map .osm").geomap( "toggle", false )
        -
        -

        This method toggles or sets the visibility property of service objects in the services array.

        -

        If you call toggle directly on geomap's div element, it will apply to all services. You can target individual services using a CSS selector based on the map div id and the class supplied for the service in its service object or just the id of the service if supplied in its service object.

        -
        // for example, given the following as the map div
        -<div id="map"></div>
        -
        -// and initializing geomap with the following services
        -$("#map").geomap({
        -  services: [
        -    {
        -      id: "water",
        -      class: "mass-gis",
        -      type: "shingled",
        -      src: function ( view ) { return null; }
        -    },
        -    {
        -      id: "towns",
        -      class: "mass-gis",
        -      type: "shingled",
        -      src: function ( view ) { return null; }
        -    },
        -    {
        -      id: "harbor-cruise",
        -      type: "shingled",
        -      src: function ( view ) { return null; }
        -    }
        -  ]
        -});
        -
        -// you can later hide all services
        -$("#map").geomap("toggle", false);
        -
        -// all mass-gis services
        -$("#map .mass-gis").geomap("toggle", false);
        -
        -// or a specific service
        -$("#harbor-cruise").geomap("toggle", false);
        -

        If the optional boolean value is not supplied, the visibility of the services will be toggled.

        -

        The change will happen immediately and you do not need to call refresh. This is recommended over manually changing the visibility property of the service object as it does not cause other services to refresh.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/zoom.html b/libs/js/jquery-geo-1.0b2/docs/geomap/zoom.html deleted file mode 100755 index ee62611..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/zoom.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - zoom | geomap - - - - - - - - - - - -
        -
        -

        zoom

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeNumber
        default0
        init
        $( selector ).geomap( { zoom: 0 } );
        get
        var zoom = $( selector ).geomap( "option", "zoom" );
        set
        $( selector ).geomap( "option", "zoom", 7 );
        - -

        The zoom option gets or sets the current zoom of the map view.

        - -

        For tiled maps, the zoom option's range starts at zero and goes to either the current geomap tilingScheme's levels property minus one or the length of the tilingScheme's pixelSize array (depending on how the tilingScheme option is declared).

        - - -

        For non-tiled maps, i.e., tilingScheme is null and you're using all shingled services, the zoom option is based on the ratio between sizes of the bbox and bboxMax properties. If they are equal, the zoom option is 0. Smaller bbox areas will have larger zoom values.

        - -

        If you attempt to initialize both zoom and bbox at the same time when creating a geomap widget, bbox will be applied and zoom will modify the final bbox.

        - -

        Apart from setting the zoom option directly, you can use the zoom method to change the zoom by relative amounts.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMax.html b/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMax.html deleted file mode 100755 index eec3e55..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMax.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - zoomMax | geomap - - - - - - - - - - - -
        -
        -

        zoomMax

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeNumber
        defaultNumber.POSITIVE_INFINITY
        init
        $( selector ).geomap( { zoomMax: 17 } );
        get
        var zoomMax = $( selector ).geomap( "option", "zoomMax" );
        set
        $( selector ).geomap( "option", "zoomMax", 7 );
        - -

        The zoomMax option gets or sets the maximum value of the zoom option for the map.

        - -

        For tiled maps, this option overrides the tilingScheme option when it is smaller than what you've specified in the tilingScheme. For example, if the tilingScheme has a total of 18 levels but you set the zoomMax option to 7, the user will not be able to zoom in past level 7.

        - -

        For non-tiled maps, i.e., tilingScheme is null and you're using all shingled services, this option determines the maximum zoom (and therefore minimum pixelSize) a user can achieve. Without setting this option for non-tiled maps, users will be able to infinitely zoom in to fully dynamic maps which is likely not what you want. Non-tiled maps require the bboxMax option to determine what zoom level 0 means. This option represents the other side of the zoom range.

        - -

        This option also overrides programmatic changes. If zoomMax is 7 and you try to set the zoom option to 8 using JavaScript, it will be set to 7 instead.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMethod.html b/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMethod.html deleted file mode 100755 index 8f13e22..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMethod.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - zoom | geomap - - - - - - - - - - - -
        -
        -

        zoom

        -
        - -
        - - - - - - - - - - - - - -
        return typeundefined
        syntax.geomap( "zoom", Number numberOfLevels )
        usage
        $("#map").geomap( "zoom", 1 )
        -$("#map").geomap( "zoom", -2 )
        -

        The zoom method can zoom the map in or out by a given number of zoom levels. Positive values zoom the map in, negative values zoom the map out.

        -

        This method will not zoom out beyond zoom level 0. If you are using a tiling scheme, this method will not zoom in past the maximum number of zoom levels defined in the tilingScheme property.

        -

        This method accepts values relative to the map's current zoom level. This is different than the zoom property, which is the map's current zoom level. - It might be useful to add an explicit plus sign when using this zoom method.

        -
        // set the map to zoom level 2
        -$("#map").geomap( "option", "zoom", 2 );
        -
        -// zoom the map in 2 levels from its current zoom
        -$("#map").geomap( "zoom", +2 );
        -

        This method does not trigger events, not even bboxchange.

        -

        There is no default value. Passing null or undefined will not change the map's zoom.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMin.html b/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMin.html deleted file mode 100755 index ecbc812..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/geomap/zoomMin.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - zoomMin | geomap - - - - - - - - - - - -
        -
        -

        zoomMin

        -
        - -
        - - - - - - - - - - - - - - - - - - - - - -
        typeNumber
        default0
        init
        $( selector ).geomap( { zoomMin: 5 } );
        get
        var zoomMin = $( selector ).geomap( "option", "zoomMin" );
        set
        $( selector ).geomap( "option", "zoomMin", 7 );
        - -

        The zoomMin option gets or sets the smallest allowed value of the zoom option for the map.

        - -

        For tiled maps, this option overrides the tilingScheme option when it is larger than zero. For example, a tilingScheme always defines what zoom level 0 is, but if you set the zoomMin option to 7, the user will not be able to zoom out past level 7.

        - -

        For non-tiled maps, i.e., tilingScheme is null and you're using all shingled services, this option determines the minimum zoom (and therefore maximum pixelSize) a user can achieve. Non-tiled maps require the bboxMax option to determine what zoom level 0 means. This option overrides the map's ability to get to zoom level 0. It is not so useful for non-tiled maps, as you can just set a smaller bboxMax and continue using 0 as the minimum zoom.

        - -

        This option also overrides programmatic changes. If zoomMin is 2 and you try to set the zoom option to 0 using JavaScript, it will be set to 2 instead.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/html/index.html b/libs/js/jquery-geo-1.0b2/docs/html/index.html deleted file mode 100755 index 0ee93d9..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/html/index.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - html | jQuery Geo - - - - - - - - - - - -
        -
        -

        html

        -
        - -
        -

        Our geospatial plugin's only widget is a geographic map that you can create on any div with a computable width and height.

        -
        <div style="width: 640px; height: 480px;"></div>
        -

        If the div is not already in relative, absolute or fixed position, the widget will force relative positioning.

        -

        fullscreen

        -

        The div size does not have to be so specific.

        -
        <div style="position: fixed; top: 0; right: 0; bottom: 0; left: 0;"></div>
        -

        As in the above example, you can have the map fill the window by setting position to either absolute or fixed and the top, right, bottom and left properties to all zero. The map will follow the size of the window and recenter when the size of the window changes.

        -

        Fixed position is preferred because it will not create scroll bars when making the window smaller. However, keep in mind that fixed position is not supported by IE6 and can be odd on some mobile browsers. If you do use absolute position, you can set the overflow style property on the body element to hidden and avoid scroll bars.

        -
        <body style="overflow: hidden;">
        -  <div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0;"></div>
        -</body>
        -

        box model

        -

        The map supports divs that have padding, borders and margins. The plugin will create the map where text would normally go in such a situation, i.e., the map content will be inset from the border by the padding amount.

        -
        <style>
        -  #map {
        -    width: 90%;
        -    max-width: 640px;
        -    height: 480px;
        -    padding: 8px;
        -    border: solid 3px #444;
        -    margin: .5em;
        -    background: #ddf;
        -  }
        -</style>
        -<div id="map">O HAI</div>
        -
        O HAI
        -

        inner elements

        -

        Any elements inside the map div can be absolutely positioned and will not interfere with map operation. Map images will appear beneath them. This is useful if you want to layout a scale bar for example.

        -
        <style>
        -  #bar {
        -    position: absolute;
        -    top: 10px;
        -    right: 10px;
        -    padding: 16px;
        -    background: red;
        -    opacity: .8;
        -    border-radius: 8px;
        -    text-align: center;
        -    font-size: 10px;
        -  }
        -  #bar div {
        -    width: 96px;
        -    height: 2px;
        -    margin-bottom: 8px;
        -    background: #444;
        -    color: #444;
        -  }
        -</style>
        -<div id="map"><div id="bar"><div></div><span>1134 meters</span></div></div>
        - -
        1134 meters
        - -

        This rather large scale bar will not interfere with a user trying to pan the map. Ignore the scale bar value in this example, it's static text.

        - -

        mobile

        -

        The geomap widget works on modern mobile browsers without any additional JavaScript. However, some web design is necessary. For starters, as with any mobile development you should add a viewport meta tag into your head element. This should appear above most other tags so the mobile browser can get ready for a mobile page before doing any other work.

        - -
        <meta name="viewport" content="width=device-width, minimum-scale=1">
        - -

        For a fullscreen map, you can also add a maximum-scale attribute.

        - -
        <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
        - -

        If you have done any other mobile web developement, you're probably frowning at my decision to disable the default zoom capability of the device's web browser. If you haven't done much with mobile, I am disabling double-tap to zoom a page by setting the min and max scale to 1.

        - -

        In almost all other cases, I would agree that disabling browser zoom is a bad user experience, however for a full-screen mapping application, double-tap has a whole new meaning and users expect it to zoom the map itself, not the page. It is in this case only that I suggest you disable browser page zoom. If you are targeting modern mobile browsers such as iOS, Android, Windows Phone 7 or Opera Mobile, you can used fixed positioning and the HTML for the full screen mobile app would look like the first fullscreen example:

        - -
        <div style="position: fixed; top: 0; right: 0; bottom: 0; left: 0;"></div>
        - -

        Other mobile browsers are currently untested.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/images/$.geo-logo-large.png b/libs/js/jquery-geo-1.0b2/docs/images/$.geo-logo-large.png deleted file mode 100755 index db2ecf1f8216330cd6e3b8ad1b4728d2aae0c91e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2252 zcmeHH`8U)H6#veAV=%@HdS%TpL&h$z&Dt2-WQ={Op7oF>LYaq@F~i7E_K=<|ArqP; zie4C$rQ&7xEJa!35UFPwj5q#;_v`DP^SSrj&%M9g&pG##76Netg-Si7n5uLr6|I!2j84O-+}6^} z*4E0=)ydY=&C%B@u_cy}PM4BN+#aZ`?a~_qyovkO4>h0{BU0t70 z0&6Z_s0pGxkEGT|QX8UvZ@3!qB07@m=GMfdH!&H_H{!X8OfDNlRtc6QlLQN1(WmCP{;RFK?R4Cz zk|>w3@~)xIg%w?E)`xu>urXwhznHg1$vr0b!$P;LVg=r>t$?rC(0L&CfoA3H zQ?=%vIgwuOoU=HNGjPcA&E-rfwi+a_{-Z-F-$LCYZvDkEG7OuQoYXT#wQFKatc5+d zq{y$okW4MWD%-$OeYF*tO^ICj%AQ9d+o~~=K1^N~X}@7r-hpq|l(`5RzAJuVpwRX6Xy%4P>uubHc9u7gMQZl5M#Q^BP2W&&buILOOTo-b1uRo;1i77>0mEWA#xHEsa z0mIrNcs|Hjlgz=56n%TmgD&~kBo!?OzvQd@5p~_od(x$)F2#r?lEI$`PRB5w;)YE_ z^dppOME8|7ae<0UMS+Xv!TnOVd2xWogBa|=^zOb*rN_?EkeAOkk0iR^n1uG5F&G5q z8tNawk4A^IYQ6gIWN<{SVV*ZiRraIL2E7e#CVe}UY@!~|&ONXOXsuLi(Lm0@na{#hAu|MRx*~k%7 zzjeZ0;d>vICWcJ1m*IC|O@z+njknN~<5LF|3tHxOdXLX+#Y>#x1u7LHNd@URQL|DW zI`1MXj^dzTG`~f71ICGqaPT0W&re6ND};+7=__#!lsX$E-I^W}AouHubX`U1EXc6x zD0XfDHk+X`ei??WSpc)rI~~_Sn`!nU551I7Q1Ue((10GM|N2bPDNB8 zb~7$DE;u(kfL#Cp1wBbbK~zXfy;Xfs({&hUY_bhq9yG+g@!K04;20-xirtJL%^%``*h<>~oS z^NnR(*R{LfU(fS>-aaq$^ZP%4o~7CJ_S6)*ubz9>tfbXZ6l34>YyEx2U4|@rn=Xld z!e*t7i|>Ew1zOt^I*COt+hP_8*SDu6&$vISXIU=OHZyj?n;g!T=Gd4#XNLZ<`{V8< z24S6;da;JbD{h~YoH(vQYhr@ZA`+cGnv(PPO{xiB+q> z9Up(Ec}7$dPCALiabu~O&p&=JGZT*H=0YPy{oIk7qIqBwQwUeztJ4jQ?%oY|cJ72d zbLNcJ@cAq4TFuxwYI(fR&lVR0i4T;OL6b!Ml|z>lN@8ZAAgxoSx-#T;!^o~(a0G{} z;Z5J*&}r|T+AQGDb;iUD4tqRsv%MW$ad9ISspKhl_TsU7)`^72POe!4qdh(F_13Lm zrKnS$Y{TOuW|2!%Y*NYP-#a?sHV(HxJst2|&w7>^?lo{@a)Tngy*@M)$Y5k$K2GkIzI1=Jv@A*ip9bL;zPYf1q>4J$;+MEpj4QwLg9tCrP7~j_`Jh?D+;GS zfCB-!fBS0+W5A^0Qa?Ya3=F(>xa1X~HwlZ-t&tJw6)e_y60cyh2k-=HZyZ79;DCv> zVPU$i^fbOt=AUvq8MR@e+hoG($&-ien#7HGBBnPP3kFpO1$|gfr^5~oXUHrNyx*NU zUo>GEVS&sRnQZjC(o*=LvJxDTkymXo>I83rt_(f*t!dLfK3-4&m&|53wrm+7b|2Vg z#cKAhUdcoq$WRALWDm<{Q&ULDbG=$E47pq|f?)O~CyyW&8Qx@MmB7eko+iZ!o4&88 zfGRe7*ccFS5o4ztsjzQt63IZLQsHqf$OszO#5qr&(nL|CXV$NWvzsrxj<>H;s zmeOdW{syLit9A>=b z9C~%DzcnI4kB=^s21aJURjX1_?8(W#YYn}H`D|;1G6+418Y7tCyy z$$oqfnc|L%gED{rF}9GeO{s+b>}=>%M-Mi~sH>eB^K`rOmnWe`ypFUkcW9IJ6WVfD z?h>9aLQ}d?|j7F#mWaDOxTa|3~AhG#R^78?yejQJle8gDl z8)RSIkvWVewJHHAeCo@M8{v9uD}1qT9T*u5cmua`C=@`Pm{9d-ULKf2r)_AN9sg*c zA8vHu2A{lgqhZD=bj&wbU+nq-ez;A7BaJ#!3_NJynyZ<535^zwCNSV^q{OZ1PRBSUgZG680fYx&Ny8-#tRR4#fY2s9Gva)um7WZ;Sua aq<;XvzA!gYQb=3?0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+nAz&MYj^Fo z-D9S<&bqbdu47B9h;QHbwuzk zR0Qfn1iX_QH}HP`(;qY3)!;Q{rFTopV}Tkrn>YAO0r!m~<~iV%5;9c7 zV2qd+M)$NNKbCiTdp>PYjKS#M^5kZ-ET%=v^&6?1KYyfYk*xldV(ao5lf2S>(z`V^ zrBoLb^qJn@A9|N9gJTj2X#F^FNFsT4OjRB2ya4(LnjVR}P|M{`9G6OAASnqN`FyD5 z1%A?-lUYtacBTo8Hr)YFPYmr1rHuL-RehyU3e z8VcjBtpEc9aIdEa&aGb$HQwG|A6=So5Rby)xVtjaf1>j8f|0Z|`1<5Y%IBl{dTL|( zVE#?Ccc}bO@v}msC~Q>AV!``LC1roVzaQQ#DS;X<#{H%^Sp)hoX_GXBhDx;l+{w$k zc2SPj&uxnZbX+drQM4aflHlOn5Fs8S)&6^3oz4DUZ!i2ZFAr+Det`C=_QA}tvGE!| zzjx0+@q|MR;?oiv3%Yqh!{`%8n_wM(zC^>}OkOD}a&Z2#r3LCR!P>xpcI+>Q1aVVC zhJXOLX*Ak=CNbEr6$;RDIAC5F?T{cIW4xNpe)r|{bcYy|eSOd#7YEt^|6%l@PtdY5 zQCKe$zGsPwg0I@zY)3qrnF&fCpF4P2l%q8Vz3g|_zG0nG?c)QZSy^zWql5DK)MSEI znG7pF?~~VRDy8=Jr?xA^hOm%d7co2*Vz}VDE!#K-;>*W{9x6QP}6RTGl?0v}h`f$8EcVu(JwPak z1R6)+K8v`h=g+@|s$&{-kVP#?iTg?a5f-`I*-7~k@FpOx^7eLsEpo#Llat}Cy?ZGh z?ud^EEth+{B{jL&neV41jCi-Uj?bSk2?Q{folRAa04ljCx**BS!Z)VYHH zuvSnk?(5Co;=Y2`WZT!R4MlPJj&mi=F$;f&+Ahu$X>Y&rp^_qhydW>CnaqhZDJk&B zefu1HFeSOfZ4WwE602BTgQC=l#wJjZ-spNNqs(o;*cl)R%TByQ z?%3qvEv5^I)OVdQ%i*vv7|Y3_FtJG}#Bsn6UMk$a_dzT9Zyc=Hh+O)G#ruahp_o^u)2C?*UoA4%7aw)TiYV_eSCV=D%;#)WreF(f& zrxbbRc>Le3nxWeSPJGRE0RfY*=jKvV+lK}N#Sld9Ps2(N)eLg60J%5{xi|_p5%93Z zqx^=SE0Gdt(fRvN5_Li@h%Y1XZ+X*tnYy{e%{=D2GLuiP(UL-Q3swqSH)r(V_Llx=O3=`CB7U|bp2-Kfp zV&m4Cqz7APYVL7AlRQkBah8yym_4iX^}X$hnjtm@WFy+CE*7UcWflEY_b|y>eO{^f z5%XB$a=kk>W94GHxwvg=E;hw1^o)xiG+|HFj5R^Jmxb1;mxZGV^8ZYN)Mav3GdNSD zzWmGi^1X&5^2OEd>(^d0qO8IpefrxB1K(yA&G0t!pcQjvPp4+Aw#dcbyl&y;>cXL& z%sx}ETfd$0b?duI(A_#y?}HiU*qBxg^*%UnD4q7I-KY iJbPjNUNih}3HC2Q`GB%uZX0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+*LgRNQs0250|L_t(|UhQ0kdlknP=PxNFB*85N2%6yT z#Tq2IyF;P4yF0<%AvhFT3PkWga4Arrj{=22`&G_6zq5NbbC-LQ8|f?U%YNT}dvET{ znVB=cIljr2E9c7LKn@4~8V)4iNTyLEN7C`5$LOyaA&2TG#evuZ2WaK;<+N<+Qd+-u zEq#6RWR^Gn(#1)~#v8&|z7o{Yfz|XEM2R&6_iqiWMqM z!2y935}23r09GJ4gtlznlJ1z-u3n|XhYm@*ZCkbqV2&O+LgmYZ z3s?(=4_UFgmb*zgK#R2?;rBFul{VaQ=MR7@W$WJOLTLu`wasA0SL`EPsBl zShgHht{6c-{`ezp-?o)Hw2P)EkDqwZPP&#vh4SSWFr-EEW^%Hu4H9kbnl;q2S#y>~ zwFI1)H`d#%NmJUkb*r@TMl0_8d1(u9`vRIj>-tx>dGO!?6)Rj=n1mZl*Bgw*sfQ}j zTfcj28ypx&-<>&=WiVANSDwy%`z^hA{(?6;4;3j`$Schv1qu>Cm(~W|y?d9cREnTV z<;&Cdt=kwZ!8CsCSnAomyGWzZV#TO?m#$Q=R&5$HdbC$s7cX3(3T4YuxiV!4lIdR! zh|DgoU!Oj5Dgg|fIz6TOJ=i6o%m>sMcn5_J~%S#F_GIDY{F zZ2dZQMEb>@JO9xdPMjY+G-3@$G+3Cq6EYf&v1BnI?c##lc2t z^FTk%oyt2u_M*2T8;AZCa4-jUu+6!;qz8M>=u6(3zY+vdG@=rv~0;z znI|M;-rTu)USEjaglodM@iG_CoIP_U0qhE_rHdDf3dCCH&YmL&rhIr=s=;fRKX39A5b$Xxjo`IL2rcRkc`}ggqf-JFT&zSlD4W`Bo z8+w32ff324eI2{nuu*(nP+=XT+j~ecRf&-mDrO5~E3t~hobKMaBlJcNA5M`KSQ6#2 z>@i%w{PGJ`jffPff;P>YHYKRo>q*z;J3O;|3?8UBs54#TF^(TyNK6!P`ci2M_V7}r z1W2!6zot_szZM#Od-ta5RjLXwr%#!dE$j8?aD8%Zwrt)k#DFuSo;_5uSaDB@#*Cgic}kX;``|uow<01<+{|0N zaFJ}_+L#zhNl6hk)vQSqX;-R5D1~y2=+|F=rR3xrvgu75HKN~t|6O86SZ{N7_ka8C zHv*V~atF|sO`Cnr^LaPYxUznNS55@1|i5 z5G`7;P?&Z9-aYEtsj~;jOf`nj@P6XYTY$pJE>kj0z$D%u{|*Up$Ce}+nU}T&P0#~f zZ~fs2^zGG~9^Ah#5@*_!sr2ySLkBpR7i=Q5!*93{bVOSK2p2pz0MY~!Xxv~GreiK) z)d(7MX3ds9V@8dZF|f|oty;-vwUd&PlIY13Pwz4_YyZdenL25*#S8@aY-4)dn6bhr zs4Per(~wq!+Ihkr;*$&pZ`!y~`kgy_mI|@$poTl1-8y&4^ht$x1RCDFGQ@x|KiDY; z_8$<5v|`zELKp);898jYfH=BsJ1W37)!{>j1!Sc|OA2sce8+OXuo5MN&h)8MWuB0( z#aRlj<1m44Ce$ftBqk)%?OV555>=9jIBcvnt72rlv%L1*J9o-_-G=@@1{4{c=au-(IW<(j@L1|gMhCthX+a&DQZR9`Hoq&imqI~ET1t) zjMXtZI#X-S41fOiK0Ug2^^h810HVIQz(gt>3%kRaGRfEpW(4ODj>cF-=C0AMCm8|;_fY`@_< zBxK8G%_R63dmxsgTC}97mMtASX3VHjVl%B+woKaJzI~gbS>-`Z?ccZWqq#y2LXAha zX(O?%jT<(Ky{H=*-L@@tVNW(Y;%9$5IQ*Re#I9+_;B(nhrRk49{*Yv-NGZPCw`(WB zO7EJ$fjyNxNNeDlJZX}1YE^B*DE4=b?skxpP#X*8&6f~FT843E$H?iIK@QaA)Bu2@ ziBLR;4jL=~7(QgEl}cbSjyTEqvE%5^KmU~9@Ep*upCmUSjQ~7cIKgUMLz>}2{6;%WS33qaR0M1cY%){;u3FV=$nOaF0c;T8<~4Z0AaS4HzI`iy ze(~Z3$7MKqYO6Qc4*=M`yZ6LS3AFQA3bfH*ewk@7J%0R{9)JJ6+)wy(cJnwpJgw}Y z;m^7pBF%7}Sa8|hpQIsoPCfyr}TeO4v^FP4}1U} zr7yhVztyi}*tzZ56*f0sBoA*c0+YCqlms9gi4^52kp}SQHf!93CDJ!gU7Mvt!Dga$SsBWuw0SPn%1nGzh{VVRPa6O$HCBqqlD zscTrXIz|MCyN|9H-nzCOW}7xZF3D3Pl z);rjaK5JAPu0F1X^A|YM1um^W*PL0ioap!vRt*3biqB+Wwhe~Q?U|lG`d{0O;D92; zu(zNnm=aOGf=D=(24+kvnBzlmD-~CoO~pw5m(d7P0Y6!S8m?8VWnntOr0~-|3?yqB@ouCnE~DO#tj;90Q44> zHZlfE4|EV1#Tvi^9ZS7#w2S3<+o9M)QY9gL@*>?8OvjEMm2zgNGSD^;8Ri8?>ZAR0 zY$ZD`11a_L7g)BHx~A!N+k0zKznE#k?=-d)l(V=P$`b^Yulo> zs#ac^s?q~Y@X}Q5DhN)%wJShht!>3{3yO)F~7CtPVG zjF1s&q-`%=y!a8*G4JrO(hj|^?7SB?SQ(9R`?IZckF))%R+TAw+Oeq^=Ln}xET(#v z#K71@Tn$BUs*aRrc%r;z2A2TC2nX-xFnIRu+3SESAwI#GkEjL)(z9pJxIVnThn=bt z@bszE(%%FUq`;~bE1amkslH6(7cVTRN-}{2sj0jK&{e&=)w1qWmyVsJy(Zwb9t|&F z_}stxb?T*xa%McT<*1Z|YC?n47!rnLtAP zPXTBG2@+EIEY60lx=m@MpOr5ohmYVY&~T5rdyDov`-hquwPCDN8$eCCHVG*aT<{pQ zNKF^6UY@CI;h|{F5)!7e5C)iq@;tQOu3q#9IPNwHoV0bH9{nzFmDo;$dLUpX41UC# za9zD}RSZg#hMvA_cHx>YAeAg$T%hK(e9?>=D&W5jWJ3vy__BvN`nf@(*=6}iKTO#56zP)?BwwJ@neAjj8GqV!OsxHk#QLVm^`g2p-c~g0Q0SWeu zzBgt93f{mGcGdNI%?3A0Prv*23|;0E_QTU3oZs+bVV|D89Iq!;{N|=_Snp>ANQsG_ z5=lV?b@}AUQ=yF#V3QeY1HmRx8|foe!W)y6WR=n$X0OIn;R+b2dPLCmLM;-)0ytQp zjdEic)`4tWnH!+*-$BKBTYJ4awH+^4d4(~30cp_!%ahi5>9c;_)I&PlwvkklsNH4S zNFCZ)HWE}nfIex$1b(&ZsHMUjGsdcxa39QcB@z}2gVCD~wouzjGTkVeH?Q~a--{s% z-3*4i`{R4hZr!s4BFxQ~YC~X7Hwijj#ksjLc<&7dMb)0$7JyeJKsu;EN__hX}gR^3iDj+fv@h``$^ zS3u#_A>`Y#B8}iZ;tg20YQne>&oD$G8BoOUo(uYP>R=g~h{2dZSLVR$f>eQuuz-*n zM?xE@%|x!y4E*dfN4;WmRxV#b@W^nlWJ4I z$j6wTmJ-tU*4(;NziTi{z8lfg8Pld`2}GDvRLfQ#D!>G`0>^!N)N_Fdhvx=5DA)C7 z3wYQ#b^)9orW#eN${WKE*^7nOrtkY)k@kgt$ELYM`zl>buSw^vZE?CEJxqOd9QEh5s#SN~ zUp+L={}M0`0dk2thh$F1Y9(oqZAW+muW7^NW9fa8rH`8j8`f`-^_XcIows^@X@yF# zndqy9eX7b#&rv)|UJL9W9e-`i8YvUT*rwFdxDz}}w4Fb9p7Xngb+imSLqI}Q8WC<~ zuAV}FpL$w%?XapAvwF2=uR_$CBvWzPecu9bJLy`lR%#N`oC9JwwQJP$@B*E~VfTf) zGyB|R8w;vS#6Hp{T)T~bY+?Pg3G44d!#;T6l~!%K*T050RLX78*0m=6?(JHN$&}c*l9JlLn~pR)qg| zoQQI$kqi&&qr>@g=V<4S9pcR(F`VYj1^X!4M-^py{)15zFh`?CF7h?^W&k3HFd;EJWjh*(& xN28y+Jzn70wbSCeF9#q!9_Rd?!+~@;@Lz5w_s4TrtoQ%`002ovPDHLkV1jo*oYepT diff --git a/libs/js/jquery-geo-1.0b2/docs/images/map.png b/libs/js/jquery-geo-1.0b2/docs/images/map.png deleted file mode 100755 index d41dc4d6e420bdb951514ccee218e12666c7f875..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5005 zcmd6r`9G9j^uV7PS+b2KSz;`ONR*Jhv3;^<%bJ}~wi-#4rYu>8q_JktpfuJ-S;i6> z!q_sl%*fIdrXe&W`98kif8u*y?|bff&fV|1=a(nh#`-c3rx+&y06b=<#&%#m50(-R z7EsGnXLNuS1Zj8K5U3%E{{TOZ1Q=Ku06_gyuD{-_0Kfv+SUQ-1eudKt=g%peS39o- zq6wm9sHh2 zeZ75S?)k<)@I^nqiB3Tlq~FA(BQcpEF$LMkg6x=r{1|LD5?d65%SYmhV(_3*7DK8* zk{XcYrWkTd45d2;oq{gNkH;3pW6MC$xQcjO1seA{9`_oJtHBUn#}jHW_y#ng1=Kiv z10LUmCmcc`wBQLX1VTHZw$Ra;tw_nz1_XNL~!RIB+@`HX@Eo;CXo*zlgCNqNfKqUmpo1;Pm(EzP$;ux z3YAQmrBJ982DO()CDW)B8kNRaBr#Td8LK4PB85hyFlb~3s8`91RSJ{Q%Vdz4pt0G@ z+$0?^dk>hPCes#apfC<$Fjm1rW2`bjVKQjUL(ODv(wLiI#W(=j18pWK2YVm~pny;A z|BslJJUdL3qv575NC4pNJ}eMoSd|~>6pb)(j<65A9&y+Ewm)Fw9TXa&Y;EEo6?s8f zU0Gu!4(AF0unjX~1BWONdf`(y`$lDZv3Bt}DSxJgX7kMx|Mlk?-b zC9!Dyoy>DWd-je|MT!5_ra?)1% zVAxAOqr@QfX?iq0W;>&qT5dK-E_ujQt$(_uK1iEq844M$OXFlgJ$L03^fofdEs^`FMaSbtK&GyR_u^ z)nna!A)k>DZSj8K{u}6VA`m6b5ttBlP7CGxf#b*JchbBl$<<~c20|E|N-0O$U9VciIgx*{(x`817Z9!6g!OwY~Hx952yT4!9{ z+zQffG)@PetCDc=5 z%MMEUFSfluUH0y?=drI`qC-oVCXJkGcaKK_tu5#7x}EqIi4pv1w6(e6|5-}#Z+v)u zv#I!}urXcum7E*&(08dKp-+M*Yu{-m_oH};I{qEch5uYC^IS}9ZEewo7uQw>`1$#5 zjqdF9^b8KJt%>i+5Ab|&*VWOvaN)xF^ZNSw+S;nOD=Ue#*00ZW{H?cn*7G;b#&cVt zk~@;3;Uc#`WlHWn?6eV9Is+pOku1?qDL6!tlmE={93!T0ebjrGqoa$CG zRpq03`?N;sREPY5>~L2HkG{=^N5iy}{3*t=0^-Y4BC>Cf51>YkLTxvs1#S)W&phfD zJL>KZuN|(8NO@v7KDM&*eLa%;bCo!d(%`_$;rYydW{{s*_SRW)ckf-?K+iMUfglWe z=N__YetBrQx7w|;p=o=2n}-{nhCi-=lJNC~VOTet+I*sQmSx8iaxBO6K9wa4OE#x| z_AleuljF3)#FTa7^3Oxp6+Ehw(-K5NIqLt#eknk0|Bfwz#=fbQ;*orwv-EN3Y~Q%^ zcjvz&^ZeG^-=uz7Cq_PFzttwZ&k@rUbcL+b*Hs~ z2Q1|aN{d6XY{S$g92)Hl_&rQSUmjD?=rmI1g*}Go)%#6oLRwjOZHGp(Z91ctOni?7 zTb(W`KNaiyDR^@Al7nDJB@mJYgP&ss_SkJv;UW90<6k^>?@eg0Is^o?-APJVBtHD4gvGZZ1~28Bd?X#C1H zX$SdzW;!!F$?pRc?rw`>`EU{{l6N*)rQ}(Ig#3mPCjYEUBuYNcpn{)ICA>Y=t~phu zq@h&tb_aiF9Hdh)nommIO(3B2IP1Cl9sIz^>*)3Pf6$&dGiW*85dw)-qV}&t{=06m zuxc>l!Ok}?uZwz`;Gr7TA~R;d1^IO6fz5Qx58%~wrU|5&1C_@0mcR?ZWcDQ;V3fy$ z214gl-2^-lGjr|>5U`IX%j;$IdhjLo`McXvFu9{P(>`L&cRARimOo8YJH@sO9;vE` zlWCMqjSh#ZvIn)6Ku|(|6=Om`Gz7=XTcR=EuRfehuXi4??T_Qwiu^PPRIXKPB zQtp3vD%SP95zzrYz5F|oFNZ1=9zo!tPm3&*RHSg+N0Z9@``WeK8#PW+|6Cd2!}?of zOO|Yxc0?Zho7vnx2dfe3gdM?=k2xF05jd@cF35eg%UmruADplWMAWY_m|vMfbi@Jj}8Fot_eL_gK0IJ^^4 z4A>o?GZ!5b@laro3U?Z^p%*!MOy>vq%)|?ezZ3sCAKv0>nqGxr0R~1!(RZ{9LyeB| z@p&jN0OdlN2B?<%0w(;Ac}6=e_|{@h%JL#yrA3eAc7)k>zU|{0YmnvY@%UdK5NOyG zY%%`vx?mZ%EqBiEH5XUSlSG|G3l`_ZUwx|eH?kC>sRQ9Vuzz6`NIw(}o-k@%Q|$NN zz9)BKS#SdfD>p$2j1yJb{LCp9VB7H_{d(a+;|Fc?aR+99I(M`3VGuhZSUb2acsV}} zv+}=8_%v4dr0D;bC9NHXVQY|u|0epSYndL7w|Ev>oU4#BlUar83Hf!>C8D!0*sM*j z>R4ts^$Y-Hm!=)pF41PW+A|{ksXpjMcida;GdlC*i-9*okrh#h)QXo8`Wqgdahr?Z zQy^dNjTIF>t9RTCIrboltw0_&mZ5B_=+zVRZ4F-Vl&e}zbI3u1!#mum&_J#h*Ge0Eva@)rZE*Ev48mcwpv};8EV4MHZ!_(_JC;q;HzsG=0sE;HDZZ(VcWdo5|WR#6S*-f|sfMdP< zE_dt zYkklDFW$g)LWYw?>XFfYskXW$bG9rN?|MPx+2JasF$)sqwPqy0yDAoZQ{ z{_^A_WJdPc205RtR$tWq)_{-a&UNJ}(5glPeNzn8!r{QfaP+62NVyHFla?}%7Au9RYq3GRok>OW<7f6`~1 z6jh75lVl#n8@nR;8i(5-it$3EaO)LjaMhjGK)kA78-(zPzSJ6#e(h%webSh7flH(c z^CYA-;CIRABvPQ#J@$}Qt`lWK2w{=%^$?~myc{Dv4LMxoVMbm8S&**B3|iLV%FQM$k%^D&hE1q*jkH=OhF!I1a)DL+Uf?B(IZlh z2ZX<1$K0Ph*=42nTIl1@Zsv<;kB1bcS~X5<**VU0afS&CVgm!f6vkPJ&ekL^tT&s& z^gk{XzNglYX^c+GrIb1=f8M!P#MoZ%Vp8VKS|w_Vy4y0n zAL(qa5!g6tMILjss!^^sZ_vMzQ;qv*8*2GHtIY_FPNtyra)jw80*z%|R?lj@z?L_? z*m-1{;G5FTpI>J_=}wfP8ZV!)FuN2j^H9xl%Mq7I{40E1AmD9r>7{8kzl+NiiY)w! z#2HHZaT!;O&rP?8f*T%nq{u@TSY#xe%XPbj;M`+NqIqwECx4_Cc(ImiYlz@ar6Gd3Qk;7)Vq5tEcRb^+hdsa7YVpZ z>G$sF*?~tskZa#`L|?H@zjbM`YAKKyk&pgHvF>@ahPqRAE|q)q0!PKfvm{5BntpE0 zIh4`~dy()PEh~L{Erh0uRCUC80YsSmf{i20+NvYIvFyi^N5rty`lE~d^y}?%I$pl} zyNU%zoX&X~)2%?im{8A3Ms?N{$wUKZ$R(PIjZV|uP-Nz~QU0cY+M;QfE1jzVQC z<_4Yo+3&;TA8ec&bPlt!?M!TWt>>2%>sp*|U0fM_ ze2n!?RYtK~euqb98LC2c`IdtGL9C+kR%X17;PKTuH?`WzDt7+p=U=L@G@0CT!OfJc zT$a2^gI7@Z=qLt7?_l?sJ3Cf&Ydw__M!Mt}W;H79nwU?%z7kQ5w7EeEUX-#&z@uK^ z6BM{|oe0J9s@huBmv=q_Zu_bRl1J&t9I*ZTMAV_ZlxC|(pmVYBU4~M g%l(g#kl#P{$Uz%Cs^Is=;ZF=R6KmrdL$AmG1Nt?5nE(I) diff --git a/libs/js/jquery-geo-1.0b2/docs/index.html b/libs/js/jquery-geo-1.0b2/docs/index.html deleted file mode 100755 index 1c2dab7..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/index.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - jQuery Geo docs - - - - - - - - - - - -
        -
        -

        jQuery Geo docs

        -
        - -
        -

        Welcome!

        - -

        jQuery Geo is an open-source, geospatial mapping jQuery plugin from Applied Geographics developed with the intention of making spatial web mapping significantly simpler than it may initially seem. We would like to point out the term "open-source" to explictly state that Google, Bing, & Esri are generally free but not open.

        - - - -

        Please read the following sections for more information and examples, and thank you for considering us! If you have any questions feel free to ask the lead developer on Twitter.

        - - - -

        If you would like only release notifications, you can follow the project itself on Twitter.

        - - - -

        docs

        - - - -

        This project takes pride in having easy-to-use, up-to-date documentation. Before any code is committed, these docs are updated with any public API changes and sometimes internal design decisions. The side effect is that the documenation may be ahead of the code at times. Also, any undocumented features you find in the source should be ignored or asked about.

        - -

        support

        - -

        jQuery Geo supports the following devices and browsers and may work in other un-tested environments.

        - -
          -
        • Microsoft Internet Explorer – IE8 and up
        • -
        • Mozilla Firefox – latest
        • -
        • Google Chrome – latest
        • -
        • Apple Safari – latest
        • -
        • Apple Mobile Safari – latest
        • -
        • Google Android Browser – various; difficult to test all
        • -
        - -

        examples

        - -

        Now that that's out of the way, here are some code examples! Use these as a suppliment to reading the above sections but above all, have fun!

        - -

        "everything" examples

        - -

        These first two examples attempt to let you test as many of jQuery Geo's features as possible on one page. The first link is a tiled map, i.e., it has a tilingScheme, set-in-stone zoom levels, and uses at least one tiled map service object. The second link is a dynamic map, i.e., it does not have a tilingScheme, displays fully dynamic data from MassGIS, and uses all shingled map service objects. The second type of map usually redraws slower but allows for more accurate zooming.

        - - - -

        You can find isolated examples of individual jQuery Geo features in the component examples section at the bottom of this page.

        - -

        showcase

        - -

        This third set are more complete examples using jQuery Geo. These try to implement slimmed-down versions of an existing applications and test how jQuery Geo can be used in real-world situations.

        - - - -

        demos

        - -

        The examples in this second set of use the features of jQuery Geo in a more interesting way. They attempt to show & test how you can use different parts jQuery Geo together to build apps and how we can integrate with external data and libraries.

        - - - -

        component examples

        - -

        This last set of examples attempts to test various components of jQuery Geo in an insolated way.

        - - - -

        internals

        - -

        Lastly, short of looking through the source code you can read a bit about the internal design decisions we made in the following section.

        - - - - Boston Built badge -
        -
        - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/internals/index.html b/libs/js/jquery-geo-1.0b2/docs/internals/index.html deleted file mode 100755 index c9143a2..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/internals/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - internals | jQuery Geo - - - - - - - - - - - -
        -
        -

        internals

        -
        - -
        -

        We keep some plugin design decisions here.

        -

        jQuery UI widget factory

        -

        The geomap widget uses the same widget factory that all other jQuery UI and jQuery Mobile widgets use. Like jQuery Mobile, we include a copy of jquery.ui.widget.js in the project. While this adds 3k to the final compressed build it allows us to easilly follow the patterns designed by UI and better integrate into the jQuery plugin community.

        -
        $.widget( "geo.geomap", { } );
        -

        Virtual state

        -

        The public properties bbox, bboxMax and center do not always match the internal state of the map widget. In fact internally, geomap only tracks center and pixelSize. The bbox and bboxMax properties are calculated based on the current or max center and pixelSize. In the code, you will see two properties each for each of these. One is public, the other is private. For center, the internal position (_center) is always in internal map units (web mercator meters by default) even if the developer sets the public bbox or center by longitude & latitude.

        -

        Initialization options

        -

        You may notice that we override jQuery UI's _createWidget function in order to capture the options passed in by the user. Let us know if there's a better way to do that. At the end of _create, we iterate over the passed options and set certain internal state values before creating services and refreshing the map. This insures that we handle supplied bbox or center properly. Since bbox and center can potentially conflict, only supply one. If both are supplied the behavior is technically undefined but currently center will override bbox.

        -

        bbox cache

        -

        When you append a shape to the map, the geomap widget will cache the shape's bounding box (in non-geodetic - coordinates) for faster searches when you call find. When you remove a shape from the map, the cache will be cleared. When you use the $.geo.bbox method on a shape after it has been appended to the map, the cached bounding box will be returned.

        -
        // the bbox of an appended shape is cached while it is on the map
        -var calculatedBbox = $.geo.bbox(shape);
        -$("#map").geomap("append", shape);
        -var cachedBbox = $.geo.bbox(shape);
        -$("#map").geomap("remove", shape);
        -var calculatedAgain = $.geo.bbox(shape);
        -

        jQuery Geo caches the bbox using jQuery's data function under the name geoBbox. Though I can't think of a reason to do so, you can remove this cache by calling removeData directly on the shape object:

        -
        $.removeData(shape, "geoBbox");
        -

        jQuery Geo's caching will not alter your geometry object so you don't have to worry about unintentionally storing or sending extra data to a server.

        -

        External libraries

        -

        Apart from the jQuery UI widget factory, geomap includes a couple external libraries.

        -

        Mouse wheel extension 3.0.2

        - http://plugins.jquery.com/node/7146 -

        We've found this to be a very stable mousewheel special event plugin and are using it to handle mouse wheel interaction. This plugin's license comment and source are included intact in the minified releases of jQuery Geo.

        -

        Google excanvas

        -

        We include parts of Google's excanvas library to support graphic drawing in IE6-8. Only functions required to support jQuery Geo's feature list are included. This library's license comment and source are included intact in the non-minified releases of jQuery Geo. The license comment and partial source are included intact in the minified releases of jQuery Geo.

        -

        jsRender

        - https://github.com/BorisMoore/jsrender -

        jQuery Geo includes a snapshot of jsRender, the next-generation templating engine from the jQuery team. This is used for measure text templates and src string templates.

        -

        Service types

        -

        Developers can set the services array used by the geomap widget. When it comes time to draw map images, the geomap widget uses an internal _serviceTypes object. The object contains one property for each service type geomap supports, e.g., tiled and shingled. The type property on each service object determines which serviceType object geomap uses to refresh the service. The following code snippet is a simplification of the relationship.

        -
        options: {
        -  services: [
        -    {
        -      "class": "osm",
        -      type: "tiled"
        -      /* ,... */
        -    }
        -  ]
        -},
        -
        -_serviceTypes: {
        -  tiled: {
        -    refresh: function (map, service) {
        -    }
        -    /* ,... */
        -  }
        -}
        -

        In the future the _serviceTypes property will be public and developers can extend the service types geomap supports.

        -
        -
        - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.js deleted file mode 100755 index 3552d4c..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.js +++ /dev/null @@ -1,4826 +0,0 @@ -// excanvas -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* - * AppGeo/geo - * (c) 2007-2011, Applied Geographics, Inc. All rights reserved. - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - */ - - -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// Known Issues: -// -// * Patterns only support repeat. -// * Radial gradient are not implemented. The VML version of these look very -// different from the canvas one. -// * Clipping paths are not implemented. -// * Coordsize. The width and height attribute have higher priority than the -// width and height style values which isn't correct. -// * Painting mode isn't implemented. -// * Canvas width/height should is using content-box by default. IE in -// Quirks mode will draw the canvas using border-box. Either change your -// doctype to HTML5 -// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) -// or use Box Sizing Behavior from WebFX -// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) -// * Non uniform scaling does not correctly scale strokes. -// * Optimize. There is always room for speed improvements. - -// Only add this code if we do not already have a canvas implementation -if (!document.createElement('canvas').getContext) { - - (function () { - - // alias some functions to make (compiled) code shorter - var m = Math; - var mr = m.round; - var ms = m.sin; - var mc = m.cos; - var abs = m.abs; - var sqrt = m.sqrt; - - // this is used for sub pixel precision - var Z = 10; - var Z2 = Z / 2; - - var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1]; - - /** - * This funtion is assigned to the elements as element.getContext(). - * @this {HTMLElement} - * @return {CanvasRenderingContext2D_} - */ - function getContext() { - return this.context_ || - (this.context_ = new CanvasRenderingContext2D_(this)); - } - - var slice = Array.prototype.slice; - - /** - * Binds a function to an object. The returned function will always use the - * passed in {@code obj} as {@code this}. - * - * Example: - * - * g = bind(f, obj, a, b) - * g(c, d) // will do f.call(obj, a, b, c, d) - * - * @param {Function} f The function to bind the object to - * @param {Object} obj The object that should act as this when the function - * is called - * @param {*} var_args Rest arguments that will be used as the initial - * arguments when the function is called - * @return {Function} A new function that has bound this - */ - function bind(f, obj, var_args) { - var a = slice.call(arguments, 2); - return function () { - return f.apply(obj, a.concat(slice.call(arguments))); - }; - } - - function encodeHtmlAttribute(s) { - return String(s).replace(/&/g, '&').replace(/"/g, '"'); - } - - function addNamespace(doc, prefix, urn) { - if (!doc.namespaces[prefix]) { - doc.namespaces.add(prefix, urn, '#default#VML'); - } - } - - function addNamespacesAndStylesheet(doc) { - addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml'); - addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office'); - - // Setup default CSS. Only add one style sheet per document - if (!doc.styleSheets['ex_canvas_']) { - var ss = doc.createStyleSheet(); - ss.owningElement.id = 'ex_canvas_'; - ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + - // default size is 300x150 in Gecko and Opera - 'text-align:left;width:300px;height:150px}'; - } - } - - // Add namespaces and stylesheet at startup. - addNamespacesAndStylesheet(document); - - var G_vmlCanvasManager_ = { - init: function (opt_doc) { - var doc = opt_doc || document; - // Create a dummy element so that IE will allow canvas elements to be - // recognized. - doc.createElement('canvas'); - doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); - }, - - init_: function (doc) { - // find all canvas elements - var els = doc.getElementsByTagName('canvas'); - for (var i = 0; i < els.length; i++) { - this.initElement(els[i]); - } - }, - - /** - * Public initializes a canvas element so that it can be used as canvas - * element from now on. This is called automatically before the page is - * loaded but if you are creating elements using createElement you need to - * make sure this is called on the element. - * @param {HTMLElement} el The canvas element to initialize. - * @return {HTMLElement} the element that was created. - */ - initElement: function (el) { - if (!el.getContext) { - el.getContext = getContext; - - // Add namespaces and stylesheet to document of the element. - addNamespacesAndStylesheet(el.ownerDocument); - - // Remove fallback content. There is no way to hide text nodes so we - // just remove all childNodes. We could hide all elements and remove - // text nodes but who really cares about the fallback content. - el.innerHTML = ''; - - // do not use inline function because that will leak memory - el.attachEvent('onpropertychange', onPropertyChange); - el.attachEvent('onresize', onResize); - - var attrs = el.attributes; - if (attrs.width && attrs.width.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setWidth_(attrs.width.nodeValue); - el.style.width = attrs.width.nodeValue + 'px'; - } else { - el.width = el.clientWidth; - } - if (attrs.height && attrs.height.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setHeight_(attrs.height.nodeValue); - el.style.height = attrs.height.nodeValue + 'px'; - } else { - el.height = el.clientHeight; - } - //el.getContext().setCoordsize_() - } - return el; - } - }; - - function onPropertyChange(e) { - var el = e.srcElement; - - switch (e.propertyName) { - case 'width': - el.getContext().clearRect(); - el.style.width = el.attributes.width.nodeValue + 'px'; - // In IE8 this does not trigger onresize. - el.firstChild.style.width = el.clientWidth + 'px'; - break; - case 'height': - el.getContext().clearRect(); - el.style.height = el.attributes.height.nodeValue + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - break; - } - } - - function onResize(e) { - var el = e.srcElement; - if (el.firstChild) { - el.firstChild.style.width = el.clientWidth + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - } - } - - G_vmlCanvasManager_.init(); - - // precompute "00" to "FF" - var decToHex = []; - for (var i = 0; i < 16; i++) { - for (var j = 0; j < 16; j++) { - decToHex[i * 16 + j] = i.toString(16) + j.toString(16); - } - } - - function createMatrixIdentity() { - return [ - [1, 0, 0], - [0, 1, 0], - [0, 0, 1] - ]; - } - - function matrixMultiply(m1, m2) { - var result = createMatrixIdentity(); - - for (var x = 0; x < 3; x++) { - for (var y = 0; y < 3; y++) { - var sum = 0; - - for (var z = 0; z < 3; z++) { - sum += m1[x][z] * m2[z][y]; - } - - result[x][y] = sum; - } - } - return result; - } - - function copyState(o1, o2) { - o2.fillStyle = o1.fillStyle; - o2.lineCap = o1.lineCap; - o2.lineJoin = o1.lineJoin; - o2.lineWidth = o1.lineWidth; - o2.miterLimit = o1.miterLimit; - o2.shadowBlur = o1.shadowBlur; - o2.shadowColor = o1.shadowColor; - o2.shadowOffsetX = o1.shadowOffsetX; - o2.shadowOffsetY = o1.shadowOffsetY; - o2.strokeStyle = o1.strokeStyle; - o2.globalAlpha = o1.globalAlpha; - o2.font = o1.font; - o2.textAlign = o1.textAlign; - o2.textBaseline = o1.textBaseline; - o2.arcScaleX_ = o1.arcScaleX_; - o2.arcScaleY_ = o1.arcScaleY_; - o2.lineScale_ = o1.lineScale_; - } - - // var colorData = { - // aliceblue: '#F0F8FF', - // antiquewhite: '#FAEBD7', - // aquamarine: '#7FFFD4', - // azure: '#F0FFFF', - // beige: '#F5F5DC', - // bisque: '#FFE4C4', - // black: '#000000', - // blanchedalmond: '#FFEBCD', - // blueviolet: '#8A2BE2', - // brown: '#A52A2A', - // burlywood: '#DEB887', - // cadetblue: '#5F9EA0', - // chartreuse: '#7FFF00', - // chocolate: '#D2691E', - // coral: '#FF7F50', - // cornflowerblue: '#6495ED', - // cornsilk: '#FFF8DC', - // crimson: '#DC143C', - // cyan: '#00FFFF', - // darkblue: '#00008B', - // darkcyan: '#008B8B', - // darkgoldenrod: '#B8860B', - // darkgray: '#A9A9A9', - // darkgreen: '#006400', - // darkgrey: '#A9A9A9', - // darkkhaki: '#BDB76B', - // darkmagenta: '#8B008B', - // darkolivegreen: '#556B2F', - // darkorange: '#FF8C00', - // darkorchid: '#9932CC', - // darkred: '#8B0000', - // darksalmon: '#E9967A', - // darkseagreen: '#8FBC8F', - // darkslateblue: '#483D8B', - // darkslategray: '#2F4F4F', - // darkslategrey: '#2F4F4F', - // darkturquoise: '#00CED1', - // darkviolet: '#9400D3', - // deeppink: '#FF1493', - // deepskyblue: '#00BFFF', - // dimgray: '#696969', - // dimgrey: '#696969', - // dodgerblue: '#1E90FF', - // firebrick: '#B22222', - // floralwhite: '#FFFAF0', - // forestgreen: '#228B22', - // gainsboro: '#DCDCDC', - // ghostwhite: '#F8F8FF', - // gold: '#FFD700', - // goldenrod: '#DAA520', - // grey: '#808080', - // greenyellow: '#ADFF2F', - // honeydew: '#F0FFF0', - // hotpink: '#FF69B4', - // indianred: '#CD5C5C', - // indigo: '#4B0082', - // ivory: '#FFFFF0', - // khaki: '#F0E68C', - // lavender: '#E6E6FA', - // lavenderblush: '#FFF0F5', - // lawngreen: '#7CFC00', - // lemonchiffon: '#FFFACD', - // lightblue: '#ADD8E6', - // lightcoral: '#F08080', - // lightcyan: '#E0FFFF', - // lightgoldenrodyellow: '#FAFAD2', - // lightgreen: '#90EE90', - // lightgrey: '#D3D3D3', - // lightpink: '#FFB6C1', - // lightsalmon: '#FFA07A', - // lightseagreen: '#20B2AA', - // lightskyblue: '#87CEFA', - // lightslategray: '#778899', - // lightslategrey: '#778899', - // lightsteelblue: '#B0C4DE', - // lightyellow: '#FFFFE0', - // limegreen: '#32CD32', - // linen: '#FAF0E6', - // magenta: '#FF00FF', - // mediumaquamarine: '#66CDAA', - // mediumblue: '#0000CD', - // mediumorchid: '#BA55D3', - // mediumpurple: '#9370DB', - // mediumseagreen: '#3CB371', - // mediumslateblue: '#7B68EE', - // mediumspringgreen: '#00FA9A', - // mediumturquoise: '#48D1CC', - // mediumvioletred: '#C71585', - // midnightblue: '#191970', - // mintcream: '#F5FFFA', - // mistyrose: '#FFE4E1', - // moccasin: '#FFE4B5', - // navajowhite: '#FFDEAD', - // oldlace: '#FDF5E6', - // olivedrab: '#6B8E23', - // orange: '#FFA500', - // orangered: '#FF4500', - // orchid: '#DA70D6', - // palegoldenrod: '#EEE8AA', - // palegreen: '#98FB98', - // paleturquoise: '#AFEEEE', - // palevioletred: '#DB7093', - // papayawhip: '#FFEFD5', - // peachpuff: '#FFDAB9', - // peru: '#CD853F', - // pink: '#FFC0CB', - // plum: '#DDA0DD', - // powderblue: '#B0E0E6', - // rosybrown: '#BC8F8F', - // royalblue: '#4169E1', - // saddlebrown: '#8B4513', - // salmon: '#FA8072', - // sandybrown: '#F4A460', - // seagreen: '#2E8B57', - // seashell: '#FFF5EE', - // sienna: '#A0522D', - // skyblue: '#87CEEB', - // slateblue: '#6A5ACD', - // slategray: '#708090', - // slategrey: '#708090', - // snow: '#FFFAFA', - // springgreen: '#00FF7F', - // steelblue: '#4682B4', - // tan: '#D2B48C', - // thistle: '#D8BFD8', - // tomato: '#FF6347', - // turquoise: '#40E0D0', - // violet: '#EE82EE', - // wheat: '#F5DEB3', - // whitesmoke: '#F5F5F5', - // yellowgreen: '#9ACD32' - // }; - - - function getRgbHslContent(styleString) { - var start = styleString.indexOf('(', 3); - var end = styleString.indexOf(')', start + 1); - var parts = styleString.substring(start + 1, end).split(','); - // add alpha if needed - if (parts.length != 4 || styleString.charAt(3) != 'a') { - parts[3] = 1; - } - return parts; - } - - function percent(s) { - return parseFloat(s) / 100; - } - - function clamp(v, min, max) { - return Math.min(max, Math.max(min, v)); - } - - function hslToRgb(parts) { - var r, g, b, h, s, l; - h = parseFloat(parts[0]) / 360 % 360; - if (h < 0) - h++; - s = clamp(percent(parts[1]), 0, 1); - l = clamp(percent(parts[2]), 0, 1); - if (s == 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hueToRgb(p, q, h + 1 / 3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1 / 3); - } - - return '#' + decToHex[Math.floor(r * 255)] + - decToHex[Math.floor(g * 255)] + - decToHex[Math.floor(b * 255)]; - } - - function hueToRgb(m1, m2, h) { - if (h < 0) - h++; - if (h > 1) - h--; - - if (6 * h < 1) - return m1 + (m2 - m1) * 6 * h; - else if (2 * h < 1) - return m2; - else if (3 * h < 2) - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - else - return m1; - } - - var processStyleCache = {}; - - function processStyle(styleString) { - if (styleString in processStyleCache) { - return processStyleCache[styleString]; - } - - var str, alpha = 1; - - styleString = String(styleString); - if (styleString.charAt(0) == '#') { - str = styleString; - } else if (/^rgb/.test(styleString)) { - var parts = getRgbHslContent(styleString); - var str = '#', n; - for (var i = 0; i < 3; i++) { - if (parts[i].indexOf('%') != -1) { - n = Math.floor(percent(parts[i]) * 255); - } else { - n = +parts[i]; - } - str += decToHex[clamp(n, 0, 255)]; - } - alpha = +parts[3]; - } else if (/^hsl/.test(styleString)) { - var parts = getRgbHslContent(styleString); - str = hslToRgb(parts); - alpha = parts[3]; - } else { - str = /*colorData[styleString] ||*/styleString; - } - return processStyleCache[styleString] = { color: str, alpha: alpha }; - } - - var DEFAULT_STYLE = { - style: 'normal', - variant: 'normal', - weight: 'normal', - size: 10, - family: 'sans-serif' - }; - - // Internal text style cache - // var fontStyleCache = {}; - - // function processFontStyle(styleString) { - // if (fontStyleCache[styleString]) { - // return fontStyleCache[styleString]; - // } - - // var el = document.createElement('div'); - // var style = el.style; - // try { - // style.font = styleString; - // } catch (ex) { - // // Ignore failures to set to invalid font. - // } - - // return fontStyleCache[styleString] = { - // style: style.fontStyle || DEFAULT_STYLE.style, - // variant: style.fontVariant || DEFAULT_STYLE.variant, - // weight: style.fontWeight || DEFAULT_STYLE.weight, - // size: style.fontSize || DEFAULT_STYLE.size, - // family: style.fontFamily || DEFAULT_STYLE.family - // }; - // } - - // function getComputedStyle(style, element) { - // var computedStyle = {}; - - // for (var p in style) { - // computedStyle[p] = style[p]; - // } - - // // Compute the size - // var canvasFontSize = parseFloat(element.currentStyle.fontSize), - // fontSize = parseFloat(style.size); - - // if (typeof style.size == 'number') { - // computedStyle.size = style.size; - // } else if (style.size.indexOf('px') != -1) { - // computedStyle.size = fontSize; - // } else if (style.size.indexOf('em') != -1) { - // computedStyle.size = canvasFontSize * fontSize; - // } else if(style.size.indexOf('%') != -1) { - // computedStyle.size = (canvasFontSize / 100) * fontSize; - // } else if (style.size.indexOf('pt') != -1) { - // computedStyle.size = fontSize / .75; - // } else { - // computedStyle.size = canvasFontSize; - // } - - // // Different scaling between normal text and VML text. This was found using - // // trial and error to get the same size as non VML text. - // computedStyle.size *= 0.981; - - // return computedStyle; - // } - - // function buildStyle(style) { - // return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + - // style.size + 'px ' + style.family; - // } - - var lineCapMap = { - 'butt': 'flat', - 'round': 'round' - }; - - function processLineCap(lineCap) { - return lineCapMap[lineCap] || 'square'; - } - - /** - * This class implements CanvasRenderingContext2D interface as described by - * the WHATWG. - * @param {HTMLElement} canvasElement The element that the 2D context should - * be associated with - */ - function CanvasRenderingContext2D_(canvasElement) { - this.m_ = createMatrixIdentity(); - - this.mStack_ = []; - this.aStack_ = []; - this.currentPath_ = []; - - // Canvas context properties - this.strokeStyle = '#000'; - this.fillStyle = '#000'; - - this.lineWidth = 1; - this.lineJoin = 'miter'; - this.lineCap = 'butt'; - this.miterLimit = Z * 1; - this.globalAlpha = 1; - //this.font = '10px sans-serif'; - //this.textAlign = 'left'; - //this.textBaseline = 'alphabetic'; - this.canvas = canvasElement; - - var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' + - canvasElement.clientHeight + 'px;overflow:hidden;position:absolute'; - var el = canvasElement.ownerDocument.createElement('div'); - el.style.cssText = cssText; - canvasElement.appendChild(el); - - var overlayEl = el.cloneNode(false); - // Use a non transparent background. - overlayEl.style.backgroundColor = 'red'; - overlayEl.style.filter = 'alpha(opacity=0)'; - canvasElement.appendChild(overlayEl); - - this.element_ = el; - this.arcScaleX_ = 1; - this.arcScaleY_ = 1; - this.lineScale_ = 1; - } - - var contextPrototype = CanvasRenderingContext2D_.prototype; - contextPrototype.clearRect = function () { - if (this.textMeasureEl_) { - this.textMeasureEl_.removeNode(true); - this.textMeasureEl_ = null; - } - this.element_.innerHTML = ''; - }; - - contextPrototype.beginPath = function () { - // TODO: Branch current matrix so that save/restore has no effect - // as per safari docs. - this.currentPath_ = []; - }; - - contextPrototype.moveTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'moveTo', x: p.x, y: p.y }); - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.lineTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'lineTo', x: p.x, y: p.y }); - - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY) { - var p = getCoords(this, aX, aY); - var cp1 = getCoords(this, aCP1x, aCP1y); - var cp2 = getCoords(this, aCP2x, aCP2y); - bezierCurveTo(this, cp1, cp2, p); - }; - - // Helper function that takes the already fixed cordinates. - function bezierCurveTo(self, cp1, cp2, p) { - self.currentPath_.push({ - type: 'bezierCurveTo', - cp1x: cp1.x, - cp1y: cp1.y, - cp2x: cp2.x, - cp2y: cp2.y, - x: p.x, - y: p.y - }); - self.currentX_ = p.x; - self.currentY_ = p.y; - } - - contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { - // the following is lifted almost directly from - // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes - - var cp = getCoords(this, aCPx, aCPy); - var p = getCoords(this, aX, aY); - - var cp1 = { - x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), - y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) - }; - var cp2 = { - x: cp1.x + (p.x - this.currentX_) / 3.0, - y: cp1.y + (p.y - this.currentY_) / 3.0 - }; - - bezierCurveTo(this, cp1, cp2, p); - }; - - contextPrototype.arc = function (aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise) { - aRadius *= Z; - var arcType = aClockwise ? 'at' : 'wa'; - - var xStart = aX + mc(aStartAngle) * aRadius - Z2; - var yStart = aY + ms(aStartAngle) * aRadius - Z2; - - var xEnd = aX + mc(aEndAngle) * aRadius - Z2; - var yEnd = aY + ms(aEndAngle) * aRadius - Z2; - - // IE won't render arches drawn counter clockwise if xStart == xEnd. - if (xStart == xEnd && !aClockwise) { - xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something - // that can be represented in binary - } - - var p = getCoords(this, aX, aY); - var pStart = getCoords(this, xStart, yStart); - var pEnd = getCoords(this, xEnd, yEnd); - - this.currentPath_.push({ type: arcType, - x: p.x, - y: p.y, - radius: aRadius, - xStart: pStart.x, - yStart: pStart.y, - xEnd: pEnd.x, - yEnd: pEnd.y - }); - - }; - - // contextPrototype.rect = function(aX, aY, aWidth, aHeight) { - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // }; - - // contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.stroke(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.fill(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { - // var gradient = new CanvasGradient_('gradient'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // return gradient; - // }; - - // contextPrototype.createRadialGradient = function(aX0, aY0, aR0, - // aX1, aY1, aR1) { - // var gradient = new CanvasGradient_('gradientradial'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.r0_ = aR0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // gradient.r1_ = aR1; - // return gradient; - // }; - - // contextPrototype.drawImage = function(image, var_args) { - // var dx, dy, dw, dh, sx, sy, sw, sh; - - // // to find the original width we overide the width and height - // var oldRuntimeWidth = image.runtimeStyle.width; - // var oldRuntimeHeight = image.runtimeStyle.height; - // image.runtimeStyle.width = 'auto'; - // image.runtimeStyle.height = 'auto'; - - // // get the original size - // var w = image.width; - // var h = image.height; - - // // and remove overides - // image.runtimeStyle.width = oldRuntimeWidth; - // image.runtimeStyle.height = oldRuntimeHeight; - - // if (arguments.length == 3) { - // dx = arguments[1]; - // dy = arguments[2]; - // sx = sy = 0; - // sw = dw = w; - // sh = dh = h; - // } else if (arguments.length == 5) { - // dx = arguments[1]; - // dy = arguments[2]; - // dw = arguments[3]; - // dh = arguments[4]; - // sx = sy = 0; - // sw = w; - // sh = h; - // } else if (arguments.length == 9) { - // sx = arguments[1]; - // sy = arguments[2]; - // sw = arguments[3]; - // sh = arguments[4]; - // dx = arguments[5]; - // dy = arguments[6]; - // dw = arguments[7]; - // dh = arguments[8]; - // } else { - // throw Error('Invalid number of arguments'); - // } - - // var d = getCoords(this, dx, dy); - - // var w2 = sw / 2; - // var h2 = sh / 2; - - // var vmlStr = []; - - // var W = 10; - // var H = 10; - - // // For some reason that I've now forgotten, using divs didn't work - // vmlStr.push(' ' , - // '', - // ''); - - // this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join('')); - // }; - - contextPrototype.stroke = function (aFill) { - var lineStr = []; - var lineOpen = false; - - var W = 10; - var H = 10; - - lineStr.push(''); - - if (!aFill) { - appendStroke(this, lineStr); - } else { - appendFill(this, lineStr, min, max); - } - - lineStr.push(''); - - this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - }; - - function appendStroke(ctx, lineStr) { - var a = processStyle(ctx.strokeStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - var lineWidth = ctx.lineScale_ * ctx.lineWidth; - - // VML cannot correctly render a line if the width is less than 1px. - // In that case, we dilute the color to make the line look thinner. - if (lineWidth < 1) { - opacity *= lineWidth; - } - - lineStr.push( - '' - ); - } - - function appendFill(ctx, lineStr, min, max) { - var fillStyle = ctx.fillStyle; - var arcScaleX = ctx.arcScaleX_; - var arcScaleY = ctx.arcScaleY_; - var width = max.x - min.x; - var height = max.y - min.y; - // if (fillStyle instanceof CanvasGradient_) { - // // TODO: Gradients transformed with the transformation matrix. - // var angle = 0; - // var focus = {x: 0, y: 0}; - - // // additional offset - // var shift = 0; - // // scale factor for offset - // var expansion = 1; - - // if (fillStyle.type_ == 'gradient') { - // var x0 = fillStyle.x0_ / arcScaleX; - // var y0 = fillStyle.y0_ / arcScaleY; - // var x1 = fillStyle.x1_ / arcScaleX; - // var y1 = fillStyle.y1_ / arcScaleY; - // var p0 = getCoords(ctx, x0, y0); - // var p1 = getCoords(ctx, x1, y1); - // var dx = p1.x - p0.x; - // var dy = p1.y - p0.y; - // angle = Math.atan2(dx, dy) * 180 / Math.PI; - - // // The angle should be a non-negative number. - // if (angle < 0) { - // angle += 360; - // } - - // // Very small angles produce an unexpected result because they are - // // converted to a scientific notation string. - // if (angle < 1e-6) { - // angle = 0; - // } - // } else { - // var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_); - // focus = { - // x: (p0.x - min.x) / width, - // y: (p0.y - min.y) / height - // }; - - // width /= arcScaleX * Z; - // height /= arcScaleY * Z; - // var dimension = m.max(width, height); - // shift = 2 * fillStyle.r0_ / dimension; - // expansion = 2 * fillStyle.r1_ / dimension - shift; - // } - - // // We need to sort the color stops in ascending order by offset, - // // otherwise IE won't interpret it correctly. - // var stops = fillStyle.colors_; - // stops.sort(function(cs1, cs2) { - // return cs1.offset - cs2.offset; - // }); - - // var length = stops.length; - // var color1 = stops[0].color; - // var color2 = stops[length - 1].color; - // var opacity1 = stops[0].alpha * ctx.globalAlpha; - // var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; - - // var colors = []; - // for (var i = 0; i < length; i++) { - // var stop = stops[i]; - // colors.push(stop.offset * expansion + shift + ' ' + stop.color); - // } - - // // When colors attribute is used, the meanings of opacity and o:opacity2 - // // are reversed. - // lineStr.push(''); - // } else if (fillStyle instanceof CanvasPattern_) { - // if (width && height) { - // var deltaLeft = -min.x; - // var deltaTop = -min.y; - // lineStr.push(''); - // } - // } else { - var a = processStyle(ctx.fillStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - lineStr.push(''); - // } - } - - contextPrototype.fill = function () { - this.stroke(true); - }; - - contextPrototype.closePath = function () { - this.currentPath_.push({ type: 'close' }); - }; - - function getCoords(ctx, aX, aY) { - var m = ctx.m_; - return { - x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, - y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 - }; - }; - - contextPrototype.save = function () { - var o = {}; - copyState(this, o); - this.aStack_.push(o); - this.mStack_.push(this.m_); - this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); - }; - - contextPrototype.restore = function () { - if (this.aStack_.length) { - copyState(this.aStack_.pop(), this); - this.m_ = this.mStack_.pop(); - } - }; - - function matrixIsFinite(m) { - return isFinite(m[0][0]) && isFinite(m[0][1]) && - isFinite(m[1][0]) && isFinite(m[1][1]) && - isFinite(m[2][0]) && isFinite(m[2][1]); - } - - function setM(ctx, m, updateLineScale) { - if (!matrixIsFinite(m)) { - return; - } - ctx.m_ = m; - - if (updateLineScale) { - // Get the line scale. - // Determinant of this.m_ means how much the area is enlarged by the - // transformation. So its square root can be used as a scale factor - // for width. - var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; - ctx.lineScale_ = sqrt(abs(det)); - } - } - - contextPrototype.translate = function (aX, aY) { - var m1 = [ - [1, 0, 0], - [0, 1, 0], - [aX, aY, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), false); - }; - - // contextPrototype.rotate = function(aRot) { - // var c = mc(aRot); - // var s = ms(aRot); - - // var m1 = [ - // [c, s, 0], - // [-s, c, 0], - // [0, 0, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), false); - // }; - - contextPrototype.scale = function (aX, aY) { - this.arcScaleX_ *= aX; - this.arcScaleY_ *= aY; - var m1 = [ - [aX, 0, 0], - [0, aY, 0], - [0, 0, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), true); - }; - - // contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { - // var m1 = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), true); - // }; - - // contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { - // var m = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, m, true); - // }; - - /** - * The text drawing function. - * The maxWidth argument isn't taken in account, since no browser supports - * it yet. - */ - // contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { - // var m = this.m_, - // delta = 1000, - // left = 0, - // right = delta, - // offset = {x: 0, y: 0}, - // lineStr = []; - - // var fontStyle = getComputedStyle(processFontStyle(this.font), - // this.element_); - - // var fontStyleString = buildStyle(fontStyle); - - // var elementStyle = this.element_.currentStyle; - // var textAlign = this.textAlign.toLowerCase(); - // switch (textAlign) { - // case 'left': - // case 'center': - // case 'right': - // break; - // case 'end': - // textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; - // break; - // case 'start': - // textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; - // break; - // default: - // textAlign = 'left'; - // } - - // // 1.75 is an arbitrary number, as there is no info about the text baseline - // switch (this.textBaseline) { - // case 'hanging': - // case 'top': - // offset.y = fontStyle.size / 1.75; - // break; - // case 'middle': - // break; - // default: - // case null: - // case 'alphabetic': - // case 'ideographic': - // case 'bottom': - // offset.y = -fontStyle.size / 2.25; - // break; - // } - - // switch(textAlign) { - // case 'right': - // left = delta; - // right = 0.05; - // break; - // case 'center': - // left = right = delta / 2; - // break; - // } - - // var d = getCoords(this, x + offset.x, y + offset.y); - - // lineStr.push(''); - - // if (stroke) { - // appendStroke(this, lineStr); - // } else { - // // TODO: Fix the min and max params. - // appendFill(this, lineStr, {x: -left, y: 0}, - // {x: right, y: fontStyle.size}); - // } - - // var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + - // m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; - - // var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); - - // lineStr.push('', - // '', - // ''); - - // this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - // }; - - // contextPrototype.fillText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, false); - // }; - - // contextPrototype.strokeText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, true); - // }; - - // contextPrototype.measureText = function(text) { - // if (!this.textMeasureEl_) { - // var s = ''; - // this.element_.insertAdjacentHTML('beforeEnd', s); - // this.textMeasureEl_ = this.element_.lastChild; - // } - // var doc = this.element_.ownerDocument; - // this.textMeasureEl_.innerHTML = ''; - // this.textMeasureEl_.style.font = this.font; - // // Don't use innerHTML or innerText because they allow markup/whitespace. - // this.textMeasureEl_.appendChild(doc.createTextNode(text)); - // return {width: this.textMeasureEl_.offsetWidth}; - // }; - - /******** STUBS ********/ - // contextPrototype.clip = function() { - // // TODO: Implement - // }; - - // contextPrototype.arcTo = function() { - // // TODO: Implement - // }; - - // contextPrototype.createPattern = function(image, repetition) { - // return new CanvasPattern_(image, repetition); - // }; - - // // Gradient / Pattern Stubs - // function CanvasGradient_(aType) { - // this.type_ = aType; - // this.x0_ = 0; - // this.y0_ = 0; - // this.r0_ = 0; - // this.x1_ = 0; - // this.y1_ = 0; - // this.r1_ = 0; - // this.colors_ = []; - // } - - // CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { - // aColor = processStyle(aColor); - // this.colors_.push({offset: aOffset, - // color: aColor.color, - // alpha: aColor.alpha}); - // }; - - // function CanvasPattern_(image, repetition) { - // assertImageIsValid(image); - // switch (repetition) { - // case 'repeat': - // case null: - // case '': - // this.repetition_ = 'repeat'; - // break - // case 'repeat-x': - // case 'repeat-y': - // case 'no-repeat': - // this.repetition_ = repetition; - // break; - // default: - // throwException('SYNTAX_ERR'); - // } - - // this.src_ = image.src; - // this.width_ = image.width; - // this.height_ = image.height; - // } - - function throwException(s) { - throw new DOMException_(s); - } - - // function assertImageIsValid(img) { - // if (!img || img.nodeType != 1 || img.tagName != 'IMG') { - // throwException('TYPE_MISMATCH_ERR'); - // } - // if (img.readyState != 'complete') { - // throwException('INVALID_STATE_ERR'); - // } - // } - - function DOMException_(s) { - this.code = this[s]; - this.message = s + ': DOM Exception ' + this.code; - } - var p = DOMException_.prototype = new Error; - p.INDEX_SIZE_ERR = 1; - p.DOMSTRING_SIZE_ERR = 2; - p.HIERARCHY_REQUEST_ERR = 3; - p.WRONG_DOCUMENT_ERR = 4; - p.INVALID_CHARACTER_ERR = 5; - p.NO_DATA_ALLOWED_ERR = 6; - p.NO_MODIFICATION_ALLOWED_ERR = 7; - p.NOT_FOUND_ERR = 8; - p.NOT_SUPPORTED_ERR = 9; - p.INUSE_ATTRIBUTE_ERR = 10; - p.INVALID_STATE_ERR = 11; - p.SYNTAX_ERR = 12; - p.INVALID_MODIFICATION_ERR = 13; - p.NAMESPACE_ERR = 14; - p.INVALID_ACCESS_ERR = 15; - p.VALIDATION_ERR = 16; - p.TYPE_MISMATCH_ERR = 17; - - // set up externs - G_vmlCanvasManager = G_vmlCanvasManager_; - CanvasRenderingContext2D = CanvasRenderingContext2D_; - //CanvasGradient = CanvasGradient_; - //CanvasPattern = CanvasPattern_; - DOMException = DOMException_; - })(); - -} // if -/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * - * Version: 3.0.2 - * - * Requires: 1.2.2+ - */ -(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery); - -/*! - * jQuery UI Widget @VERSION - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ -if (!$.widget) { -(function( $, undefined ) { - -var slice = Array.prototype.slice; - -var _cleanData = $.cleanData; -$.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - $( elem ).triggerHandler( "remove" ); - } - _cleanData( elems ); -}; - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - // create the constructor using $.extend() so we can carry over any - // static properties stored on the existing constructor (if there is one) - $[ namespace ][ name ] = $.extend( function( options, element ) { - // allow instantiation without "new" keyword - if ( !this._createWidget ) { - return new $[ namespace ][ name ]( options, element ); - } - - // allow instantiation without initializing for simple inheritance - // must use "new" keyword (the code above always passes args) - if ( arguments.length ) { - this._createWidget( options, element ); - } - }, $[ namespace ][ name ] ); - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $.each( prototype, function( prop, value ) { - if ( $.isFunction( value ) ) { - prototype[ prop ] = (function() { - var _super = function( method ) { - return base.prototype[ method ].apply( this, slice.call( arguments, 1 ) ); - }; - var _superApply = function( method, args ) { - return base.prototype[ method ].apply( this, args ); - }; - return function() { - var __super = this._super, - __superApply = this._superApply, - returnValue; - - this._super = _super; - this._superApply = _superApply; - - returnValue = value.apply( this, arguments ); - - this._super = __super; - this._superApply = __superApply; - - return returnValue; - }; - }()); - } - }); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ); - if ( !instance ) { - return $.error( "cannot call methods on " + name + " prior to initialization; " + - "attempted to call method '" + options + "'" ); - } - if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { - return $.error( "no such method '" + options + "' for " + name + " widget instance" ); - } - var methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - object( options, this ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without "new" keyword - if ( !this._createWidget ) { - return new $[ namespace ][ name ]( options, element ); - } - - // allow instantiation without initializing for simple inheritance - // must use "new" keyword (the code above always passes args) - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - defaultElement: "
        ", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - element = $( element || this.defaultElement || this )[ 0 ]; - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - this._getCreateOptions(), - options ); - - this.bindings = $(); - this.hoverable = $(); - this.focusable = $(); - - if ( element !== this ) { - $.data( element, this.widgetName, this ); - this._bind({ remove: "destroy" }); - } - - this._create(); - this._trigger( "create" ); - this._init(); - }, - _getCreateOptions: function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }, - _create: $.noop, - _init: $.noop, - - destroy: function() { - this._destroy(); - // we can probably remove the unbind calls in 2.0 - // all event bindings should go through this._bind() - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - - // clean up events and states - this.bindings.unbind( "." + this.widgetName ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - }, - _destroy: $.noop, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, this.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var self = this; - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - .toggleClass( this.widgetBaseClass + "-disabled ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _bind: function( element, handlers ) { - // no element argument, shuffle and use this.element - if ( !handlers ) { - handlers = element; - element = this.element; - } else { - // accept selectors, DOM elements - element = $( element ); - this.bindings = this.bindings.add( element ); - } - var instance = this; - $.each( handlers, function( event, handler ) { - element.bind( event + "." + instance.widgetName, function() { - // allow widgets to customize the disabled handling - // - disabled as an array instead of boolean - // - disabled class as method for disabling individual parts - if ( instance.options.disabled === true || - $( this ).hasClass( "ui-state-disabled" ) ) { - return; - } - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - }); - }); - }, - - _hoverable: function( element ) { - this.hoverable = this.hoverable.add( element ); - this._bind( element, { - mouseenter: function( event ) { - $( event.currentTarget ).addClass( "ui-state-hover" ); - }, - mouseleave: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-hover" ); - } - }); - }, - - _focusable: function( element ) { - this.focusable = this.focusable.add( element ); - this._bind( element, { - focusin: function( event ) { - $( event.currentTarget ).addClass( "ui-state-focus" ); - }, - focusout: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-focus" ); - } - }); - }, - - _trigger: function( type, event, data ) { - var callback = this.options[ type ], - args; - - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - data = data || {}; - - // copy original event properties over to the new event - // this would happen if we could call $.event.fix instead of $.Event - // but we don't have a way to force an event to be fixed multiple times - if ( event.originalEvent ) { - for ( var i = $.event.props.length, prop; i; ) { - prop = $.event.props[ --i ]; - event[ prop ] = event.originalEvent[ prop ]; - } - } - - this.element.trigger( event, data ); - - args = $.isArray( data ) ? - [ event ].concat( data ) : - [ event, data ]; - - return !( $.isFunction( callback ) && - callback.apply( this.element[0], args ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); -}(function ($, window, undefined) { - var pos_oo = Number.POSITIVE_INFINITY, - neg_oo = Number.NEGATIVE_INFINITY; - - $.geo = { - // - // utility functions - // - - _allCoordinates: function (geom) { - // return array of all positions in all geometries of geom - // not in JTS - var geometries = this._flatten(geom), - curGeom = 0, - result = []; - - for (; curGeom < geometries.length; curGeom++) { - var coordinates = geometries[curGeom].coordinates, - isArray = coordinates && $.isArray(coordinates[0]), - isDblArray = isArray && $.isArray(coordinates[0][0]), - isTriArray = isDblArray && $.isArray(coordinates[0][0][0]), - i, j, k; - - if (!isTriArray) { - if (!isDblArray) { - if (!isArray) { - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - - for (i = 0; i < coordinates.length; i++) { - for (j = 0; j < coordinates[i].length; j++) { - for (k = 0; k < coordinates[i][j].length; k++) { - result.push(coordinates[i][j][k]); - } - } - } - } - return result; - }, - - // - // bbox functions - // - - center: function (bbox, _ignoreGeo /* Internal Use Only */) { - // Envelope.centre in JTS - // bbox only, use centroid for geom - if (!_ignoreGeo && $.geo.proj) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - var center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2]; - return !_ignoreGeo && $.geo.proj ? $.geo.proj.toGeodetic(center) : center; - }, - - expandBy: function (bbox, dx, dy) { - if ($.geo.proj) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - bbox = [bbox[0] - dx, bbox[1] - dy, bbox[2] + dx, bbox[3] + dy]; - return $.geo.proj ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - height: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if (!_ignoreGeo && $.geo.proj) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - return bbox[3] - bbox[1]; - }, - - _in: function(bbox1, bbox2) { - return bbox1[0] <= bbox2[0] && - bbox1[1] <= bbox2[1] && - bbox1[2] >= bbox2[2] && - bbox1[3] >= bbox2[3]; - }, - - _bboxDisjoint: function( bbox1, bbox2 ) { - return bbox2[ 0 ] > bbox1[ 2 ] || - bbox2[ 2 ] < bbox1[ 0 ] || - bbox2[ 1 ] > bbox1[ 3 ] || - bbox2[ 3 ] < bbox1[ 1 ]; - }, - - reaspect: function (bbox, ratio, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - if (!_ignoreGeo && $.geo.proj) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - var width = this.width(bbox, true), - height = this.height(bbox, true), - center = this.center(bbox, true), - dx, dy; - - if (width != 0 && height != 0 && ratio > 0) { - if (width / height > ratio) { - dx = width / 2; - dy = dx / ratio; - } else { - dy = height / 2; - dx = dy * ratio; - } - - bbox = [center[0] - dx, center[1] - dy, center[0] + dx, center[1] + dy]; - } - return $.geo.proj ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - scaleBy: function ( bbox, scale, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - if (!_ignoreGeo && $.geo.proj) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - var c = this.center(bbox, true), - dx = (bbox[2] - bbox[0]) * scale / 2, - dy = (bbox[3] - bbox[1]) * scale / 2; - bbox = [c[0] - dx, c[1] - dy, c[0] + dx, c[1] + dy]; - return !_ignoreGeo && $.geo.proj ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - width: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if (!_ignoreGeo && $.geo.proj) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - return bbox[2] - bbox[0]; - }, - - // - // geometry functions - // - - // bbox (Geometry.getEnvelope in JTS) - - bbox: function ( geom, _ignoreGeo /* Internal Use Only */ ) { - if ( !geom ) { - return undefined; - } else if ( geom.bbox ) { - result = !_ignoreGeo && $.geo.proj ? $.geo.proj.fromGeodetic( geom.bbox ) : geom.bbox; - } else { - result = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - - var coordinates = this._allCoordinates( geom ), - curCoord = 0; - - if ( coordinates.length == 0 ) { - return undefined; - } - - if ( $.geo.proj ) { - coordinates = $.geo.proj.fromGeodetic( coordinates ); - } - - for ( ; curCoord < coordinates.length; curCoord++ ) { - result[0] = Math.min(coordinates[curCoord][0], result[0]); - result[1] = Math.min(coordinates[curCoord][1], result[1]); - result[2] = Math.max(coordinates[curCoord][0], result[2]); - result[3] = Math.max(coordinates[curCoord][1], result[3]); - } - } - - return $.geo.proj ? $.geo.proj.toGeodetic(result) : result; - }, - - // centroid - - centroid: function( geom, _ignoreGeo /* Internal Use Only */ ) { - switch (geom.type) { - case "Point": - return $.extend({}, geom); - - case "LineString": - case "Polygon": - var a = 0, - c = [0, 0], - coords = $.merge( [ ], geom.type == "Polygon" ? geom.coordinates[0] : geom.coordinates ), - i = 1, j, n; - - if ( !_ignoreGeo && $.geo.proj ) { - coords = $.geo.proj.fromGeodetic(coords); - } - - //if (coords[0][0] != coords[coords.length - 1][0] || coords[0][1] != coords[coords.length - 1][1]) { - // coords.push(coords[0]); - //} - - for (; i <= coords.length; i++) { - j = i % coords.length; - n = (coords[i - 1][0] * coords[j][1]) - (coords[j][0] * coords[i - 1][1]); - a += n; - c[0] += (coords[i - 1][0] + coords[j][0]) * n; - c[1] += (coords[i - 1][1] + coords[j][1]) * n; - } - - if (a == 0) { - if (coords.length > 0) { - c[0] = coords[0][0]; - c[1] = coords[0][1]; - return { type: "Point", coordinates: !_ignoreGeo && $.geo.proj ? $.geo.proj.toGeodetic(c) : c }; - } else { - return undefined; - } - } - - a *= 3; - c[0] /= a; - c[1] /= a; - - return { type: "Point", coordinates: !_ignoreGeo && $.geo.proj ? $.geo.proj.toGeodetic(c) : c }; - } - return undefined; - }, - - // contains - - contains: function (geom1, geom2) { - if (geom1.type != "Polygon") { - return false; - } - - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1.coordinates, geom2.coordinates); - - case "LineString": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates); - - case "Polygon": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates[0]); - - default: - return false; - } - }, - - _containsPolygonPoint: function (polygonCoordinates, pointCoordinate) { - if (polygonCoordinates.length == 0 || polygonCoordinates[0].length < 4) { - return false; - } - - var rayCross = 0, - a = polygonCoordinates[0][0], - i = 1, - b, - x; - - for (; i < polygonCoordinates[0].length; i++) { - b = polygonCoordinates[0][i]; - - if ((a[1] <= pointCoordinate[1] && pointCoordinate[1] < b[1]) || (b[1] <= pointCoordinate[1] && pointCoordinate[1] < a[1]) && (pointCoordinate[0] < a[0] || pointCoordinate[0] < b[0])) { - x = a[0] + (b[0] - a[0]) * (pointCoordinate[1] - a[1]) / (b[1] - a[1]); - - if (x > pointCoordinate[0]) { - rayCross++; - } - } - - a = b; - } - - return rayCross % 2 == 1; - }, - - _containsPolygonLineString: function (polygonCoordinates, lineStringCoordinates) { - for (var i = 0; i < lineStringCoordinates.length; i++) { - if (!this._containsPolygonPoint(polygonCoordinates, lineStringCoordinates[i])) { - return false; - } - } - return true; - }, - - // distance - - distance: function ( geom1, geom2, _ignoreGeo /* Internal Use Only */ ) { - var geom1CoordinatesProjected = !_ignoreGeo && $.geo.proj ? $.geo.proj.fromGeodetic(geom1.coordinates) : geom1.coordinates, - geom2CoordinatesProjected = !_ignoreGeo && $.geo.proj ? $.geo.proj.fromGeodetic(geom2.coordinates) : geom2.coordinates; - - switch (geom1.type) { - case "Point": - switch (geom2.type) { - case "Point": - return this._distancePointPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "LineString": - return this._distanceLineStringPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "Polygon": - return this._containsPolygonPoint(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "LineString": - switch (geom2.type) { - case "Point": - return this._distanceLineStringPoint(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "LineString": - return this._distanceLineStringLineString(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "Polygon": - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "LineString": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected[0]) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected[0]); - default: - return undefined; - } - break; - } - }, - - _distancePointPoint: function (coordinate1, coordinate2) { - var dx = coordinate2[0] - coordinate1[0], - dy = coordinate2[1] - coordinate1[1]; - return Math.sqrt((dx * dx) + (dy * dy)); - }, - - _distanceLineStringPoint: function (lineStringCoordinates, pointCoordinate) { - var minDist = pos_oo; - - if (lineStringCoordinates.length > 0) { - var a = lineStringCoordinates[0], - - apx = pointCoordinate[0] - a[0], - apy = pointCoordinate[1] - a[1]; - - if (lineStringCoordinates.length == 1) { - return Math.sqrt(apx * apx + apy * apy); - } else { - for (var i = 1; i < lineStringCoordinates.length; i++) { - var b = lineStringCoordinates[i], - - abx = b[0] - a[0], - aby = b[1] - a[1], - bpx = pointCoordinate[0] - b[0], - bpy = pointCoordinate[1] - b[1], - - d = this._distanceSegmentPoint(abx, aby, apx, apy, bpx, bpy); - - if (d == 0) { - return 0; - } - - if (d < minDist) { - minDist = d; - } - - a = b; - apx = bpx; - apy = bpy; - } - } - } - - return Math.sqrt(minDist); - }, - - _distanceSegmentPoint: function (abx, aby, apx, apy, bpx, bpy) { - var dot1 = abx * apx + aby * apy; - - if (dot1 <= 0) { - return apx * apx + apy * apy; - } - - var dot2 = abx * abx + aby * aby; - - if (dot1 >= dot2) { - return bpx * bpx + bpy * bpy; - } - - return apx * apx + apy * apy - dot1 * dot1 / dot2; - }, - - _distanceLineStringLineString: function (lineStringCoordinates1, lineStringCoordinates2) { - var minDist = pos_oo; - for (var i = 0; i < lineStringCoordinates2.length; i++) { - minDist = Math.min(minDist, this._distanceLineStringPoint(lineStringCoordinates1, lineStringCoordinates2[i])); - } - return minDist; - }, - - // - // feature - // - - _flatten: function (geom) { - // return an array of all basic geometries - // not in JTS - var geometries = [], - curGeom = 0; - switch (geom.type) { - case "Feature": - $.merge(geometries, this._flatten(geom.geometry)); - break; - - case "FeatureCollection": - for (; curGeom < geom.features.length; curGeom++) { - $.merge(geometries, this._flatten(geom.features[curGeom].geometry)); - } - break; - - case "GeometryCollection": - for (; curGeom < geom.geometries.length; curGeom++) { - $.merge(geometries, this._flatten(geom.geometries[curGeom])); - } - break; - - default: - geometries[0] = geom; - break; - } - return geometries; - }, - - // - // WKT functions - // - - _WKT: (function () { - function pointToString(value) { - return "POINT " + pointToUntaggedString(value.coordinates); - } - - function pointToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - return "(" + coordinates.join(" ") + ")"; - } - } - - function lineStringToString(value) { - return "LINESTRING " + lineStringToUntaggedString(value.coordinates); - } - - function lineStringToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var points = [] - - for (var i = 0; i < coordinates.length; i++) { - points.push(coordinates[i].join(" ")); - } - - return "(" + points + ")"; - } - } - - function polygonToString(value) { - return "POLYGON " + polygonToUntaggedString(value.coordinates); - } - - function polygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMTPY"; - } else { - var lineStrings = []; - - for (var i = 0; i < coordinates.length; i++) { - lineStrings.push(lineStringToUntaggedString(coordinates[i])); - } - - return "(" + lineStrings + ")"; - } - } - - function multiPointToString(value) { - return "MULTIPOINT " + lineStringToUntaggedString(value.coordinates); - } - - function multiLineStringToString(value) { - return "MULTILINSTRING " + polygonToUntaggedString(value.coordinates); - } - - function multiPolygonToString(value) { - return "MULTIPOLYGON " + multiPolygonToUntaggedString(value.coordinates); - } - - function multiPolygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var polygons = []; - for (var i = 0; i < coordinates.length; i++) { - polygons.push(polygonToUntaggedString(coordinates[i])); - } - return "(" + polygons + ")"; - } - } - - function geometryCollectionToString(value) { - return "GEOMETRYCOLLECTION " + geometryCollectionToUntaggedString(value.geometries); - } - - function geometryCollectionToUntaggedString(geometries) { - if (!(geometries && geometries.length)) { - return "EMPTY"; - } else { - var geometryText = []; - for (var i = 0; i < geometries.length; i++) { - geometryText.push(stringify(geometries[i])); - } - return "(" + geometries + ")"; - } - } - - function stringify(value) { - if (!(value && value.type)) { - return ""; - } else { - switch (value.type) { - case "Point": - return pointToString(value); - - case "LineString": - return lineStringToString(value); - - case "Polygon": - return polygonToString(value); - - case "MultiPoint": - return multiPointToString(value); - - case "MultiLineString": - return multiLineStringToString(value); - - case "MultiPolygon": - return multiPolygonToString(value); - - case "GeometryCollection": - return geometryCollectionToString(value); - - default: - return ""; - } - } - } - - function pointParseUntagged(wkt) { - var pointString = wkt.match(/\(\s*([\d\.-]+)\s+([\d\.-]+)\s*\)/); - return pointString && pointString.length >= 2 ? { - type: "Point", - coordinates: [ - parseFloat(pointString[1]), - parseFloat(pointString[2]) - ] - } : null; - } - - function parse(wkt) { - wkt = $.trim(wkt); - - var typeIndex = wkt.indexOf(" "); - - switch (wkt.substr(0, typeIndex).toUpperCase()) { - case "POINT": - return pointParseUntagged(wkt.substr(typeIndex + 1)); - } - } - - return { - stringify: stringify, - - parse: parse - }; - })(), - - // - // projection functions - // - - proj: (function () { - var halfPi = 1.5707963267948966192, - quarterPi = 0.7853981633974483096, - radiansPerDegree = 0.0174532925199432958, - degreesPerRadian = 57.295779513082320877, - semiMajorAxis = 6378137; - - return { - fromGeodeticPos: function (coordinate) { - if (!coordinate) { - debugger; - } - return [ - semiMajorAxis * coordinate[ 0 ] * radiansPerDegree, - semiMajorAxis * Math.log(Math.tan(quarterPi + coordinate[ 1 ] * radiansPerDegree / 2)) - ]; - }, - - fromGeodetic: function (coordinates) { - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - fromGeodeticPos = this.fromGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = fromGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = fromGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ], - i, j, k; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = fromGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - }, - - toGeodeticPos: function (coordinate) { - return [ - (coordinate[ 0 ] / semiMajorAxis) * degreesPerRadian, - (halfPi - 2 * Math.atan(1 / Math.exp(coordinate[ 1 ] / semiMajorAxis))) * degreesPerRadian - ]; - }, - - toGeodetic: function (coordinates) { - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - toGeodeticPos = this.toGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = toGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = toGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ]; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = toGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - } - } - })(), - - // - // service types (defined in other files) - // - - _serviceTypes: {} - } -})(jQuery, this); -(function ($, undefined) { - - var _ieVersion = (function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - while (div.innerHTML = "", a[0]) { } - return v > 6 ? v : !v; - } ()); - - $.widget("geo.geographics", { - _$elem: undefined, - _options: {}, - _trueCanvas: true, - - _width: 0, - _height: 0, - - _$canvas: undefined, - _context: undefined, - - options: { - style: { - borderRadius: "8px", - color: "#7f0000", - //fill: undefined, - fillOpacity: .2, - height: "8px", - opacity: 1, - //stroke: undefined, - strokeOpacity: 1, - strokeWidth: "2px", - visibility: "visible", - width: "8px" - } - }, - - _create: function () { - this._$elem = this.element; - this._options = this.options; - - this._$elem.css({ display: "inline-block", overflow: "hidden", textAlign: "left" }); - - if (this._$elem.css("position") == "static") { - this._$elem.css("position", "relative"); - } - - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width")); - this._height = parseInt(this._$elem.css("height")); - } - - if (document.createElement('canvas').getContext) { - this._$elem.append(''); - this._$canvas = this._$elem.children(':last'); - this._context = this._$canvas[0].getContext("2d"); - } else if (_ieVersion <= 8) { - this._trueCanvas = false; - this._$elem.append('
        '); - this._$canvas = this._$elem.children(':last'); - - G_vmlCanvasManager.initElement(this._$canvas[0]); - this._context = this._$canvas[0].getContext("2d"); - this._$canvas.children().css({ backgroundColor: "transparent", width: this._width, height: this._height }); - } - }, - - _setOption: function (key, value) { - if (key == "style") { - value = $.extend({}, this._options.style, value); - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - destroy: function () { - $.Widget.prototype.destroy.apply(this, arguments); - this._$elem.html(""); - }, - - clear: function () { - this._context.clearRect(0, 0, this._width, this._height); - }, - - drawArc: function (coordinates, startAngle, sweepAngle, style) { - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0 && style.widthValue > 0 && style.heightValue > 0) { - var r = Math.min(style.widthValue, style.heightValue) / 2; - - startAngle = (startAngle * Math.PI / 180); - sweepAngle = (sweepAngle * Math.PI / 180); - - this._context.save(); - this._context.translate(coordinates[0], coordinates[1]); - if (style.widthValue > style.heightValue) { - this._context.scale(style.widthValue / style.heightValue, 1); - } else { - this._context.scale(1, style.heightValue / style.widthValue); - } - - this._context.beginPath(); - this._context.arc(0, 0, r, startAngle, sweepAngle, false); - - if (this._trueCanvas) { - this._context.restore(); - } - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - - if (!this._trueCanvas) { - this._context.restore(); - } - } - }, - - drawPoint: function (coordinates, style) { - var style = this._getGraphicStyle(style); - if (style.widthValue == style.heightValue && style.heightValue == style.borderRadiusValue) { - this.drawArc(coordinates, 0, 360, style); - } else if (style.visibility != "hidden" && style.opacity > 0) { - style.borderRadiusValue = Math.min(Math.min(style.widthValue, style.heightValue) / 2, style.borderRadiusValue); - coordinates[0] -= style.widthValue / 2; - coordinates[1] -= style.heightValue / 2; - this._context.beginPath(); - this._context.moveTo(coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.lineTo(coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1]); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1], coordinates[0] + style.widthValue, coordinates[1] + style.borderRadiusValue); - this._context.lineTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue, coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.lineTo(coordinates[0] + style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1] + style.heightValue, coordinates[0], coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.lineTo(coordinates[0], coordinates[1] + style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1], coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.closePath(); - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - - this._context.stroke(); - } - } - }, - - drawLineString: function (coordinates, style) { - this._drawLines([coordinates], false, style); - }, - - drawPolygon: function (coordinates, style) { - this._drawLines(coordinates, true, style); - }, - - drawBbox: function (bbox, style) { - this._drawLines([[ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ]], true, style); - }, - - _getGraphicStyle: function (style) { - function safeParse(value) { - value = parseInt(value); - return (+value + '') === value ? +value : value; - } - - style = $.extend({}, this._options.style, style); - style.borderRadiusValue = safeParse(style.borderRadius); - style.fill = style.fill || style.color; - style.doFill = style.fill && style.fillOpacity > 0; - style.stroke = style.stroke || style.color; - style.strokeWidthValue = safeParse(style.strokeWidth); - style.doStroke = style.stroke && style.strokeOpacity > 0 && style.strokeWidthValue > 0; - style.widthValue = safeParse(style.width); - style.heightValue = safeParse(style.height); - return style; - }, - - _drawLines: function (coordinates, close, style) { - if (!coordinates || !coordinates.length || coordinates[0].length < 2) { - return; - } - - var style = this._getGraphicStyle(style), - i, j; - - if (style.visibility != "hidden" && style.opacity > 0) { - this._context.beginPath(); - this._context.moveTo(coordinates[0][0][0], coordinates[0][0][1]); - - for (i = 0; i < coordinates.length; i++) { - for (j = 0; j < coordinates[i].length; j++) { - this._context.lineTo(coordinates[i][j][0], coordinates[i][j][1]); - } - } - - if (close) { - this._context.closePath(); - } - - if (close && style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineCap = this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - } - } - }); - - -})(jQuery); - -(function ($, undefined) { - var _ieVersion = (function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - while (div.innerHTML = "", a[0]) { } - return v > 6 ? v : !v; - } ()), - - _defaultOptions = { - bbox: [-180, -85, 180, 85], - bboxMax: [-180, -85, 180, 85], - center: [0, 0], - cursors: { - pan: "move", - zoom: "crosshair", - drawPoint: "crosshair", - drawLineString: "crosshair", - drawPolygon: "crosshair" - }, - drawStyle: {}, - shapeStyle: {}, - mode: "pan", - services: [ - { - "class": "osm", - type: "tiled", - getUrl: function (view) { - return "http://tile.openstreetmap.org/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png"; - }, - attr: "© OpenStreetMap & contributors, CC-BY-SA" - } - ], - tilingScheme: { - tileWidth: 256, - tileHeight: 256, - levels: 18, - basePixelSize: 156543.03392799936, - origin: [-20037508.342787, 20037508.342787] - }, - zoom: 0, - pixelSize: 0 - }; - - $.widget("geo.geomap", { - // private widget members - _$elem: undefined, - _created: false, - - _contentBounds: {}, - - _$contentFrame: undefined, - _$existingChildren: undefined, - _$servicesContainer: undefined, - _$drawContainer: undefined, - _$shapesContainer: undefined, - _$textContainer: undefined, - _$textContent: undefined, - _$eventTarget: undefined, - - _dpi: 96, - - _currentServices: [], //< internal copy - - _center: undefined, - _pixelSize: undefined, - _centerMax: undefined, - _pixelSizeMax: undefined, - - _wheelZoomFactor: 1.18920711500273, - _wheelTimeout: null, - _wheelLevel: 0, - - _zoomFactor: 2, - - _mouseDown: undefined, - _inOp: undefined, - _toolPan: undefined, - _shiftZoom: undefined, - _anchor: undefined, - _current: undefined, - _downDate: undefined, - _moveDate: undefined, - _clickDate: undefined, - _lastMove: undefined, - _lastDrag: undefined, - - _windowHandler: null, - _resizeTimeout: null, - - _panning: undefined, - _velocity: undefined, - _friction: undefined, - - _supportTouch: undefined, - _softDblClick: undefined, - _isTap: undefined, - _isDbltap: undefined, - - _drawTimeout: null, //< used in drawPoint mode so we don't send two shape events on dbltap - _drawPixels: [], //< an array of coordinate arrays for drawing lines & polygons, in pixel coordinates - _drawCoords: [], - - _graphicShapes: [], //< an array of objects containing style object refs & GeoJSON object refs - - _initOptions: {}, - - _options: {}, - - options: $.extend({}, _defaultOptions), - - _createWidget: function (options, element) { - this._$elem = $(element); - - if (this._$elem.is("[data-geo-service]")) { - $.Widget.prototype._createWidget.apply(this, arguments); - return; - } - - this._$elem.attr("data-geo-map", "data-geo-map"); - - this._graphicShapes = []; - - this._initOptions = options || {}; - - this._forcePosition(this._$elem); - - this._$elem.css("text-align", "left"); - - var size = this._findMapSize(); - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left")), - y: parseInt(this._$elem.css("padding-top")), - width: size["width"], - height: size["height"] - }; - - this._createChildren(); - - this._center = this._centerMax = [0, 0]; - - this.options["pixelSize"] = this._pixelSize = this._pixelSizeMax = 156543.03392799936; - - this._mouseDown = - this._inOp = - this._toolPan = - this._shiftZoom = - this._panning = - this._isTap = - this._isDbltap = false; - - this._anchor = - this._current = - this._lastMove = - this._lastDrag = - this._velocity = [0, 0]; - - this._friction = [.8, .8]; - - this._downDate = - this._moveDate = - this._clickDate = 0; - - $.Widget.prototype._createWidget.apply(this, arguments); - }, - - _create: function () { - if (this._$elem.is("[data-geo-service]")) { - return; - } - - this._options = this.options; - - this._supportTouch = "ontouchend" in document; - this._softDblClick = this._supportTouch || _ieVersion == 7; - - var touchStartEvent = this._supportTouch ? "touchstart" : "mousedown", - touchStopEvent = this._supportTouch ? "touchend touchcancel" : "mouseup", - touchMoveEvent = this._supportTouch ? "touchmove" : "mousemove"; - - $(document).keydown($.proxy(this._document_keydown, this)); - - this._$eventTarget.dblclick($.proxy(this._eventTarget_dblclick, this)); - - this._$eventTarget.bind(touchStartEvent, $.proxy(this._eventTarget_touchstart, this)); - - var dragTarget = (this._$eventTarget[0].setCapture) ? this._$eventTarget : $(document); - dragTarget.bind(touchMoveEvent, $.proxy(this._dragTarget_touchmove, this)); - dragTarget.bind(touchStopEvent, $.proxy(this._dragTarget_touchstop, this)); - - this._$eventTarget.mousewheel($.proxy(this._eventTarget_mousewheel, this)); - - var geomap = this; - this._windowHandler = function () { - if (geomap._resizeTimeout) { - clearTimeout(geomap._resizeTimeout); - } - this._resizeTimeout = setTimeout(function () { - if (geomap._created) { - geomap._$elem.geomap("resize"); - } - }, 500); - }; - - $(window).resize(this._windowHandler); - - this._$drawContainer.geographics({ style: this._initOptions.drawStyle || {} }); - this._options["drawStyle"] = this._$drawContainer.geographics("option", "style"); - - this._$shapesContainer.geographics( { style: this._initOptions.shapeStyle || { } } ); - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - - if (this._initOptions) { - if (this._initOptions.bbox) { - this._setOption("bbox", this._initOptions.bbox, false); - } - if (this._initOptions.center) { - this._setOption("center", this._initOptions.center, false); - } - if (this._initOptions.zoom) { - this._setZoom(this._initOptions.zoom, false, false); - } - } - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._createServices(); - - this._refresh(); - - this._created = true; - }, - - _setOption: function (key, value, refresh) { - if ( this._$elem.is( "[data-geo-service]" ) || key == "pixelSize" ) { - return; - } - - refresh = (refresh === undefined || refresh); - - switch (key) { - case "bbox": - if ($.geo.proj) { - value = $.geo.proj.fromGeodetic([[value[0], value[1]], [value[2], value[3]]]); - value = [value[0][0], value[0][1], value[1][0], value[1][1]]; - } - - this._setBbox(value, false, refresh); - value = this._getBbox(); - - if ($.geo.proj) { - value = $.geo.proj.toGeodetic([[value[0], value[1]], [value[2], value[3]]]); - value = [value[0][0], value[0][1], value[1][0], value[1][1]]; - } - break; - - case "center": - this._setCenterAndSize($.geo.proj ? $.geo.proj.fromGeodetic([[value[0], value[1]]])[0] : value, this._pixelSize, false, refresh); - break; - - case "drawStyle": - if (this._$drawContainer) { - this._$drawContainer.geographics("option", "style", value); - value = this._$drawContainer.geographics("option", "style"); - } - break; - - case "shapeStyle": - if (this._$shapesContainer) { - this._$shapesContainer.geographics("option", "style", value); - value = this._$shapesContainer.geographics("option", "style"); - } - break; - - case "mode": - this._$drawContainer.geographics("clear"); - this._$eventTarget.css("cursor", this._options["cursors"][value]); - break; - - case "zoom": - this._setZoom(value, false, refresh); - break; - } - - $.Widget.prototype._setOption.apply(this, arguments); - - switch (key) { - case "services": - this._createServices(); - if (refresh) { - this._refresh(); - } - break; - - case "shapeStyle": - if ( refresh ) { - this._$shapesContainer.geographics("clear"); - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes ); - } - break; - } - }, - - destroy: function () { - if (this._$elem.is("[data-geo-map]")) { - this._created = false; - - $(window).unbind("resize", this._windowHandler); - - for ( var i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[i].serviceContainer.geomap("destroy"); - $.geo["_serviceTypes"][this._currentServices[i].type].destroy(this, this._$servicesContainer, this._currentServices[i]); - } - - this._$shapesContainer.geographics("destroy"); - this._$drawContainer.geographics("destroy"); - - this._$existingChildren.detach(); - this._$elem.html(""); - this._$elem.append(this._$existingChildren); - this._$elem.removeAttr("data-geo-map"); - } - $.Widget.prototype.destroy.apply(this, arguments); - }, - - toMap: function (p) { - p = this._toMap(p); - return $.geo.proj ? $.geo.proj.toGeodetic(p) : p; - }, - - toPixel: function ( p, _center /* Internal Use Only */, _pixelSize /* Internal Use Only */ ) { - p = $.geo.proj ? $.geo.proj.fromGeodetic(p) : p; - return this._toPixel(p, _center, _pixelSize); - }, - - opacity: function (value, _serviceContainer) { - if (this._$elem.is("[data-geo-service]")) { - this._$elem.closest("[data-geo-map]").geomap("opacity", value, this._$elem); - } else { - if (value >= 0 || value <= 1) { - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[i]; - if ( !_serviceContainer || service.serviceContainer[0] == _serviceContainer[0] ) { - this._options["services"][i].opacity = service.opacity = value; - $.geo["_serviceTypes"][service.type].opacity(this, service); - } - } - } - } - }, - - toggle: function (value, _serviceContainer) { - if (this._$elem.is("[data-geo-service]")) { - this._$elem.closest("[data-geo-map]").geomap("toggle", value, this._$elem); - } else { - for (var i = 0; i < this._currentServices.length; i++) { - var service = this._currentServices[i]; - if (!_serviceContainer || service.serviceContainer[0] == _serviceContainer[0]) { - if (value === undefined) { - value = (service.visibility === undefined || service.visibility === "visible" ? false : true); - } - - this._options["services"][i].visibility = service.visibility = ( value ? "visible" : "hidden" ); - $.geo["_serviceTypes"][service.type].toggle(this, service); - - if (value) { - $.geo["_serviceTypes"][service.type].refresh(this, service); - } - } - } - } - }, - - zoom: function (numberOfLevels) { - if (numberOfLevels != null) { - this._setZoom(this._options["zoom"] + numberOfLevels, false, true); - } - }, - - refresh: function () { - this._refresh(); - }, - - resize: function () { - var size = this._findMapSize(), - dx = size["width"]/2 - this._contentBounds.width/2, - dy = size["height"]/2 - this._contentBounds.height/2, - i; - - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left")), - y: parseInt(this._$elem.css("padding-top")), - width: size["width"], - height: size["height"] - }; - - this._$contentFrame.css({ - width: size["width"], - height: size["height"] - }); - - this._$servicesContainer.css({ - width: size["width"], - height: size["height"] - }); - - this._$eventTarget.css({ - width: size["width"], - height: size["height"] - }); - - var shapeStyle = this._$shapesContainer.geographics("option", "style"); - - this._$shapesContainer.geographics("destroy"); - this._$drawContainer.geographics("destroy"); - - for (i = 0; i < this._currentServices.length; i++) { - $.geo["_serviceTypes"][this._currentServices[i].type].resize(this, this._currentServices[i]); - } - - - this._$drawContainer.css({ - width: size.width, - height: size.height - }); - this._$drawContainer.geographics(); - - this._$shapesContainer.css({ - width: size.width, - height: size.height - }); - this._$shapesContainer.geographics( { style: shapeStyle } ); - - for (i = 0; i < this._drawPixels.length; i++) { - this._drawPixels[i][0] += dx; - this._drawPixels[i][1] += dy; - } - - this._setCenterAndSize(this._center, this._pixelSize, false, true); - }, - - append: function ( shape, style, refresh ) { - if ( shape ) { - var shapes, i = 0; - if ( shape.type == "FeatureCollection" ) { - shapes = shape.features; - } else { - shapes = $.isArray( shape ) ? shape : [ shape ]; - } - - if ( typeof style === "boolean" ) { - refresh = style; - style = null; - } - - for ( ; i < shapes.length; i++ ) { - if ( shapes[ i ].type != "Point" ) { - var bbox = $.geo.bbox( shapes[ i ] ); - if ( $.geo.proj ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - $.data( shapes[ i ], "geoBbox", bbox ); - } - - this._graphicShapes.push( { - shape: shapes[ i ], - style: style - } ); - } - - if ( refresh === undefined || refresh ) { - this._refresh( ); - } - } - }, - - empty: function ( refresh ) { - $.each( this._graphicShapes, function( ) { - $.removeData( this, "geoBbox" ); - } ); - this._graphicShapes = []; - if ( refresh === undefined || refresh ) { - this._refresh(); - } - }, - - find: function (point, pixelTolerance) { - var searchPixel = this.toPixel( point.coordinates ), - mapTol = this._pixelSize * pixelTolerance, - result = [], - curGeom; - - $.each( this._graphicShapes, function ( i ) { - if ( this.shape.type == "Point" ) { - if ( $.geo.distance(this.shape, point) <= mapTol ) { - result.push( this.shape ); - } - } else { - var bbox = $.data( this.shape, "geoBbox" ), - bboxPolygon = { - type: "Polygon", - coordinates: [ [ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ] ] - }, - projectedPoint = { - type: "Point", - coordinates: $.geo.proj ? $.geo.proj.fromGeodetic( point.coordinates ) : point.coordinates - }; - - if ( $.geo.distance( bboxPolygon, projectedPoint, true ) <= mapTol ) { - var geometries = $.geo._flatten( this.shape ); - for ( curGeom = 0; curGeom < geometries.length; curGeom++ ) { - if ( $.geo.distance( geometries[curGeom], point ) <= mapTol ) { - result.push( this.shape ); - break; - } - } - } - } - }); - - return result; - }, - - remove: function ( shape, refresh ) { - var geomap = this; - $.each( this._graphicShapes, function ( i ) { - if ( this.shape == shape ) { - $.removeData( shape, "geoBbox" ); - var rest = geomap._graphicShapes.slice( i + 1 ); - geomap._graphicShapes.length = i; - geomap._graphicShapes.push.apply(geomap._graphicShapes, rest); - return false; - } - }); - - if ( refresh === undefined || refresh ) { - this._refresh(); - } - }, - - _getBbox: function (center, pixelSize) { - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - // calculate the internal bbox - var halfWidth = this._contentBounds["width"] / 2 * pixelSize, - halfHeight = this._contentBounds["height"] / 2 * pixelSize; - return [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight]; - }, - - _setBbox: function (value, trigger, refresh) { - var center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2], - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height); - - if (this._options["tilingScheme"]) { - var zoom = this._getTiledZoom(pixelSize); - pixelSize = this._getTiledPixelSize(zoom); - } - this._setCenterAndSize(center, pixelSize, trigger, refresh); - }, - - _getBboxMax: function () { - // calculate the internal bboxMax - var halfWidth = this._contentBounds["width"] / 2 * this._pixelSizeMax, - halfHeight = this._contentBounds["height"] / 2 * this._pixelSizeMax; - return [this._centerMax[0] - halfWidth, this._centerMax[1] - halfHeight, this._centerMax[0] + halfWidth, this._centerMax[1] + halfHeight]; - }, - - _getCenter: function () { - return this._center; - }, - - _getContentBounds: function () { - return this._contentBounds; - }, - - _getServicesContainer: function () { - return this._$servicesContainer; - }, - - _getZoom: function () { - // calculate the internal zoom level, vs. public zoom property - if (this._options["tilingScheme"]) { - return this._getTiledZoom(this._pixelSize); - } else { - var ratio = this._contentBounds["width"] / this._contentBounds["height"], - bbox = $.geo.reaspect(this._getBbox(), ratio, true), - bboxMax = $.geo.reaspect(this._getBboxMax(), ratio, true); - - return Math.log($.geo.width(bboxMax, true) / $.geo.width(bbox, true)) / Math.log(this._zoomFactor); - } - }, - - _setZoom: function (value, trigger, refresh) { - value = Math.max(value, 0); - - if (this._options["tilingScheme"]) { - this._setCenterAndSize(this._center, this._getTiledPixelSize(value), trigger, refresh); - } else { - var bbox = $.geo.scaleBy(this._getBboxMax(), 1 / Math.pow(this._zoomFactor, value), true), - pixelSize = Math.max($.geo.width(bbox, true) / this._contentBounds.width, $.geo.height(bbox, true) / this._contentBounds.height); - this._setCenterAndSize(this._center, pixelSize, trigger, refresh); - } - }, - - _createChildren: function () { - this._$existingChildren = this._$elem.children().detach(); - - this._forcePosition(this._$existingChildren); - - this._$existingChildren.css("-moz-user-select", "none"); - - this._$elem.prepend("
        "); - this._$eventTarget = this._$contentFrame = this._$elem.children(':first'); - - this._$contentFrame.append('
        '); - this._$servicesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
        '); - this._$shapesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
        '); - this._$drawContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append(''); - this._$textContainer = this._$contentFrame.children(':last'); - this._$textContent = this._$textContainer.children(); - - this._$contentFrame.append(this._$existingChildren); - }, - - _createServices: function () { - var i; - - for (i = 0; i < this._currentServices.length; i++) { - this._currentServices[i].serviceContainer.geomap("destroy"); - $.geo["_serviceTypes"][this._currentServices[i].type].destroy(this, this._$servicesContainer, this._currentServices[i]); - } - - this._currentServices = []; - for (i = 0; i < this._options["services"].length; i++) { - this._currentServices[i] = this._options["services"][i]; - this._currentServices[i].serviceContainer = $.geo["_serviceTypes"][this._currentServices[i].type].create(this, this._$servicesContainer, this._currentServices[i], i).geomap(); - } - }, - - _refreshDrawing: function () { - this._$drawContainer.geographics("clear"); - - if ( this._drawPixels.length > 0 ) { - var mode = this._options[ "mode" ], - coords = this._drawPixels; - - if ( mode == "drawPolygon" ) { - coords = [ coords ]; - } - - this._$drawContainer.geographics( mode, coords ); - } - }, - - _resetDrawing: function () { - //this._$textContainer.hide(); - this._drawPixels = []; - this._drawCoords = []; - this._$drawContainer.geographics("clear"); - }, - - _refreshShapes: function (geographics, shapes, styles, center, pixelSize) { - var i, - mgi, - shape, - shapeBbox, - style, - pixelPositions, - bbox = this._getBbox(center, pixelSize), - geomap = this; - - for (i = 0; i < shapes.length; i++) { - shape = shapes[i].shape || shapes[i]; - shape = shape.geometry || shape; - shapeBbox = $.data(shape, "geoBbox"); - - if ( shapeBbox && $.geo._bboxDisjoint( bbox, shapeBbox ) ) { - continue; - } - - style = $.isArray(styles) ? styles[i].style : styles; - - switch (shape.type) { - case "Point": - this._$shapesContainer.geographics("drawPoint", this.toPixel(shape.coordinates, center, pixelSize), style); - break; - case "LineString": - this._$shapesContainer.geographics("drawLineString", this.toPixel(shape.coordinates, center, pixelSize), style); - break; - case "Polygon": - pixelPositions = []; - $.each(shape.coordinates, function (i) { - pixelPositions[i] = geomap.toPixel(this, center, pixelSize); - }); - this._$shapesContainer.geographics("drawPolygon", pixelPositions, style); - break; - case "MultiPoint": - for (mgi = 0; mgi < shape.coordinates; mgi++) { - this._$shapesContainer.geographics("drawPoint", this.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - break; - case "MultiLineString": - for (mgi = 0; mgi < shape.coordinates; mgi++) { - this._$shapesContainer.geographics("drawLineString", this.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - break; - case "MultiPolygon": - for (mgi = 0; mgi < shape.coordinates; mgi++) { - pixelPositions = []; - $.each(shape.coordinates[mgi], function (i) { - pixelPositions[i] = geomap.toPixel(this, center, pixelSize); - }); - this._$shapesContainer.geographics("drawPolygon", pixelPositions, style); - } - break; - - case "GeometryCollection": - geomap._refreshShapes(geographics, shape.geometries, style, center, pixelSize); - break; - } - } - }, - - _findMapSize: function () { - // really, really attempt to find a size for this thing - // even if it's hidden (look at parents) - var size = { width: 0, height: 0 }, - sizeContainer = this._$elem; - - while (sizeContainer.size() && !(size["width"] > 0 && size["height"] > 0)) { - size = { width: sizeContainer.width(), height: sizeContainer.height() }; - if (size["width"] <= 0 || size["height"] <= 0) { - size = { width: parseInt(sizeContainer.css("width")), height: parseInt(sizeContainer.css("height")) }; - } - sizeContainer = sizeContainer.parent(); - } - return size; - }, - - _forcePosition: function (elem) { - var cssPosition = elem.css("position"); - if (cssPosition != "relative" && cssPosition != "absolute" && cssPosition != "fixed") { - elem.css("position", "relative"); - } - }, - - _getTiledPixelSize: function (zoom) { - var tilingScheme = this._options["tilingScheme"]; - if (tilingScheme != null) { - if (zoom === 0) { - return tilingScheme.pixelSizes != null ? tilingScheme.pixelSizes[0] : tilingScheme.basePixelSize; - } - - zoom = Math.round(zoom); - zoom = Math.max(zoom, 0); - var levels = tilingScheme.pixelSizes != null ? tilingScheme.pixelSizes.length : tilingScheme.levels; - zoom = Math.min(zoom, levels - 1); - - if (tilingScheme.pixelSizes != null) { - return tilingScheme.pixelSizes[zoom]; - } else { - return tilingScheme.basePixelSize / Math.pow(2, zoom); - } - } else { - return NaN; - } - }, - - _getTiledZoom: function (pixelSize) { - var tilingScheme = this._options["tilingScheme"]; - if (tilingScheme.pixelSizes != null) { - var roundedPixelSize = Math.floor(pixelSize * 1000), - levels = tilingScheme.pixelSizes != null ? tilingScheme.pixelSizes.length : tilingScheme.levels; - for (var i = levels - 1; i >= 0; i--) { - if (Math.floor(tilingScheme.pixelSizes[i] * 1000) >= roundedPixelSize) { - return i; - } - } - return 0; - } else { - return Math.max(Math.round(Math.log(tilingScheme.basePixelSize / pixelSize) / Math.log(2)), 0); - } - }, - - _getZoomCenterAndSize: function (anchor, zoomDelta, zoomFactor) { - var pixelSize, zoomLevel, scale; - if (this._options["tilingScheme"]) { - zoomLevel = this._getTiledZoom(this._pixelSize) + zoomDelta; - pixelSize = this._getTiledPixelSize(zoomLevel); - } else { - scale = Math.pow(zoomFactor, -zoomDelta); - pixelSize = this._pixelSize * scale; - } - - var - ratio = pixelSize / this._pixelSize, - anchorMapCoord = this._toMap(anchor), - centerDelta = [(this._center[0] - anchorMapCoord[0]) * ratio, (this._center[1] - anchorMapCoord[1]) * ratio], - scaleCenter = [anchorMapCoord[0] + centerDelta[0], anchorMapCoord[1] + centerDelta[1]]; - - return { pixelSize: pixelSize, center: scaleCenter }; - }, - - _mouseWheelFinish: function () { - this._wheelTimeout = null; - - if (this._wheelLevel != 0) { - var wheelCenterAndSize = this._getZoomCenterAndSize(this._anchor, this._wheelLevel, this._wheelZoomFactor); - - this._setCenterAndSize(wheelCenterAndSize.center, wheelCenterAndSize.pixelSize, true, true); - - this._wheelLevel = 0; - } else { - this._refresh(); - } - }, - - _panEnd: function () { - this._velocity = [ - (this._velocity[0] > 0 ? Math.floor(this._velocity[0] * this._friction[0]) : Math.ceil(this._velocity[0] * this._friction[0])), - (this._velocity[1] > 0 ? Math.floor(this._velocity[1] * this._friction[1]) : Math.ceil(this._velocity[1] * this._friction[1])) - ]; - - if (Math.abs(this._velocity[0]) < 4 && Math.abs(this._velocity[1]) < 4) { - this._panFinalize(); - } else { - this._current = [ - this._current[0] + this._velocity[0], - this._current[1] + this._velocity[1] - ]; - - this._panMove(); - setTimeout($.proxy(this._panEnd, this), 30); - } - }, - - _panFinalize: function () { - if (this._panning) { - this._velocity = [0, 0]; - - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - dxMap = -dx * this._pixelSize, - dyMap = dy * this._pixelSize; - - this._$shapesContainer.css({ left: 0, top: 0 }); - - this._setCenterAndSize([this._center[0] + dxMap, this._center[1] + dyMap], this._pixelSize, true, true); - - this._inOp = false; - this._anchor = this._current; - this._toolPan = this._panning = false; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - } - }, - - _panMove: function () { - var dx = this._current[0] - this._lastDrag[0], - dy = this._current[1] - this._lastDrag[1], - i = 0, - service; - - if (this._toolPan || dx > 3 || dx < -3 || dy > 3 || dy < -3) { - if (!this._toolPan) { - this._toolPan = true; - this._$eventTarget.css("cursor", this._options["cursors"]["pan"]); - } - - if (this._mouseDown) { - this._velocity = [dx, dy]; - } - - if (dx != 0 || dy != 0) { - this._panning = true; - this._lastDrag = this._current; - - for (i = 0; i < this._options["services"].length; i++) { - service = this._options["services"][i]; - $.geo["_serviceTypes"][service.type].interactivePan(this, service, dx, dy); - } - - this._$shapesContainer.css({ - left: function (index, value) { - return parseInt(value) + dx; - }, - top: function (index, value) { - return parseInt(value) + dy; - } - }); - - for (i = 0; i < this._drawPixels.length; i++) { - this._drawPixels[i][0] += dx; - this._drawPixels[i][1] += dy; - } - - this._refreshDrawing(); - } - } - }, - - _refresh: function () { - for (var i = 0; i < this._options["services"].length; i++) { - var service = this._options["services"][i]; - if (!this._mouseDown && $.geo["_serviceTypes"][service.type] != null) { - $.geo["_serviceTypes"][service.type].refresh(this, service); - } - } - - if (this._$shapesContainer) { - this._$shapesContainer.geographics("clear"); - if (this._graphicShapes.length > 0) { - this._refreshShapes(this._$shapesContainer, this._graphicShapes, this._graphicShapes); - } - } - }, - - _setCenterAndSize: function (center, pixelSize, trigger, refresh) { - // the final call during any extent change - if (this._pixelSize != pixelSize) { - this._$shapesContainer.geographics("clear"); - for (var i = 0; i < this._options["services"].length; i++) { - var service = this._options["services"][i]; - $.geo["_serviceTypes"][service.type].interactiveScale(this, service, center, pixelSize); - } - } - - this._center = center; - this.options["pixelSize"] = this._pixelSize = pixelSize; - - if ($.geo.proj) { - var bbox = this._getBbox(); - bbox = $.geo.proj.toGeodetic([[bbox[0], bbox[1]], [bbox[2], bbox[3]]]); - bbox = [bbox[0][0], bbox[0][1], bbox[1][0], bbox[1][1]]; - this._options["bbox"] = bbox; - - this._options["center"] = $.geo.proj.toGeodetic([[this._center[0], this._center[1]]])[0]; - } else { - this._options["bbox"] = this._getBbox(); - - this._options["center"] = this._center; - } - - this._options["zoom"] = this._getZoom(); - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel(this._drawCoords); - } - - if (trigger) { - this._trigger("bboxchange", window.event, { bbox: this._options["bbox"] }); - } - - if (refresh) { - this._refresh(); - this._refreshDrawing(); - } - }, - - _toMap: function (p, center, pixelSize) { - // ignores $.geo.proj - var isArray = $.isArray(p[0]); - if (!isArray) { - p = [p]; - } - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - xRatio = $.geo.width(bbox, true) / width, - yRatio = $.geo.height(bbox, true) / height, - result = []; - - $.each(p, function (i) { - var yOffset = (this[1] * yRatio); - result[i] = [bbox[0] + (this[0] * xRatio), bbox[3] - yOffset]; - }); - - return isArray ? result : result[0]; - }, - - _toPixel: function (p, center, pixelSize) { - // ignores $.geo.proj - var isArray = $.isArray(p[0]); - if (!isArray) { - p = [p]; - } - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - bboxWidth = $.geo.width(bbox, true), - bboxHeight = $.geo.height(bbox, true), - result = []; - - $.each(p, function (i) { - result[i] = [ - Math.round((this[0] - bbox[0]) * width / bboxWidth), - Math.round((bbox[3] - this[1]) * height / bboxHeight) - ]; - }); - - return isArray ? result : result[0]; - }, - - _zoomTo: function (coord, zoom, trigger, refresh) { - zoom = zoom < 0 ? 0 : zoom; - - var tiledPixelSize = this._getTiledPixelSize(zoom); - - if (!isNaN(tiledPixelSize)) { - this._setCenterAndSize(coord, tiledPixelSize, trigger, refresh); - } else { - var bboxMax = $.geo._scaleBy(this._getBboxMax(), 1 / Math.pow(this._zoomFactor, zoom), true), - pixelSize = Math.max($.geo.width(bboxMax, true) / this._contentBounds["width"], $.geo.height(bboxMax, true) / this._contentBounds["height"]); - - this._setCenterAndSize(coord, pixelSize, trigger, refresh); - } - }, - - _document_keydown: function (e) { - var len = this._drawCoords.length; - if (len > 0 && e.which == 27) { - if (len <= 2) { - this._resetDrawing(); - this._inOp = false; - } else { - this._drawCoords[len - 2] = $.merge( [], this._drawCoords[ len - 1 ] ); - this._drawPixels[len - 2] = $.merge( [], this._drawPixels[ len - 1 ] ); - - this._drawCoords.length--; - this._drawPixels.length--; - - this._refreshDrawing(); - } - } - }, - - _eventTarget_dblclick_zoom: function(e) { - this._trigger("dblclick", e, { type: "Point", coordinates: this.toMap(this._current) }); - if (!e.isDefaultPrevented()) { - var centerAndSize = this._getZoomCenterAndSize(this._current, 1, this._zoomFactor); - this._setCenterAndSize(centerAndSize.center, centerAndSize.pixelSize, true, true); - } - }, - - _eventTarget_dblclick: function (e) { - this._panFinalize(); - - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - var offset = $(e.currentTarget).offset(); - - switch (this._options["mode"]) { - case "pan": - case "drawPoint": - this._eventTarget_dblclick_zoom(e); - break; - - case "drawLineString": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - this._drawCoords.length--; - this._trigger( "shape", e, { - type: "LineString", - coordinates: $.geo.proj ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords - } ); - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - case "drawPolygon": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - var endIndex = this._drawCoords.length - 1; - if (endIndex > 2) { - this._drawCoords[endIndex] = $.merge( [], this._drawCoords[0] ); - this._trigger( "shape", e, { - type: "Polygon", - coordinates: [ $.geo.proj ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords ] - } ); - } - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - } - - this._inOp = false; - }, - - _eventTarget_touchstart: function (e) { - if (!this._supportTouch && e.which != 1) { - return; - } - - this._panFinalize(); - this._mouseWheelFinish(); - - var offset = $(e.currentTarget).offset(); - - if (this._supportTouch) { - this._current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } else { - this._current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - var downDate = $.now(); - if (downDate - this._downDate < 750) { - if (this._isTap) { - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - distance = Math.sqrt((dx * dx) + (dy * dy)); - if (distance > 10) { - this._isTap = false; - } else { - this._current = this._anchor; - } - } - - if (this._isDbltap) { - this._isDbltap = false; - } else { - this._isDbltap = this._isTap; - } - } else { - this._isDbltap = false; - } - this._isTap = true; - this._downDate = downDate; - } - - - this._mouseDown = true; - this._anchor = this._current; - - if (!this._inOp && e.shiftKey) { - this._shiftZoom = true; - this._$eventTarget.css("cursor", this._options["cursors"]["zoom"]); - } else { - this._inOp = true; - - switch (this._options["mode"]) { - case "pan": - case "drawPoint": - case "drawLineString": - case "drawPolygon": - this._lastDrag = this._current; - - if (e.currentTarget.setCapture) { - e.currentTarget.setCapture(); - } - - break; - } - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _dragTarget_touchmove: function (e) { - var offset = this._$eventTarget.offset(), - drawCoordsLen = this._drawCoords.length, - current; - - if (this._supportTouch) { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (current[0] === this._lastMove[0] && current[1] === this._lastMove[1]) { - if ( this._inOp ) { - e.preventDefault(); - return false; - } - } - - if (this._softDblClick) { - this._isDbltap = this._isTap = false; - } - - if (this._mouseDown) { - this._current = current; - this._moveDate = $.now(); - } - - var mode = this._shiftZoom ? "zoom" : this._options["mode"]; - - switch (mode) { - case "zoom": - if ( this._mouseDown ) { - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawBbox", [ - this._anchor[ 0 ], - this._anchor[ 1 ], - current[ 0 ], - current[ 1 ] - ] ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "pan": - case "drawPoint": - if (this._mouseDown || this._toolPan) { - this._panMove(); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "drawLineString": - case "drawPolygon": - if (this._mouseDown || this._toolPan) { - this._panMove(); - } else { - if (drawCoordsLen > 0) { - this._drawCoords[drawCoordsLen - 1] = this._toMap(current); - this._drawPixels[drawCoordsLen - 1] = current; - - this._refreshDrawing(); - } - - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - } - - this._lastMove = current; - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _dragTarget_touchstop: function (e) { - if (!this._mouseDown && _ieVersion == 7) { - // ie7 doesn't appear to trigger dblclick on this._$eventTarget, - // we fake regular click here to cause soft dblclick - this._eventTarget_touchstart(e); - } - - var mouseWasDown = this._mouseDown, - wasToolPan = this._toolPan, - offset = this._$eventTarget.offset(), - mode = this._shiftZoom ? "zoom" : this._options["mode"], - current, i, clickDate, - dx, dy; - - if (this._supportTouch) { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._shiftZoom = this._mouseDown = this._toolPan = false; - - if (document.releaseCapture) { - document.releaseCapture(); - } - - if (mouseWasDown) { - clickDate = $.now(); - this._current = current; - - switch (mode) { - case "zoom": - if ( dx > 0 || dy > 0 ) { - var minSize = this._pixelSize * 6, - bboxCoords = this._toMap( [ [ - Math.min( this._anchor[ 0 ], current[ 0 ] ), - Math.max( this._anchor[ 1 ], current[ 1 ] ) - ], [ - Math.max( this._anchor[ 0 ], current[ 0 ] ), - Math.min( this._anchor[ 1 ], current[ 1 ] ) - ] - ] ), - bbox = [ - bboxCoords[0][0], - bboxCoords[0][1], - bboxCoords[1][0], - bboxCoords[1][1] - ]; - - if ( ( bbox[2] - bbox[0] ) < minSize && ( bbox[3] - bbox[1] ) < minSize ) { - bbox = $.geo.scaleBy( this._getBbox( $.geo.center( bbox, true ) ), .5, true ); - } - - this._setBbox(bbox, true, true); - } - - this._resetDrawing(); - break; - - case "pan": - if (wasToolPan) { - this._panEnd(); - } else { - if (clickDate - this._clickDate > 100) { - this._trigger("click", e, { type: "Point", coordinates: this.toMap(current) }); - this._inOp = false; - } - } - break; - - case "drawPoint": - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - var geomap = this; - this._drawTimeout = setTimeout(function () { - if (geomap._drawTimeout) { - geomap._trigger("shape", e, { type: "Point", coordinates: geomap.toMap(current) }); - geomap._inOp = false; - geomap._drawTimeout = false; - } - }, 250); - } - } - break; - - case "drawLineString": - case "drawPolygon": - if (wasToolPan) { - this._panFinalize(); - } else { - i = (this._drawCoords.length == 0 ? 0 : this._drawCoords.length - 1); - - this._drawCoords[i] = this._toMap(current); - this._drawPixels[i] = current; - - if (i < 2 || !(this._drawCoords[i][0] == this._drawCoords[i-1][0] && - this._drawCoords[i][1] == this._drawCoords[i-1][1])) { - this._drawCoords[i + 1] = this._toMap(current); - this._drawPixels[i + 1] = current; - } - - this._refreshDrawing(); - } - break; - } - - this._clickDate = clickDate; - - if (this._softDblClick && this._isDbltap) { - this._isDbltap = this._isTap = false; - this._$eventTarget.trigger("dblclick", e); - } - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _eventTarget_mousewheel: function (e, delta) { - e.preventDefault(); - - this._panFinalize(); - - if (this._mouseDown) { - return false; - } - - if (delta != 0) { - if (this._wheelTimeout) { - window.clearTimeout(this._wheelTimeout); - this._wheelTimeout = null; - } else { - var offset = $(e.currentTarget).offset(); - this._anchor = [e.pageX - offset.left, e.pageY - offset.top]; - } - - this._wheelLevel += delta; - - var wheelCenterAndSize = this._getZoomCenterAndSize(this._anchor, this._wheelLevel, this._wheelZoomFactor); - - this._$shapesContainer.geographics("clear"); - - for (i = 0; i < this._options["services"].length; i++) { - var service = this._options["services"][i]; - $.geo["_serviceTypes"][service.type].interactiveScale(this, service, wheelCenterAndSize.center, wheelCenterAndSize.pixelSize); - } - - this._$shapesContainer.geographics("clear"); - if (this._graphicShapes.length > 0 && this._graphicShapes.length < 256) { - this._refreshShapes(this._$shapesContainer, this._graphicShapes, this._graphicShapes, wheelCenterAndSize.center, wheelCenterAndSize.pixelSize); - } - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel(this._drawCoords, wheelCenterAndSize.center, wheelCenterAndSize.pixelSize); - this._refreshDrawing(); - } - - var geomap = this; - this._wheelTimeout = window.setTimeout(function () { - geomap._mouseWheelFinish(); - }, 1000); - } - - return false; - } - } - ); -})(jQuery); - -(function ($, undefined) { - $.geo._serviceTypes.tiled = (function () { - return { - create: function (map, servicesContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0, - reloadTiles: false - }; - - var idString = service.id ? ' id="' + service.id + '"' : "", - classString = service["class"] ? ' class="' + service["class"] + '"' : "", - scHtml = '
        '; - - servicesContainer.append(scHtml); - - serviceState.serviceContainer = servicesContainer.children(":last"); - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, servicesContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactivePan: function ( map, service, dx, dy ) { - var serviceState = $.data( service, "geoServiceState" ); - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).css( { - left: function ( index, value ) { - return parseInt( value ) + dx; - }, - top: function ( index, value ) { - return parseInt( value ) + dy; - } - }); - - if ( service && ( service.visibility === undefined || service.visibility === "visible" ) ) { - var pixelSize = map._pixelSize, - - serviceContainer = serviceState.serviceContainer, - scaleContainer = serviceContainer.children("[data-pixelSize='" + pixelSize + "']"), - - /* same as refresh 1 */ - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - /* end same as refresh 1 */ - - halfWidth = mapWidth / 2 * pixelSize, - halfHeight = mapHeight / 2 * pixelSize, - - currentPosition = scaleContainer.position(), - scaleOriginParts = scaleContainer.data("scaleOrigin").split(","), - totalDx = parseInt(scaleOriginParts[0]) - currentPosition.left, - totalDy = parseInt(scaleOriginParts[1]) - currentPosition.top, - - mapCenterOriginal = map._getCenter(), - mapCenter = [mapCenterOriginal[0] + totalDx * pixelSize, mapCenterOriginal[1] - totalDy * pixelSize], - - /* same as refresh 2 */ - tileX = Math.floor(((mapCenter[0] - halfWidth) - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.floor((tilingScheme.origin[1] - (mapCenter[1] + halfHeight)) / (pixelSize * tileHeight)), - tileX2 = Math.ceil(((mapCenter[0] + halfWidth) - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil((tilingScheme.origin[1] - (mapCenter[1] - halfHeight)) / (pixelSize * tileHeight)), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getTiledPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] - bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMaxY = tilingScheme.origin[1] - (fullYAtScale * tileHeight) * pixelSize, - /* end same as refresh 2 */ - - serviceLeft = Math.round((fullXMinX - (mapCenterOriginal[0] - halfWidth)) / pixelSize), - serviceTop = Math.round(((mapCenterOriginal[1] + halfHeight) - fullYMaxY) / pixelSize), - - opacity = (service.opacity === undefined ? 1 : service.opacity), - - x, y; - - for ( x = tileX; x < tileX2; x++ ) { - for ( y = tileY; y < tileY2; y++ ) { - var tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ( $img.size( ) === 0 ) { - /* same as refresh 3 */ - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] - (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] - ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - imageUrl = service.getUrl( { - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - } ); - /* end same as refresh 3 */ - - serviceState.loadCount++; - //this._map._requestQueued(); - - if ( serviceState.reloadTiles && $img.size() > 0 ) { - $img.attr( "src", imageUrl ); - } else { - /* same as refresh 4 */ - var imgMarkup = ""; - - scaleContainer.append( imgMarkup ); - $img = scaleContainer.children(":last"); - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", imageUrl); - /* end same as refresh 4 */ - } - } - } - } - } - } - }, - - interactiveScale: function (map, service, center, pixelSize) { - var serviceState = $.data( service, "geoServiceState" ); - - if ( serviceState && service && ( service.visibility === undefined || service.visibility === "visible" ) ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight; - - - serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scaleRatio = $scaleContainer.attr("data-pixelSize") / pixelSize; - - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var scaleOriginParts = $scaleContainer.data("scaleOrigin").split(","), - oldMapCoord = map._toMap([scaleOriginParts[0], scaleOriginParts[1]]), - newPixelPoint = map._toPixel(oldMapCoord, center, pixelSize); - - $scaleContainer.css( { - left: Math.round(newPixelPoint[0]) + "px", - top: Math.round(newPixelPoint[1]) + "px", - width: tileWidth * scaleRatio, - height: tileHeight * scaleRatio - } ); - - if ( $("body")[0].filters !== undefined ) { - $scaleContainer.children().each( function ( i ) { - $( this ).css( "filter", "progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11=" + scaleRatio + ",M22=" + scaleRatio + ",sizingmethod='auto expand')" ); - } ); - } - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - if ( serviceState && service && ( service.visibility === undefined || service.visibility === "visible" ) ) { - this._cancelUnloaded(map, service); - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - $serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - - tileX = Math.floor((bbox[0] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.floor((tilingScheme.origin[1] - bbox[3]) / (pixelSize * tileHeight)), - tileX2 = Math.ceil((bbox[2] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil((tilingScheme.origin[1] - bbox[1]) / (pixelSize * tileHeight)), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getTiledPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] - bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMaxY = tilingScheme.origin[1] - (fullYAtScale * tileHeight) * pixelSize, - - serviceLeft = Math.round((fullXMinX - bbox[0]) / pixelSize), - serviceTop = Math.round((bbox[3] - fullYMaxY) / pixelSize), - - scaleContainers = $serviceContainer.children().show(), - scaleContainer = scaleContainers.filter("[data-pixelSize='" + pixelSize + "']").appendTo($serviceContainer), - - opacity = (service.opacity === undefined ? 1 : service.opacity), - - x, y; - - if (serviceState.reloadTiles) { - scaleContainers.find("img").attr("data-dirty", "true"); - } - - if (!scaleContainer.size()) { - $serviceContainer.append("
        "); - scaleContainer = $serviceContainer.children(":last").data("scaleOrigin", (serviceLeft % tileWidth) + "," + (serviceTop % tileHeight)); - } else { - scaleContainer.css({ - left: (serviceLeft % tileWidth) + "px", - top: (serviceTop % tileHeight) + "px" - }).data("scaleOrigin", (serviceLeft % tileWidth) + "," + (serviceTop % tileHeight)); - - scaleContainer.children().each(function (i) { - var - $img = $(this), - tile = $img.attr("data-tile").split(","); - - $img.css({ - left: Math.round(((parseInt(tile[0]) - fullXAtScale) * 100) + (serviceLeft - (serviceLeft % tileWidth)) / tileWidth * 100) + "%", - top: Math.round(((parseInt(tile[1]) - fullYAtScale) * 100) + (serviceTop - (serviceTop % tileHeight)) / tileHeight * 100) + "%" - }); - - if (opacity < 1) { - $img.fadeTo(0, opacity); - } - }); - } - - for (x = tileX; x < tileX2; x++) { - for (y = tileY; y < tileY2; y++) { - var - tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ($img.size() === 0 || serviceState.reloadTiles) { - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] - (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] - ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - imageUrl = service.getUrl({ - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - }); - - serviceState.loadCount++; - //this._map._requestQueued(); - - if (serviceState.reloadTiles && $img.size() > 0) { - $img.attr("src", imageUrl); - } else { - var imgMarkup = ""; - - scaleContainer.append(imgMarkup); - $img = scaleContainer.children(":last"); - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - $serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - $serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", imageUrl); - } - } - } - } - - scaleContainers.find("[data-dirty]").remove(); - serviceState.reloadTiles = false; - } - }, - - resize: function (map, service) { - }, - - opacity: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find("img").stop(true).fadeTo("fast", service.opacity); - }, - - toggle: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.css("display", service.visibility === "visible" ? "block" : "none"); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - } - } - } - }; - })(); -})(jQuery); -(function ($, undefined) { - $.geo._serviceTypes.shingled = (function () { - return { - create: function (map, servicesContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0 - }; - - var idString = service.id ? ' id="' + service.id + '"' : "", - classString = service["class"] ? ' class="' + service["class"] + '"' : "", - scHtml = '
        '; - - servicesContainer.append(scHtml); - - serviceState.serviceContainer = servicesContainer.children(":last"); - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, servicesContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactivePan: function (map, service, dx, dy) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - pixelSize = map._pixelSize, - scaleContainer = serviceContainer.children("[data-pixelSize='" + pixelSize + "']"), - panContainer = scaleContainer.children("div"); - - if ( !panContainer.length ) { - scaleContainer.children("img").wrap('
        '); - panContainer = scaleContainer.children("div"); - } - - panContainer.css( { - left: function (index, value) { - return parseInt(value) + dx; - }, - top: function (index, value) { - return parseInt(value) + dy; - } - } ); - } - }, - - interactiveScale: function (map, service, center, pixelSize) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight]; - - serviceContainer.children().each(function (i) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.attr("data-pixelSize"), - ratio = scalePixelSize / pixelSize; - - $scaleContainer.css({ width: mapWidth * ratio, height: mapHeight * ratio }).children("img").each(function (i) { - var $img = $(this), - imgCenter = $img.data("center"), - x = (Math.round((imgCenter[0] - center[0]) / scalePixelSize) - halfWidth) * ratio, - y = (Math.round((center[1] - imgCenter[1]) / scalePixelSize) - halfHeight) * ratio; - - $img.css({ left: x + "px", top: y + "px" }); - }); - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if (serviceState && service && (service.visibility === undefined || service.visibility === "visible")) { - this._cancelUnloaded(map, service); - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - scaleContainer = serviceContainer.children('[data-pixelSize="' + pixelSize + '"]'), - - opacity = (service.opacity === undefined ? 1 : service.opacity), - - $img; - - if ( !scaleContainer.size() ) { - serviceContainer.append('
        '); - scaleContainer = serviceContainer.children(":last"); - } - - scaleContainer.children("img").each(function (i) { - var $thisimg = $(this), - imgCenter = $thisimg.data("center"), - center = map._getCenter(), - x = Math.round((imgCenter[0] - center[0]) / pixelSize) - halfWidth, - y = Math.round((center[1] - imgCenter[1]) / pixelSize) - halfHeight; - - $thisimg.css({ left: x + "px", top: y + "px" }); - }); - - if (opacity < 1) { - serviceContainer.find("img").attr("data-keepAlive", "0"); - } - - var imageUrl = service.getUrl({ - bbox: bbox, - width: mapWidth, - height: mapHeight, - zoom: map._getZoom(), - tile: null, - index: 0 - }); - - serviceState.loadCount++; - //this._map._requestQueued(); - - scaleContainer.append(''); - $img = scaleContainer.children(":last").data("center", map._getCenter()); - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(':not([data-pixelSize="' + pixelSize + '"])').remove(); - - var panContainer = serviceContainer.find('[data-pixelSize="' + pixelSize + '"]>div'); - if (panContainer.size() > 0) { - var panContainerPos = panContainer.position(); - - panContainer.children("img").each(function (i) { - var $thisimg = $(this), - x = panContainerPos.left + parseInt($thisimg.css("left")), - y = panContainerPos.top + parseInt($thisimg.css("top")); - - $thisimg.css({ left: x + "px", top: y + "px" }); - }).unwrap(); - - panContainer.remove(); - } - - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", imageUrl); - } - }, - - resize: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState && service && (service.visibility === undefined || service.visibility === "visible")) { - this._cancelUnloaded(map, service); - - var serviceState = shingledServicesState[service.id], - serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - scaleContainer = serviceContainer.children(); - - scaleContainer.attr("data-pixelSize", "0"); - scaleContainer.css({ - left: halfWidth + 'px', - top: halfHeight + 'px' - }); - } - }, - - opacity: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - serviceState.serviceContainer.find("img").stop(true).fadeTo("fast", service.opacity); - }, - - toggle: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - serviceState.serviceContainer.css("display", service.visibility === "visible" ? "block" : "none"); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - } - } - } - } - })(); -})(jQuery); diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.min.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.min.js deleted file mode 100755 index c7bf3b2..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a3.min.js +++ /dev/null @@ -1,128 +0,0 @@ -document.createElement("canvas").getContext||function(){function e(){return this.context_||(this.context_=new s(this))}function r(h,n){var q=K.call(arguments,2);return function(){return h.apply(n,q.concat(K.call(arguments)))}}function p(h){h.namespaces.g_vml_||h.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");h.namespaces.g_o_||h.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!h.styleSheets.ex_canvas_){h=h.createStyleSheet();h.owningElement.id= -"ex_canvas_";h.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function a(h){var n=h.srcElement;switch(h.propertyName){case "width":n.getContext().clearRect();n.style.width=n.attributes.width.nodeValue+"px";n.firstChild.style.width=n.clientWidth+"px";break;case "height":n.getContext().clearRect();n.style.height=n.attributes.height.nodeValue+"px";n.firstChild.style.height=n.clientHeight+"px"}}function c(h){h=h.srcElement;if(h.firstChild){h.firstChild.style.width= -h.clientWidth+"px";h.firstChild.style.height=h.clientHeight+"px"}}function b(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(h,n){for(var q=b(),u=0;u<3;u++)for(var z=0;z<3;z++){for(var v=0,L=0;L<3;L++)v+=h[u][L]*n[L][z];q[u][z]=v}return q}function g(h,n){n.fillStyle=h.fillStyle;n.lineCap=h.lineCap;n.lineJoin=h.lineJoin;n.lineWidth=h.lineWidth;n.miterLimit=h.miterLimit;n.shadowBlur=h.shadowBlur;n.shadowColor=h.shadowColor;n.shadowOffsetX=h.shadowOffsetX;n.shadowOffsetY=h.shadowOffsetY;n.strokeStyle=h.strokeStyle; -n.globalAlpha=h.globalAlpha;n.font=h.font;n.textAlign=h.textAlign;n.textBaseline=h.textBaseline;n.arcScaleX_=h.arcScaleX_;n.arcScaleY_=h.arcScaleY_;n.lineScale_=h.lineScale_}function f(h){var n=h.indexOf("(",3),q=h.indexOf(")",n+1);n=h.substring(n+1,q).split(",");if(n.length!=4||h.charAt(3)!="a")n[3]=1;return n}function m(h,n,q){return Math.min(q,Math.max(n,h))}function l(h,n,q){q<0&&q++;q>1&&q--;return 6*q<1?h+(n-h)*6*q:2*q<1?n:3*q<2?h+(n-h)*(2/3-q)*6:h}function o(h){if(h in O)return O[h];var n, -q=1;h=String(h);if(h.charAt(0)=="#")n=h;else if(/^rgb/.test(h)){q=f(h);n="#";for(var u,z=0;z<3;z++){u=q[z].indexOf("%")!=-1?Math.floor(parseFloat(q[z])/100*255):+q[z];n+=F[m(u,0,255)]}q=+q[3]}else if(/^hsl/.test(h)){z=q=f(h);n=parseFloat(z[0])/360%360;n<0&&n++;u=m(parseFloat(z[1])/100,0,1);z=m(parseFloat(z[2])/100,0,1);if(u==0)u=z=n=z;else{var v=z<0.5?z*(1+u):z+u-z*u,L=2*z-v;u=l(L,v,n+1/3);z=l(L,v,n);n=l(L,v,n-1/3)}n="#"+F[Math.floor(u*255)]+F[Math.floor(z*255)]+F[Math.floor(n*255)];q=q[3]}else n= -h;return O[h]={color:n,alpha:q}}function s(h){this.m_=b();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=D*1;this.globalAlpha=1;this.canvas=h;var n="width:"+h.clientWidth+"px;height:"+h.clientHeight+"px;overflow:hidden;position:absolute",q=h.ownerDocument.createElement("div");q.style.cssText=n;h.appendChild(q);n=q.cloneNode(false);n.style.backgroundColor="red";n.style.filter="alpha(opacity=0)"; -h.appendChild(n);this.element_=q;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}function x(h,n,q,u){h.currentPath_.push({type:"bezierCurveTo",cp1x:n.x,cp1y:n.y,cp2x:q.x,cp2y:q.y,x:u.x,y:u.y});h.currentX_=u.x;h.currentY_=u.y}function t(h,n,q){h=h.m_;return{x:D*(n*h[0][0]+q*h[1][0]+h[2][0])-J,y:D*(n*h[0][1]+q*h[1][1]+h[2][1])-J}}function A(h,n,q){if(isFinite(n[0][0])&&isFinite(n[0][1])&&isFinite(n[1][0])&&isFinite(n[1][1])&&isFinite(n[2][0])&&isFinite(n[2][1])){h.m_=n;if(q)h.lineScale_=E(G(n[0][0]* -n[1][1]-n[0][1]*n[1][0]))}}function B(h){this.code=this[h];this.message=h+": DOM Exception "+this.code}var C=Math,y=C.round,H=C.sin,I=C.cos,G=C.abs,E=C.sqrt,D=10,J=D/2;navigator.userAgent.match(/MSIE ([\d.]+)?/);var K=Array.prototype.slice;p(document);C={init:function(h){h=h||document;h.createElement("canvas");h.attachEvent("onreadystatechange",r(this.init_,this,h))},init_:function(h){h=h.getElementsByTagName("canvas");for(var n=0;nu.x)u.x=v.x;if(q.y==null||v.yu.y)u.y=v.y}}n.push(' ">');if(h){h=o(this.fillStyle);n.push('')}else{q=o(this.strokeStyle);h=q.color;q=q.alpha*this.globalAlpha;u=this.lineScale_*this.lineWidth;if(u<1)q*=u;n.push("')}n.push("");this.element_.insertAdjacentHTML("beforeEnd",n.join(""))};w.fill=function(){this.stroke(true)};w.closePath=function(){this.currentPath_.push({type:"close"})};w.save= -function(){var h={};g(this,h);this.aStack_.push(h);this.mStack_.push(this.m_);this.m_=d(b(),this.m_)};w.restore=function(){if(this.aStack_.length){g(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};w.translate=function(h,n){A(this,d([[1,0,0],[0,1,0],[h,n,1]],this.m_),false)};w.scale=function(h,n){this.arcScaleX_*=h;this.arcScaleY_*=n;A(this,d([[h,0,0],[0,n,0],[0,0,1]],this.m_),true)};w=B.prototype=Error();w.INDEX_SIZE_ERR=1;w.DOMSTRING_SIZE_ERR=2;w.HIERARCHY_REQUEST_ERR=3;w.WRONG_DOCUMENT_ERR= -4;w.INVALID_CHARACTER_ERR=5;w.NO_DATA_ALLOWED_ERR=6;w.NO_MODIFICATION_ALLOWED_ERR=7;w.NOT_FOUND_ERR=8;w.NOT_SUPPORTED_ERR=9;w.INUSE_ATTRIBUTE_ERR=10;w.INVALID_STATE_ERR=11;w.SYNTAX_ERR=12;w.INVALID_MODIFICATION_ERR=13;w.NAMESPACE_ERR=14;w.INVALID_ACCESS_ERR=15;w.VALIDATION_ERR=16;w.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=C;CanvasRenderingContext2D=s;DOMException=B}(); -(function(e){function r(a){var c=[].slice.call(arguments,1),b=0;a=e.event.fix(a||window.event);a.type="mousewheel";if(a.wheelDelta)b=a.wheelDelta/120;if(a.detail)b=-a.detail/3;c.unshift(a,b);return e.event.handle.apply(this,c)}var p=["DOMMouseScroll","mousewheel"];e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=p.length;a;)this.addEventListener(p[--a],r,false);else this.onmousewheel=r},teardown:function(){if(this.removeEventListener)for(var a=p.length;a;)this.removeEventListener(p[--a], -r,false);else this.onmousewheel=null}};e.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); -$.widget||function(e,r){var p=Array.prototype.slice,a=e.cleanData;e.cleanData=function(c){for(var b=0,d;(d=c[b])!=null;b++)e(d).triggerHandler("remove");a(c)};e.widget=function(c,b,d){var g=c.split(".")[0],f;c=c.split(".")[1];f=g+"-"+c;if(!d){d=b;b=e.Widget}e.expr[":"][f]=function(l){return!!e.data(l,c)};e[g]=e[g]||{};e[g][c]=e.extend(function(l,o){if(!this._createWidget)return new e[g][c](l,o);arguments.length&&this._createWidget(l,o)},e[g][c]);var m=new b;m.options=e.extend(true,{},m.options);e.each(d, -function(l,o){if(e.isFunction(o))d[l]=function(){var s=function(t){return b.prototype[t].apply(this,p.call(arguments,1))},x=function(t,A){return b.prototype[t].apply(this,A)};return function(){var t=this._super,A=this._superApply,B;this._super=s;this._superApply=x;B=o.apply(this,arguments);this._super=t;this._superApply=A;return B}}()});e[g][c].prototype=e.extend(true,m,{namespace:g,widgetName:c,widgetEventPrefix:c,widgetBaseClass:f},d);e.widget.bridge(c,e[g][c])};e.widget.bridge=function(c,b){e.fn[c]= -function(d){var g=typeof d==="string",f=p.call(arguments,1),m=this;d=!g&&f.length?e.extend.apply(null,[true,d].concat(f)):d;g?this.each(function(){var l=e.data(this,c);if(!l)return e.error("cannot call methods on "+c+" prior to initialization; attempted to call method '"+d+"'");if(!e.isFunction(l[d])||d.charAt(0)==="_")return e.error("no such method '"+d+"' for "+c+" widget instance");var o=l[d].apply(l,f);if(o!==l&&o!==r){m=o;return false}}):this.each(function(){var l=e.data(this,c);l?l.option(d|| -{})._init():b(d,this)});return m}};e.Widget=function(c,b){if(!this._createWidget)return new e[namespace][name](c,b);arguments.length&&this._createWidget(c,b)};e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
        ",options:{disabled:false},_createWidget:function(c,b){b=e(b||this.defaultElement||this)[0];this.element=e(b);this.options=e.extend(true,{},this.options,this._getCreateOptions(),c);this.bindings=e();this.hoverable=e();this.focusable=e();if(b!==this){e.data(b,this.widgetName, -this);this._bind({remove:"destroy"})}this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]},_create:e.noop,_init:e.noop,destroy:function(){this._destroy();this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled");this.bindings.unbind("."+this.widgetName);this.hoverable.removeClass("ui-state-hover"); -this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(c,b){var d=c;if(arguments.length===0)return e.extend({},this.options);if(typeof c==="string"){if(b===r)return this.options[c];d={};d[c]=b}this._setOptions(d);return this},_setOptions:function(c){var b=this;e.each(c,function(d,g){b._setOption(d,g)});return this},_setOption:function(c,b){this.options[c]=b;if(c==="disabled"){this.widget().toggleClass(this.widgetBaseClass+"-disabled ui-state-disabled", -!!b).attr("aria-disabled",b);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_bind:function(c,b){if(b){c=e(c);this.bindings=this.bindings.add(c)}else{b=c;c=this.element}var d=this;e.each(b,function(g,f){c.bind(g+"."+d.widgetName,function(){if(!(d.options.disabled===true||e(this).hasClass("ui-state-disabled")))return(typeof f=== -"string"?d[f]:f).apply(d,arguments)})})},_hoverable:function(c){this.hoverable=this.hoverable.add(c);this._bind(c,{mouseenter:function(b){e(b.currentTarget).addClass("ui-state-hover")},mouseleave:function(b){e(b.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(c){this.focusable=this.focusable.add(c);this._bind(c,{focusin:function(b){e(b.currentTarget).addClass("ui-state-focus")},focusout:function(b){e(b.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(c,b,d){var g= -this.options[c];b=e.Event(b);b.type=(c===this.widgetEventPrefix?c:this.widgetEventPrefix+c).toLowerCase();d=d||{};if(b.originalEvent){c=e.event.props.length;for(var f;c;){f=e.event.props[--c];b[f]=b.originalEvent[f]}}this.element.trigger(b,d);d=e.isArray(d)?[b].concat(d):[b,d];return!(e.isFunction(g)&&g.apply(this.element[0],d)===false||b.isDefaultPrevented())}}}(jQuery); -(function(e,r,p){var a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;e.geo={_allCoordinates:function(b){b=this._flatten(b);for(var d=0,g=[];d=d[2]&&b[3]>=d[3]},_bboxDisjoint:function(b,d){return d[0]>b[2]||d[2]b[3]||d[3]0){if(f/m>d){b=f/2;f=b/d}else{f=m/2;b=f*d}b=[g[0]-b,g[1]-f,g[0]+b,g[1]+f]}return e.geo.proj?e.geo.proj.toGeodetic(b):b},scaleBy:function(b,d,g){if(!g&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);var f=this.center(b,true),m=(b[2]-b[0])*d/2;b=(b[3]-b[1])*d/2;b=[f[0]-m,f[1]-b,f[0]+m,f[1]+b];return!g&&e.geo.proj?e.geo.proj.toGeodetic(b):b},width:function(b,d){if(!d&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);return b[2]-b[0]}, -bbox:function(b,d){if(b)if(b.bbox)result=!d&&e.geo.proj?e.geo.proj.fromGeodetic(b.bbox):b.bbox;else{result=[a,a,c,c];var g=this._allCoordinates(b),f=0;if(g.length==0)return p;if(e.geo.proj)g=e.geo.proj.fromGeodetic(g);for(;f0){f[0]=m[0][0];f[1]=m[0][1];return{type:"Point",coordinates:!d&&e.geo.proj?e.geo.proj.toGeodetic(f):f}}else break;g*=3;f[0]/=g;f[1]/=g;return{type:"Point",coordinates:!d&&e.geo.proj? -e.geo.proj.toGeodetic(f):f}}return p},contains:function(b,d){if(b.type!="Polygon")return false;switch(d.type){case "Point":return this._containsPolygonPoint(b.coordinates,d.coordinates);case "LineString":return this._containsPolygonLineString(b.coordinates,d.coordinates);case "Polygon":return this._containsPolygonLineString(b.coordinates,d.coordinates[0]);default:return false}},_containsPolygonPoint:function(b,d){if(b.length==0||b[0].length<4)return false;for(var g=0,f=b[0][0],m=1,l;md[0]&&g++}f=l}return g%2==1},_containsPolygonLineString:function(b,d){for(var g=0;g0){var f=b[0],m=d[0]-f[0],l=d[1]-f[1];if(b.length==1)return Math.sqrt(m*m+ -l*l);else for(var o=1;o=b)return m*m+l*l;return g*g+f*f-o*o/b},_distanceLineStringLineString:function(b,d){for(var g=a,f=0;f=2?{type:"Point",coordinates:[parseFloat(f[1]),parseFloat(f[2])]}:null}}}}(),proj:function(){return{fromGeodeticPos:function(b){if(!b)debugger; -return[6378137*b[0]*0.017453292519943295,6378137*Math.log(Math.tan(0.7853981633974483+b[1]*0.017453292519943295/2))]},fromGeodetic:function(b){var d=e.isArray(b[0]),g=this.fromGeodeticPos;if(!d&&b.length==4){d=g([b[0],b[1]]);b=g([b[2],b[3]]);return[d[0],d[1],b[0],b[1]]}else{var f=d&&e.isArray(b[0][0]),m=f&&e.isArray(b[0][0][0]),l=[],o,s,x;if(!m){if(!f){d||(b=[b]);b=[b]}b=[b]}for(o=0;o
        ",b[0];);return a>6?a:!a}();e.widget("geo.geographics",{_$elem:r,_options:{},_trueCanvas:true,_width:0,_height:0,_$canvas:r,_context:r,options:{style:{borderRadius:"8px",color:"#7f0000",fillOpacity:0.2,height:"8px",opacity:1,strokeOpacity:1,strokeWidth:"2px",visibility:"visible",width:"8px"}},_create:function(){this._$elem=this.element;this._options=this.options; -this._$elem.css({display:"inline-block",overflow:"hidden",textAlign:"left"});this._$elem.css("position")=="static"&&this._$elem.css("position","relative");this._width=this._$elem.width();this._height=this._$elem.height();if(!(this._width&&this._height)){this._width=parseInt(this._$elem.css("width"));this._height=parseInt(this._$elem.css("height"))}if(document.createElement("canvas").getContext){this._$elem.append('');this._$canvas=this._$elem.children(":last");this._context=this._$canvas[0].getContext("2d")}else if(p<=8){this._trueCanvas=false;this._$elem.append('
        ');this._$canvas=this._$elem.children(":last");G_vmlCanvasManager.initElement(this._$canvas[0]);this._context=this._$canvas[0].getContext("2d"); -this._$canvas.children().css({backgroundColor:"transparent",width:this._width,height:this._height})}},_setOption:function(a,c){if(a=="style")c=e.extend({},this._options.style,c);e.Widget.prototype._setOption.apply(this,arguments)},destroy:function(){e.Widget.prototype.destroy.apply(this,arguments);this._$elem.html("")},clear:function(){this._context.clearRect(0,0,this._width,this._height)},drawArc:function(a,c,b,d){d=this._getGraphicStyle(d);if(d.visibility!="hidden"&&d.opacity>0&&d.widthValue>0&& -d.heightValue>0){var g=Math.min(d.widthValue,d.heightValue)/2;c=c*Math.PI/180;b=b*Math.PI/180;this._context.save();this._context.translate(a[0],a[1]);d.widthValue>d.heightValue?this._context.scale(d.widthValue/d.heightValue,1):this._context.scale(1,d.heightValue/d.widthValue);this._context.beginPath();this._context.arc(0,0,g,c,b,false);this._trueCanvas&&this._context.restore();if(d.doFill){this._context.fillStyle=d.fill;this._context.globalAlpha=d.opacity*d.fillOpacity;this._context.fill()}if(d.doStroke){this._context.lineJoin= -"round";this._context.lineWidth=d.strokeWidthValue;this._context.strokeStyle=d.stroke;this._context.globalAlpha=d.opacity*d.strokeOpacity;this._context.stroke()}this._trueCanvas||this._context.restore()}},drawPoint:function(a,c){c=this._getGraphicStyle(c);if(c.widthValue==c.heightValue&&c.heightValue==c.borderRadiusValue)this.drawArc(a,0,360,c);else if(c.visibility!="hidden"&&c.opacity>0){c.borderRadiusValue=Math.min(Math.min(c.widthValue,c.heightValue)/2,c.borderRadiusValue);a[0]-=c.widthValue/2; -a[1]-=c.heightValue/2;this._context.beginPath();this._context.moveTo(a[0]+c.borderRadiusValue,a[1]);this._context.lineTo(a[0]+c.widthValue-c.borderRadiusValue,a[1]);this._context.quadraticCurveTo(a[0]+c.widthValue,a[1],a[0]+c.widthValue,a[1]+c.borderRadiusValue);this._context.lineTo(a[0]+c.widthValue,a[1]+c.heightValue-c.borderRadiusValue);this._context.quadraticCurveTo(a[0]+c.widthValue,a[1]+c.heightValue,a[0]+c.widthValue-c.borderRadiusValue,a[1]+c.heightValue);this._context.lineTo(a[0]+c.borderRadiusValue, -a[1]+c.heightValue);this._context.quadraticCurveTo(a[0],a[1]+c.heightValue,a[0],a[1]+c.heightValue-c.borderRadiusValue);this._context.lineTo(a[0],a[1]+c.borderRadiusValue);this._context.quadraticCurveTo(a[0],a[1],a[0]+c.borderRadiusValue,a[1]);this._context.closePath();if(c.doFill){this._context.fillStyle=c.fill;this._context.globalAlpha=c.opacity*c.fillOpacity;this._context.fill()}if(c.doStroke){this._context.lineJoin="round";this._context.lineWidth=c.strokeWidthValue;this._context.strokeStyle=c.stroke; -this._context.globalAlpha=c.opacity*c.strokeOpacity;this._context.stroke()}}},drawLineString:function(a,c){this._drawLines([a],false,c)},drawPolygon:function(a,c){this._drawLines(a,true,c)},drawBbox:function(a,c){this._drawLines([[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]],[a[0],a[1]]]],true,c)},_getGraphicStyle:function(a){function c(b){b=parseInt(b);return+b+""===b?+b:b}a=e.extend({},this._options.style,a);a.borderRadiusValue=c(a.borderRadius);a.fill=a.fill||a.color;a.doFill=a.fill&&a.fillOpacity> -0;a.stroke=a.stroke||a.color;a.strokeWidthValue=c(a.strokeWidth);a.doStroke=a.stroke&&a.strokeOpacity>0&&a.strokeWidthValue>0;a.widthValue=c(a.width);a.heightValue=c(a.height);return a},_drawLines:function(a,c,b){if(!(!a||!a.length||a[0].length<2)){b=this._getGraphicStyle(b);var d,g;if(b.visibility!="hidden"&&b.opacity>0){this._context.beginPath();this._context.moveTo(a[0][0][0],a[0][0][1]);for(d=0;d
        ",b[0];);return a>6?a:!a}();e.widget("geo.geomap",{_$elem:r,_created:false,_contentBounds:{},_$contentFrame:r,_$existingChildren:r,_$servicesContainer:r,_$drawContainer:r,_$shapesContainer:r,_$textContainer:r,_$textContent:r,_$eventTarget:r,_dpi:96,_currentServices:[],_center:r,_pixelSize:r,_centerMax:r,_pixelSizeMax:r,_wheelZoomFactor:1.18920711500273,_wheelTimeout:null, -_wheelLevel:0,_zoomFactor:2,_mouseDown:r,_inOp:r,_toolPan:r,_shiftZoom:r,_anchor:r,_current:r,_downDate:r,_moveDate:r,_clickDate:r,_lastMove:r,_lastDrag:r,_windowHandler:null,_resizeTimeout:null,_panning:r,_velocity:r,_friction:r,_supportTouch:r,_softDblClick:r,_isTap:r,_isDbltap:r,_drawTimeout:null,_drawPixels:[],_drawCoords:[],_graphicShapes:[],_initOptions:{},_options:{},options:e.extend({},{bbox:[-180,-85,180,85],bboxMax:[-180,-85,180,85],center:[0,0],cursors:{pan:"move",zoom:"crosshair",drawPoint:"crosshair", -drawLineString:"crosshair",drawPolygon:"crosshair"},drawStyle:{},shapeStyle:{},mode:"pan",services:[{"class":"osm",type:"tiled",getUrl:function(a){return"http://tile.openstreetmap.org/"+a.zoom+"/"+a.tile.column+"/"+a.tile.row+".png"},attr:"© OpenStreetMap & contributors, CC-BY-SA"}],tilingScheme:{tileWidth:256,tileHeight:256,levels:18,basePixelSize:156543.03392799935,origin:[-2.0037508342787E7,2.0037508342787E7]},zoom:0,pixelSize:0}),_createWidget:function(a,c){this._$elem=e(c);if(!this._$elem.is("[data-geo-service]")){this._$elem.attr("data-geo-map", -"data-geo-map");this._graphicShapes=[];this._initOptions=a||{};this._forcePosition(this._$elem);this._$elem.css("text-align","left");var b=this._findMapSize();this._contentBounds={x:parseInt(this._$elem.css("padding-left")),y:parseInt(this._$elem.css("padding-top")),width:b.width,height:b.height};this._createChildren();this._center=this._centerMax=[0,0];this.options.pixelSize=this._pixelSize=this._pixelSizeMax=156543.03392799935;this._mouseDown=this._inOp=this._toolPan=this._shiftZoom=this._panning= -this._isTap=this._isDbltap=false;this._anchor=this._current=this._lastMove=this._lastDrag=this._velocity=[0,0];this._friction=[0.8,0.8];this._downDate=this._moveDate=this._clickDate=0}e.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){if(!this._$elem.is("[data-geo-service]")){this._options=this.options;this._softDblClick=(this._supportTouch="ontouchend"in document)||p==7;var a=this._supportTouch?"touchstart":"mousedown",c=this._supportTouch?"touchend touchcancel":"mouseup", -b=this._supportTouch?"touchmove":"mousemove";e(document).keydown(e.proxy(this._document_keydown,this));this._$eventTarget.dblclick(e.proxy(this._eventTarget_dblclick,this));this._$eventTarget.bind(a,e.proxy(this._eventTarget_touchstart,this));a=this._$eventTarget[0].setCapture?this._$eventTarget:e(document);a.bind(b,e.proxy(this._dragTarget_touchmove,this));a.bind(c,e.proxy(this._dragTarget_touchstop,this));this._$eventTarget.mousewheel(e.proxy(this._eventTarget_mousewheel,this));var d=this;this._windowHandler= -function(){d._resizeTimeout&&clearTimeout(d._resizeTimeout);this._resizeTimeout=setTimeout(function(){d._created&&d._$elem.geomap("resize")},500)};e(window).resize(this._windowHandler);this._$drawContainer.geographics({style:this._initOptions.drawStyle||{}});this._options.drawStyle=this._$drawContainer.geographics("option","style");this._$shapesContainer.geographics({style:this._initOptions.shapeStyle||{}});this._options.shapeStyle=this._$shapesContainer.geographics("option","style");if(this._initOptions){this._initOptions.bbox&& -this._setOption("bbox",this._initOptions.bbox,false);this._initOptions.center&&this._setOption("center",this._initOptions.center,false);this._initOptions.zoom&&this._setZoom(this._initOptions.zoom,false,false)}this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]);this._createServices();this._refresh();this._created=true}},_setOption:function(a,c,b){if(!(this._$elem.is("[data-geo-service]")||a=="pixelSize")){b=b===r||b;switch(a){case "bbox":if(e.geo.proj){c=e.geo.proj.fromGeodetic([[c[0], -c[1]],[c[2],c[3]]]);c=[c[0][0],c[0][1],c[1][0],c[1][1]]}this._setBbox(c,false,b);c=this._getBbox();if(e.geo.proj){c=e.geo.proj.toGeodetic([[c[0],c[1]],[c[2],c[3]]]);c=[c[0][0],c[0][1],c[1][0],c[1][1]]}break;case "center":this._setCenterAndSize(e.geo.proj?e.geo.proj.fromGeodetic([[c[0],c[1]]])[0]:c,this._pixelSize,false,b);break;case "drawStyle":if(this._$drawContainer){this._$drawContainer.geographics("option","style",c);c=this._$drawContainer.geographics("option","style")}break;case "shapeStyle":if(this._$shapesContainer){this._$shapesContainer.geographics("option", -"style",c);c=this._$shapesContainer.geographics("option","style")}break;case "mode":this._$drawContainer.geographics("clear");this._$eventTarget.css("cursor",this._options.cursors[c]);break;case "zoom":this._setZoom(c,false,b)}e.Widget.prototype._setOption.apply(this,arguments);switch(a){case "services":this._createServices();b&&this._refresh();break;case "shapeStyle":if(b){this._$shapesContainer.geographics("clear");this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes)}}}}, -destroy:function(){if(this._$elem.is("[data-geo-map]")){this._created=false;e(window).unbind("resize",this._windowHandler);for(var a=0;a=0||a<=1)for(var b=0;b
        "); -this._$eventTarget=this._$contentFrame=this._$elem.children(":first");this._$contentFrame.append('
        ');this._$servicesContainer=this._$contentFrame.children(":last");this._$contentFrame.append('
        '); -this._$shapesContainer=this._$contentFrame.children(":last");this._$contentFrame.append('
        ');this._$drawContainer=this._$contentFrame.children(":last");this._$contentFrame.append(''); -this._$textContainer=this._$contentFrame.children(":last");this._$textContent=this._$textContainer.children();this._$contentFrame.append(this._$existingChildren)},_createServices:function(){var a;for(a=0;a0){var a=this._options.mode,c=this._drawPixels;if(a=="drawPolygon")c=[c];this._$drawContainer.geographics(a,c)}},_resetDrawing:function(){this._drawPixels=[];this._drawCoords=[];this._$drawContainer.geographics("clear")}, -_refreshShapes:function(a,c,b,d,g){var f,m,l,o,s,x=this._getBbox(d,g),t=this;for(f=0;f0&&a.height>0);){a={width:c.width(),height:c.height()};if(a.width<=0||a.height<=0)a={width:parseInt(c.css("width")),height:parseInt(c.css("height"))};c=c.parent()}return a},_forcePosition:function(a){var c=a.css("position");c!="relative"&&c!="absolute"&&c!="fixed"&&a.css("position","relative")},_getTiledPixelSize:function(a){var c=this._options.tilingScheme; -if(c!=null){if(a===0)return c.pixelSizes!=null?c.pixelSizes[0]:c.basePixelSize;a=Math.round(a);a=Math.max(a,0);a=Math.min(a,(c.pixelSizes!=null?c.pixelSizes.length:c.levels)-1);return c.pixelSizes!=null?c.pixelSizes[a]:c.basePixelSize/Math.pow(2,a)}else return NaN},_getTiledZoom:function(a){var c=this._options.tilingScheme;if(c.pixelSizes!=null){a=Math.floor(a*1E3);for(var b=(c.pixelSizes!=null?c.pixelSizes.length:c.levels)-1;b>=0;b--)if(Math.floor(c.pixelSizes[b]*1E3)>=a)return b;return 0}else return Math.max(Math.round(Math.log(c.basePixelSize/ -a)/Math.log(2)),0)},_getZoomCenterAndSize:function(a,c,b){if(this._options.tilingScheme){c=this._getTiledZoom(this._pixelSize)+c;c=this._getTiledPixelSize(c)}else{c=Math.pow(b,-c);c=this._pixelSize*c}b=c/this._pixelSize;a=this._toMap(a);b=[(this._center[0]-a[0])*b,(this._center[1]-a[1])*b];return{pixelSize:c,center:[a[0]+b[0],a[1]+b[1]]}},_mouseWheelFinish:function(){this._wheelTimeout=null;if(this._wheelLevel!=0){var a=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._wheelZoomFactor); -this._setCenterAndSize(a.center,a.pixelSize,true,true);this._wheelLevel=0}else this._refresh()},_panEnd:function(){this._velocity=[this._velocity[0]>0?Math.floor(this._velocity[0]*this._friction[0]):Math.ceil(this._velocity[0]*this._friction[0]),this._velocity[1]>0?Math.floor(this._velocity[1]*this._friction[1]):Math.ceil(this._velocity[1]*this._friction[1])];if(Math.abs(this._velocity[0])<4&&Math.abs(this._velocity[1])<4)this._panFinalize();else{this._current=[this._current[0]+this._velocity[0], -this._current[1]+this._velocity[1]];this._panMove();setTimeout(e.proxy(this._panEnd,this),30)}},_panFinalize:function(){if(this._panning){this._velocity=[0,0];var a=-(this._current[0]-this._anchor[0])*this._pixelSize,c=(this._current[1]-this._anchor[1])*this._pixelSize;this._$shapesContainer.css({left:0,top:0});this._setCenterAndSize([this._center[0]+a,this._center[1]+c],this._pixelSize,true,true);this._inOp=false;this._anchor=this._current;this._toolPan=this._panning=false;this._$eventTarget.css("cursor", -this._options.cursors[this._options.mode])}},_panMove:function(){var a=this._current[0]-this._lastDrag[0],c=this._current[1]-this._lastDrag[1],b=0,d;if(this._toolPan||a>3||a<-3||c>3||c<-3){if(!this._toolPan){this._toolPan=true;this._$eventTarget.css("cursor",this._options.cursors.pan)}if(this._mouseDown)this._velocity=[a,c];if(a!=0||c!=0){this._panning=true;this._lastDrag=this._current;for(b=0;b0&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes)}},_setCenterAndSize:function(a,c,b,d){if(this._pixelSize!=c){this._$shapesContainer.geographics("clear");for(var g=0;g0)this._drawPixels=this._toPixel(this._drawCoords);b&&this._trigger("bboxchange",window.event,{bbox:this._options.bbox});if(d){this._refresh();this._refreshDrawing()}},_toMap:function(a,c,b){var d=e.isArray(a[0]);d||(a=[a]);c=c||this._center; -b=b||this._pixelSize;var g=this._contentBounds.width,f=this._contentBounds.height,m=g/2*b;b=f/2*b;var l=[c[0]-m,c[1]-b,c[0]+m,c[1]+b],o=e.geo.width(l,true)/g,s=e.geo.height(l,true)/f,x=[];e.each(a,function(t){x[t]=[l[0]+this[0]*o,l[3]-this[1]*s]});return d?x:x[0]},_toPixel:function(a,c,b){var d=e.isArray(a[0]);d||(a=[a]);c=c||this._center;b=b||this._pixelSize;var g=this._contentBounds.width,f=this._contentBounds.height,m=g/2*b;b=f/2*b;var l=[c[0]-m,c[1]-b,c[0]+m,c[1]+b],o=e.geo.width(l,true),s=e.geo.height(l, -true),x=[];e.each(a,function(t){x[t]=[Math.round((this[0]-l[0])*g/o),Math.round((l[3]-this[1])*f/s)]});return d?x:x[0]},_zoomTo:function(a,c,b,d){c=c<0?0:c;var g=this._getTiledPixelSize(c);if(isNaN(g)){c=e.geo._scaleBy(this._getBboxMax(),1/Math.pow(this._zoomFactor,c),true);c=Math.max(e.geo.width(c,true)/this._contentBounds.width,e.geo.height(c,true)/this._contentBounds.height);this._setCenterAndSize(a,c,b,d)}else this._setCenterAndSize(a,g,b,d)},_document_keydown:function(a){var c=this._drawCoords.length; -if(c>0&&a.which==27)if(c<=2){this._resetDrawing();this._inOp=false}else{this._drawCoords[c-2]=e.merge([],this._drawCoords[c-1]);this._drawPixels[c-2]=e.merge([],this._drawPixels[c-1]);this._drawCoords.length--;this._drawPixels.length--;this._refreshDrawing()}},_eventTarget_dblclick_zoom:function(a){this._trigger("dblclick",a,{type:"Point",coordinates:this.toMap(this._current)});if(!a.isDefaultPrevented()){a=this._getZoomCenterAndSize(this._current,1,this._zoomFactor);this._setCenterAndSize(a.center, -a.pixelSize,true,true)}},_eventTarget_dblclick:function(a){this._panFinalize();if(this._drawTimeout){window.clearTimeout(this._drawTimeout);this._drawTimeout=null}e(a.currentTarget).offset();switch(this._options.mode){case "pan":case "drawPoint":this._eventTarget_dblclick_zoom(a);break;case "drawLineString":if(this._drawCoords.length>1&&!(this._drawCoords[0][0]==this._drawCoords[1][0]&&this._drawCoords[0][1]==this._drawCoords[1][1])){this._drawCoords.length--;this._trigger("shape",a,{type:"LineString", -coordinates:e.geo.proj?e.geo.proj.toGeodetic(this._drawCoords):this._drawCoords})}else this._eventTarget_dblclick_zoom(a);this._resetDrawing();break;case "drawPolygon":if(this._drawCoords.length>1&&!(this._drawCoords[0][0]==this._drawCoords[1][0]&&this._drawCoords[0][1]==this._drawCoords[1][1])){var c=this._drawCoords.length-1;if(c>2){this._drawCoords[c]=e.merge([],this._drawCoords[0]);this._trigger("shape",a,{type:"Polygon",coordinates:[e.geo.proj?e.geo.proj.toGeodetic(this._drawCoords):this._drawCoords]})}}else this._eventTarget_dblclick_zoom(a); -this._resetDrawing()}this._inOp=false},_eventTarget_touchstart:function(a){if(!(!this._supportTouch&&a.which!=1)){this._panFinalize();this._mouseWheelFinish();var c=e(a.currentTarget).offset();this._current=this._supportTouch?[a.originalEvent.changedTouches[0].pageX-c.left,a.originalEvent.changedTouches[0].pageY-c.top]:[a.pageX-c.left,a.pageY-c.top];if(this._softDblClick){c=e.now();if(c-this._downDate<750){if(this._isTap){var b=this._current[0]-this._anchor[0],d=this._current[1]-this._anchor[1];if(Math.sqrt(b* -b+d*d)>10)this._isTap=false;else this._current=this._anchor}this._isDbltap=this._isDbltap?false:this._isTap}else this._isDbltap=false;this._isTap=true;this._downDate=c}this._mouseDown=true;this._anchor=this._current;if(!this._inOp&&a.shiftKey){this._shiftZoom=true;this._$eventTarget.css("cursor",this._options.cursors.zoom)}else{this._inOp=true;switch(this._options.mode){case "pan":case "drawPoint":case "drawLineString":case "drawPolygon":this._lastDrag=this._current;a.currentTarget.setCapture&&a.currentTarget.setCapture()}}if(this._inOp){a.preventDefault(); -return false}}},_dragTarget_touchmove:function(a){var c=this._$eventTarget.offset(),b=this._drawCoords.length;c=this._supportTouch?[a.originalEvent.changedTouches[0].pageX-c.left,a.originalEvent.changedTouches[0].pageY-c.top]:[a.pageX-c.left,a.pageY-c.top];if(c[0]===this._lastMove[0]&&c[1]===this._lastMove[1])if(this._inOp){a.preventDefault();return false}if(this._softDblClick)this._isDbltap=this._isTap=false;if(this._mouseDown){this._current=c;this._moveDate=e.now()}switch(this._shiftZoom?"zoom": -this._options.mode){case "zoom":if(this._mouseDown){this._$drawContainer.geographics("clear");this._$drawContainer.geographics("drawBbox",[this._anchor[0],this._anchor[1],c[0],c[1]])}else this._trigger("move",a,{type:"Point",coordinates:this.toMap(c)});break;case "pan":case "drawPoint":this._mouseDown||this._toolPan?this._panMove():this._trigger("move",a,{type:"Point",coordinates:this.toMap(c)});break;case "drawLineString":case "drawPolygon":if(this._mouseDown||this._toolPan)this._panMove();else{if(b> -0){this._drawCoords[b-1]=this._toMap(c);this._drawPixels[b-1]=c;this._refreshDrawing()}this._trigger("move",a,{type:"Point",coordinates:this.toMap(c)})}}this._lastMove=c;if(this._inOp){a.preventDefault();return false}},_dragTarget_touchstop:function(a){!this._mouseDown&&p==7&&this._eventTarget_touchstart(a);var c=this._mouseDown,b=this._toolPan,d=this._$eventTarget.offset(),g=this._shiftZoom?"zoom":this._options.mode,f,m;f=this._supportTouch?[a.originalEvent.changedTouches[0].pageX-d.left,a.originalEvent.changedTouches[0].pageY- -d.top]:[a.pageX-d.left,a.pageY-d.top];d=f[0]-this._anchor[0];m=f[1]-this._anchor[1];this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]);this._shiftZoom=this._mouseDown=this._toolPan=false;document.releaseCapture&&document.releaseCapture();if(c){c=e.now();this._current=f;switch(g){case "zoom":if(d>0||m>0){b=this._pixelSize*6;g=this._toMap([[Math.min(this._anchor[0],f[0]),Math.max(this._anchor[1],f[1])],[Math.max(this._anchor[0],f[0]),Math.min(this._anchor[1],f[1])]]);g=[g[0][0], -g[0][1],g[1][0],g[1][1]];if(g[2]-g[0]100){this._trigger("click",a,{type:"Point",coordinates:this.toMap(f)});this._inOp=false}break;case "drawPoint":if(this._drawTimeout){window.clearTimeout(this._drawTimeout);this._drawTimeout=null}if(b)this._panFinalize();else if(c-this._clickDate>100){var l=this;this._drawTimeout= -setTimeout(function(){if(l._drawTimeout){l._trigger("shape",a,{type:"Point",coordinates:l.toMap(f)});l._inOp=false;l._drawTimeout=false}},250)}break;case "drawLineString":case "drawPolygon":if(b)this._panFinalize();else{b=this._drawCoords.length==0?0:this._drawCoords.length-1;this._drawCoords[b]=this._toMap(f);this._drawPixels[b]=f;if(b<2||!(this._drawCoords[b][0]==this._drawCoords[b-1][0]&&this._drawCoords[b][1]==this._drawCoords[b-1][1])){this._drawCoords[b+1]=this._toMap(f);this._drawPixels[b+ -1]=f}this._refreshDrawing()}}this._clickDate=c;if(this._softDblClick&&this._isDbltap){this._isDbltap=this._isTap=false;this._$eventTarget.trigger("dblclick",a)}}if(this._inOp){a.preventDefault();return false}},_eventTarget_mousewheel:function(a,c){a.preventDefault();this._panFinalize();if(this._mouseDown)return false;if(c!=0){if(this._wheelTimeout){window.clearTimeout(this._wheelTimeout);this._wheelTimeout=null}else{var b=e(a.currentTarget).offset();this._anchor=[a.pageX-b.left,a.pageY-b.top]}this._wheelLevel+= -c;b=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._wheelZoomFactor);this._$shapesContainer.geographics("clear");for(i=0;i0&&this._graphicShapes.length<256&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,b.center,b.pixelSize);if(this._drawCoords.length> -0){this._drawPixels=this._toPixel(this._drawCoords,b.center,b.pixelSize);this._refreshDrawing()}var g=this;this._wheelTimeout=window.setTimeout(function(){g._mouseWheelFinish()},1E3)}return false}})})(jQuery); -(function(e,r){e.geo._serviceTypes.tiled=function(){return{create:function(p,a,c){p=e.data(c,"geoServiceState");if(!p){p={loadCount:0,reloadTiles:false};a.append('
        ');p.serviceContainer=a.children(":last");e.data(c,"geoServiceState",p)}return p.serviceContainer}, -destroy:function(p,a,c){e.data(c,"geoServiceState").serviceContainer.remove();e.removeData(c,"geoServiceState")},interactivePan:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d){this._cancelUnloaded(p,a);d.serviceContainer.children().css({left:function(w,M){return parseInt(M)+c},top:function(w,M){return parseInt(M)+b}});if(a&&(a.visibility===r||a.visibility==="visible")){var g=p._pixelSize,f=d.serviceContainer,m=f.children("[data-pixelSize='"+g+"']"),l=p._getContentBounds(),o=p.options.tilingScheme, -s=o.tileWidth,x=o.tileHeight,t=l.width/2*g,A=l.height/2*g,B=m.position(),C=m.data("scaleOrigin").split(",");l=parseInt(C[0])-B.left;B=parseInt(C[1])-B.top;var y=p._getCenter();C=[y[0]+l*g,y[1]-B*g];var H=Math.floor((C[0]-t-o.origin[0])/(g*s));l=Math.floor((o.origin[1]-(C[1]+A))/(g*x));B=Math.ceil((C[0]+t-o.origin[0])/(g*s));C=Math.ceil((o.origin[1]-(C[1]-A))/(g*x));var I=p._getBboxMax(),G=p._getTiledPixelSize(0),E=G/g,D=Math.floor((I[0]-o.origin[0])/(G*s))*E;I=Math.floor((o.origin[1]-I[3])/(G*x))* -E;t=Math.round((o.origin[0]+D*s*g-(y[0]-t))/g);A=Math.round((y[1]+A-(o.origin[1]-I*x*g))/g);var J=a.opacity===r?1:a.opacity;for(y=H;y -0)E.attr("src",K);else{E="";m.append(E);E=m.children(":last");E.load(function(w){J<1?e(w.target).fadeTo(0,J):e(w.target).show();d.loadCount--;if(d.loadCount<=0){f.children(":not([data-pixelSize='"+ -g+"'])").remove();d.loadCount=0}}).error(function(w){e(w.target).remove();d.loadCount--;if(d.loadCount<=0){f.children(":not([data-pixelSize='"+g+"'])").remove();d.loadCount=0}}).attr("src",K)}}}}}},interactiveScale:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,a);a=p.options.tilingScheme;var g=a.tileWidth,f=a.tileHeight;d.serviceContainer.children().each(function(){var m=e(this),l=m.attr("data-pixelSize")/b;l=Math.round(l* -1E3)/1E3;var o=m.data("scaleOrigin").split(",");o=p._toMap([o[0],o[1]]);o=p._toPixel(o,c,b);m.css({left:Math.round(o[0])+"px",top:Math.round(o[1])+"px",width:g*l,height:f*l});e("body")[0].filters!==r&&m.children().each(function(){e(this).css("filter","progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11="+l+",M22="+l+",sizingmethod='auto expand')")})})}},refresh:function(p,a){var c=e.data(a,"geoServiceState");if(c&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p, -a);var b=p._getBbox(),d=p._pixelSize,g=c.serviceContainer;p._getContentBounds();var f=p.options.tilingScheme,m=f.tileWidth,l=f.tileHeight,o=Math.floor((b[0]-f.origin[0])/(d*m)),s=Math.floor((f.origin[1]-b[3])/(d*l)),x=Math.ceil((b[2]-f.origin[0])/(d*m)),t=Math.ceil((f.origin[1]-b[1])/(d*l)),A=p._getBboxMax(),B=p._getTiledPixelSize(0),C=B/d,y=Math.floor((A[0]-f.origin[0])/(B*m))*C,H=Math.floor((f.origin[1]-A[3])/(B*l))*C,I=Math.round((f.origin[0]+y*m*d-b[0])/d),G=Math.round((b[3]-(f.origin[1]-H*l* -d))/d);b=g.children().show();A=b.filter("[data-pixelSize='"+d+"']").appendTo(g);var E=a.opacity===r?1:a.opacity;c.reloadTiles&&b.find("img").attr("data-dirty","true");if(A.size()){A.css({left:I%m+"px",top:G%l+"px"}).data("scaleOrigin",I%m+","+G%l);A.children().each(function(){var F=e(this),w=F.attr("data-tile").split(",");F.css({left:Math.round((parseInt(w[0])-y)*100+(I-I%m)/m*100)+"%",top:Math.round((parseInt(w[1])-H)*100+(G-G%l)/l*100)+"%"});E<1&&F.fadeTo(0,E)})}else{g.append("
        ");A=g.children(":last").data("scaleOrigin",I%m+","+G%l)}for(o=o;o0)D.attr("src",J);else{D="";A.append(D);D=A.children(":last");D.load(function(F){E<1?e(F.target).fadeTo(0, -E):e(F.target).show();c.loadCount--;if(c.loadCount<=0){g.children(":not([data-pixelSize='"+d+"'])").remove();c.loadCount=0}}).error(function(F){e(F.target).remove();c.loadCount--;if(c.loadCount<=0){g.children(":not([data-pixelSize='"+d+"'])").remove();c.loadCount=0}}).attr("src",J)}}}b.find("[data-dirty]").remove();c.reloadTiles=false}},resize:function(){},opacity:function(p,a){e.data(a,"geoServiceState").serviceContainer.find("img").stop(true).fadeTo("fast",a.opacity)},toggle:function(p,a){e.data(a, -"geoServiceState").serviceContainer.css("display",a.visibility==="visible"?"block":"none")},_cancelUnloaded:function(p,a){var c=e.data(a,"geoServiceState");if(c&&c.loadCount>0)for(c.serviceContainer.find("img:hidden").remove();c.loadCount>0;)c.loadCount--}}}()})(jQuery); -(function(e,r){e.geo._serviceTypes.shingled=function(){return{create:function(p,a,c){p=e.data(c,"geoServiceState");if(!p){p={loadCount:0};a.append('
        ');p.serviceContainer=a.children(":last");e.data(c,"geoServiceState",p)}return p.serviceContainer}, -destroy:function(p,a,c){e.data(c,"geoServiceState").serviceContainer.remove();e.removeData(c,"geoServiceState")},interactivePan:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d){this._cancelUnloaded(p,a);p=d.serviceContainer.children("[data-pixelSize='"+p._pixelSize+"']");a=p.children("div");if(!a.length){p.children("img").wrap('
        ');a=p.children("div")}a.css({left:function(g,f){return parseInt(f)+c},top:function(g, -f){return parseInt(f)+b}})}},interactiveScale:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d){this._cancelUnloaded(p,a);a=d.serviceContainer;p=p._getContentBounds();var g=p.width,f=p.height,m=g/2,l=f/2;a.children().each(function(){var o=e(this),s=o.attr("data-pixelSize"),x=s/b;o.css({width:g*x,height:f*x}).children("img").each(function(){var t=e(this),A=t.data("center");t.css({left:(Math.round((A[0]-c[0])/s)-m)*x+"px",top:(Math.round((c[1]-A[1])/s)-l)*x+"px"})})})}},refresh:function(p,a){var c= -e.data(a,"geoServiceState");if(c&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,a);var b=p._getBbox(),d=p._pixelSize,g=c.serviceContainer,f=p._getContentBounds(),m=f.width,l=f.height,o=m/2,s=l/2;f=g.children('[data-pixelSize="'+d+'"]');var x=a.opacity===r?1:a.opacity;if(!f.size()){g.append('
        ');f=g.children(":last")}f.children("img").each(function(){var t= -e(this),A=t.data("center"),B=p._getCenter();t.css({left:Math.round((A[0]-B[0])/d)-o+"px",top:Math.round((B[1]-A[1])/d)-s+"px"})});x<1&&g.find("img").attr("data-keepAlive","0");b=a.getUrl({bbox:b,width:m,height:l,zoom:p._getZoom(),tile:null,index:0});c.loadCount++;f.append(''); -f.children(":last").data("center",p._getCenter()).load(function(t){x<1?e(t.target).fadeTo(0,x):e(t.target).show();c.loadCount--;if(c.loadCount<=0){g.children(':not([data-pixelSize="'+d+'"])').remove();t=g.find('[data-pixelSize="'+d+'"]>div');if(t.size()>0){var A=t.position();t.children("img").each(function(){var B=e(this),C=A.left+parseInt(B.css("left")),y=A.top+parseInt(B.css("top"));B.css({left:C+"px",top:y+"px"})}).unwrap();t.remove()}c.loadCount=0}}).error(function(t){e(t.target).remove();c.loadCount--; -if(c.loadCount<=0){g.children(":not([data-pixelSize='"+d+"'])").remove();c.loadCount=0}}).attr("src",b)}},resize:function(p,a){var c=e.data(a,"geoServiceState");if(c&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,a);c=shingledServicesState[a.id];var b=c.serviceContainer,d=p._getContentBounds();c=d.width/2;d=d.height/2;b=b.children();b.attr("data-pixelSize","0");b.css({left:c+"px",top:d+"px"})}},opacity:function(p,a){e.data(a,"geoServiceState").serviceContainer.find("img").stop(true).fadeTo("fast", -a.opacity)},toggle:function(p,a){e.data(a,"geoServiceState").serviceContainer.css("display",a.visibility==="visible"?"block":"none")},_cancelUnloaded:function(p,a){var c=e.data(a,"geoServiceState");if(c&&c.loadCount>0)for(c.serviceContainer.find("img:hidden").remove();c.loadCount>0;)c.loadCount--}}}()})(jQuery); diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.js deleted file mode 100755 index 3223253..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.js +++ /dev/null @@ -1,6233 +0,0 @@ -// excanvas -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* - * AppGeo/geo - * (c) 2007-2011, Applied Geographics, Inc. All rights reserved. - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - */ - - -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// Known Issues: -// -// * Patterns only support repeat. -// * Radial gradient are not implemented. The VML version of these look very -// different from the canvas one. -// * Clipping paths are not implemented. -// * Coordsize. The width and height attribute have higher priority than the -// width and height style values which isn't correct. -// * Painting mode isn't implemented. -// * Canvas width/height should is using content-box by default. IE in -// Quirks mode will draw the canvas using border-box. Either change your -// doctype to HTML5 -// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) -// or use Box Sizing Behavior from WebFX -// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) -// * Non uniform scaling does not correctly scale strokes. -// * Optimize. There is always room for speed improvements. - -// Only add this code if we do not already have a canvas implementation -if (!document.createElement('canvas').getContext) { - - (function () { - - // alias some functions to make (compiled) code shorter - var m = Math; - var mr = m.round; - var ms = m.sin; - var mc = m.cos; - var abs = m.abs; - var sqrt = m.sqrt; - - // this is used for sub pixel precision - var Z = 10; - var Z2 = Z / 2; - - var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1]; - - /** - * This funtion is assigned to the elements as element.getContext(). - * @this {HTMLElement} - * @return {CanvasRenderingContext2D_} - */ - function getContext() { - return this.context_ || - (this.context_ = new CanvasRenderingContext2D_(this)); - } - - var slice = Array.prototype.slice; - - /** - * Binds a function to an object. The returned function will always use the - * passed in {@code obj} as {@code this}. - * - * Example: - * - * g = bind(f, obj, a, b) - * g(c, d) // will do f.call(obj, a, b, c, d) - * - * @param {Function} f The function to bind the object to - * @param {Object} obj The object that should act as this when the function - * is called - * @param {*} var_args Rest arguments that will be used as the initial - * arguments when the function is called - * @return {Function} A new function that has bound this - */ - function bind(f, obj, var_args) { - var a = slice.call(arguments, 2); - return function () { - return f.apply(obj, a.concat(slice.call(arguments))); - }; - } - - function encodeHtmlAttribute(s) { - return String(s).replace(/&/g, '&').replace(/"/g, '"'); - } - - function addNamespace(doc, prefix, urn) { - if (!doc.namespaces[prefix]) { - doc.namespaces.add(prefix, urn, '#default#VML'); - } - } - - function addNamespacesAndStylesheet(doc) { - addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml'); - addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office'); - - // Setup default CSS. Only add one style sheet per document - if (!doc.styleSheets['ex_canvas_']) { - var ss = doc.createStyleSheet(); - ss.owningElement.id = 'ex_canvas_'; - ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + - // default size is 300x150 in Gecko and Opera - 'text-align:left;width:300px;height:150px}'; - } - } - - // Add namespaces and stylesheet at startup. - addNamespacesAndStylesheet(document); - - var G_vmlCanvasManager_ = { - init: function (opt_doc) { - var doc = opt_doc || document; - // Create a dummy element so that IE will allow canvas elements to be - // recognized. - doc.createElement('canvas'); - doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); - }, - - init_: function (doc) { - // find all canvas elements - var els = doc.getElementsByTagName('canvas'); - for (var i = 0; i < els.length; i++) { - this.initElement(els[i]); - } - }, - - /** - * Public initializes a canvas element so that it can be used as canvas - * element from now on. This is called automatically before the page is - * loaded but if you are creating elements using createElement you need to - * make sure this is called on the element. - * @param {HTMLElement} el The canvas element to initialize. - * @return {HTMLElement} the element that was created. - */ - initElement: function (el) { - if (!el.getContext) { - el.getContext = getContext; - - // Add namespaces and stylesheet to document of the element. - addNamespacesAndStylesheet(el.ownerDocument); - - // Remove fallback content. There is no way to hide text nodes so we - // just remove all childNodes. We could hide all elements and remove - // text nodes but who really cares about the fallback content. - el.innerHTML = ''; - - // do not use inline function because that will leak memory - el.attachEvent('onpropertychange', onPropertyChange); - el.attachEvent('onresize', onResize); - - var attrs = el.attributes; - if (attrs.width && attrs.width.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setWidth_(attrs.width.nodeValue); - el.style.width = attrs.width.nodeValue + 'px'; - } else { - el.width = el.clientWidth; - } - if (attrs.height && attrs.height.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setHeight_(attrs.height.nodeValue); - el.style.height = attrs.height.nodeValue + 'px'; - } else { - el.height = el.clientHeight; - } - //el.getContext().setCoordsize_() - } - return el; - } - }; - - function onPropertyChange(e) { - var el = e.srcElement; - - switch (e.propertyName) { - case 'width': - el.getContext().clearRect(); - el.style.width = el.attributes.width.nodeValue + 'px'; - // In IE8 this does not trigger onresize. - el.firstChild.style.width = el.clientWidth + 'px'; - break; - case 'height': - el.getContext().clearRect(); - el.style.height = el.attributes.height.nodeValue + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - break; - } - } - - function onResize(e) { - var el = e.srcElement; - if (el.firstChild) { - el.firstChild.style.width = el.clientWidth + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - } - } - - G_vmlCanvasManager_.init(); - - // precompute "00" to "FF" - var decToHex = []; - for (var i = 0; i < 16; i++) { - for (var j = 0; j < 16; j++) { - decToHex[i * 16 + j] = i.toString(16) + j.toString(16); - } - } - - function createMatrixIdentity() { - return [ - [1, 0, 0], - [0, 1, 0], - [0, 0, 1] - ]; - } - - function matrixMultiply(m1, m2) { - var result = createMatrixIdentity(); - - for (var x = 0; x < 3; x++) { - for (var y = 0; y < 3; y++) { - var sum = 0; - - for (var z = 0; z < 3; z++) { - sum += m1[x][z] * m2[z][y]; - } - - result[x][y] = sum; - } - } - return result; - } - - function copyState(o1, o2) { - o2.fillStyle = o1.fillStyle; - o2.lineCap = o1.lineCap; - o2.lineJoin = o1.lineJoin; - o2.lineWidth = o1.lineWidth; - o2.miterLimit = o1.miterLimit; - o2.shadowBlur = o1.shadowBlur; - o2.shadowColor = o1.shadowColor; - o2.shadowOffsetX = o1.shadowOffsetX; - o2.shadowOffsetY = o1.shadowOffsetY; - o2.strokeStyle = o1.strokeStyle; - o2.globalAlpha = o1.globalAlpha; - o2.font = o1.font; - o2.textAlign = o1.textAlign; - o2.textBaseline = o1.textBaseline; - o2.arcScaleX_ = o1.arcScaleX_; - o2.arcScaleY_ = o1.arcScaleY_; - o2.lineScale_ = o1.lineScale_; - } - - // var colorData = { - // aliceblue: '#F0F8FF', - // antiquewhite: '#FAEBD7', - // aquamarine: '#7FFFD4', - // azure: '#F0FFFF', - // beige: '#F5F5DC', - // bisque: '#FFE4C4', - // black: '#000000', - // blanchedalmond: '#FFEBCD', - // blueviolet: '#8A2BE2', - // brown: '#A52A2A', - // burlywood: '#DEB887', - // cadetblue: '#5F9EA0', - // chartreuse: '#7FFF00', - // chocolate: '#D2691E', - // coral: '#FF7F50', - // cornflowerblue: '#6495ED', - // cornsilk: '#FFF8DC', - // crimson: '#DC143C', - // cyan: '#00FFFF', - // darkblue: '#00008B', - // darkcyan: '#008B8B', - // darkgoldenrod: '#B8860B', - // darkgray: '#A9A9A9', - // darkgreen: '#006400', - // darkgrey: '#A9A9A9', - // darkkhaki: '#BDB76B', - // darkmagenta: '#8B008B', - // darkolivegreen: '#556B2F', - // darkorange: '#FF8C00', - // darkorchid: '#9932CC', - // darkred: '#8B0000', - // darksalmon: '#E9967A', - // darkseagreen: '#8FBC8F', - // darkslateblue: '#483D8B', - // darkslategray: '#2F4F4F', - // darkslategrey: '#2F4F4F', - // darkturquoise: '#00CED1', - // darkviolet: '#9400D3', - // deeppink: '#FF1493', - // deepskyblue: '#00BFFF', - // dimgray: '#696969', - // dimgrey: '#696969', - // dodgerblue: '#1E90FF', - // firebrick: '#B22222', - // floralwhite: '#FFFAF0', - // forestgreen: '#228B22', - // gainsboro: '#DCDCDC', - // ghostwhite: '#F8F8FF', - // gold: '#FFD700', - // goldenrod: '#DAA520', - // grey: '#808080', - // greenyellow: '#ADFF2F', - // honeydew: '#F0FFF0', - // hotpink: '#FF69B4', - // indianred: '#CD5C5C', - // indigo: '#4B0082', - // ivory: '#FFFFF0', - // khaki: '#F0E68C', - // lavender: '#E6E6FA', - // lavenderblush: '#FFF0F5', - // lawngreen: '#7CFC00', - // lemonchiffon: '#FFFACD', - // lightblue: '#ADD8E6', - // lightcoral: '#F08080', - // lightcyan: '#E0FFFF', - // lightgoldenrodyellow: '#FAFAD2', - // lightgreen: '#90EE90', - // lightgrey: '#D3D3D3', - // lightpink: '#FFB6C1', - // lightsalmon: '#FFA07A', - // lightseagreen: '#20B2AA', - // lightskyblue: '#87CEFA', - // lightslategray: '#778899', - // lightslategrey: '#778899', - // lightsteelblue: '#B0C4DE', - // lightyellow: '#FFFFE0', - // limegreen: '#32CD32', - // linen: '#FAF0E6', - // magenta: '#FF00FF', - // mediumaquamarine: '#66CDAA', - // mediumblue: '#0000CD', - // mediumorchid: '#BA55D3', - // mediumpurple: '#9370DB', - // mediumseagreen: '#3CB371', - // mediumslateblue: '#7B68EE', - // mediumspringgreen: '#00FA9A', - // mediumturquoise: '#48D1CC', - // mediumvioletred: '#C71585', - // midnightblue: '#191970', - // mintcream: '#F5FFFA', - // mistyrose: '#FFE4E1', - // moccasin: '#FFE4B5', - // navajowhite: '#FFDEAD', - // oldlace: '#FDF5E6', - // olivedrab: '#6B8E23', - // orange: '#FFA500', - // orangered: '#FF4500', - // orchid: '#DA70D6', - // palegoldenrod: '#EEE8AA', - // palegreen: '#98FB98', - // paleturquoise: '#AFEEEE', - // palevioletred: '#DB7093', - // papayawhip: '#FFEFD5', - // peachpuff: '#FFDAB9', - // peru: '#CD853F', - // pink: '#FFC0CB', - // plum: '#DDA0DD', - // powderblue: '#B0E0E6', - // rosybrown: '#BC8F8F', - // royalblue: '#4169E1', - // saddlebrown: '#8B4513', - // salmon: '#FA8072', - // sandybrown: '#F4A460', - // seagreen: '#2E8B57', - // seashell: '#FFF5EE', - // sienna: '#A0522D', - // skyblue: '#87CEEB', - // slateblue: '#6A5ACD', - // slategray: '#708090', - // slategrey: '#708090', - // snow: '#FFFAFA', - // springgreen: '#00FF7F', - // steelblue: '#4682B4', - // tan: '#D2B48C', - // thistle: '#D8BFD8', - // tomato: '#FF6347', - // turquoise: '#40E0D0', - // violet: '#EE82EE', - // wheat: '#F5DEB3', - // whitesmoke: '#F5F5F5', - // yellowgreen: '#9ACD32' - // }; - - - function getRgbHslContent(styleString) { - var start = styleString.indexOf('(', 3); - var end = styleString.indexOf(')', start + 1); - var parts = styleString.substring(start + 1, end).split(','); - // add alpha if needed - if (parts.length != 4 || styleString.charAt(3) != 'a') { - parts[3] = 1; - } - return parts; - } - - function percent(s) { - return parseFloat(s) / 100; - } - - function clamp(v, min, max) { - return Math.min(max, Math.max(min, v)); - } - - function hslToRgb(parts) { - var r, g, b, h, s, l; - h = parseFloat(parts[0]) / 360 % 360; - if (h < 0) - h++; - s = clamp(percent(parts[1]), 0, 1); - l = clamp(percent(parts[2]), 0, 1); - if (s == 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hueToRgb(p, q, h + 1 / 3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1 / 3); - } - - return '#' + decToHex[Math.floor(r * 255)] + - decToHex[Math.floor(g * 255)] + - decToHex[Math.floor(b * 255)]; - } - - function hueToRgb(m1, m2, h) { - if (h < 0) - h++; - if (h > 1) - h--; - - if (6 * h < 1) - return m1 + (m2 - m1) * 6 * h; - else if (2 * h < 1) - return m2; - else if (3 * h < 2) - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - else - return m1; - } - - var processStyleCache = {}; - - function processStyle(styleString) { - if (styleString in processStyleCache) { - return processStyleCache[styleString]; - } - - var str, alpha = 1; - - styleString = String(styleString); - if (styleString.charAt(0) == '#') { - str = styleString; - } else if (/^rgb/.test(styleString)) { - var parts = getRgbHslContent(styleString); - var str = '#', n; - for (var i = 0; i < 3; i++) { - if (parts[i].indexOf('%') != -1) { - n = Math.floor(percent(parts[i]) * 255); - } else { - n = +parts[i]; - } - str += decToHex[clamp(n, 0, 255)]; - } - alpha = +parts[3]; - } else if (/^hsl/.test(styleString)) { - var parts = getRgbHslContent(styleString); - str = hslToRgb(parts); - alpha = parts[3]; - } else { - str = /*colorData[styleString] ||*/styleString; - } - return processStyleCache[styleString] = { color: str, alpha: alpha }; - } - - var DEFAULT_STYLE = { - style: 'normal', - variant: 'normal', - weight: 'normal', - size: 10, - family: 'sans-serif' - }; - - // Internal text style cache - // var fontStyleCache = {}; - - // function processFontStyle(styleString) { - // if (fontStyleCache[styleString]) { - // return fontStyleCache[styleString]; - // } - - // var el = document.createElement('div'); - // var style = el.style; - // try { - // style.font = styleString; - // } catch (ex) { - // // Ignore failures to set to invalid font. - // } - - // return fontStyleCache[styleString] = { - // style: style.fontStyle || DEFAULT_STYLE.style, - // variant: style.fontVariant || DEFAULT_STYLE.variant, - // weight: style.fontWeight || DEFAULT_STYLE.weight, - // size: style.fontSize || DEFAULT_STYLE.size, - // family: style.fontFamily || DEFAULT_STYLE.family - // }; - // } - - // function getComputedStyle(style, element) { - // var computedStyle = {}; - - // for (var p in style) { - // computedStyle[p] = style[p]; - // } - - // // Compute the size - // var canvasFontSize = parseFloat(element.currentStyle.fontSize), - // fontSize = parseFloat(style.size); - - // if (typeof style.size == 'number') { - // computedStyle.size = style.size; - // } else if (style.size.indexOf('px') != -1) { - // computedStyle.size = fontSize; - // } else if (style.size.indexOf('em') != -1) { - // computedStyle.size = canvasFontSize * fontSize; - // } else if(style.size.indexOf('%') != -1) { - // computedStyle.size = (canvasFontSize / 100) * fontSize; - // } else if (style.size.indexOf('pt') != -1) { - // computedStyle.size = fontSize / .75; - // } else { - // computedStyle.size = canvasFontSize; - // } - - // // Different scaling between normal text and VML text. This was found using - // // trial and error to get the same size as non VML text. - // computedStyle.size *= 0.981; - - // return computedStyle; - // } - - // function buildStyle(style) { - // return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + - // style.size + 'px ' + style.family; - // } - - var lineCapMap = { - 'butt': 'flat', - 'round': 'round' - }; - - function processLineCap(lineCap) { - return lineCapMap[lineCap] || 'square'; - } - - /** - * This class implements CanvasRenderingContext2D interface as described by - * the WHATWG. - * @param {HTMLElement} canvasElement The element that the 2D context should - * be associated with - */ - function CanvasRenderingContext2D_(canvasElement) { - this.m_ = createMatrixIdentity(); - - this.mStack_ = []; - this.aStack_ = []; - this.currentPath_ = []; - - // Canvas context properties - this.strokeStyle = '#000'; - this.fillStyle = '#000'; - - this.lineWidth = 1; - this.lineJoin = 'miter'; - this.lineCap = 'butt'; - this.miterLimit = Z * 1; - this.globalAlpha = 1; - //this.font = '10px sans-serif'; - //this.textAlign = 'left'; - //this.textBaseline = 'alphabetic'; - this.canvas = canvasElement; - - var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' + - canvasElement.clientHeight + 'px;overflow:hidden;position:absolute'; - var el = canvasElement.ownerDocument.createElement('div'); - el.style.cssText = cssText; - canvasElement.appendChild(el); - - var overlayEl = el.cloneNode(false); - // Use a non transparent background. - overlayEl.style.backgroundColor = 'red'; - overlayEl.style.filter = 'alpha(opacity=0)'; - canvasElement.appendChild(overlayEl); - - this.element_ = el; - this.arcScaleX_ = 1; - this.arcScaleY_ = 1; - this.lineScale_ = 1; - } - - var contextPrototype = CanvasRenderingContext2D_.prototype; - contextPrototype.clearRect = function () { - if (this.textMeasureEl_) { - this.textMeasureEl_.removeNode(true); - this.textMeasureEl_ = null; - } - this.element_.innerHTML = ''; - }; - - contextPrototype.beginPath = function () { - // TODO: Branch current matrix so that save/restore has no effect - // as per safari docs. - this.currentPath_ = []; - }; - - contextPrototype.moveTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'moveTo', x: p.x, y: p.y }); - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.lineTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'lineTo', x: p.x, y: p.y }); - - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY) { - var p = getCoords(this, aX, aY); - var cp1 = getCoords(this, aCP1x, aCP1y); - var cp2 = getCoords(this, aCP2x, aCP2y); - bezierCurveTo(this, cp1, cp2, p); - }; - - // Helper function that takes the already fixed cordinates. - function bezierCurveTo(self, cp1, cp2, p) { - self.currentPath_.push({ - type: 'bezierCurveTo', - cp1x: cp1.x, - cp1y: cp1.y, - cp2x: cp2.x, - cp2y: cp2.y, - x: p.x, - y: p.y - }); - self.currentX_ = p.x; - self.currentY_ = p.y; - } - - contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { - // the following is lifted almost directly from - // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes - - var cp = getCoords(this, aCPx, aCPy); - var p = getCoords(this, aX, aY); - - var cp1 = { - x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), - y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) - }; - var cp2 = { - x: cp1.x + (p.x - this.currentX_) / 3.0, - y: cp1.y + (p.y - this.currentY_) / 3.0 - }; - - bezierCurveTo(this, cp1, cp2, p); - }; - - contextPrototype.arc = function (aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise) { - aRadius *= Z; - var arcType = aClockwise ? 'at' : 'wa'; - - var xStart = aX + mc(aStartAngle) * aRadius - Z2; - var yStart = aY + ms(aStartAngle) * aRadius - Z2; - - var xEnd = aX + mc(aEndAngle) * aRadius - Z2; - var yEnd = aY + ms(aEndAngle) * aRadius - Z2; - - // IE won't render arches drawn counter clockwise if xStart == xEnd. - if (xStart == xEnd && !aClockwise) { - xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something - // that can be represented in binary - } - - var p = getCoords(this, aX, aY); - var pStart = getCoords(this, xStart, yStart); - var pEnd = getCoords(this, xEnd, yEnd); - - this.currentPath_.push({ type: arcType, - x: p.x, - y: p.y, - radius: aRadius, - xStart: pStart.x, - yStart: pStart.y, - xEnd: pEnd.x, - yEnd: pEnd.y - }); - - }; - - // contextPrototype.rect = function(aX, aY, aWidth, aHeight) { - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // }; - - // contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.stroke(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.fill(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { - // var gradient = new CanvasGradient_('gradient'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // return gradient; - // }; - - // contextPrototype.createRadialGradient = function(aX0, aY0, aR0, - // aX1, aY1, aR1) { - // var gradient = new CanvasGradient_('gradientradial'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.r0_ = aR0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // gradient.r1_ = aR1; - // return gradient; - // }; - - // contextPrototype.drawImage = function(image, var_args) { - // var dx, dy, dw, dh, sx, sy, sw, sh; - - // // to find the original width we overide the width and height - // var oldRuntimeWidth = image.runtimeStyle.width; - // var oldRuntimeHeight = image.runtimeStyle.height; - // image.runtimeStyle.width = 'auto'; - // image.runtimeStyle.height = 'auto'; - - // // get the original size - // var w = image.width; - // var h = image.height; - - // // and remove overides - // image.runtimeStyle.width = oldRuntimeWidth; - // image.runtimeStyle.height = oldRuntimeHeight; - - // if (arguments.length == 3) { - // dx = arguments[1]; - // dy = arguments[2]; - // sx = sy = 0; - // sw = dw = w; - // sh = dh = h; - // } else if (arguments.length == 5) { - // dx = arguments[1]; - // dy = arguments[2]; - // dw = arguments[3]; - // dh = arguments[4]; - // sx = sy = 0; - // sw = w; - // sh = h; - // } else if (arguments.length == 9) { - // sx = arguments[1]; - // sy = arguments[2]; - // sw = arguments[3]; - // sh = arguments[4]; - // dx = arguments[5]; - // dy = arguments[6]; - // dw = arguments[7]; - // dh = arguments[8]; - // } else { - // throw Error('Invalid number of arguments'); - // } - - // var d = getCoords(this, dx, dy); - - // var w2 = sw / 2; - // var h2 = sh / 2; - - // var vmlStr = []; - - // var W = 10; - // var H = 10; - - // // For some reason that I've now forgotten, using divs didn't work - // vmlStr.push(' ' , - // '', - // ''); - - // this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join('')); - // }; - - contextPrototype.stroke = function (aFill) { - var lineStr = []; - var lineOpen = false; - - var W = 10; - var H = 10; - - lineStr.push(''); - - if (!aFill) { - appendStroke(this, lineStr); - } else { - appendFill(this, lineStr, min, max); - } - - lineStr.push(''); - - this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - }; - - function appendStroke(ctx, lineStr) { - var a = processStyle(ctx.strokeStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - var lineWidth = ctx.lineScale_ * ctx.lineWidth; - - // VML cannot correctly render a line if the width is less than 1px. - // In that case, we dilute the color to make the line look thinner. - if (lineWidth < 1) { - opacity *= lineWidth; - } - - lineStr.push( - '' - ); - } - - function appendFill(ctx, lineStr, min, max) { - var fillStyle = ctx.fillStyle; - var arcScaleX = ctx.arcScaleX_; - var arcScaleY = ctx.arcScaleY_; - var width = max.x - min.x; - var height = max.y - min.y; - // if (fillStyle instanceof CanvasGradient_) { - // // TODO: Gradients transformed with the transformation matrix. - // var angle = 0; - // var focus = {x: 0, y: 0}; - - // // additional offset - // var shift = 0; - // // scale factor for offset - // var expansion = 1; - - // if (fillStyle.type_ == 'gradient') { - // var x0 = fillStyle.x0_ / arcScaleX; - // var y0 = fillStyle.y0_ / arcScaleY; - // var x1 = fillStyle.x1_ / arcScaleX; - // var y1 = fillStyle.y1_ / arcScaleY; - // var p0 = getCoords(ctx, x0, y0); - // var p1 = getCoords(ctx, x1, y1); - // var dx = p1.x - p0.x; - // var dy = p1.y - p0.y; - // angle = Math.atan2(dx, dy) * 180 / Math.PI; - - // // The angle should be a non-negative number. - // if (angle < 0) { - // angle += 360; - // } - - // // Very small angles produce an unexpected result because they are - // // converted to a scientific notation string. - // if (angle < 1e-6) { - // angle = 0; - // } - // } else { - // var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_); - // focus = { - // x: (p0.x - min.x) / width, - // y: (p0.y - min.y) / height - // }; - - // width /= arcScaleX * Z; - // height /= arcScaleY * Z; - // var dimension = m.max(width, height); - // shift = 2 * fillStyle.r0_ / dimension; - // expansion = 2 * fillStyle.r1_ / dimension - shift; - // } - - // // We need to sort the color stops in ascending order by offset, - // // otherwise IE won't interpret it correctly. - // var stops = fillStyle.colors_; - // stops.sort(function(cs1, cs2) { - // return cs1.offset - cs2.offset; - // }); - - // var length = stops.length; - // var color1 = stops[0].color; - // var color2 = stops[length - 1].color; - // var opacity1 = stops[0].alpha * ctx.globalAlpha; - // var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; - - // var colors = []; - // for (var i = 0; i < length; i++) { - // var stop = stops[i]; - // colors.push(stop.offset * expansion + shift + ' ' + stop.color); - // } - - // // When colors attribute is used, the meanings of opacity and o:opacity2 - // // are reversed. - // lineStr.push(''); - // } else if (fillStyle instanceof CanvasPattern_) { - // if (width && height) { - // var deltaLeft = -min.x; - // var deltaTop = -min.y; - // lineStr.push(''); - // } - // } else { - var a = processStyle(ctx.fillStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - lineStr.push(''); - // } - } - - contextPrototype.fill = function () { - this.stroke(true); - }; - - contextPrototype.closePath = function () { - this.currentPath_.push({ type: 'close' }); - }; - - function getCoords(ctx, aX, aY) { - var m = ctx.m_; - return { - x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, - y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 - }; - }; - - contextPrototype.save = function () { - var o = {}; - copyState(this, o); - this.aStack_.push(o); - this.mStack_.push(this.m_); - this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); - }; - - contextPrototype.restore = function () { - if (this.aStack_.length) { - copyState(this.aStack_.pop(), this); - this.m_ = this.mStack_.pop(); - } - }; - - function matrixIsFinite(m) { - return isFinite(m[0][0]) && isFinite(m[0][1]) && - isFinite(m[1][0]) && isFinite(m[1][1]) && - isFinite(m[2][0]) && isFinite(m[2][1]); - } - - function setM(ctx, m, updateLineScale) { - if (!matrixIsFinite(m)) { - return; - } - ctx.m_ = m; - - if (updateLineScale) { - // Get the line scale. - // Determinant of this.m_ means how much the area is enlarged by the - // transformation. So its square root can be used as a scale factor - // for width. - var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; - ctx.lineScale_ = sqrt(abs(det)); - } - } - - contextPrototype.translate = function (aX, aY) { - var m1 = [ - [1, 0, 0], - [0, 1, 0], - [aX, aY, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), false); - }; - - // contextPrototype.rotate = function(aRot) { - // var c = mc(aRot); - // var s = ms(aRot); - - // var m1 = [ - // [c, s, 0], - // [-s, c, 0], - // [0, 0, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), false); - // }; - - contextPrototype.scale = function (aX, aY) { - this.arcScaleX_ *= aX; - this.arcScaleY_ *= aY; - var m1 = [ - [aX, 0, 0], - [0, aY, 0], - [0, 0, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), true); - }; - - // contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { - // var m1 = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), true); - // }; - - // contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { - // var m = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, m, true); - // }; - - /** - * The text drawing function. - * The maxWidth argument isn't taken in account, since no browser supports - * it yet. - */ - // contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { - // var m = this.m_, - // delta = 1000, - // left = 0, - // right = delta, - // offset = {x: 0, y: 0}, - // lineStr = []; - - // var fontStyle = getComputedStyle(processFontStyle(this.font), - // this.element_); - - // var fontStyleString = buildStyle(fontStyle); - - // var elementStyle = this.element_.currentStyle; - // var textAlign = this.textAlign.toLowerCase(); - // switch (textAlign) { - // case 'left': - // case 'center': - // case 'right': - // break; - // case 'end': - // textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; - // break; - // case 'start': - // textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; - // break; - // default: - // textAlign = 'left'; - // } - - // // 1.75 is an arbitrary number, as there is no info about the text baseline - // switch (this.textBaseline) { - // case 'hanging': - // case 'top': - // offset.y = fontStyle.size / 1.75; - // break; - // case 'middle': - // break; - // default: - // case null: - // case 'alphabetic': - // case 'ideographic': - // case 'bottom': - // offset.y = -fontStyle.size / 2.25; - // break; - // } - - // switch(textAlign) { - // case 'right': - // left = delta; - // right = 0.05; - // break; - // case 'center': - // left = right = delta / 2; - // break; - // } - - // var d = getCoords(this, x + offset.x, y + offset.y); - - // lineStr.push(''); - - // if (stroke) { - // appendStroke(this, lineStr); - // } else { - // // TODO: Fix the min and max params. - // appendFill(this, lineStr, {x: -left, y: 0}, - // {x: right, y: fontStyle.size}); - // } - - // var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + - // m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; - - // var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); - - // lineStr.push('', - // '', - // ''); - - // this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - // }; - - // contextPrototype.fillText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, false); - // }; - - // contextPrototype.strokeText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, true); - // }; - - // contextPrototype.measureText = function(text) { - // if (!this.textMeasureEl_) { - // var s = ''; - // this.element_.insertAdjacentHTML('beforeEnd', s); - // this.textMeasureEl_ = this.element_.lastChild; - // } - // var doc = this.element_.ownerDocument; - // this.textMeasureEl_.innerHTML = ''; - // this.textMeasureEl_.style.font = this.font; - // // Don't use innerHTML or innerText because they allow markup/whitespace. - // this.textMeasureEl_.appendChild(doc.createTextNode(text)); - // return {width: this.textMeasureEl_.offsetWidth}; - // }; - - /******** STUBS ********/ - // contextPrototype.clip = function() { - // // TODO: Implement - // }; - - // contextPrototype.arcTo = function() { - // // TODO: Implement - // }; - - // contextPrototype.createPattern = function(image, repetition) { - // return new CanvasPattern_(image, repetition); - // }; - - // // Gradient / Pattern Stubs - // function CanvasGradient_(aType) { - // this.type_ = aType; - // this.x0_ = 0; - // this.y0_ = 0; - // this.r0_ = 0; - // this.x1_ = 0; - // this.y1_ = 0; - // this.r1_ = 0; - // this.colors_ = []; - // } - - // CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { - // aColor = processStyle(aColor); - // this.colors_.push({offset: aOffset, - // color: aColor.color, - // alpha: aColor.alpha}); - // }; - - // function CanvasPattern_(image, repetition) { - // assertImageIsValid(image); - // switch (repetition) { - // case 'repeat': - // case null: - // case '': - // this.repetition_ = 'repeat'; - // break - // case 'repeat-x': - // case 'repeat-y': - // case 'no-repeat': - // this.repetition_ = repetition; - // break; - // default: - // throwException('SYNTAX_ERR'); - // } - - // this.src_ = image.src; - // this.width_ = image.width; - // this.height_ = image.height; - // } - - function throwException(s) { - throw new DOMException_(s); - } - - // function assertImageIsValid(img) { - // if (!img || img.nodeType != 1 || img.tagName != 'IMG') { - // throwException('TYPE_MISMATCH_ERR'); - // } - // if (img.readyState != 'complete') { - // throwException('INVALID_STATE_ERR'); - // } - // } - - function DOMException_(s) { - this.code = this[s]; - this.message = s + ': DOM Exception ' + this.code; - } - var p = DOMException_.prototype = new Error; - p.INDEX_SIZE_ERR = 1; - p.DOMSTRING_SIZE_ERR = 2; - p.HIERARCHY_REQUEST_ERR = 3; - p.WRONG_DOCUMENT_ERR = 4; - p.INVALID_CHARACTER_ERR = 5; - p.NO_DATA_ALLOWED_ERR = 6; - p.NO_MODIFICATION_ALLOWED_ERR = 7; - p.NOT_FOUND_ERR = 8; - p.NOT_SUPPORTED_ERR = 9; - p.INUSE_ATTRIBUTE_ERR = 10; - p.INVALID_STATE_ERR = 11; - p.SYNTAX_ERR = 12; - p.INVALID_MODIFICATION_ERR = 13; - p.NAMESPACE_ERR = 14; - p.INVALID_ACCESS_ERR = 15; - p.VALIDATION_ERR = 16; - p.TYPE_MISMATCH_ERR = 17; - - // set up externs - G_vmlCanvasManager = G_vmlCanvasManager_; - CanvasRenderingContext2D = CanvasRenderingContext2D_; - //CanvasGradient = CanvasGradient_; - //CanvasPattern = CanvasPattern_; - DOMException = DOMException_; - })(); - -} // if -/*! - * jQuery UI Widget @VERSION - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ - -if ( ! $.widget ) { - -(function( $, undefined ) { - -// jQuery 1.4+ -if ( $.cleanData ) { - var _cleanData = $.cleanData; - $.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - try { - $( elem ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - } - _cleanData( elems ); - }; -} else { - var _remove = $.fn.remove; - $.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( [ this ] ).each(function() { - try { - $( this ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - }); - } - } - return _remove.call( $(this), selector, keepData ); - }); - }; -} - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from -// $.each( basePrototype, function( key, val ) { -// if ( $.isPlainObject(val) ) { -// basePrototype[ key ] = $.extend( {}, val ); -// } -// }); - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = Array.prototype.slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - // prevent calls to internal methods - if ( isMethodCall && options.charAt( 0 ) === "_" ) { - return returnValue; - } - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ), - methodValue = instance && $.isFunction( instance[options] ) ? - instance[ options ].apply( instance, args ) : - instance; - // TODO: add this back in 1.9 and use $.error() (see #5972) -// if ( !instance ) { -// throw "cannot call methods on " + name + " prior to initialization; " + -// "attempted to call method '" + options + "'"; -// } -// if ( !$.isFunction( instance[options] ) ) { -// throw "no such method '" + options + "' for " + name + " widget instance"; -// } -// var methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - $.data( this, name, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - // $.widget.bridge stores the plugin instance, but we do it anyway - // so that it's stored even before the _create function runs - $.data( element, this.widgetName, this ); - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - this._getCreateOptions(), - options ); - - var self = this; - this.element.bind( "remove." + this.widgetName, function() { - self.destroy(); - }); - - this._create(); - this._trigger( "create" ); - this._init(); - }, - _getCreateOptions: function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }, - _create: function() {}, - _init: function() {}, - - destroy: function() { - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - }, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, this.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var self = this; - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - [ value ? "addClass" : "removeClass"]( - this.widgetBaseClass + "-disabled" + " " + - "ui-state-disabled" ) - .attr( "aria-disabled", value ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - - return !( $.isFunction(callback) && - callback.call( this.element[0], event, data ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); - -} - -/*! JsRender v1.0pre - (jsrender.js version: does not require jQuery): http://github.com/BorisMoore/jsrender */ -/* - * Optimized version of jQuery Templates, fosr rendering to string, using 'codeless' markup. - * - * Copyright 2011, Boris Moore - * Released under the MIT License. - */ -window.JsViews || window.jQuery && jQuery.views || (function( window, undefined ) { - -var $, _$, JsViews, viewsNs, tmplEncode, render, rTag, registerTags, registerHelpers, extend, - FALSE = false, TRUE = true, - jQuery = window.jQuery, document = window.document, - htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /, - rPath = /^(true|false|null|[\d\.]+)|(\w+|\$(view|data|ctx|(\w+)))([\w\.]*)|((['"])(?:\\\1|.)*\7)$/g, - rParams = /(\$?[\w\.\[\]]+)(?:(\()|\s*(===|!==|==|!=|<|>|<=|>=)\s*|\s*(\=)\s*)?|(\,\s*)|\\?(\')|\\?(\")|(\))|(\s+)/g, - rNewLine = /\r?\n/g, - rUnescapeQuotes = /\\(['"])/g, - rEscapeQuotes = /\\?(['"])/g, - rBuildHash = /\x08([^\x08]+)\x08/g, - autoName = 0, - escapeMapForHtml = { - "&": "&", - "<": "<", - ">": ">" - }, - htmlSpecialChar = /[\x00"&'<>]/g, - slice = Array.prototype.slice; - -if ( jQuery ) { - - //////////////////////////////////////////////////////////////////////////////////////////////// - // jQuery is loaded, so make $ the jQuery object - $ = jQuery; - - $.fn.extend({ - // Use first wrapped element as template markup. - // Return string obtained by rendering the template against data. - render: function( data, context, parentView, path ) { - return render( data, this[0], context, parentView, path ); - }, - - // Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template. - template: function( name, context ) { - return $.template( name, this[0], context ); - } - }); - -} else { - - //////////////////////////////////////////////////////////////////////////////////////////////// - // jQuery is not loaded. Make $ the JsViews object - - // Map over the $ in case of overwrite - _$ = window.$; - - window.JsViews = JsViews = window.$ = $ = { - extend: function( target, source ) { - var name; - for ( name in source ) { - target[ name ] = source[ name ]; - } - return target; - }, - isArray: Array.isArray || function( obj ) { - return Object.prototype.toString.call( obj ) === "[object Array]"; - }, - noConflict: function() { - if ( window.$ === JsViews ) { - window.$ = _$; - } - return JsViews; - } - }; -} - -extend = $.extend; - -//================= -// View constructor -//================= - -function View( context, path, parentView, data, template ) { - // Returns a view data structure for a new rendered instance of a template. - // The content field is a hierarchical array of strings and nested views. - - parentView = parentView || { viewsCount:0, ctx: viewsNs.helpers }; - - var parentContext = parentView && parentView.ctx; - - return { - jsViews: "v1.0pre", - path: path || "", - // inherit context from parentView, merged with new context. - itemNumber: ++parentView.viewsCount || 1, - viewsCount: 0, - tmpl: template, - data: data || parentView.data || {}, - // Set additional context on this view (which will modify the context inherited from the parent, and be inherited by child views) - ctx : context && context === parentContext - ? parentContext - : (parentContext ? extend( extend( {}, parentContext ), context ) : context||{}), - // If no jQuery, extend does not support chained copies - so limit to two parameters - parent: parentView - }; -} -extend( $, { - views: viewsNs = { - templates: {}, - tags: { - "if": function() { - var ifTag = this, - view = ifTag._view; - view.onElse = function( presenter, args ) { - var i = 0, - l = args.length; - while ( l && !args[ i++ ]) { - // Only render content if args.length === 0 (i.e. this is an else with no condition) or if a condition argument is truey - if ( i === l ) { - return ""; - } - } - view.onElse = undefined; // If condition satisfied, so won't run 'else'. - return render( view.data, presenter.tmpl, view.ctx, view); - }; - return view.onElse( this, arguments ); - }, - "else": function() { - var view = this._view; - return view.onElse ? view.onElse( this, arguments ) : ""; - }, - each: function() { - var i, - self = this, - result = "", - args = arguments, - l = args.length, - content = self.tmpl, - view = self._view; - for ( i = 0; i < l; i++ ) { - result += args[ i ] ? render( args[ i ], content, self.ctx || view.ctx, view, self._path, self._ctor ) : ""; - } - return l ? result - // If no data parameter, use the current $data from view, and render once - : result + render( view.data, content, view.ctx, view, self._path, self.tag ); - }, - "=": function( value ) { - return value; - }, - "*": function( value ) { - return value; - } - }, - helpers: { - not: function( value ) { - return !value; - } - }, - allowCode: FALSE, - debugMode: TRUE, - err: function( e ) { - return viewsNs.debugMode ? ("
        Error: " + (e.message || e) + ". "): '""'; - }, - -//=============== -// setDelimiters -//=============== - - setDelimiters: function( openTag, closeTag ) { - // Set or modify the delimiter characters for tags: "{{" and "}}" - var firstCloseChar = closeTag.charAt( 0 ), - secondCloseChar = closeTag.charAt( 1 ); - openTag = "\\" + openTag.charAt( 0 ) + "\\" + openTag.charAt( 1 ); - closeTag = "\\" + firstCloseChar + "\\" + secondCloseChar; - - // Build regex with new delimiters - // {{ - rTag = openTag - // # tag (followed by space,! or }) or equals or code - + "(?:(?:(\\#)?(\\w+(?=[!\\s\\" + firstCloseChar + "]))" + "|(?:(\\=)|(\\*)))" - // params - + "\\s*((?:[^\\" + firstCloseChar + "]|\\" + firstCloseChar + "(?!\\" + secondCloseChar + "))*?)" - // encoding - + "(!(\\w*))?" - // closeBlock - + "|(?:\\/([\\w\\$\\.\\[\\]]+)))" - // }} - + closeTag; - - // Default rTag: # tag equals code params encoding closeBlock - // /\{\{(?:(?:(\#)?(\w+(?=[\s\}!]))|(?:(\=)|(\*)))((?:[^\}]|\}(?!\}))*?)(!(\w*))?|(?:\/([\w\$\.\[\]]+)))\}\}/g; - - rTag = new RegExp( rTag, "g" ); - }, - - -//=============== -// registerTags -//=============== - - // Register declarative tag. - registerTags: registerTags = function( name, tagFn ) { - var key; - if ( typeof name === "object" ) { - for ( key in name ) { - registerTags( key, name[ key ]); - } - } else { - // Simple single property case. - viewsNs.tags[ name ] = tagFn; - } - return this; - }, - -//=============== -// registerHelpers -//=============== - - // Register helper function for use in markup. - registerHelpers: registerHelpers = function( name, helper ) { - if ( typeof name === "object" ) { - // Object representation where property name is path and property value is value. - // TODO: We've discussed an "objectchange" event to capture all N property updates here. See TODO note above about propertyChanges. - var key; - for ( key in name ) { - registerHelpers( key, name[ key ]); - } - } else { - // Simple single property case. - viewsNs.helpers[ name ] = helper; - } - return this; - }, - -//=============== -// tmpl.encode -//=============== - - encode: function( encoding, text ) { - return text - ? ( tmplEncode[ encoding || "html" ] || tmplEncode.html)( text ) // HTML encoding is the default - : ""; - }, - - encoders: tmplEncode = { - "none": function( text ) { - return text; - }, - "html": function( text ) { - // HTML encoding helper: Replace < > & and ' and " by corresponding entities. - // Implementation, from Mike Samuel - return String( text ).replace( htmlSpecialChar, replacerForHtml ); - } - //TODO add URL encoding, and perhaps other encoding helpers... - }, - -//=============== -// renderTag -//=============== - - renderTag: function( tag, view, encode, content, tagProperties ) { - // This is a tag call, with arguments: "tag", view, encode, content, presenter [, params...] - var ret, ctx, name, - args = arguments, - presenters = viewsNs.presenters; - hash = tagProperties._hash, - tagFn = viewsNs.tags[ tag ]; - - if ( !tagFn ) { - return ""; - } - - content = content && view.tmpl.nested[ content - 1 ]; - tagProperties.tmpl = tagProperties.tmpl || content || undefined; - // Set the tmpl property to the content of the block tag, unless set as an override property on the tag - - if ( presenters && presenters[ tag ]) { - ctx = extend( extend( {}, tagProperties.ctx ), tagProperties ); - delete ctx.ctx; - delete ctx._path; - delete ctx.tmpl; - tagProperties.ctx = ctx; - tagProperties._ctor = tag + (hash ? "=" + hash.slice( 0, -1 ) : ""); - - tagProperties = extend( extend( {}, tagFn ), tagProperties ); - tagFn = viewsNs.tags.each; // Use each to render the layout template against the data - } - - tagProperties._encode = encode; - tagProperties._view = view; - ret = tagFn.apply( tagProperties, args.length > 5 ? slice.call( args, 5 ) : [view.data] ); - return ret || (ret === undefined ? "" : ret.toString()); // (If ret is the value 0 or false or null, will render to string) - } - }, - -//=============== -// render -//=============== - - render: render = function( data, tmpl, context, parentView, path, tagName ) { - // Render template against data as a tree of subviews (nested template), or as a string (top-level template). - // tagName parameter for internal use only. Used for rendering templates registered as tags (which may have associated presenter objects) - var i, l, dataItem, arrayView, content, result = ""; - - if ( arguments.length === 2 && data.jsViews ) { - parentView = data; - context = parentView.ctx; - data = parentView.data; - } - tmpl = $.template( tmpl ); - if ( !tmpl ) { - return ""; // Could throw... - } - - if ( $.isArray( data )) { - // Create a view item for the array, whose child views correspond to each data item. - arrayView = new View( context, path, parentView, data); - l = data.length; - for ( i = 0, l = data.length; i < l; i++ ) { - dataItem = data[ i ]; - content = dataItem ? tmpl( dataItem, new View( context, path, arrayView, dataItem, tmpl, this )) : ""; - result += viewsNs.activeViews ? "" + content + "" : content; - } - } else { - result += tmpl( data, new View( context, path, parentView, data, tmpl )); - } - - return viewsNs.activeViews - // If in activeView mode, include annotations - ? "" + result + "" - // else return just the string result - : result; - }, - -//=============== -// template -//=============== - - template: function( name, tmpl ) { - // Set: - // Use $.template( name, tmpl ) to cache a named template, - // where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc. - // Use $( "selector" ).template( name ) to provide access by name to a script block template declaration. - - // Get: - // Use $.template( name ) to access a cached template. - // Also $( selectorToScriptBlock ).template(), or $.template( null, templateString ) - // will return the compiled template, without adding a name reference. - // If templateString is not a selector, $.template( templateString ) is equivalent - // to $.template( null, templateString ). To ensure a string is treated as a template, - // include an HTML element, an HTML comment, or a template comment tag. - - if (tmpl) { - // Compile template and associate with name - if ( "" + tmpl === tmpl ) { // type string - // This is an HTML string being passed directly in. - tmpl = compile( tmpl ); - } else if ( jQuery && tmpl instanceof $ ) { - tmpl = tmpl[0]; - } - if ( tmpl ) { - if ( jQuery && tmpl.nodeType ) { - // If this is a template block, use cached copy, or generate tmpl function and cache. - tmpl = $.data( tmpl, "tmpl" ) || $.data( tmpl, "tmpl", compile( tmpl.innerHTML )); - } - viewsNs.templates[ tmpl._name = tmpl._name || name || "_" + autoName++ ] = tmpl; - } - return tmpl; - } - // Return named compiled template - return name - ? "" + name !== name // not type string - ? (name._name - ? name // already compiled - : $.template( null, name )) - : viewsNs.templates[ name ] || - // If not in map, treat as a selector. (If integrated with core, use quickExpr.exec) - $.template( null, htmlExpr.test( name ) ? name : try$( name )) - : null; - } -}); - -viewsNs.setDelimiters( "{{", "}}" ); - -//================= -// compile template -//================= - -// Generate a reusable function that will serve to render a template against data -// (Compile AST then build template function) - -function parsePath( all, comp, object, viewDataCtx, viewProperty, path, string, quot ) { - return object - ? ((viewDataCtx - ? viewProperty - ? ("$view." + viewProperty) - : object - :("$data." + object) - ) + ( path || "" )) - : string || (comp || ""); -} - -function compile( markup ) { - var newNode, - loc = 0, - stack = [], - topNode = [], - content = topNode, - current = [,,topNode]; - - function pushPreceedingContent( shift ) { - shift -= loc; - if ( shift ) { - content.push( markup.substr( loc, shift ).replace( rNewLine,"\\n")); - } - } - - function parseTag( all, isBlock, tagName, equals, code, params, useEncode, encode, closeBlock, index ) { - // rTag : # tagName equals code params encode closeBlock - // /\{\{(?:(?:(\#)?(\w+(?=[\s\}!]))|(?:(\=)|(\*)))((?:[^\}]|\}(?!\}))*?)(!(\w*))?|(?:\/([\w\$\.\[\]]+)))\}\}/g; - - // Build abstract syntax tree: [ tagName, params, content, encode ] - var named, - hash = "", - parenDepth = 0, - quoted = FALSE, // boolean for string content in double qoutes - aposed = FALSE; // or in single qoutes - - function parseParams( all, path, paren, comp, eq, comma, apos, quot, rightParen, space, index ) { - // path paren eq comma apos quot rtPrn space - // /(\$?[\w\.\[\]]+)(?:(\()|(===)|(\=))?|(\,\s*)|\\?(\')|\\?(\")|(\))|(\s+)/g - - return aposed - // within single-quoted string - ? ( aposed = !apos, (aposed ? all : '"')) - : quoted - // within double-quoted string - ? ( quoted = !quot, (quoted ? all : '"')) - : comp - // comparison - ? ( path.replace( rPath, parsePath ) + comp) - : eq - // named param - ? parenDepth ? "" :( named = TRUE, '\b' + path + ':') - : paren - // function - ? (parenDepth++, path.replace( rPath, parsePath ) + '(') - : rightParen - // function - ? (parenDepth--, ")") - : path - // path - ? path.replace( rPath, parsePath ) - : comma - ? "," - : space - ? (parenDepth - ? "" - : named - ? ( named = FALSE, "\b") - : "," - ) - : (aposed = apos, quoted = quot, '"'); - } - - tagName = tagName || equals; - pushPreceedingContent( index ); - if ( code ) { - if ( viewsNs.allowCode ) { - content.push([ "*", params.replace( rUnescapeQuotes, "$1" )]); - } - } else if ( tagName ) { - if ( tagName === "else" ) { - current = stack.pop(); - content = current[ 2 ]; - isBlock = TRUE; - } - params = (params - ? (params + " ") - .replace( rParams, parseParams ) - .replace( rBuildHash, function( all, keyValue, index ) { - hash += keyValue + ","; - return ""; - }) - : ""); - params = params.slice( 0, -1 ); - newNode = [ - tagName, - useEncode ? encode || "none" : "", - isBlock && [], - "{" + hash + "_hash:'" + hash + "',_path:'" + params + "'}", - params - ]; - - if ( isBlock ) { - stack.push( current ); - current = newNode; - } - content.push( newNode ); - } else if ( closeBlock ) { - current = stack.pop(); - } - loc = index + all.length; // location marker - parsed up to here - if ( !current ) { - throw "Expected block tag"; - } - content = current[ 2 ]; - } - markup = markup.replace( rEscapeQuotes, "\\$1" ); - markup.replace( rTag, parseTag ); - pushPreceedingContent( markup.length ); - return buildTmplFunction( topNode ); -} - -// Build javascript compiled template function, from AST -function buildTmplFunction( nodes ) { - var ret, node, i, - nested = [], - l = nodes.length, - code = "try{var views=" - + (jQuery ? "jQuery" : "JsViews") - + '.views,tag=views.renderTag,enc=views.encode,html=views.encoders.html,$ctx=$view && $view.ctx,result=""+\n\n'; - - for ( i = 0; i < l; i++ ) { - node = nodes[ i ]; - if ( node[ 0 ] === "*" ) { - code = code.slice( 0, i ? -1 : -3 ) + ";" + node[ 1 ] + ( i + 1 < l ? "result+=" : "" ); - } else if ( "" + node === node ) { // type string - code += '"' + node + '"+'; - } else { - var tag = node[ 0 ], - encode = node[ 1 ], - content = node[ 2 ], - obj = node[ 3 ], - params = node[ 4 ], - paramsOrEmptyString = params + '||"")+'; - - if( content ) { - nested.push( buildTmplFunction( content )); - } - code += tag === "=" - ? (!encode || encode === "html" - ? "html(" + paramsOrEmptyString - : encode === "none" - ? ("(" + paramsOrEmptyString) - : ('enc("' + encode + '",' + paramsOrEmptyString) - ) - : 'tag("' + tag + '",$view,"' + ( encode || "" ) + '",' - + (content ? nested.length : '""') // For block tags, pass in the key (nested.length) to the nested content template - + "," + obj + (params ? "," : "") + params + ")+"; - } - } - ret = new Function( "$data, $view", code.slice( 0, -1) + ";return result;\n\n}catch(e){return views.err(e);}" ); - ret.nested = nested; - return ret; -} - -//========================== Private helper functions, used by code above ========================== - -function replacerForHtml( ch ) { - // Original code from Mike Samuel - return escapeMapForHtml[ ch ] - // Intentional assignment that caches the result of encoding ch. - || ( escapeMapForHtml[ ch ] = "&#" + ch.charCodeAt( 0 ) + ";" ); -} - -function try$( selector ) { - // If selector is valid, return jQuery object, otherwise return (invalid) selector string - try { - return $( selector ); - } catch( e) {} - return selector; -} -})( window ); -(function ($, window, undefined) { - var pos_oo = Number.POSITIVE_INFINITY, - neg_oo = Number.NEGATIVE_INFINITY; - - $.geo = { - // - // utility functions - // - - _allCoordinates: function (geom) { - // return array of all positions in all geometries of geom - // not in JTS - var geometries = this._flatten(geom), - curGeom = 0, - result = []; - - for (; curGeom < geometries.length; curGeom++) { - var coordinates = geometries[curGeom].coordinates, - isArray = coordinates && $.isArray(coordinates[0]), - isDblArray = isArray && $.isArray(coordinates[0][0]), - isTriArray = isDblArray && $.isArray(coordinates[0][0][0]), - i, j, k; - - if (!isTriArray) { - if (!isDblArray) { - if (!isArray) { - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - - for (i = 0; i < coordinates.length; i++) { - for (j = 0; j < coordinates[i].length; j++) { - for (k = 0; k < coordinates[i][j].length; k++) { - result.push(coordinates[i][j][k]); - } - } - } - } - return result; - }, - - _isGeodetic: function( coords ) { - // returns true if the first coordinate it can find is geodetic - - while ( $.isArray( coords ) ) { - if ( coords.length > 1 && ! $.isArray( coords[ 0 ] ) ) { - return ( coords[ 0 ] >= -180 && coords[ 0 ] <= 180 && coords[ 1 ] >= -85 && coords[ 1 ] <= 85 ); - } else { - coords = coords[ 0 ]; - } - } - - return false; - }, - - // - // bbox functions - // - - center: function (bbox, _ignoreGeo /* Internal Use Only */) { - // Envelope.centre in JTS - // bbox only, use centroid for geom - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2]; - return wasGeodetic ? $.geo.proj.toGeodetic(center) : center; - }, - - expandBy: function (bbox, dx, dy, _ignoreGeo /* Internal Use Only */) { - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - bbox = [bbox[0] - dx, bbox[1] - dy, bbox[2] + dx, bbox[3] + dy]; - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - height: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - - return bbox[3] - bbox[1]; - }, - - _in: function(bbox1, bbox2) { - return bbox1[0] <= bbox2[0] && - bbox1[1] <= bbox2[1] && - bbox1[2] >= bbox2[2] && - bbox1[3] >= bbox2[3]; - }, - - _bboxDisjoint: function( bbox1, bbox2 ) { - return bbox2[ 0 ] > bbox1[ 2 ] || - bbox2[ 2 ] < bbox1[ 0 ] || - bbox2[ 1 ] > bbox1[ 3 ] || - bbox2[ 3 ] < bbox1[ 1 ]; - }, - - reaspect: function (bbox, ratio, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var width = this.width(bbox, true), - height = this.height(bbox, true), - center = this.center(bbox, true), - dx, dy; - - if (width != 0 && height != 0 && ratio > 0) { - if (width / height > ratio) { - dx = width / 2; - dy = dx / ratio; - } else { - dy = height / 2; - dx = dy * ratio; - } - - bbox = [center[0] - dx, center[1] - dy, center[0] + dx, center[1] + dy]; - } - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - recenter: function( bbox, center, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj ) { - if ( this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - if ( this._isGeodetic( center ) ) { - center = $.geo.proj.fromGeodetic(center); - } - } - - var halfWidth = ( bbox[ 2 ] - bbox[ 0 ] ) / 2, - halfHeight = ( bbox[ 3 ] - bbox[ 1 ] ) / 2; - - bbox = [ - center[ 0 ] - halfWidth, - center[ 1 ] - halfHeight, - center[ 0 ] + halfWidth, - center[ 1 ] + halfHeight - ]; - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - scaleBy: function ( bbox, scale, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var c = this.center(bbox, true), - dx = (bbox[2] - bbox[0]) * scale / 2, - dy = (bbox[3] - bbox[1]) * scale / 2; - - bbox = [c[0] - dx, c[1] - dy, c[0] + dx, c[1] + dy]; - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - width: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - - return bbox[2] - bbox[0]; - }, - - // - // geometry functions - // - - // bbox (Geometry.getEnvelope in JTS) - - bbox: function ( geom, _ignoreGeo /* Internal Use Only */ ) { - if ( !geom ) { - return undefined; - } else if ( geom.bbox ) { - result = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom.bbox ) ) ? $.geo.proj.fromGeodetic( geom.bbox ) : geom.bbox; - } else { - result = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - - var coordinates = this._allCoordinates( geom ), - curCoord = 0; - - if ( coordinates.length == 0 ) { - return undefined; - } - - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( coordinates ) ) { - wasGeodetic = true; - coordinates = $.geo.proj.fromGeodetic( coordinates ); - } - - for ( ; curCoord < coordinates.length; curCoord++ ) { - result[0] = Math.min(coordinates[curCoord][0], result[0]); - result[1] = Math.min(coordinates[curCoord][1], result[1]); - result[2] = Math.max(coordinates[curCoord][0], result[2]); - result[3] = Math.max(coordinates[curCoord][1], result[3]); - } - } - - return wasGeodetic ? $.geo.proj.toGeodetic(result) : result; - }, - - // centroid - - centroid: function( geom, _ignoreGeo /* Internal Use Only */ ) { - switch (geom.type) { - case "Point": - return $.extend({}, geom); - - case "LineString": - case "Polygon": - var a = 0, - c = [0, 0], - coords = $.merge( [ ], geom.type == "Polygon" ? geom.coordinates[0] : geom.coordinates ), - i = 1, j, n; - - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( coords ) ) { - wasGeodetic = true; - coords = $.geo.proj.fromGeodetic(coords); - } - - //if (coords[0][0] != coords[coords.length - 1][0] || coords[0][1] != coords[coords.length - 1][1]) { - // coords.push(coords[0]); - //} - - for (; i <= coords.length; i++) { - j = i % coords.length; - n = (coords[i - 1][0] * coords[j][1]) - (coords[j][0] * coords[i - 1][1]); - a += n; - c[0] += (coords[i - 1][0] + coords[j][0]) * n; - c[1] += (coords[i - 1][1] + coords[j][1]) * n; - } - - if (a == 0) { - if (coords.length > 0) { - c[0] = coords[0][0]; - c[1] = coords[0][1]; - return { type: "Point", coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c }; - } else { - return undefined; - } - } - - a *= 3; - c[0] /= a; - c[1] /= a; - - return { type: "Point", coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c }; - } - return undefined; - }, - - // contains - - contains: function (geom1, geom2) { - if (geom1.type != "Polygon") { - return false; - } - - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1.coordinates, geom2.coordinates); - - case "LineString": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates); - - case "Polygon": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates[0]); - - default: - return false; - } - }, - - _containsPolygonPoint: function (polygonCoordinates, pointCoordinate) { - if (polygonCoordinates.length == 0 || polygonCoordinates[0].length < 4) { - return false; - } - - var rayCross = 0, - a = polygonCoordinates[0][0], - i = 1, - b, - x; - - for (; i < polygonCoordinates[0].length; i++) { - b = polygonCoordinates[0][i]; - - if ((a[1] <= pointCoordinate[1] && pointCoordinate[1] < b[1]) || (b[1] <= pointCoordinate[1] && pointCoordinate[1] < a[1]) && (pointCoordinate[0] < a[0] || pointCoordinate[0] < b[0])) { - x = a[0] + (b[0] - a[0]) * (pointCoordinate[1] - a[1]) / (b[1] - a[1]); - - if (x > pointCoordinate[0]) { - rayCross++; - } - } - - a = b; - } - - return rayCross % 2 == 1; - }, - - _containsPolygonLineString: function (polygonCoordinates, lineStringCoordinates) { - for (var i = 0; i < lineStringCoordinates.length; i++) { - if (!this._containsPolygonPoint(polygonCoordinates, lineStringCoordinates[i])) { - return false; - } - } - return true; - }, - - // distance - - distance: function ( geom1, geom2, _ignoreGeo /* Internal Use Only */ ) { - var geom1CoordinatesProjected = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom1.coordinates ) ) ? $.geo.proj.fromGeodetic(geom1.coordinates) : geom1.coordinates, - geom2CoordinatesProjected = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom2.coordinates ) ) ? $.geo.proj.fromGeodetic(geom2.coordinates) : geom2.coordinates; - - switch (geom1.type) { - case "Point": - switch (geom2.type) { - case "Point": - return this._distancePointPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "LineString": - return this._distanceLineStringPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "Polygon": - return this._containsPolygonPoint(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "LineString": - switch (geom2.type) { - case "Point": - return this._distanceLineStringPoint(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "LineString": - return this._distanceLineStringLineString(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "Polygon": - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "LineString": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected[0]) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected[0]); - default: - return undefined; - } - break; - } - }, - - _distancePointPoint: function (coordinate1, coordinate2) { - var dx = coordinate2[0] - coordinate1[0], - dy = coordinate2[1] - coordinate1[1]; - return Math.sqrt((dx * dx) + (dy * dy)); - }, - - _distanceLineStringPoint: function (lineStringCoordinates, pointCoordinate) { - var minDist = pos_oo; - - if (lineStringCoordinates.length > 0) { - var a = lineStringCoordinates[0], - - apx = pointCoordinate[0] - a[0], - apy = pointCoordinate[1] - a[1]; - - if (lineStringCoordinates.length == 1) { - return Math.sqrt(apx * apx + apy * apy); - } else { - for (var i = 1; i < lineStringCoordinates.length; i++) { - var b = lineStringCoordinates[i], - - abx = b[0] - a[0], - aby = b[1] - a[1], - bpx = pointCoordinate[0] - b[0], - bpy = pointCoordinate[1] - b[1], - - d = this._distanceSegmentPoint(abx, aby, apx, apy, bpx, bpy); - - if (d == 0) { - return 0; - } - - if (d < minDist) { - minDist = d; - } - - a = b; - apx = bpx; - apy = bpy; - } - } - } - - return Math.sqrt(minDist); - }, - - _distanceSegmentPoint: function (abx, aby, apx, apy, bpx, bpy) { - var dot1 = abx * apx + aby * apy; - - if (dot1 <= 0) { - return apx * apx + apy * apy; - } - - var dot2 = abx * abx + aby * aby; - - if (dot1 >= dot2) { - return bpx * bpx + bpy * bpy; - } - - return apx * apx + apy * apy - dot1 * dot1 / dot2; - }, - - _distanceLineStringLineString: function (lineStringCoordinates1, lineStringCoordinates2) { - var minDist = pos_oo; - for (var i = 0; i < lineStringCoordinates2.length; i++) { - minDist = Math.min(minDist, this._distanceLineStringPoint(lineStringCoordinates1, lineStringCoordinates2[i])); - } - return minDist; - }, - - // buffer - - _buffer: function( geom, distance, _ignoreGeo /* Internal Use Only */ ) { - var wasGeodetic = false, - coords = geom.coordinates; - - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom.coordinates ) ) { - wasGeodetic = true; - coords = $.geo.proj.fromGeodetic( geom.coordinates ); - } - - switch ( geom.type ) { - case "Point": - var resultCoords = [], - slices = 180, - i = 0, - a; - - for ( ; i <= slices; i++ ) { - a = ( i * 360 / slices ) * ( Math.PI / 180 ); - resultCoords.push( [ - coords[ 0 ] + Math.cos( a ) * distance, - coords[ 1 ] + Math.sin( a ) * distance - ] ); - } - - return { - type: "Polygon", - coordinates: [ ( wasGeodetic ? $.geo.proj.toGeodetic( resultCoords ) : resultCoords ) ] - }; - - break; - - default: - return undefined; - } - }, - - - // - // feature - // - - _flatten: function (geom) { - // return an array of all basic geometries - // not in JTS - var geometries = [], - curGeom = 0; - switch (geom.type) { - case "Feature": - $.merge(geometries, this._flatten(geom.geometry)); - break; - - case "FeatureCollection": - for (; curGeom < geom.features.length; curGeom++) { - $.merge(geometries, this._flatten(geom.features[curGeom].geometry)); - } - break; - - case "GeometryCollection": - for (; curGeom < geom.geometries.length; curGeom++) { - $.merge(geometries, this._flatten(geom.geometries[curGeom])); - } - break; - - default: - geometries[0] = geom; - break; - } - return geometries; - }, - - length: function( geom, _ignoreGeo /* Internal Use Only */ ) { - var sum = 0, - lineStringCoordinates, - i = 1, dx, dy; - - switch ( geom.type ) { - case "Point": - return 0; - - case "LineString": - lineStringCoordinates = geom.coordinates; - break; - - case "Polygon": - lineStringCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( lineStringCoordinates ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( lineStringCoordinates ) ) { - lineStringCoordinates = $.geo.proj.fromGeodetic( lineStringCoordinates ); - } - - for ( ; i < lineStringCoordinates.length; i++ ) { - dx = lineStringCoordinates[ i ][0] - lineStringCoordinates[ i - 1 ][0]; - dy = lineStringCoordinates[ i ][1] - lineStringCoordinates[ i - 1 ][1]; - sum += Math.sqrt((dx * dx) + (dy * dy)); - } - - return sum; - } - - // return undefined; - }, - - area: function( geom, _ignoreGeo /* Internal Use Only */ ) { - var sum = 0, - polygonCoordinates, - i = 1, j; - - switch ( geom.type ) { - case "Point": - case "LineString": - return 0; - - case "Polygon": - polygonCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( polygonCoordinates ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( polygonCoordinates ) ) { - polygonCoordinates = $.geo.proj.fromGeodetic( polygonCoordinates ); - } - - for ( ; i <= polygonCoordinates.length; i++) { - j = i % polygonCoordinates.length; - sum += ( polygonCoordinates[ i - 1 ][ 0 ] - polygonCoordinates[ j ][ 0 ] ) * ( polygonCoordinates[ i - 1 ][ 1 ] + polygonCoordinates[ j ][ 1 ] ) / 2; - } - - return Math.abs( sum ); - } - }, - - pointAlong: function( geom, percentage, _ignoreGeo /* Internal Use Only */ ) { - var totalLength = 0, - previousPercentageSum = 0, - percentageSum = 0, - remainderPercentageSum, - len, - lineStringCoordinates, - segmentLengths = [], - i = 1, dx, dy, - c, c0, c1, - wasGeodetic = false; - - switch ( geom.type ) { - case "Point": - return $.extend( { }, geom ); - - case "LineString": - lineStringCoordinates = geom.coordinates; - break; - - case "Polygon": - lineStringCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( lineStringCoordinates ) { - if ( percentage === 0 ) { - return { - type: "Point", - coordinates: [ lineStringCoordinates[ 0 ][ 0 ], lineStringCoordinates[ 0 ][ 1 ] ] - }; - } else if ( percentage === 1 ) { - i = lineStringCoordinates.length - 1; - return { - type: "Point", - coordinates: [ lineStringCoordinates[ i ][ 0 ], lineStringCoordinates[ i ][ 1 ] ] - }; - } else { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( lineStringCoordinates ) ) { - wasGeodetic = true; - lineStringCoordinates = $.geo.proj.fromGeodetic( lineStringCoordinates ); - } - - for ( ; i < lineStringCoordinates.length; i++ ) { - dx = lineStringCoordinates[ i ][ 0 ] - lineStringCoordinates[ i - 1 ][ 0 ]; - dy = lineStringCoordinates[ i ][ 1 ] - lineStringCoordinates[ i - 1 ][ 1 ]; - len = Math.sqrt((dx * dx) + (dy * dy)); - segmentLengths.push( len ); - totalLength += len; - } - - for ( i = 0; i < segmentLengths.length && percentageSum < percentage; i++ ) { - previousPercentageSum = percentageSum; - percentageSum += ( segmentLengths[ i ] / totalLength ); - } - - remainderPercentageSum = percentage - previousPercentageSum; - - c0 = lineStringCoordinates[ i - 1 ]; - c1 = lineStringCoordinates[ i ]; - - c = [ - c0[ 0 ] + ( remainderPercentageSum * ( c1[ 0 ] - c0[ 0 ] ) ), - c0[ 1 ] + ( remainderPercentageSum * ( c1[ 1 ] - c0[ 1 ] ) ) - ]; - - return { - type: "Point", - coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c - }; - } - } - }, - - // - // WKT functions - // - - _WKT: (function () { - function pointToString(value) { - return "POINT " + pointToUntaggedString(value.coordinates); - } - - function pointToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - return "(" + coordinates.join(" ") + ")"; - } - } - - function lineStringToString(value) { - return "LINESTRING " + lineStringToUntaggedString(value.coordinates); - } - - function lineStringToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var points = [] - - for (var i = 0; i < coordinates.length; i++) { - points.push(coordinates[i].join(" ")); - } - - return "(" + points + ")"; - } - } - - function polygonToString(value) { - return "POLYGON " + polygonToUntaggedString(value.coordinates); - } - - function polygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMTPY"; - } else { - var lineStrings = []; - - for (var i = 0; i < coordinates.length; i++) { - lineStrings.push(lineStringToUntaggedString(coordinates[i])); - } - - return "(" + lineStrings + ")"; - } - } - - function multiPointToString(value) { - return "MULTIPOINT " + lineStringToUntaggedString(value.coordinates); - } - - function multiLineStringToString(value) { - return "MULTILINSTRING " + polygonToUntaggedString(value.coordinates); - } - - function multiPolygonToString(value) { - return "MULTIPOLYGON " + multiPolygonToUntaggedString(value.coordinates); - } - - function multiPolygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var polygons = []; - for (var i = 0; i < coordinates.length; i++) { - polygons.push(polygonToUntaggedString(coordinates[i])); - } - return "(" + polygons + ")"; - } - } - - function geometryCollectionToString(value) { - return "GEOMETRYCOLLECTION " + geometryCollectionToUntaggedString(value.geometries); - } - - function geometryCollectionToUntaggedString(geometries) { - if (!(geometries && geometries.length)) { - return "EMPTY"; - } else { - var geometryText = []; - for (var i = 0; i < geometries.length; i++) { - geometryText.push(stringify(geometries[i])); - } - return "(" + geometries + ")"; - } - } - - function stringify(value) { - if (!(value && value.type)) { - return ""; - } else { - switch (value.type) { - case "Point": - return pointToString(value); - - case "LineString": - return lineStringToString(value); - - case "Polygon": - return polygonToString(value); - - case "MultiPoint": - return multiPointToString(value); - - case "MultiLineString": - return multiLineStringToString(value); - - case "MultiPolygon": - return multiPolygonToString(value); - - case "GeometryCollection": - return geometryCollectionToString(value); - - default: - return ""; - } - } - } - - function pointParseUntagged(wkt) { - var pointString = wkt.match( /\(\s*([\d\.-]+)\s+([\d\.-]+)\s*\)/ ); - return pointString && pointString.length > 2 ? { - type: "Point", - coordinates: [ - parseFloat(pointString[1]), - parseFloat(pointString[2]) - ] - } : null; - } - - function lineStringParseUntagged(wkt) { - var lineString = wkt.match( /\s*\((.*)\)/ ), - coords = [], - pointStrings, - pointParts, - i = 0; - - if ( lineString.length > 1 ) { - pointStrings = lineString[ 1 ].match( /[\d\.-]+\s+[\d\.-]+/g ); - - for ( ; i < pointStrings.length; i++ ) { - pointParts = pointStrings[ i ].match( /\s*([\d\.-]+)\s+([\d\.-]+)\s*/ ); - coords[ i ] = [ parseFloat( pointParts[ 1 ] ), parseFloat( pointParts[ 2 ] ) ]; - } - - return { - type: "LineString", - coordinates: coords - }; - } else { - return null - } - } - - function polygonParseUntagged(wkt) { - var polygon = wkt.match( /\s*\(\s*\((.*)\)\s*\)/ ), - coords = [], - pointStrings, - pointParts, - i = 0; - - if ( polygon.length > 1 ) { - pointStrings = polygon[ 1 ].match( /[\d\.-]+\s+[\d\.-]+/g ); - - for ( ; i < pointStrings.length; i++ ) { - pointParts = pointStrings[ i ].match( /\s*([\d\.-]+)\s+([\d\.-]+)\s*/ ); - coords[ i ] = [ parseFloat( pointParts[ 1 ] ), parseFloat( pointParts[ 2 ] ) ]; - } - - return { - type: "Polygon", - coordinates: [ coords ] - }; - } else { - return null; - } - } - - function parse(wkt) { - wkt = $.trim(wkt); - - var typeIndex = wkt.indexOf( " " ), - untagged = wkt.substr( typeIndex + 1 ); - - switch (wkt.substr(0, typeIndex).toUpperCase()) { - case "POINT": - return pointParseUntagged( untagged ); - - case "LINESTRING": - return lineStringParseUntagged( untagged ); - - case "POLYGON": - return polygonParseUntagged( untagged ); - - default: - return null; - } - } - - return { - stringify: stringify, - - parse: parse - }; - })(), - - // - // projection functions - // - - proj: (function () { - var halfPi = 1.5707963267948966192, - quarterPi = 0.7853981633974483096, - radiansPerDegree = 0.0174532925199432958, - degreesPerRadian = 57.295779513082320877, - semiMajorAxis = 6378137; - - return { - fromGeodeticPos: function (coordinate) { - if (!coordinate) { - debugger; - } - return [ - semiMajorAxis * coordinate[ 0 ] * radiansPerDegree, - semiMajorAxis * Math.log(Math.tan(quarterPi + coordinate[ 1 ] * radiansPerDegree / 2)) - ]; - }, - - fromGeodetic: function ( coordinates ) { - if ( ! $.geo._isGeodetic( coordinates ) ) { - return coordinates; - } - - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - fromGeodeticPos = this.fromGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = fromGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = fromGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ], - i, j, k; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = fromGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - }, - - toGeodeticPos: function (coordinate) { - return [ - (coordinate[ 0 ] / semiMajorAxis) * degreesPerRadian, - (halfPi - 2 * Math.atan(1 / Math.exp(coordinate[ 1 ] / semiMajorAxis))) * degreesPerRadian - ]; - }, - - toGeodetic: function (coordinates) { - if ( $.geo._isGeodetic( coordinates ) ) { - return coordinates; - } - - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - toGeodeticPos = this.toGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = toGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = toGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ]; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = toGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - } - } - })(), - - // - // service types (defined in other files) - // - - _serviceTypes: {} - } -})(jQuery, this); -(function ($, undefined) { - - var _ieVersion = (function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - while (div.innerHTML = "", a[0]) { } - return v > 6 ? v : !v; - } ()); - - $.widget("geo.geographics", { - _$elem: undefined, - _options: {}, - _trueCanvas: true, - - _width: 0, - _height: 0, - - _$canvas: undefined, - _context: undefined, - _$labelsContainer: undefined, - - options: { - style: { - borderRadius: "8px", - color: "#7f0000", - //fill: undefined, - fillOpacity: .2, - height: "8px", - opacity: 1, - //stroke: undefined, - strokeOpacity: 1, - strokeWidth: "2px", - visibility: "visible", - width: "8px" - } - }, - - _create: function () { - this._$elem = this.element; - this._options = this.options; - - this._$elem.css({ display: "inline-block", overflow: "hidden", textAlign: "left" }); - - if (this._$elem.css("position") == "static") { - this._$elem.css("position", "relative"); - } - - this._$elem.addClass( "geo-graphics" ); - - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width")); - this._height = parseInt(this._$elem.css("height")); - } - - var posCss = 'position:absolute;left:0;top:0;margin:0;padding:0;', - sizeCss = 'width:' + this._width + 'px;height:' + this._height + 'px;', - sizeAttr = 'width="' + this._width + '" height="' + this._height + '"'; - - if (document.createElement('canvas').getContext) { - this._$elem.append(''); - this._$canvas = this._$elem.children(':last'); - this._context = this._$canvas[0].getContext("2d"); - } else if (_ieVersion <= 8) { - this._trueCanvas = false; - this._$elem.append( '
        '); - this._$canvas = this._$elem.children(':last'); - - G_vmlCanvasManager.initElement(this._$canvas[0]); - this._context = this._$canvas[0].getContext("2d"); - this._$canvas.children().css({ backgroundColor: "transparent", width: this._width, height: this._height }); - } - - this._$elem.append('
        '); - this._$labelsContainer = this._$elem.children(':last'); - }, - - _setOption: function (key, value) { - if (key == "style") { - value = $.extend({}, this._options.style, value); - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - destroy: function () { - $.Widget.prototype.destroy.apply(this, arguments); - this._$elem.html(""); - this._$elem.removeClass( "geo-graphics" ); - }, - - clear: function () { - this._context.clearRect(0, 0, this._width, this._height); - this._$labelsContainer.html(""); - }, - - drawArc: function (coordinates, startAngle, sweepAngle, style) { - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0 && style.widthValue > 0 && style.heightValue > 0) { - var r = Math.min(style.widthValue, style.heightValue) / 2; - - startAngle = (startAngle * Math.PI / 180); - sweepAngle = (sweepAngle * Math.PI / 180); - - this._context.save(); - this._context.translate(coordinates[0], coordinates[1]); - if (style.widthValue > style.heightValue) { - this._context.scale(style.widthValue / style.heightValue, 1); - } else { - this._context.scale(1, style.heightValue / style.widthValue); - } - - this._context.beginPath(); - this._context.arc(0, 0, r, startAngle, sweepAngle, false); - - if (this._trueCanvas) { - this._context.restore(); - } - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - - if (!this._trueCanvas) { - this._context.restore(); - } - } - }, - - drawPoint: function (coordinates, style) { - var style = this._getGraphicStyle(style); - if (style.widthValue == style.heightValue && style.heightValue == style.borderRadiusValue) { - this.drawArc(coordinates, 0, 360, style); - } else if (style.visibility != "hidden" && style.opacity > 0) { - style.borderRadiusValue = Math.min(Math.min(style.widthValue, style.heightValue) / 2, style.borderRadiusValue); - coordinates[0] -= style.widthValue / 2; - coordinates[1] -= style.heightValue / 2; - this._context.beginPath(); - this._context.moveTo(coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.lineTo(coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1]); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1], coordinates[0] + style.widthValue, coordinates[1] + style.borderRadiusValue); - this._context.lineTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue, coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.lineTo(coordinates[0] + style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1] + style.heightValue, coordinates[0], coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.lineTo(coordinates[0], coordinates[1] + style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1], coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.closePath(); - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - - this._context.stroke(); - } - } - }, - - drawLineString: function (coordinates, style) { - this._drawLines([coordinates], false, style); - }, - - drawPolygon: function (coordinates, style) { - this._drawLines(coordinates, true, style); - }, - - drawBbox: function (bbox, style) { - this._drawLines([[ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ]], true, style); - }, - - drawLabel: function( coordinates, label ) { - this._$labelsContainer.append( '
        ' + label + '
        '); - }, - - resize: function( ) { - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width")); - this._height = parseInt(this._$elem.css("height")); - } - - if ( this._trueCanvas ) { - this._$canvas[0].width = this._width; - this._$canvas[0].height = this._height; - } else { - } - - this._$labelsContainer.css( { - width: this._width, - height: this._height - } ); - }, - - _getGraphicStyle: function (style) { - function safeParse(value) { - value = parseInt(value); - return (+value + '') === value ? +value : value; - } - - style = $.extend({}, this._options.style, style); - style.borderRadiusValue = safeParse(style.borderRadius); - style.fill = style.fill || style.color; - style.doFill = style.fill && style.fillOpacity > 0; - style.stroke = style.stroke || style.color; - style.strokeWidthValue = safeParse(style.strokeWidth); - style.doStroke = style.stroke && style.strokeOpacity > 0 && style.strokeWidthValue > 0; - style.widthValue = safeParse(style.width); - style.heightValue = safeParse(style.height); - return style; - }, - - _drawLines: function (coordinates, close, style) { - if (!coordinates || !coordinates.length || coordinates[0].length < 2) { - return; - } - - var style = this._getGraphicStyle(style), - i, j; - - if (style.visibility != "hidden" && style.opacity > 0) { - this._context.beginPath(); - this._context.moveTo(coordinates[0][0][0], coordinates[0][0][1]); - - for (i = 0; i < coordinates.length; i++) { - for (j = 0; j < coordinates[i].length; j++) { - this._context.lineTo(coordinates[i][j][0], coordinates[i][j][1]); - } - } - - if (close) { - this._context.closePath(); - } - - if (close && style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineCap = this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - } - } - }); - - -})(jQuery); - -(function ($, undefined) { - var _ieVersion = (function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - while (div.innerHTML = "", a[0]) { } - return v > 6 ? v : !v; - } ()), - - _defaultOptions = { - bbox: [-180, -85, 180, 85], - bboxMax: [-180, -85, 180, 85], - center: [0, 0], - cursors: { - "static": "default", - pan: "url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move", - zoom: "crosshair", - drawPoint: "crosshair", - drawLineString: "crosshair", - drawPolygon: "crosshair", - measureLength: "crosshair", - measureArea: "crosshair" - }, - measureLabels: { - length: "{{=length.toFixed( 2 )}} m", - area: "{{=area.toFixed( 2 )}} sq m" - }, - drawStyle: {}, - shapeStyle: {}, - mode: "pan", - pannable: true, - scroll: "default", - services: [ - { - "class": "osm", - type: "tiled", - src: function (view) { - return "http://tile.openstreetmap.org/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png"; - }, - attr: "© OpenStreetMap & contributors, CC-BY-SA" - } - ], - tilingScheme: { - tileWidth: 256, - tileHeight: 256, - levels: 18, - basePixelSize: 156543.03392799936, - origin: [-20037508.342787, 20037508.342787] - }, - axisLayout: "map", - zoom: 0, - pixelSize: 0 - }; - - $.widget("geo.geomap", { - // private widget members - _$elem: undefined, //< map div for maps, service div for services - _map: undefined, //< only defined in services - _created: false, - - _contentBounds: {}, - - _$resizeContainer: undefined, //< all elements that should match _contentBounds' size - - _$eventTarget: undefined, - _$contentFrame: undefined, - _$existingChildren: undefined, - _$attrList: undefined, - _$servicesContainer: undefined, - - _$panContainer: undefined, //< all non-service elements that move while panning - _$shapesContainer: undefined, - _$drawContainer: undefined, - _$measureContainer: undefined, - _$measureLabel: undefined, - - _dpi: 96, - - _currentServices: [], //< internal copy - - _center: undefined, - _pixelSize: undefined, - _centerMax: undefined, - _pixelSizeMax: undefined, - - _userGeodetic: true, - - _wheelTimeout: null, - _wheelLevel: 0, - - _zoomFactor: 2, //< determines what a zoom level means - - _fullZoomFactor: 2, //< interactiveScale factor needed to zoom a whole level - _partialZoomFactor: 1.18920711500273, //< interactiveScale factor needed to zoom a fraction of a level (the fourth root of 2) - - _mouseDown: undefined, - _inOp: undefined, - _toolPan: undefined, - _shiftZoom: undefined, - _anchor: undefined, - _current: undefined, - _downDate: undefined, - _moveDate: undefined, - _clickDate: undefined, - _lastMove: undefined, - _lastDrag: undefined, - - _windowHandler: null, - _resizeTimeout: null, - - _panning: undefined, - _velocity: undefined, - _friction: undefined, - - _supportTouch: undefined, - _softDblClick: undefined, - _isTap: undefined, - _isDbltap: undefined, - - _isMultiTouch: undefined, - _multiTouchAnchor: undefined, //< TouchList - _multiTouchAnchorBbox: undefined, //< bbox - _multiTouchCurrentBbox: undefined, //< bbox - - _drawTimeout: null, //< used in drawPoint mode so we don't send two shape events on dbltap - _drawPixels: [], //< an array of coordinate arrays for drawing lines & polygons, in pixel coordinates - _drawCoords: [], - - _graphicShapes: [], //< an array of objects containing style object refs & GeoJSON object refs - - _initOptions: {}, - - _options: {}, - - options: $.extend({}, _defaultOptions), - - _createWidget: function (options, element) { - this._$elem = $(element); - - if (this._$elem.is(".geo-service")) { - var $contentFrame = this._$elem.closest( ".geo-content-frame" ); - this._$elem.append('
        '); - this._$shapesContainer = this._$elem.children(':last'); - this._graphicShapes = []; - $.Widget.prototype._createWidget.apply(this, arguments); - return; - } - - this._$elem.addClass("geo-map"); - - this._initOptions = options || {}; - - this._forcePosition(this._$elem); - - this._$elem.css("text-align", "left"); - - var size = this._findMapSize(); - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left")), - y: parseInt(this._$elem.css("padding-top")), - width: size["width"], - height: size["height"] - }; - - this._createChildren(); - - this._center = this._centerMax = [0, 0]; - - this.options["pixelSize"] = this._pixelSize = this._pixelSizeMax = 156543.03392799936; - - this._mouseDown = - this._inOp = - this._toolPan = - this._shiftZoom = - this._panning = - this._isTap = - this._isDbltap = false; - - this._anchor = [ 0, 0 ]; - this._current = [ 0, 0 ]; - this._lastMove = [ 0, 0 ]; - this._lastDrag = [ 0, 0 ]; - this._velocity = [ 0, 0 ]; - - this._friction = [.8, .8]; - - this._downDate = - this._moveDate = - this._clickDate = 0; - - this._drawPixels = []; - this._drawCoords = []; - this._graphicShapes = []; - - - $.Widget.prototype._createWidget.apply(this, arguments); - }, - - _create: function () { - this._options = this.options; - - if (this._$elem.is(".geo-service")) { - this._map = this._$elem.data( "geoMap" ); - this._$shapesContainer.geographics( ); - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - return; - } - - this._map = this; - - this._supportTouch = "ontouchend" in document; - this._softDblClick = this._supportTouch || _ieVersion == 7; - - var geomap = this, - touchStartEvent = this._supportTouch ? "touchstart" : "mousedown", - touchStopEvent = this._supportTouch ? "touchend touchcancel" : "mouseup", - touchMoveEvent = this._supportTouch ? "touchmove" : "mousemove"; - - $(document).keydown($.proxy(this._document_keydown, this)); - - this._$eventTarget.dblclick($.proxy(this._eventTarget_dblclick, this)); - - this._$eventTarget.bind(touchStartEvent, $.proxy(this._eventTarget_touchstart, this)); - - var dragTarget = (this._$eventTarget[0].setCapture) ? this._$eventTarget : $(document); - dragTarget.bind(touchMoveEvent, $.proxy(this._dragTarget_touchmove, this)); - dragTarget.bind(touchStopEvent, $.proxy(this._dragTarget_touchstop, this)); - - this._$eventTarget.mousewheel($.proxy(this._eventTarget_mousewheel, this)); - - this._windowHandler = function () { - if (geomap._resizeTimeout) { - clearTimeout(geomap._resizeTimeout); - } - geomap._resizeTimeout = setTimeout(function () { - if (geomap._created) { - geomap._$elem.geomap("resize"); - } - }, 500); - }; - - $(window).resize(this._windowHandler); - - this._$drawContainer.geographics({ style: this._initOptions.drawStyle || {} }); - this._options["drawStyle"] = this._$drawContainer.geographics("option", "style"); - - this._$shapesContainer.geographics( { style: this._initOptions.shapeStyle || { } } ); - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - - if (this._initOptions) { - if (this._initOptions.tilingScheme) { - this._setOption("tilingScheme", this._initOptions.tilingScheme, false); - } - if ( this._initOptions.services ) { - // jQuery UI Widget Factory merges user services with our default, we want to clobber the default - this._options[ "services" ] = $.merge( [ ], this._initOptions.services ); - } - if (this._initOptions.bbox) { - this._setOption("bbox", this._initOptions.bbox, false); - } - if (this._initOptions.center) { - this._setOption("center", this._initOptions.center, false); - } - if (this._initOptions.zoom !== undefined) { - this._setZoom(this._initOptions.zoom, false, false); - } - } - - $.template( "geoMeasureLength", this._options[ "measureLabels" ].length ); - $.template( "geoMeasureArea", this._options[ "measureLabels" ].area ); - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._createServices(); - this._refresh(); - - this._created = true; - }, - - _setOption: function (key, value, refresh) { - if ( key == "pixelSize" ) { - return; - } - - refresh = (refresh === undefined || refresh); - - if ( this._$elem.is( ".geo-map" ) ) { - this._panFinalize(); - } - - switch (key) { - case "bbox": - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - this._setBbox(value, false, refresh); - value = this._getBbox(); - break; - - case "center": - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - this._setCenterAndSize( value, this._pixelSize, false, refresh ); - break; - - case "measureLabels": - value = $.extend( this._options[ "measureLabels" ], value ); - $.template( "geoMeasureLength", value.length ); - $.template( "geoMeasureArea", value.area ); - break; - - case "drawStyle": - if (this._$drawContainer) { - this._$drawContainer.geographics("option", "style", value); - value = this._$drawContainer.geographics("option", "style"); - } - break; - - case "shapeStyle": - if (this._$shapesContainer) { - this._$shapesContainer.geographics("option", "style", value); - value = this._$shapesContainer.geographics("option", "style"); - } - break; - - case "mode": - this._resetDrawing( ); - this._$eventTarget.css("cursor", this._options["cursors"][value]); - break; - - case "zoom": - this._setZoom(value, false, refresh); - break; - } - - $.Widget.prototype._setOption.apply(this, arguments); - - switch ( key ) { - case "bbox": - case "center": - if ( this._userGeodetic ) { - this._options[ "bbox" ] = $.geo.proj.toGeodetic( this._options[ "bbox" ] ); - this._options[ "center" ] = $.geo.proj.toGeodetic( this._center ); - } - break; - - case "tilingScheme": - if ( value != null ) { - this._pixelSizeMax = this._getPixelSize( 0 ); - this._centerMax = [ - value.origin[ 0 ] + this._pixelSizeMax * value.tileWidth / 2, - value.origin[ 1 ] + this._pixelSizeMax * value.tileHeight / 2 - ]; - } - break; - - case "bboxMax": - this._pixelSizeMax = this._getPixelSize( 0 ); - - if ( $.geo.proj && $.geo._isGeodetic( value ) ) { - this._centerMax = $.geo.center( $.geo.proj.fromGeodetic( value ) ); - } else { - this._centerMax = $.geo.center( value ); - } - break; - - case "services": - this._createServices(); - if (refresh) { - this._refresh(); - } - break; - - case "shapeStyle": - if ( refresh ) { - this._$shapesContainer.geographics("clear"); - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - break; - } - }, - - destroy: function () { - if ( this._$elem.is(".geo-service") ) { - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - } else { - this._created = false; - - $(window).unbind("resize", this._windowHandler); - - for ( var i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap("destroy"); - $.geo["_serviceTypes"][this._currentServices[i].type].destroy(this, this._$servicesContainer, this._currentServices[i]); - } - - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._$drawContainer.geographics("destroy"); - this._$drawContainer = undefined; - - this._$existingChildren.detach(); - this._$elem.html(""); - this._$elem.append(this._$existingChildren); - this._$elem.removeClass("geo-map"); - } - - $.Widget.prototype.destroy.apply(this, arguments); - }, - - toMap: function (p) { - p = this._toMap(p); - return this._userGeodetic ? $.geo.proj.toGeodetic(p) : p; - }, - - toPixel: function ( p, _center /* Internal Use Only */, _pixelSize /* Internal Use Only */ ) { - return this._toPixel( $.geo.proj ? $.geo.proj.fromGeodetic( p ) : p, _center, _pixelSize ); - }, - - opacity: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "opacity", value, this._$elem ); - } else { - if ( value >= 0 || value <= 1 ) { - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - service.style.opacity = value; - $.geo[ "_serviceTypes" ][ service.type ].opacity( this, service ); - } - } - } - } - }, - - toggle: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "toggle", value, this._$elem ); - } else { - - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - if ( value === undefined ) { - // toggle visibility - value = ( service.style.visibility !== "visible" ); - } - - service.style.visibility = ( value ? "visible" : "hidden" ); - - service.serviceContainer.toggle( value ); - - if ( value ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service ); - } - } - } - } - }, - - zoom: function (numberOfLevels) { - if (numberOfLevels != null) { - this._setZoom(this._options["zoom"] + numberOfLevels, false, true); - } - }, - - refresh: function () { - this._refresh(); - }, - - resize: function () { - var size = this._findMapSize(), - dx = size["width"]/2 - this._contentBounds.width/2, - dy = size["height"]/2 - this._contentBounds.height/2, - i; - - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left")), - y: parseInt(this._$elem.css("padding-top")), - width: size["width"], - height: size["height"] - }; - - this._$resizeContainer.css( { - width: size["width"], - height: size["height"] - } ); - - for (i = 0; i < this._currentServices.length; i++) { - $.geo["_serviceTypes"][this._currentServices[i].type].resize(this, this._currentServices[i]); - } - - this._$elem.find( ".geo-graphics" ).css( { - width: size["width"], - height: size["height"] - }).geographics( "resize" ); - - for (i = 0; i < this._drawPixels.length; i++) { - this._drawPixels[i][0] += dx; - this._drawPixels[i][1] += dy; - } - - this._setCenterAndSize(this._center, this._pixelSize, false, true); - }, - - append: function ( shape, style, label, refresh ) { - if ( shape && $.isPlainObject( shape ) ) { - var shapes, arg, i, realStyle, realLabel, realRefresh; - - if ( shape.type == "FeatureCollection" ) { - shapes = shape.features; - } else { - shapes = $.isArray( shape ) ? shape : [ shape ]; - } - - for ( i = 1; i < arguments.length; i++ ) { - arg = arguments[ i ]; - - if ( typeof arg === "object" ) { - realStyle = arg; - } else if ( typeof arg === "number" || typeof arg === "string" ) { - realLabel = arg; - } else if ( typeof arg === "boolean" ) { - realRefresh = arg; - } - } - - for ( i = 0; i < shapes.length; i++ ) { - if ( shapes[ i ].type != "Point" ) { - var bbox = $.geo.bbox( shapes[ i ] ); - if ( $.geo.proj && $.geo._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - $.data( shapes[ i ], "geoBbox", bbox ); - } - - this._graphicShapes.push( { - shape: shapes[ i ], - style: realStyle, - label: realLabel - } ); - } - - if ( realRefresh === undefined || realRefresh ) { - this._refresh( ); - } - } - }, - - empty: function ( refresh ) { - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - $.removeData( this._graphicShapes[ i ].shape, "geoBbox" ); - } - - this._graphicShapes = []; - - if ( refresh === undefined || refresh ) { - this._refresh(); - } - }, - - find: function ( selector, pixelTolerance ) { - var isPoint = $.isPlainObject( selector ), - searchPixel = isPoint ? this._map.toPixel( selector.coordinates ) : undefined, - mapTol = this._map._pixelSize * pixelTolerance, - result = [], - graphicShape, - geometries, - curGeom, - i = 0; - - for ( ; i < this._graphicShapes.length; i++ ) { - graphicShape = this._graphicShapes[ i ]; - - if ( isPoint ) { - if ( graphicShape.shape.type == "Point" ) { - if ( $.geo.distance( graphicShape.shape, selector ) <= mapTol ) { - result.push( graphicShape.shape ); - } - } else { - var bbox = $.data( graphicShape.shape, "geoBbox" ), - bboxPolygon = { - type: "Polygon", - coordinates: [ [ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ] ] - }, - projectedPoint = { - type: "Point", - coordinates: $.geo.proj && $.geo._isGeodetic( selector.coordinates ) ? $.geo.proj.fromGeodetic( selector.coordinates ) : selector.coordinates - }; - - if ( $.geo.distance( bboxPolygon, projectedPoint, true ) <= mapTol ) { - geometries = $.geo._flatten( graphicShape.shape ); - for ( curGeom = 0; curGeom < geometries.length; curGeom++ ) { - if ( $.geo.distance( geometries[ curGeom ], selector ) <= mapTol ) { - result.push( graphicShape.shape ); - break; - } - } - } - } - } else { - result.push( graphicShape.shape ); - } - } - - if ( this._$elem.is( ".geo-map" ) ) { - this._$elem.find( ".geo-service" ).each( function( ) { - result = $.merge( result, $( this ).geomap( "find", selector, pixelTolerance ) ); - } ); - } - - return result; - }, - - remove: function ( shape, refresh ) { - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - if ( this._graphicShapes[ i ].shape == shape ) { - $.removeData( shape, "geoBbox" ); - var rest = this._graphicShapes.slice( i + 1 ); - this._graphicShapes.length = i; - this._graphicShapes.push.apply( this._graphicShapes, rest ); - break; - } - } - - if ( refresh === undefined || refresh ) { - this._refresh(); - } - }, - - _getBbox: function (center, pixelSize) { - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - // calculate the internal bbox - var halfWidth = this._contentBounds[ "width" ] / 2 * pixelSize, - halfHeight = this._contentBounds[ "height" ] / 2 * pixelSize; - return [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - }, - - _setBbox: function (value, trigger, refresh) { - var center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2], - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height); - - if (this._options["tilingScheme"]) { - var zoom = this._getZoom( center, pixelSize ); - pixelSize = this._getPixelSize( zoom ); - } else { - if ( this._getZoom( center, pixelSize ) < 0 ) { - pixelSize = this._pixelSizeMax; - } - } - - this._setCenterAndSize(center, pixelSize, trigger, refresh); - }, - - _getBboxMax: function () { - // calculate the internal bboxMax - var halfWidth = this._contentBounds["width"] / 2 * this._pixelSizeMax, - halfHeight = this._contentBounds["height"] / 2 * this._pixelSizeMax; - return [this._centerMax[0] - halfWidth, this._centerMax[1] - halfHeight, this._centerMax[0] + halfWidth, this._centerMax[1] + halfHeight]; - }, - - _getCenter: function () { - return this._center; - }, - - _getContentBounds: function () { - return this._contentBounds; - }, - - _getServicesContainer: function () { - return this._$servicesContainer; - }, - - _getZoom: function ( center, pixelSize ) { - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - // calculate the internal zoom level, vs. public zoom property - var tilingScheme = this._options["tilingScheme"]; - if ( tilingScheme ) { - if ( tilingScheme.pixelSizes != null ) { - var roundedPixelSize = Math.floor(pixelSize * 1000), - levels = tilingScheme.pixelSizes.length, - i = levels - 1; - - for ( ; i >= 0; i-- ) { - if ( Math.floor( tilingScheme.pixelSizes[ i ] * 1000 ) >= roundedPixelSize ) { - return i; - } - } - - return 0; - } else { - return Math.max( Math.round( Math.log( tilingScheme.basePixelSize / pixelSize) / Math.log( 2 ) ), 0 ); - } - } else { - var ratio = this._contentBounds["width"] / this._contentBounds["height"], - bbox = $.geo.reaspect( this._getBbox( center, pixelSize ), ratio, true ), - bboxMax = $.geo.reaspect(this._getBboxMax(), ratio, true); - - return Math.max( Math.round( Math.log($.geo.width(bboxMax, true) / $.geo.width(bbox, true)) / Math.log(this._zoomFactor) ), 0 ); - } - }, - - _setZoom: function ( value, trigger, refresh ) { - value = Math.max( value, 0 ); - - this._setCenterAndSize( this._center, this._getPixelSize( value ), trigger, refresh ); - }, - - _createChildren: function () { - this._$existingChildren = this._$elem.children().detach(); - - this._forcePosition(this._$existingChildren); - - this._$existingChildren.css("-moz-user-select", "none"); - - var contentSizeCss = "width:" + this._contentBounds["width"] + "px; height:" + this._contentBounds["height"] + "px; margin:0; padding:0;", - contentPosCss = "position:absolute; left:0; top:0;"; - - this._$elem.prepend('
        '); - this._$eventTarget = this._$contentFrame = this._$elem.children(':first'); - - this._$contentFrame.append('
        '); - this._$servicesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
        '); - this._$shapesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append( '
          ' ); - this._$attrList = this._$contentFrame.children( ":last" ); - - this._$contentFrame.append('
          '); - this._$drawContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
          '); - this._$measureContainer = this._$contentFrame.children(':last'); - this._$measureLabel = this._$measureContainer.children(); - - this._$panContainer = $( [ this._$shapesContainer[ 0 ], this._$drawContainer[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$resizeContainer = $( [ this._$contentFrame[ 0 ], this._$servicesContainer[ 0 ], this._$eventTarget[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$contentFrame.append(this._$existingChildren); - - if ( ! $("#geo-measure-style").length ) { - $("head").prepend( '' ); - } - }, - - _createServices: function () { - var service, i; - - for ( i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap( "destroy" ); - $.geo[ "_serviceTypes" ][ this._currentServices[ i ].type ].destroy( this, this._$servicesContainer, this._currentServices[ i ] ); - } - - this._currentServices = [ ]; - this._$servicesContainer.html( "" ); - this._$attrList.html( "" ); - - for ( i = 0; i < this._options[ "services" ].length; i++ ) { - service = this._currentServices[ i ] = $.extend( { }, this._options[ "services" ][ i ] ); - - // default the service style property on our copy - service.style = $.extend( { - visibility: "visible", - opacity: 1 - }, service.style ); - - var idString = service.id ? ' id="' + service.id + '"' : "", - classString = 'class="geo-service ' + ( service["class"] ? service["class"] : '' ) + '"', - scHtml = '
          ', - servicesContainer; - - this._$servicesContainer.append( scHtml ); - serviceContainer = this._$servicesContainer.children( ":last" ); - this._currentServices[ i ].serviceContainer = serviceContainer; - - $.geo[ "_serviceTypes" ][ service.type ].create( this, serviceContainer, service, i ); - - serviceContainer.data( "geoMap", this ).geomap(); - - if ( service.attr ) { - this._$attrList.append( '
        • ' + service.attr + '
        • ' ); - } - } - - this._$attrList.find( "a" ).css( { - position: "relative", - zIndex: 100 - } ); - }, - - _refreshDrawing: function ( ) { - this._$drawContainer.geographics("clear"); - - if ( this._drawPixels.length > 0 ) { - var mode = this._options[ "mode" ], - pixels = this._drawPixels, - coords = this._drawCoords, - label, - labelShape, - labelPixel, - widthOver, - heightOver; - - switch ( mode ) { - case "measureLength": - mode = "drawLineString"; - labelShape = { - type: "LineString", - coordinates: coords - }; - label = $.render( { length: $.geo.length( labelShape, true ) }, "geoMeasureLength" ); - labelPixel = $.merge( [], pixels[ pixels.length - 1 ] ); - break; - - case "measureArea": - mode = "drawPolygon"; - - labelShape = { - type: "Polygon", - coordinates: [ $.merge( [ ], coords ) ] - }; - labelShape.coordinates[ 0 ].push( coords[ 0 ] ); - - label = $.render( { area: $.geo.area( labelShape, true ) }, "geoMeasureArea" ); - labelPixel = $.merge( [], pixels[ pixels.length - 1 ] ); - pixels = [ pixels ]; - break; - - case "drawPolygon": - pixels = [ pixels ]; - break; - } - - this._$drawContainer.geographics( mode, pixels ); - - if ( label ) { - this._$measureLabel.html( label ); - - widthOver = this._contentBounds.width - ( this._$measureLabel.outerWidth( true ) + labelPixel[ 0 ] ); - heightOver = this._contentBounds.height - ( this._$measureLabel.outerHeight( true ) + labelPixel[ 1 ] ); - - if ( widthOver < 0 ) { - labelPixel[ 0 ] += widthOver; - } - - if ( heightOver < 0 ) { - labelPixel[ 1 ] += heightOver; - } - - this._$measureLabel.css( { - left: labelPixel[ 0 ], - top: labelPixel[ 1 ] - } ).show(); - } - } - }, - - _resetDrawing: function () { - this._drawPixels = []; - this._drawCoords = []; - this._$drawContainer.geographics("clear"); - this._$measureLabel.hide(); - }, - - _refreshShapes: function (geographics, shapes, styles, labels, center, pixelSize) { - var i, mgi, - shape, - shapeBbox, - style, - label, - hasLabel, - labelPixel, - bbox = this._map._getBbox(center, pixelSize); - - for (i = 0; i < shapes.length; i++) { - shape = shapes[i].shape || shapes[i]; - shape = shape.geometry || shape; - shapeBbox = $.data(shape, "geoBbox"); - - if ( shapeBbox && $.geo._bboxDisjoint( bbox, shapeBbox ) ) { - continue; - } - - style = $.isArray(styles) ? styles[i].style : styles; - label = $.isArray(labels) ? labels[i].label : labels; - hasLabel = ( label !== undefined ); - labelPixel = undefined; - - switch (shape.type) { - case "Point": - labelPixel = this._map.toPixel( shape.coordinates, center, pixelSize ); - this._$shapesContainer.geographics("drawPoint", labelPixel, style); - break; - case "LineString": - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.pointAlong( shape, .5 ).coordinates, center, pixelSize ); - } - break; - case "Polygon": - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPoint": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPoint", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiLineString": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPolygon": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - - case "GeometryCollection": - this._refreshShapes(geographics, shape.geometries, style, label, center, pixelSize); - break; - } - - if ( hasLabel && labelPixel ) { - this._$shapesContainer.geographics( "drawLabel", labelPixel, label ); - } - } - }, - - _findMapSize: function () { - // really, really attempt to find a size for this thing - // even if it's hidden (look at parents) - var size = { width: 0, height: 0 }, - sizeContainer = this._$elem; - - while (sizeContainer.size() && !(size["width"] > 0 && size["height"] > 0)) { - size = { width: sizeContainer.width(), height: sizeContainer.height() }; - if (size["width"] <= 0 || size["height"] <= 0) { - size = { width: parseInt(sizeContainer.css("width")), height: parseInt(sizeContainer.css("height")) }; - } - sizeContainer = sizeContainer.parent(); - } - return size; - }, - - _forcePosition: function (elem) { - var cssPosition = elem.css("position"); - if (cssPosition != "relative" && cssPosition != "absolute" && cssPosition != "fixed") { - elem.css("position", "relative"); - } - }, - - _getPixelSize: function ( zoom ) { - var tilingScheme = this._options["tilingScheme"]; - if (tilingScheme != null) { - if (zoom === 0) { - return tilingScheme.pixelSizes != null ? tilingScheme.pixelSizes[0] : tilingScheme.basePixelSize; - } - - zoom = Math.round(zoom); - zoom = Math.max(zoom, 0); - var levels = tilingScheme.pixelSizes != null ? tilingScheme.pixelSizes.length : tilingScheme.levels; - zoom = Math.min(zoom, levels - 1); - - if (tilingScheme.pixelSizes != null) { - return tilingScheme.pixelSizes[zoom]; - } else { - return tilingScheme.basePixelSize / Math.pow(2, zoom); - } - } else { - var bbox = $.geo.scaleBy( this._getBboxMax(), 1 / Math.pow( this._zoomFactor, zoom ), true ); - return Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - } - }, - - _getZoomCenterAndSize: function ( anchor, zoomDelta, full ) { - var zoomFactor = ( full ? this._fullZoomFactor : this._partialZoomFactor ), - scale = Math.pow( zoomFactor, -zoomDelta ), - pixelSize, - zoomLevel; - - if ( this._options[ "tilingScheme" ] ) { - zoomLevel = this._getZoom(this._center, this._pixelSize * scale); - pixelSize = this._getPixelSize(zoomLevel); - } else { - pixelSize = this._pixelSize * scale; - - if ( this._getZoom( this._center, pixelSize ) < 0 ) { - pixelSize = this._pixelSizeMax; - } - } - - var ratio = pixelSize / this._pixelSize, - anchorMapCoord = this._toMap(anchor), - centerDelta = [(this._center[0] - anchorMapCoord[0]) * ratio, (this._center[1] - anchorMapCoord[1]) * ratio], - scaleCenter = [anchorMapCoord[0] + centerDelta[0], anchorMapCoord[1] + centerDelta[1]]; - - return { pixelSize: pixelSize, center: scaleCenter }; - }, - - _mouseWheelFinish: function () { - this._wheelTimeout = null; - - if (this._wheelLevel != 0) { - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, this._options[ "tilingScheme" ] != null ); - - this._setCenterAndSize(wheelCenterAndSize.center, wheelCenterAndSize.pixelSize, true, true); - - this._wheelLevel = 0; - } else { - this._refresh(); - } - }, - - _panEnd: function () { - this._velocity = [ - (this._velocity[0] > 0 ? Math.floor(this._velocity[0] * this._friction[0]) : Math.ceil(this._velocity[0] * this._friction[0])), - (this._velocity[1] > 0 ? Math.floor(this._velocity[1] * this._friction[1]) : Math.ceil(this._velocity[1] * this._friction[1])) - ]; - - if (Math.abs(this._velocity[0]) < 4 && Math.abs(this._velocity[1]) < 4) { - this._panFinalize(); - } else { - this._current = [ - this._current[0] + this._velocity[0], - this._current[1] + this._velocity[1] - ]; - - this._panMove(); - setTimeout($.proxy(this._panEnd, this), 30); - } - }, - - _panFinalize: function () { - if (this._panning) { - this._velocity = [0, 0]; - - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - image = this._options[ "axisLayout" ] === "image", - dxMap = -dx * this._pixelSize, - dyMap = ( image ? -1 : 1 ) * dy * this._pixelSize; - - this._$panContainer.css({ left: 0, top: 0 }); - - this._$servicesContainer.find( ".geo-shapes-container" ).css( { left: 0, top: 0 } ); - - this._setCenterAndSize([this._center[0] + dxMap, this._center[1] + dyMap], this._pixelSize, true, true); - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._inOp = false; - this._anchor = this._current; - this._mouseDown = this._toolPan = this._panning = false; - } - }, - - _panMove: function () { - if ( ! this._options[ "pannable" ] ) { - return; - } - - var dx = this._current[0] - this._lastDrag[0], - dy = this._current[1] - this._lastDrag[1], - i = 0, - service, - translateObj; - - if (this._toolPan || dx > 3 || dx < -3 || dy > 3 || dy < -3) { - if (!this._toolPan) { - this._toolPan = true; - this._$eventTarget.css("cursor", this._options["cursors"]["pan"]); - } - - if (this._mouseDown) { - this._velocity = [dx, dy]; - } - - if (dx != 0 || dy != 0) { - this._panning = true; - this._lastDrag = this._current; - - translateObj = { - left: function (index, value) { - return parseInt(value) + dx; - }, - top: function (index, value) { - return parseInt(value) + dy; - } - }; - - for ( i = 0; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - $.geo[ "_serviceTypes" ][ service.type ].interactivePan( this, service, dx, dy ); - - service.serviceContainer.find( ".geo-shapes-container" ).css( translateObj ); - } - - this._$panContainer.css( translateObj ); - - //this._refreshDrawing(); - } - } - }, - - _refresh: function () { - var service, - i = 0; - - if ( this._$elem.is( ".geo-map" ) ) { - for ( ; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - - if ( !this._mouseDown && $.geo[ "_serviceTypes" ][ service.type ] !== null ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service ); - service.serviceContainer.geomap( "refresh" ); - } - } - } - - if ( this._$shapesContainer ) { - this._$shapesContainer.geographics( "clear" ); - if ( this._graphicShapes.length > 0 ) { - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - } - }, - - _setCenterAndSize: function (center, pixelSize, trigger, refresh) { - if ( ! $.isArray( center ) || center.length != 2 || typeof center[ 0 ] !== "number" || typeof center[ 1 ] !== "number" ) { - return; - } - - // the final call during any extent change - if (this._pixelSize != pixelSize) { - this._$elem.find( ".geo-shapes-container" ).geographics("clear"); - for (var i = 0; i < this._currentServices.length; i++) { - var service = this._currentServices[i]; - $.geo["_serviceTypes"][service.type].interactiveScale(this, service, center, pixelSize); - } - } - - this._center = $.merge( [ ], center ); - this._options["pixelSize"] = this._pixelSize = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox() ); - this._options["center"] = $.geo.proj.toGeodetic( this._center ); - } else { - this._options["bbox"] = this._getBbox(); - this._options["center"] = $.merge( [ ], center ); - } - - this._options["zoom"] = this._getZoom(); - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel(this._drawCoords); - } - - if (trigger) { - this._trigger("bboxchange", window.event, { bbox: $.merge( [ ], this._options["bbox"] ) }); - } - - if (refresh) { - this._refresh(); - this._refreshDrawing(); - } - }, - - _toMap: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - xRatio = $.geo.width(bbox, true) / width, - yRatio = $.geo.height(bbox, true) / height, - yOffset, - image = this._options[ "axisLayout" ] === "image", - result = [], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - yOffset = (p[ i ][ j ][ k ][1] * yRatio); - result[ i ][ j ][ k ] = [ - bbox[ 0 ] + ( p[ i ][ j ][ k ][ 0 ] * xRatio ), - image ? bbox[ 1 ] + yOffset : bbox[ 3 ] - yOffset - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _toPixel: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - bboxWidth = $.geo.width(bbox, true), - bboxHeight = $.geo.height(bbox, true), - image = this._options[ "axisLayout" ] === "image", - xRatio = width / bboxWidth, - yRatio = height / bboxHeight, - result = [ ], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = [ - Math.round( ( p[ i ][ j ][ k ][ 0 ] - bbox[ 0 ] ) * xRatio ), - Math.round( ( image ? p[ i ][ j ][ k ][ 1 ] - bbox[ 1 ] : bbox[ 3 ] - p[ i ][ j ][ k ][ 1 ] ) * yRatio ) - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _zoomTo: function (coord, zoom, trigger, refresh) { - zoom = zoom < 0 ? 0 : zoom; - - var pixelSize = this._getPixelSize( zoom ); - - this._setCenterAndSize( coord, pixelSize, trigger, refresh ); - }, - - _document_keydown: function (e) { - var len = this._drawCoords.length; - if (len > 0 && e.which == 27) { - if (len <= 2) { - this._resetDrawing(); - this._inOp = false; - } else { - this._drawCoords[len - 2] = $.merge( [], this._drawCoords[ len - 1 ] ); - this._drawPixels[len - 2] = $.merge( [], this._drawPixels[ len - 1 ] ); - - this._drawCoords.length--; - this._drawPixels.length--; - - this._refreshDrawing(); - } - } - }, - - _eventTarget_dblclick_zoom: function(e) { - this._trigger("dblclick", e, { type: "Point", coordinates: this.toMap(this._current) }); - if (!e.isDefaultPrevented()) { - var centerAndSize = this._getZoomCenterAndSize(this._current, 1, true ); - this._setCenterAndSize(centerAndSize.center, centerAndSize.pixelSize, true, true); - } - }, - - _eventTarget_dblclick: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - this._panFinalize(); - - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - var offset = $(e.currentTarget).offset(); - - switch (this._options["mode"]) { - case "drawLineString": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - this._drawCoords.length--; - this._trigger( "shape", e, { - type: "LineString", - coordinates: this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords - } ); - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - case "drawPolygon": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - var endIndex = this._drawCoords.length - 1; - if (endIndex > 2) { - this._drawCoords[endIndex] = $.merge( [], this._drawCoords[0] ); - this._trigger( "shape", e, { - type: "Polygon", - coordinates: [ this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords ] - } ); - } - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - case "measureLength": - case "measureArea": - this._resetDrawing(); - break; - - default: - this._eventTarget_dblclick_zoom(e); - break; - } - - this._inOp = false; - }, - - _eventTarget_touchstart: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if ( !this._supportTouch && e.which != 1 ) { - return; - } - - this._panFinalize(); - this._mouseWheelFinish(); - - var offset = $(e.currentTarget).offset(), - touches = e.originalEvent.changedTouches; - - if ( this._supportTouch ) { - this._multiTouchAnchor = $.merge( [ ], touches ); - - this._isMultiTouch = this._multiTouchAnchor.length > 1; - - if ( this._isMultiTouch ) { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - touches[1].pageX - offset.left, - touches[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - NaN, - NaN - ]; - - this._current = [ touches[0].pageX - offset.left, touches[0].pageY - offset.top ]; - } - } else { - this._current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - var downDate = $.now(); - if (downDate - this._downDate < 750) { - if (this._isTap) { - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - distance = Math.sqrt((dx * dx) + (dy * dy)); - if (distance > 8) { - this._isTap = false; - } else { - this._current = $.merge( [ ], this._anchor ); - } - } - - if (this._isDbltap) { - this._isDbltap = false; - } else { - this._isDbltap = this._isTap; - } - } else { - this._isDbltap = false; - } - this._isTap = true; - this._downDate = downDate; - } - - this._mouseDown = true; - this._anchor = $.merge( [ ], this._current ); - - if (!this._inOp && e.shiftKey) { - this._shiftZoom = true; - this._$eventTarget.css("cursor", this._options["cursors"]["zoom"]); - } else if ( !this._isMultiTouch && this._options[ "pannable" ] ) { - this._inOp = true; - - switch (this._options["mode"]) { - case "zoom": - break; - - default: - this._lastDrag = this._current; - - if (e.currentTarget.setCapture) { - e.currentTarget.setCapture(); - } - - break; - } - } - - e.preventDefault(); - return false; - }, - - _dragTarget_touchmove: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - var offset = this._$eventTarget.offset(), - drawCoordsLen = this._drawCoords.length, - touches = e.originalEvent.changedTouches, - current, - service, - i = 0; - - if ( this._supportTouch ) { - if ( !this._isMultiTouch && touches[ 0 ].identifier !== this._multiTouchAnchor[ 0 ].identifier ) { - // switch to multitouch - this._mouseDown = false; - this._dragTarget_touchstop( e ); - - this._isMultiTouch = true; - - this._multiTouchAnchor.push( touches[ 0 ] ); - - this._multiTouchCurrentBbox = [ - this._multiTouchCurrentBbox[ 0 ], - this._multiTouchCurrentBbox[ 1 ], - this._multiTouchAnchor[1].pageX - offset.left, - this._multiTouchAnchor[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._mouseDown = true; - this._anchor = this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - - return false; - } - - if ( this._isMultiTouch ) { - for ( ; i < touches.length; i++ ) { - if ( touches[ i ].identifier === this._multiTouchAnchor[ 0 ].identifier ) { - this._multiTouchCurrentBbox[ 0 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 1 ] = touches[ i ].pageY - offset.top; - } else if ( touches[ i ].identifier === this._multiTouchAnchor[ 1 ].identifier ) { - this._multiTouchCurrentBbox[ 2 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 3 ] = touches[ i ].pageY - offset.top; - } - } - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - - var currentWidth = this._multiTouchCurrentBbox[ 2 ] - this._multiTouchCurrentBbox[ 0 ], - anchorWidth = this._multiTouchAnchorBbox[ 2 ] - this._multiTouchAnchorBbox[ 0 ], - ratioWidth = currentWidth / anchorWidth; - - this._wheelLevel = Math.abs( Math.floor( ( 1 - ratioWidth ) * 10 ) ); - if ( Math.abs( currentWidth ) < Math.abs( anchorWidth ) ) { - this._wheelLevel = - this._wheelLevel; - } - - var pinchCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, false ); - this._$elem.find( ".geo-shapes-container" ).geographics("clear"); - - for ( i = 0; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - $.geo[ "_serviceTypes" ][ service.type ].interactiveScale( this, service, pinchCenterAndSize.center, pinchCenterAndSize.pixelSize ); - } - - if (this._graphicShapes.length > 0 && this._graphicShapes.length < 256) { - this._refreshShapes(this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes, pinchCenterAndSize.center, pinchCenterAndSize.pixelSize); - } - - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel(this._drawCoords, pinchCenterAndSize.center, pinchCenterAndSize.pixelSize); - this._refreshDrawing(); - } - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (current[0] === this._lastMove[0] && current[1] === this._lastMove[1]) { - if ( this._inOp ) { - e.preventDefault(); - return false; - } - } - - if ( _ieVersion == 7 ) { - this._isDbltap = this._isTap = false; - } - - if (this._mouseDown) { - this._current = current; - this._moveDate = $.now(); - } - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isDbltap = this._isTap = false; - return false; - } - - var mode = this._shiftZoom ? "zoom" : this._options["mode"]; - - switch (mode) { - case "zoom": - if ( this._mouseDown ) { - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawBbox", [ - this._anchor[ 0 ], - this._anchor[ 1 ], - current[ 0 ], - current[ 1 ] - ] ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (this._mouseDown || this._toolPan) { - this._panMove(); - } else { - if (drawCoordsLen > 0) { - this._drawCoords[drawCoordsLen - 1] = this._toMap(current); - this._drawPixels[drawCoordsLen - 1] = current; - - this._refreshDrawing(); - } - - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - default: - if (this._mouseDown || this._toolPan) { - this._panMove(); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - } - - this._lastMove = current; - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _dragTarget_touchstop: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if (!this._mouseDown && _ieVersion == 7) { - // ie7 doesn't appear to trigger dblclick on this._$eventTarget, - // we fake regular click here to cause soft dblclick - this._eventTarget_touchstart(e); - } - - var mouseWasDown = this._mouseDown, - wasToolPan = this._toolPan, - offset = this._$eventTarget.offset(), - mode = this._shiftZoom ? "zoom" : this._options["mode"], - current, i, clickDate, - dx, dy; - - if (this._supportTouch) { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - if (this._isTap) { - var dx = current[0] - this._anchor[0], - dy = current[1] - this._anchor[1], - distance = Math.sqrt((dx * dx) + (dy * dy)); - if (distance <= 8) { - current = $.merge( [ ], this._anchor ); - } - } - } - - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._shiftZoom = this._mouseDown = this._toolPan = false; - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isMultiTouch = false; - - var pinchCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, false ); - - this._setCenterAndSize(pinchCenterAndSize.center, pinchCenterAndSize.pixelSize, true, true); - - this._wheelLevel = 0; - - return false; - } - - if (document.releaseCapture) { - document.releaseCapture(); - } - - if (mouseWasDown) { - clickDate = $.now(); - this._current = current; - - switch (mode) { - case "zoom": - if ( dx > 0 || dy > 0 ) { - var minSize = this._pixelSize * 6, - bboxCoords = this._toMap( [ [ - Math.min( this._anchor[ 0 ], current[ 0 ] ), - Math.max( this._anchor[ 1 ], current[ 1 ] ) - ], [ - Math.max( this._anchor[ 0 ], current[ 0 ] ), - Math.min( this._anchor[ 1 ], current[ 1 ] ) - ] - ] ), - bbox = [ - bboxCoords[0][0], - bboxCoords[0][1], - bboxCoords[1][0], - bboxCoords[1][1] - ]; - - if ( ( bbox[2] - bbox[0] ) < minSize && ( bbox[3] - bbox[1] ) < minSize ) { - bbox = $.geo.scaleBy( this._getBbox( $.geo.center( bbox, true ) ), .5, true ); - } - - this._setBbox(bbox, true, true); - } - - this._resetDrawing(); - break; - - case "drawPoint": - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - var geomap = this; - this._drawTimeout = setTimeout(function () { - if (geomap._drawTimeout) { - geomap._trigger("shape", e, { type: "Point", coordinates: geomap.toMap(current) }); - geomap._inOp = false; - geomap._drawTimeout = null; - } - }, 250); - } - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (wasToolPan) { - this._panFinalize(); - } else { - i = (this._drawCoords.length == 0 ? 0 : this._drawCoords.length - 1); - - this._drawCoords[i] = this._toMap(current); - this._drawPixels[i] = current; - - if (i < 2 || !(this._drawCoords[i][0] == this._drawCoords[i-1][0] && - this._drawCoords[i][1] == this._drawCoords[i-1][1])) { - this._drawCoords[i + 1] = this._toMap(current); - this._drawPixels[i + 1] = current; - } - - this._refreshDrawing(); - } - break; - - default: - if (wasToolPan) { - this._panEnd(); - } else { - if (clickDate - this._clickDate > 100) { - this._trigger("click", e, { type: "Point", coordinates: this.toMap(current) }); - this._inOp = false; - } - } - break; - } - - this._clickDate = clickDate; - - if (this._softDblClick && this._isDbltap) { - this._isDbltap = this._isTap = false; - this._$eventTarget.trigger("dblclick", e); - } - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _eventTarget_mousewheel: function (e, delta) { - if ( this._options[ "mode" ] === "static" || this._options[ "scroll" ] === "off" ) { - return; - } - - e.preventDefault(); - - this._panFinalize(); - - if ( this._mouseDown ) { - return false; - } - - if (delta != 0) { - if (this._wheelTimeout) { - window.clearTimeout(this._wheelTimeout); - this._wheelTimeout = null; - } else { - var offset = $(e.currentTarget).offset(); - this._anchor = [e.pageX - offset.left, e.pageY - offset.top]; - } - - this._wheelLevel += delta; - - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, this._options[ "tilingScheme" ] != null ), - service, - i = 0; - - this._$elem.find( ".geo-shapes-container" ).geographics("clear"); - - for ( ; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - $.geo["_serviceTypes"][service.type].interactiveScale(this, service, wheelCenterAndSize.center, wheelCenterAndSize.pixelSize); - } - - if (this._graphicShapes.length > 0 && this._graphicShapes.length < 256) { - this._refreshShapes(this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes, wheelCenterAndSize.center, wheelCenterAndSize.pixelSize); - } - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel(this._drawCoords, wheelCenterAndSize.center, wheelCenterAndSize.pixelSize); - this._refreshDrawing(); - } - - var geomap = this; - this._wheelTimeout = window.setTimeout(function () { - geomap._mouseWheelFinish(); - }, 1000); - } - - return false; - } - } - ); -})(jQuery); - -(function ($, undefined) { - $.geo._serviceTypes.tiled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0, - reloadTiles: false - }; - - var scHtml = '
          '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children( ":last" ); - - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactivePan: function ( map, service, dx, dy ) { - var serviceState = $.data( service, "geoServiceState" ); - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).css( "-moz-transition", "").css( { - webkitTransition: "", - transition: "", - left: function ( index, value ) { - return parseInt( value ) + dx; - }, - top: function ( index, value ) { - return parseInt( value ) + dy; - } - }); - - if ( service && service.style.visibility === "visible" ) { - var pixelSize = map._pixelSize, - - serviceObj = this, - serviceContainer = serviceState.serviceContainer, - scaleContainer = serviceContainer.children("[data-pixelSize='" + pixelSize + "']"), - - /* same as refresh 1 */ - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - image = map.options[ "axisLayout" ] === "image", - ySign = image ? +1 : -1, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - /* end same as refresh 1 */ - - halfWidth = mapWidth / 2 * pixelSize, - halfHeight = mapHeight / 2 * pixelSize, - - currentPosition = scaleContainer.position(), - scaleOriginParts = scaleContainer.data("scaleOrigin").split(","), - totalDx = parseInt(scaleOriginParts[0]) - currentPosition.left, - totalDy = parseInt(scaleOriginParts[1]) - currentPosition.top, - - mapCenterOriginal = map._getCenter(), - mapCenter = [ - mapCenterOriginal[0] + totalDx * pixelSize, - mapCenterOriginal[1] + ySign * totalDy * pixelSize - ], - - /* same as refresh 2 */ - tileX = Math.floor(((mapCenter[0] - halfWidth) - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.max( Math.floor(( image ? (mapCenter[1] - halfHeight) - tilingScheme.origin[1] : tilingScheme.origin[1] - (mapCenter[1] + halfHeight)) / (pixelSize * tileHeight)), 0 ), - tileX2 = Math.ceil(((mapCenter[0] + halfWidth) - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil(( image ? (mapCenter[1] + halfHeight) - tilingScheme.origin[1] : tilingScheme.origin[1] - (mapCenter[1] - halfHeight)) / (pixelSize * tileHeight)), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] + ySign * bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMinOrMaxY = tilingScheme.origin[1] + ySign * (fullYAtScale * tileHeight) * pixelSize, - /* end same as refresh 2 */ - - serviceLeft = Math.round((fullXMinX - (mapCenterOriginal[0] - halfWidth)) / pixelSize), - serviceTop = Math.round(( image ? fullYMinOrMaxY - (mapCenterOriginal[1] - halfHeight) : (mapCenterOriginal[1] + halfHeight) - fullYMinOrMaxY ) / pixelSize), - - opacity = service.style.opacity, - - x, y; - - for ( x = tileX; x < tileX2; x++ ) { - for ( y = tileY; y < tileY2; y++ ) { - var tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ( $img.size( ) === 0 ) { - /* same as refresh 3 */ - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] + ySign * (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] + ySign * ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - urlProp = ( service.hasOwnProperty("src") ? "src" : "getUrl" ), - urlArgs = { - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl; - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.template( "geoSrc", service[ urlProp ] ); - imageUrl = $.render( urlArgs, "geoSrc" ); - } - /* end same as refresh 3 */ - - serviceState.loadCount++; - //this._map._requestQueued(); - - if ( serviceState.reloadTiles && $img.size() > 0 ) { - $img.attr( "src", imageUrl ); - } else { - /* same as refresh 4 */ - var imgMarkup = ""; - - scaleContainer.append( imgMarkup ); - $img = scaleContainer.children(":last"); - } - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, serviceState, serviceContainer, opacity ); - } else { - // assume Deferred - imageUrl.done( function( url ) { - serviceObj._loadImage( $img, url, pixelSize, serviceState, serviceContainer, opacity ); - } ).fail( function( ) { - $img.remove( ); - serviceState.loadCount--; - } ); - } - - /* end same as refresh 4 */ - } - } - } - } - } - }, - - interactiveScale: function (map, service, center, pixelSize) { - var serviceState = $.data( service, "geoServiceState" ); - - if ( serviceState && service && service.style.visibility === "visible" ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight; - - - serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scaleRatio = $scaleContainer.attr("data-pixelSize") / pixelSize, - transitionCss = ""; //"width .25s ease-in, height .25s ease-in, left .25s ease-in, top .25s ease-in"; - - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - - var scaleOriginParts = $scaleContainer.data("scaleOrigin").split(","), - oldMapCoord = map._toMap([scaleOriginParts[0], scaleOriginParts[1]]), - newPixelPoint = map._toPixel(oldMapCoord, center, pixelSize); - - $scaleContainer.css( "-moz-transition", transitionCss ).css( { - webkitTransition: transitionCss, - transition: transitionCss, - left: Math.round(newPixelPoint[0]) + "px", - top: Math.round(newPixelPoint[1]) + "px", - width: tileWidth * scaleRatio, - height: tileHeight * scaleRatio - } ); - - if ( $("body")[0].filters !== undefined ) { - $scaleContainer.children().each( function ( i ) { - $( this ).css( "filter", "progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11=" + scaleRatio + ",M22=" + scaleRatio + ",sizingmethod='auto expand')" ); - } ); - } - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - this._cancelUnloaded(map, service); - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - $serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - image = map.options[ "axisLayout" ] === "image", - ySign = image ? +1 : -1, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - - tileX = Math.floor((bbox[0] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.max( Math.floor( ( image ? bbox[1] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 3 ] ) / (pixelSize * tileHeight) ), 0 ), - tileX2 = Math.ceil((bbox[2] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil( ( image ? bbox[3] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 1 ] ) / (pixelSize * tileHeight) ), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] + ySign * bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMinOrMaxY = tilingScheme.origin[1] + ySign * (fullYAtScale * tileHeight) * pixelSize, - - serviceLeft = Math.round((fullXMinX - bbox[0]) / pixelSize), - serviceTop = Math.round( ( image ? fullYMinOrMaxY - bbox[1] : bbox[3] - fullYMinOrMaxY ) / pixelSize), - - scaleContainers = $serviceContainer.children().show(), - scaleContainer = scaleContainers.filter("[data-pixelSize='" + pixelSize + "']").appendTo($serviceContainer), - - opacity = service.style.opacity, - - x, y; - - if (serviceState.reloadTiles) { - scaleContainers.find("img").attr("data-dirty", "true"); - } - - if (!scaleContainer.size()) { - $serviceContainer.append("
          "); - scaleContainer = $serviceContainer.children(":last").data("scaleOrigin", (serviceLeft % tileWidth) + "," + (serviceTop % tileHeight)); - } else { - scaleContainer.css({ - left: (serviceLeft % tileWidth) + "px", - top: (serviceTop % tileHeight) + "px" - }).data("scaleOrigin", (serviceLeft % tileWidth) + "," + (serviceTop % tileHeight)); - - scaleContainer.children().each(function (i) { - var - $img = $(this), - tile = $img.attr("data-tile").split(","); - - $img.css({ - left: Math.round(((parseInt(tile[0]) - fullXAtScale) * 100) + (serviceLeft - (serviceLeft % tileWidth)) / tileWidth * 100) + "%", - top: Math.round(((parseInt(tile[1]) - fullYAtScale) * 100) + (serviceTop - (serviceTop % tileHeight)) / tileHeight * 100) + "%" - }); - - if (opacity < 1) { - $img.fadeTo(0, opacity); - } - }); - } - - for (x = tileX; x < tileX2; x++) { - for (y = tileY; y < tileY2; y++) { - var tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ($img.size() === 0 || serviceState.reloadTiles) { - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] + ySign * (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] + ySign * ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - urlProp = ( service.hasOwnProperty( "src" ) ? "src" : "getUrl" ), - urlArgs = { - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl; - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.template( "geoSrc", service[ urlProp ] ); - imageUrl = $.render( urlArgs, "geoSrc" ); - } - - serviceState.loadCount++; - //this._map._requestQueued(); - - if (serviceState.reloadTiles && $img.size() > 0) { - $img.attr("src", imageUrl); - } else { - var imgMarkup = ""; - - scaleContainer.append(imgMarkup); - $img = scaleContainer.children(":last"); - } - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, serviceState, $serviceContainer, opacity ); - } else { - // assume Deferred - imageUrl.done( function( url ) { - serviceObj._loadImage( $img, url, pixelSize, serviceState, $serviceContainer, opacity ); - } ).fail( function( ) { - $img.remove( ); - serviceState.loadCount--; - } ); - } - } - } - } - - scaleContainers.find("[data-dirty]").remove(); - serviceState.reloadTiles = false; - } - }, - - resize: function (map, service) { - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.css( "display", service.style.visibility === "visible" ? "block" : "none" ); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - } - } - }, - - _loadImage: function ( $img, url, pixelSize, serviceState, serviceContainer, opacity ) { - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - })(); -})(jQuery); -(function ($, undefined) { - $.geo._serviceTypes.shingled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0 - }; - - var scHtml = '
          '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children(":last"); - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactivePan: function (map, service, dx, dy) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - pixelSize = map._pixelSize, - scaleContainer = serviceContainer.children("[data-pixelSize='" + pixelSize + "']"), - panContainer = scaleContainer.children("div"); - - if ( !panContainer.length ) { - scaleContainer.children("img").wrap('
          '); - panContainer = scaleContainer.children("div"); - } - - panContainer.css( { - left: function (index, value) { - return parseInt(value) + dx; - }, - top: function (index, value) { - return parseInt(value) + dy; - } - } ); - - // until pan/zoom rewrite, remove all containers not in this scale - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - } - }, - - interactiveScale: function (map, service, center, pixelSize) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight]; - - serviceContainer.children().each(function (i) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.attr("data-pixelSize"), - ratio = scalePixelSize / pixelSize; - - $scaleContainer.css( { - width: mapWidth * ratio, - height: mapHeight * ratio } ).children("img").each(function (i) { - var $img = $(this), - imgCenter = $img.data("center"), - x = (Math.round((imgCenter[0] - center[0]) / scalePixelSize) - halfWidth) * ratio, - y = (Math.round((center[1] - imgCenter[1]) / scalePixelSize) - halfHeight) * ratio; - - $img.css({ left: x + "px", top: y + "px" }); - }); - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - this._cancelUnloaded(map, service); - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - scaleContainer = serviceContainer.children('[data-pixelSize="' + pixelSize + '"]'), - - opacity = service.style.opacity, - - $img; - - if ( !scaleContainer.size() ) { - serviceContainer.append('
          '); - scaleContainer = serviceContainer.children(":last"); - } - - scaleContainer.children("img").each(function (i) { - var $thisimg = $(this), - imgCenter = $thisimg.data("center"), - center = map._getCenter(), - x = Math.round((imgCenter[0] - center[0]) / pixelSize) - halfWidth, - y = Math.round((center[1] - imgCenter[1]) / pixelSize) - halfHeight; - - $thisimg.css({ left: x + "px", top: y + "px" }); - }); - - if (opacity < 1) { - serviceContainer.find("img").attr("data-keepAlive", "0"); - } - - var urlProp = ( service.hasOwnProperty("src") ? "src" : "getUrl" ), - urlArgs = { - bbox: bbox, - width: mapWidth, - height: mapHeight, - zoom: map._getZoom(), - tile: null, - index: 0 - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl; - - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.template( "geoSrc", service[ urlProp ] ); - imageUrl = $.render( urlArgs, "geoSrc" ); - } - - serviceState.loadCount++; - //this._map._requestQueued(); - - scaleContainer.append(''); - $img = scaleContainer.children(":last").data("center", map._getCenter()); - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, serviceState, serviceContainer, opacity ); - } else { - // assume Deferred - imageUrl.done( function( url ) { - serviceObj._loadImage( $img, url, pixelSize, serviceState, serviceContainer, opacity ); - } ).fail( function( ) { - $img.remove( ); - serviceState.loadCount--; - } ); - } - - } - }, - - resize: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState && service && service.style.visibility === "visible" ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - scaleContainer = serviceContainer.children(); - - scaleContainer.attr("data-pixelSize", "0"); - scaleContainer.css({ - left: halfWidth + 'px', - top: halfHeight + 'px' - }); - } - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - serviceState.serviceContainer.css("display", service.style.visibility === "visible" ? "block" : "none"); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - } - } - }, - - _loadImage: function ( $img, url, pixelSize, serviceState, serviceContainer, opacity ) { - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(':not([data-pixelSize="' + pixelSize + '"])').remove(); - - var panContainer = serviceContainer.find('[data-pixelSize="' + pixelSize + '"]>div'); - if (panContainer.size() > 0) { - var panContainerPos = panContainer.position(); - - panContainer.children("img").each(function (i) { - var $thisimg = $(this), - x = panContainerPos.left + parseInt($thisimg.css("left")), - y = panContainerPos.top + parseInt($thisimg.css("top")); - - $thisimg.css({ left: x + "px", top: y + "px" }); - }).unwrap(); - - panContainer.remove(); - } - - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixelSize='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - } - })(); -})(jQuery); -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.6 - * - * Requires: 1.2.2+ - */ - -(function($) { - -var types = ['DOMMouseScroll', 'mousewheel']; - -if ($.event.fixHooks) { - for ( var i=types.length; i; ) { - $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; - } -} - -$.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) { - for ( var i=types.length; i; ) { - this.addEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i=types.length; i; ) { - this.removeEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = null; - } - } -}; - -$.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } -}); - - -function handler(event) { - var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; - event = $.event.fix(orgEvent); - event.type = "mousewheel"; - - // Old school scrollwheel delta - if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } - if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } - - // New school multidimensional scroll (touchpads) deltas - deltaY = delta; - - // Gecko - if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaY = 0; - deltaX = -1*delta; - } - - // Webkit - if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } - if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - return ($.event.dispatch || $.event.handle).apply(this, args); -} - -})(jQuery); diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.min.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.min.js deleted file mode 100755 index 8696f1e..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0a4.min.js +++ /dev/null @@ -1,171 +0,0 @@ -document.createElement("canvas").getContext||function(){function g(){return this.context_||(this.context_=new t(this))}function q(p,h){var o=G.call(arguments,2);return function(){return p.apply(h,o.concat(G.call(arguments)))}}function r(p){p.namespaces.g_vml_||p.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");p.namespaces.g_o_||p.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!p.styleSheets.ex_canvas_){p=p.createStyleSheet();p.owningElement.id= -"ex_canvas_";p.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function b(p){var h=p.srcElement;switch(p.propertyName){case "width":h.getContext().clearRect();h.style.width=h.attributes.width.nodeValue+"px";h.firstChild.style.width=h.clientWidth+"px";break;case "height":h.getContext().clearRect();h.style.height=h.attributes.height.nodeValue+"px";h.firstChild.style.height=h.clientHeight+"px"}}function c(p){p=p.srcElement;if(p.firstChild){p.firstChild.style.width= -p.clientWidth+"px";p.firstChild.style.height=p.clientHeight+"px"}}function a(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(p,h){for(var o=a(),s=0;s<3;s++)for(var x=0;x<3;x++){for(var v=0,A=0;A<3;A++)v+=p[s][A]*h[A][x];o[s][x]=v}return o}function f(p,h){h.fillStyle=p.fillStyle;h.lineCap=p.lineCap;h.lineJoin=p.lineJoin;h.lineWidth=p.lineWidth;h.miterLimit=p.miterLimit;h.shadowBlur=p.shadowBlur;h.shadowColor=p.shadowColor;h.shadowOffsetX=p.shadowOffsetX;h.shadowOffsetY=p.shadowOffsetY;h.strokeStyle=p.strokeStyle; -h.globalAlpha=p.globalAlpha;h.font=p.font;h.textAlign=p.textAlign;h.textBaseline=p.textBaseline;h.arcScaleX_=p.arcScaleX_;h.arcScaleY_=p.arcScaleY_;h.lineScale_=p.lineScale_}function e(p){var h=p.indexOf("(",3),o=p.indexOf(")",h+1);h=p.substring(h+1,o).split(",");if(h.length!=4||p.charAt(3)!="a")h[3]=1;return h}function l(p,h,o){return Math.min(o,Math.max(h,p))}function m(p,h,o){o<0&&o++;o>1&&o--;return 6*o<1?p+(h-p)*6*o:2*o<1?h:3*o<2?p+(h-p)*(2/3-o)*6:p}function n(p){if(p in R)return R[p];var h, -o=1;p=String(p);if(p.charAt(0)=="#")h=p;else if(/^rgb/.test(p)){o=e(p);h="#";for(var s,x=0;x<3;x++){s=o[x].indexOf("%")!=-1?Math.floor(parseFloat(o[x])/100*255):+o[x];h+=M[l(s,0,255)]}o=+o[3]}else if(/^hsl/.test(p)){x=o=e(p);h=parseFloat(x[0])/360%360;h<0&&h++;s=l(parseFloat(x[1])/100,0,1);x=l(parseFloat(x[2])/100,0,1);if(s==0)s=x=h=x;else{var v=x<0.5?x*(1+s):x+s-x*s,A=2*x-v;s=m(A,v,h+1/3);x=m(A,v,h);h=m(A,v,h-1/3)}h="#"+M[Math.floor(s*255)]+M[Math.floor(x*255)]+M[Math.floor(h*255)];o=o[3]}else h= -p;return R[p]={color:h,alpha:o}}function t(p){this.m_=a();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=H*1;this.globalAlpha=1;this.canvas=p;var h="width:"+p.clientWidth+"px;height:"+p.clientHeight+"px;overflow:hidden;position:absolute",o=p.ownerDocument.createElement("div");o.style.cssText=h;p.appendChild(o);h=o.cloneNode(false);h.style.backgroundColor="red";h.style.filter="alpha(opacity=0)"; -p.appendChild(h);this.element_=o;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}function u(p,h,o,s){p.currentPath_.push({type:"bezierCurveTo",cp1x:h.x,cp1y:h.y,cp2x:o.x,cp2y:o.y,x:s.x,y:s.y});p.currentX_=s.x;p.currentY_=s.y}function w(p,h,o){p=p.m_;return{x:H*(h*p[0][0]+o*p[1][0]+p[2][0])-C,y:H*(h*p[0][1]+o*p[1][1]+p[2][1])-C}}function B(p,h,o){if(isFinite(h[0][0])&&isFinite(h[0][1])&&isFinite(h[1][0])&&isFinite(h[1][1])&&isFinite(h[2][0])&&isFinite(h[2][1])){p.m_=h;if(o)p.lineScale_=P(J(h[0][0]* -h[1][1]-h[0][1]*h[1][0]))}}function I(p){this.code=this[p];this.message=p+": DOM Exception "+this.code}var F=Math,y=F.round,K=F.sin,D=F.cos,J=F.abs,P=F.sqrt,H=10,C=H/2;navigator.userAgent.match(/MSIE ([\d.]+)?/);var G=Array.prototype.slice;r(document);F={init:function(p){p=p||document;p.createElement("canvas");p.attachEvent("onreadystatechange",q(this.init_,this,p))},init_:function(p){p=p.getElementsByTagName("canvas");for(var h=0;hs.x)s.x=v.x;if(o.y==null||v.ys.y)s.y=v.y}}h.push(' ">');if(p){p=n(this.fillStyle);h.push('')}else{o=n(this.strokeStyle);p=o.color;o=o.alpha*this.globalAlpha;s=this.lineScale_*this.lineWidth;if(s<1)o*=s;h.push("')}h.push("");this.element_.insertAdjacentHTML("beforeEnd",h.join(""))};z.fill=function(){this.stroke(true)};z.closePath=function(){this.currentPath_.push({type:"close"})};z.save= -function(){var p={};f(this,p);this.aStack_.push(p);this.mStack_.push(this.m_);this.m_=d(a(),this.m_)};z.restore=function(){if(this.aStack_.length){f(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};z.translate=function(p,h){B(this,d([[1,0,0],[0,1,0],[p,h,1]],this.m_),false)};z.scale=function(p,h){this.arcScaleX_*=p;this.arcScaleY_*=h;B(this,d([[p,0,0],[0,h,0],[0,0,1]],this.m_),true)};z=I.prototype=Error();z.INDEX_SIZE_ERR=1;z.DOMSTRING_SIZE_ERR=2;z.HIERARCHY_REQUEST_ERR=3;z.WRONG_DOCUMENT_ERR= -4;z.INVALID_CHARACTER_ERR=5;z.NO_DATA_ALLOWED_ERR=6;z.NO_MODIFICATION_ALLOWED_ERR=7;z.NOT_FOUND_ERR=8;z.NOT_SUPPORTED_ERR=9;z.INUSE_ATTRIBUTE_ERR=10;z.INVALID_STATE_ERR=11;z.SYNTAX_ERR=12;z.INVALID_MODIFICATION_ERR=13;z.NAMESPACE_ERR=14;z.INVALID_ACCESS_ERR=15;z.VALIDATION_ERR=16;z.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=F;CanvasRenderingContext2D=t;DOMException=I}(); -$.widget||function(g,q){if(g.cleanData){var r=g.cleanData;g.cleanData=function(c){for(var a=0,d;(d=c[a])!=null;a++)try{g(d).triggerHandler("remove")}catch(f){}r(c)}}else{var b=g.fn.remove;g.fn.remove=function(c,a){return this.each(function(){if(!a)if(!c||g.filter(c,[this]).length)g("*",this).add([this]).each(function(){try{g(this).triggerHandler("remove")}catch(d){}});return b.call(g(this),c,a)})}}g.widget=function(c,a,d){var f=c.split(".")[0],e;c=c.split(".")[1];e=f+"-"+c;if(!d){d=a;a=g.Widget}g.expr[":"][e]= -function(l){return!!g.data(l,c)};g[f]=g[f]||{};g[f][c]=function(l,m){arguments.length&&this._createWidget(l,m)};a=new a;a.options=g.extend(true,{},a.options);g[f][c].prototype=g.extend(true,a,{namespace:f,widgetName:c,widgetEventPrefix:g[f][c].prototype.widgetEventPrefix||c,widgetBaseClass:e},d);g.widget.bridge(c,g[f][c])};g.widget.bridge=function(c,a){g.fn[c]=function(d){var f=typeof d==="string",e=Array.prototype.slice.call(arguments,1),l=this;d=!f&&e.length?g.extend.apply(null,[true,d].concat(e)): -d;if(f&&d.charAt(0)==="_")return l;f?this.each(function(){var m=g.data(this,c),n=m&&g.isFunction(m[d])?m[d].apply(m,e):m;if(n!==m&&n!==q){l=n;return false}}):this.each(function(){var m=g.data(this,c);m?m.option(d||{})._init():g.data(this,c,new a(d,this))});return l}};g.Widget=function(c,a){arguments.length&&this._createWidget(c,a)};g.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(c,a){g.data(a,this.widgetName,this);this.element=g(a);this.options= -g.extend(true,{},this.options,this._getCreateOptions(),c);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return g.metadata&&g.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+ -"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(c,a){var d=c;if(arguments.length===0)return g.extend({},this.options);if(typeof c==="string"){if(a===q)return this.options[c];d={};d[c]=a}this._setOptions(d);return this},_setOptions:function(c){var a=this;g.each(c,function(d,f){a._setOption(d,f)});return this},_setOption:function(c,a){this.options[c]=a;if(c==="disabled")this.widget()[a?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled", -a);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(c,a,d){var f,e=this.options[c];d=d||{};a=g.Event(a);a.type=(c===this.widgetEventPrefix?c:this.widgetEventPrefix+c).toLowerCase();a.target=this.element[0];if(c=a.originalEvent)for(f in c)f in a||(a[f]=c[f]);this.element.trigger(a,d);return!(g.isFunction(e)&&e.call(this.element[0],a,d)===false||a.isDefaultPrevented())}}}(jQuery); -window.JsViews||window.jQuery&&jQuery.views||function(g,q){function r(h,o,s,x,v){var A=(s=s||{viewsCount:0,ctx:n.helpers})&&s.ctx;return{jsViews:"v1.0pre",path:o||"",itemNumber:++s.viewsCount||1,viewsCount:0,tmpl:v,data:x||s.data||{},ctx:h&&h===A?A:A?F(F({},A),h):h||{},parent:s}}function b(h,o,s,x,v,A,E){return s?(x?v?"$view."+v:s:"$data."+s)+(A||""):E||o||""}function c(h){function o(O){O-=x;O&&E.push(h.substr(x,O).replace(C,"\\n"))}var s,x=0,v=[],A=[],E=A,N=[,,A];h=h.replace(M,"\\$1");h.replace(w, -function(O,S,Q,ga,ha,T,ia,ja,ka,ca){function la(Z,V,ma,da,na,oa,ea,fa,pa,qa){return W?(W=!ea,W?Z:'"'):X?(X=!fa,X?Z:'"'):da?V.replace(P,b)+da:na?Y?"":(aa=K,"\u0008"+V+":"):ma?(Y++,V.replace(P,b)+"("):pa?(Y--,")"):V?V.replace(P,b):oa?",":qa?Y?"":aa?(aa=y,"\u0008"):",":(W=ea,X=fa,'"')}var aa,ba="",Y=0,X=y,W=y;Q=Q||ga;o(ca);if(ha)n.allowCode&&E.push(["*",T.replace(G,"$1")]);else if(Q){if(Q==="else"){N=v.pop();E=N[2];S=K}T=T?(T+" ").replace(H,la).replace(z,function(Z,V){ba+=V+",";return""}):"";T=T.slice(0, --1);s=[Q,ia?ja||"none":"",S&&[],"{"+ba+"_hash:'"+ba+"',_path:'"+T+"'}",T];if(S){v.push(N);N=s}E.push(s)}else if(ka)N=v.pop();x=ca+O.length;if(!N)throw"Expected block tag";E=N[2]});o(h.length);return a(A)}function a(h){var o,s,x=[],v=h.length,A="try{var views="+(D?"jQuery":"JsViews")+'.views,tag=views.renderTag,enc=views.encode,html=views.encoders.html,$ctx=$view && $view.ctx,result=""+\n\n';for(s=0;s)[^>]*$|\{\{\! /,P=/^(true|false|null|[\d\.]+)|(\w+|\$(view|data|ctx|(\w+)))([\w\.]*)|((['"])(?:\\\1|.)*\7)$/g,H=/(\$?[\w\.\[\]]+)(?:(\()|\s*(===|!==|==|!=|<|>|<=|>=)\s*|\s*(\=)\s*)?|(\,\s*)|\\?(\')|\\?(\")|(\))|(\s+)/g,C=/\r?\n/g,G=/\\(['"])/g,M=/\\?(['"])/g,z=/\x08([^\x08]+)\x08/g,L=0,R={"&":"&","<":"<",">":">"},U=/[\x00"&'<>]/g,p=Array.prototype.slice;if(D){e=D;e.fn.extend({render:function(h,o,s,x){return u(h,this[0],o,s,x)},template:function(h,o){return e.template(h, -this[0],o)}})}else{l=g.$;g.JsViews=m=g.$=e={extend:function(h,o){for(var s in o)h[s]=o[s];return h},isArray:Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"},noConflict:function(){if(g.$===m)g.$=l;return m}}}F=e.extend;F(e,{views:n={templates:{},tags:{"if":function(){var h=this._view;h.onElse=function(o,s){for(var x=0,v=s.length;v&&!s[x++];)if(x===v)return"";h.onElse=q;return u(h.data,o.tmpl,h.ctx,h)};return h.onElse(this,arguments)},"else":function(){var h=this._view; -return h.onElse?h.onElse(this,arguments):""},each:function(){var h,o="",s=arguments,x=s.length,v=this.tmpl,A=this._view;for(h=0;hError: "+(h.message||h)+". ":'""'},setDelimiters:function(h,o){var s=o.charAt(0), -x=o.charAt(1);h="\\"+h.charAt(0)+"\\"+h.charAt(1);o="\\"+s+"\\"+x;w=h+"(?:(?:(\\#)?(\\w+(?=[!\\s\\"+s+"]))|(?:(\\=)|(\\*)))\\s*((?:[^\\"+s+"]|\\"+s+"(?!\\"+x+"))*?)(!(\\w*))?|(?:\\/([\\w\\$\\.\\[\\]]+)))"+o;w=RegExp(w,"g")},registerTags:B=function(h,o){var s;if(typeof h==="object")for(s in h)B(s,h[s]);else n.tags[h]=o;return this},registerHelpers:I=function(h,o){if(typeof h==="object")for(var s in h)I(s,h[s]);else n.helpers[h]=o;return this},encode:function(h,o){return o?(t[h||"html"]||t.html)(o): -""},encoders:t={none:function(h){return h},html:function(h){return String(h).replace(U,d)}},renderTag:function(h,o,s,x,v){var A,E;A=arguments;E=n.presenters;hash=v._hash;tagFn=n.tags[h];if(!tagFn)return"";x=x&&o.tmpl.nested[x-1];v.tmpl=v.tmpl||x||q;if(E&&E[h]){E=F(F({},v.ctx),v);delete E.ctx;delete E._path;delete E.tmpl;v.ctx=E;v._ctor=h+(hash?"="+hash.slice(0,-1):"");v=F(F({},tagFn),v);tagFn=n.tags.each}v._encode=s;v._view=o;return(A=tagFn.apply(v,A.length>5?p.call(A,5):[o.data]))||(A===q?"":A.toString())}}, -render:u=function(h,o,s,x,v,A){var E,N,O,S,Q="";if(arguments.length===2&&h.jsViews){x=h;s=x.ctx;h=x.data}o=e.template(o);if(!o)return"";if(e.isArray(h)){S=new r(s,v,x,h);E=0;for(N=h.length;E"+O+""; - } while ( a[0] ); - return v > 6 ? v : !v; - }() ); - - $.widget("geo.geographics", { - _$elem: undefined, - _options: {}, - _trueCanvas: true, - - _width: 0, - _height: 0, - - _$canvas: undefined, - _context: undefined, - - _blitcanvas: undefined, - _blitcontext: undefined, - - _$labelsContainer: undefined, - - options: { - style: { - borderRadius: "8px", - color: "#7f0000", - //fill: undefined, - fillOpacity: 0.2, - height: "8px", - opacity: 1, - //stroke: undefined, - strokeOpacity: 1, - strokeWidth: "2px", - visibility: "visible", - width: "8px" - } - }, - - _create: function () { - this._$elem = this.element; - this._options = this.options; - - this._$elem.css({ display: "inline-block", overflow: "hidden", textAlign: "left" }); - - if (this._$elem.css("position") == "static") { - this._$elem.css("position", "relative"); - } - - this._$elem.addClass( "geo-graphics" ); - - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width"), 10); - this._height = parseInt(this._$elem.css("height"), 10); - } - - var posCss = 'position:absolute;left:0;top:0;margin:0;padding:0;', - sizeCss = 'width:' + this._width + 'px;height:' + this._height + 'px;', - sizeAttr = 'width="' + this._width + '" height="' + this._height + '"'; - - if (document.createElement('canvas').getContext) { - this._$elem.append(''); - this._$canvas = this._$elem.children(':last'); - this._context = this._$canvas[0].getContext("2d"); - - this._blitcanvas = document.createElement( "canvas" ); - this._blitcanvas.width = this._width; - this._blitcanvas.height = this._height; - this._blitcontext = this._blitcanvas.getContext("2d"); - } else if (_ieVersion <= 8) { - this._trueCanvas = false; - this._$elem.append( '
          '); - this._$canvas = this._$elem.children(':last'); - - G_vmlCanvasManager.initElement(this._$canvas[0]); - this._context = this._$canvas[0].getContext("2d"); - this._$canvas.children().css({ backgroundColor: "transparent", width: this._width, height: this._height }); - } - - this._$elem.append('
          '); - this._$labelsContainer = this._$elem.children(':last'); - }, - - _setOption: function (key, value) { - if (key == "style") { - value = $.extend({}, this._options.style, value); - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - destroy: function () { - $.Widget.prototype.destroy.apply(this, arguments); - this._$elem.html(""); - this._$elem.removeClass( "geo-graphics" ); - }, - - clear: function () { - this._context.clearRect(0, 0, this._width, this._height); - this._$labelsContainer.html(""); - }, - - drawArc: function (coordinates, startAngle, sweepAngle, style) { - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0 && style.widthValue > 0 && style.heightValue > 0) { - var r = Math.min(style.widthValue, style.heightValue) / 2; - - startAngle = (startAngle * Math.PI / 180); - sweepAngle = (sweepAngle * Math.PI / 180); - - this._context.save(); - this._context.translate(coordinates[0], coordinates[1]); - if (style.widthValue > style.heightValue) { - this._context.scale(style.widthValue / style.heightValue, 1); - } else { - this._context.scale(1, style.heightValue / style.widthValue); - } - - this._context.beginPath(); - this._context.arc(0, 0, r, startAngle, sweepAngle, false); - - if (this._trueCanvas) { - this._context.restore(); - } - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - - if (!this._trueCanvas) { - this._context.restore(); - } - } - }, - - drawPoint: function (coordinates, style) { - style = this._getGraphicStyle(style); - if (style.widthValue == style.heightValue && style.heightValue == style.borderRadiusValue) { - this.drawArc(coordinates, 0, 360, style); - } else if (style.visibility != "hidden" && style.opacity > 0) { - style.borderRadiusValue = Math.min(Math.min(style.widthValue, style.heightValue) / 2, style.borderRadiusValue); - coordinates[0] -= style.widthValue / 2; - coordinates[1] -= style.heightValue / 2; - this._context.beginPath(); - this._context.moveTo(coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.lineTo(coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1]); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1], coordinates[0] + style.widthValue, coordinates[1] + style.borderRadiusValue); - this._context.lineTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue, coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.lineTo(coordinates[0] + style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1] + style.heightValue, coordinates[0], coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.lineTo(coordinates[0], coordinates[1] + style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1], coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.closePath(); - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - - this._context.stroke(); - } - } - }, - - drawLineString: function (coordinates, style) { - this._drawLines([coordinates], false, style); - }, - - drawPolygon: function (coordinates, style) { - if ( !this._trueCanvas || coordinates.length == 1 ) { - // either we don't have fancy rendering or there's no need for it (no holes) - this._drawLines( coordinates, true, style ); - } else { - if ( !coordinates || !coordinates.length || coordinates[ 0 ].length < 3 ) { - // this is not a Polygon or it doesn't have a proper outer ring - return; - } - - style = this._getGraphicStyle(style); - - var pixelBbox, i, j; - - if ( style.visibility != "hidden" && style.opacity > 0 ) { - this._blitcontext.clearRect(0, 0, this._width, this._height); - - if ( style.doFill ) { - if ( coordinates.length > 1 ) { - // stencil inner rings - this._blitcontext.globalCompositeOperation = "source-out"; - this._blitcontext.globalAlpha = 1; - - for ( i = 1; i < coordinates.length; i++ ) { - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ i ][ 0 ][ 0 ], coordinates[ i ][ 0 ][ 1 ] ); - for ( j = 1; j < coordinates[ i ].length; j++ ) { - this._blitcontext.lineTo( coordinates[ i ][ j ][ 0 ], coordinates[ i ][ j ][ 1 ] ); - } - this._blitcontext.closePath(); - - this._blitcontext.fill( ); - } - } - } - - // path outer ring - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ 0 ][ 0 ][ 0 ], coordinates[ 0 ][ 0 ][ 1 ] ); - - pixelBbox = [ coordinates[ 0 ][ 0 ][ 0 ] - style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 1 ] - style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 0 ] + style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 1 ] + style.strokeWidthValue ]; - - for ( i = 1; i < coordinates[ 0 ].length - 1; i++ ) { - this._blitcontext.lineTo( coordinates[ 0 ][ i ][ 0 ], coordinates[ 0 ][ i ][ 1 ] ); - - pixelBbox[ 0 ] = Math.min( coordinates[ 0 ][ i ][ 0 ] - style.strokeWidthValue, pixelBbox[ 0 ] ); - pixelBbox[ 1 ] = Math.min( coordinates[ 0 ][ i ][ 1 ] - style.strokeWidthValue, pixelBbox[ 1 ] ); - pixelBbox[ 2 ] = Math.max( coordinates[ 0 ][ i ][ 0 ] + style.strokeWidthValue, pixelBbox[ 2 ] ); - pixelBbox[ 3 ] = Math.max( coordinates[ 0 ][ i ][ 1 ] + style.strokeWidthValue, pixelBbox[ 3 ] ); - } - - this._blitcontext.closePath(); - - this._blitcontext.globalCompositeOperation = "source-out"; - if ( style.doFill ) { - // fill outer ring - this._blitcontext.fillStyle = style.fill; - this._blitcontext.globalAlpha = style.opacity * style.fillOpacity; - this._blitcontext.fill( ); - } - - this._blitcontext.globalCompositeOperation = "source-over"; - if ( style.doStroke ) { - // stroke outer ring - this._blitcontext.lineCap = this._blitcontext.lineJoin = "round"; - this._blitcontext.lineWidth = style.strokeWidthValue; - this._blitcontext.strokeStyle = style.stroke; - - this._blitcontext.globalAlpha = style.opacity * style.strokeOpacity; - this._blitcontext.stroke( ); - - if ( coordinates.length > 1 ) { - // stroke inner rings - for ( i = 1; i < coordinates.length; i++ ) { - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ i ][ 0 ][ 0 ], coordinates[ i ][ 0 ][ 1 ] ); - for ( j = 1; j < coordinates[ i ].length; j++ ) { - this._blitcontext.lineTo( coordinates[ i ][ j ][ 0 ], coordinates[ i ][ j ][ 1 ] ); - } - this._blitcontext.closePath(); - - this._blitcontext.stroke( ); - } - } - } - - // blit - pixelBbox[ 0 ] = Math.min( Math.max( pixelBbox[ 0 ], 0), this._width ); - pixelBbox[ 1 ] = Math.min( Math.max( pixelBbox[ 1 ], 0), this._height ); - pixelBbox[ 2 ] = Math.min( Math.max( pixelBbox[ 2 ], 0), this._width ); - pixelBbox[ 3 ] = Math.min( Math.max( pixelBbox[ 3 ], 0), this._height ); - - if ( pixelBbox[ 0 ] !== pixelBbox[ 2 ] && pixelBbox[ 1 ] !== pixelBbox[ 3 ] ) { - this._context.drawImage(this._blitcanvas, pixelBbox[ 0 ], pixelBbox[ 1 ], pixelBbox[ 2 ] - pixelBbox[ 0 ], pixelBbox[ 3 ] - pixelBbox[ 1 ], pixelBbox[ 0 ], pixelBbox[ 1 ], pixelBbox[ 2 ] - pixelBbox[ 0 ], pixelBbox[ 3 ] - pixelBbox[ 1 ] ); - } - } - } - }, - - drawBbox: function (bbox, style) { - this._drawLines([[ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ]], true, style); - }, - - drawLabel: function( coordinates, label ) { - this._$labelsContainer.append( '
          ' + label + '
          '); - }, - - resize: function( ) { - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width"), 10); - this._height = parseInt(this._$elem.css("height"), 10); - } - - if ( this._trueCanvas ) { - this._$canvas[0].width = this._width; - this._$canvas[0].height = this._height; - } else { - } - - this._$labelsContainer.css( { - width: this._width, - height: this._height - } ); - }, - - _getGraphicStyle: function (style) { - function safeParse(value) { - value = parseInt(value, 10); - return (+value + '') === value ? +value : value; - } - - style = $.extend({}, this._options.style, style); - style.borderRadiusValue = safeParse(style.borderRadius); - style.fill = style.fill || style.color; - style.doFill = style.fill && style.fillOpacity > 0; - style.stroke = style.stroke || style.color; - style.strokeWidthValue = safeParse(style.strokeWidth); - style.doStroke = style.stroke && style.strokeOpacity > 0 && style.strokeWidthValue > 0; - style.widthValue = safeParse(style.width); - style.heightValue = safeParse(style.height); - return style; - }, - - _drawLines: function (coordinates, close, style) { - if (!coordinates || !coordinates.length || coordinates[0].length < 2) { - return; - } - - var i, j; - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0) { - this._context.beginPath(); - - for (i = 0; i < coordinates.length; i++) { - this._context.moveTo(coordinates[i][0][0], coordinates[i][0][1]); - for (j = 1; j < coordinates[i].length; j++) { - this._context.lineTo(coordinates[i][j][0], coordinates[i][j][1]); - } - } - - if (close) { - this._context.closePath(); - } - - if (close && style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineCap = this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - } - } - }); -}(jQuery)); - - -(function ($, undefined) { - var _widgetIdSeed = 0, - _ieVersion = ( function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - do { - div.innerHTML = ""; - } while ( a[0] ); - return v > 6 ? v : !v; - }() ), - - _defaultOptions = { - bbox: [-180, -85, 180, 85], - bboxMax: [-180, -85, 180, 85], - center: [0, 0], - cursors: { - "static": "default", - pan: "url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move", - zoom: "crosshair", - dragBox: "crosshair", - dragCircle: "crosshair", - drawPoint: "crosshair", - drawLineString: "crosshair", - drawPolygon: "crosshair", - measureLength: "crosshair", - measureArea: "crosshair" - }, - measureLabels: { - length: "{{:length.toFixed( 2 )}} m", - area: "{{:area.toFixed( 2 )}} sq m" - }, - drawStyle: {}, - shapeStyle: {}, - mode: "pan", - pannable: true, - scroll: "default", - shift: "default", - services: [ - { - "class": "osm", - type: "tiled", - src: function (view) { - return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png"; - }, - attr: "Tiles Courtesy of MapQuest " - } - ], - tilingScheme: { - tileWidth: 256, - tileHeight: 256, - levels: 18, - basePixelSize: 156543.03392799936, - origin: [-20037508.342787, 20037508.342787] - }, - axisLayout: "map", - zoom: 0, - zoomMin: 0, - zoomMax: Number.POSITIVE_INFINITY, - pixelSize: 0 - }; - - $.widget("geo.geomap", { - // private widget members - _$elem: undefined, //< map div for maps, service div for services - _map: undefined, //< only defined in services - _created: false, - _createdGraphics: false, - _widgetId: 0, - _tmplLengthId: "", - _tmplAreaId: "", - - _contentBounds: {}, - - _$resizeContainer: undefined, //< all elements that should match _contentBounds' size - - _$eventTarget: undefined, - _$contentFrame: undefined, - _$existingChildren: undefined, - _$attrList: undefined, - _$servicesContainer: undefined, - _$shapesContainers: undefined, //< all shapesContainer divs (map only) - - _$panContainer: undefined, //< all non-service elements that move while panning - _$shapesContainer: undefined, //< just "our" shapesContainer div (map & service) - _$drawContainer: undefined, - _$measureContainer: undefined, - _$measureLabel: undefined, - - _dpi: 96, - - _currentServices: [], //< internal copy - - _center: undefined, - _pixelSize: undefined, - _centerMax: undefined, - _pixelSizeMax: undefined, - - _userGeodetic: true, - - _centerInteractive: undefined, - _pixelSizeInteractive: undefined, - _timeoutInteractive: null, - _triggerInteractive: false, - - _loadCount: 0, - - _wheelTimeout: null, - _wheelLevel: 0, - - _zoomFactor: 2, //< determines what a zoom level means - - _fullZoomFactor: 2, //< interactiveScale factor needed to zoom a whole level - _partialZoomFactor: 1.18920711500273, //< interactiveScale factor needed to zoom a fraction of a level (the fourth root of 2) - - _mouseDown: undefined, - _inOp: undefined, - _toolPan: undefined, - _shiftDown: undefined, - _anchor: undefined, - _current: undefined, - _downDate: undefined, - _moveDate: undefined, - _clickDate: undefined, - _lastMove: undefined, - _lastDrag: undefined, - - _windowHandler: null, - _resizeTimeout: null, - - _panning: undefined, - _velocity: undefined, - _friction: undefined, - - _supportTouch: undefined, - _softDblClick: undefined, - _isTap: undefined, - _isDbltap: undefined, - - _isMultiTouch: undefined, - _multiTouchAnchor: [], //< TouchList - _multiTouchAnchorBbox: undefined, //< bbox - _multiTouchCurrentBbox: undefined, //< bbox - - _drawTimeout: null, //< used in drawPoint mode so we don't send two shape events on dbltap - _drawPixels: [], //< an array of coordinate arrays for drawing lines & polygons, in pixel coordinates - _drawCoords: [], - - _graphicShapes: [], //< an array of objects containing style object refs & GeoJSON object refs - - _initOptions: {}, - - _options: {}, - - options: $.extend({}, _defaultOptions), - - _createWidget: function (options, element) { - this._$elem = $(element); - - if (this._$elem.is(".geo-service")) { - this._graphicShapes = []; - $.Widget.prototype._createWidget.apply(this, arguments); - return; - } - - this._widgetId = _widgetIdSeed++; - this._tmplLengthId = "geoMeasureLength" + this._widgetId; - this._tmplAreaId = "geoMeasureArea" + this._widgetId; - - this._$elem.addClass("geo-map").css( { - webkitTransform: "translateZ(0)" - } ); - - - this._initOptions = options || {}; - - this._forcePosition(this._$elem); - - this._$elem.css("text-align", "left"); - - var size = this._findMapSize(); - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left"), 10), - y: parseInt(this._$elem.css("padding-top"), 10), - width: size["width"], - height: size["height"] - }; - - this._createChildren(); - - this._center = [ 0, 0 ]; - this._centerMax = [ 0, 0 ]; - this._centerInteractive = [ 0, 0 ]; - - this.options["pixelSize"] = this._pixelSize = this._pixelSizeMax = 156543.03392799936; - - this._mouseDown = - this._inOp = - this._toolPan = - this._shiftDown = - this._panning = - this._isTap = - this._isDbltap = false; - - this._anchor = [ 0, 0 ]; - this._current = [ 0, 0 ]; - this._lastMove = [ 0, 0 ]; - this._lastDrag = [ 0, 0 ]; - this._velocity = [ 0, 0 ]; - - this._friction = [0.8, 0.8]; - - this._downDate = - this._moveDate = - this._clickDate = 0; - - this._drawPixels = []; - this._drawCoords = []; - this._graphicShapes = []; - - - $.Widget.prototype._createWidget.apply(this, arguments); - }, - - _create: function () { - this._options = this.options; - - if (this._$elem.is(".geo-service")) { - this._map = this._$elem.data( "geoMap" ); - this._$elem.data( "geoService", this ); - return; - } - - this._map = this; - - this._supportTouch = "ontouchend" in document; - this._softDblClick = this._supportTouch || _ieVersion == 7; - - var geomap = this, - touchStartEvent = this._supportTouch ? "touchstart" : "mousedown", - touchStopEvent = this._supportTouch ? "touchend touchcancel" : "mouseup", - touchMoveEvent = this._supportTouch ? "touchmove" : "mousemove"; - - $(document).keydown($.proxy(this._document_keydown, this)); - - this._$eventTarget.dblclick($.proxy(this._eventTarget_dblclick, this)); - - this._$eventTarget.bind(touchStartEvent, $.proxy(this._eventTarget_touchstart, this)); - - var dragTarget = (this._$eventTarget[0].setCapture) ? this._$eventTarget : $(document); - dragTarget.bind(touchMoveEvent, $.proxy(this._dragTarget_touchmove, this)); - dragTarget.bind(touchStopEvent, $.proxy(this._dragTarget_touchstop, this)); - - this._$eventTarget.mousewheel($.proxy(this._eventTarget_mousewheel, this)); - - this._windowHandler = function () { - if (geomap._resizeTimeout) { - clearTimeout(geomap._resizeTimeout); - } - geomap._resizeTimeout = setTimeout(function () { - if (geomap._created) { - geomap._$elem.geomap( "resize", true ); - } - }, 500); - }; - - $(window).resize(this._windowHandler); - - this._$drawContainer.geographics({ style: this._initOptions.drawStyle || {} }); - this._options["drawStyle"] = this._$drawContainer.geographics("option", "style"); - - this._$shapesContainer.geographics( { style: this._initOptions.shapeStyle || { } } ); - this._createdGraphics = true; - - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - - if (this._initOptions) { - // always init tilingScheme right away, even if it's null - if ( this._initOptions.tilingScheme !== undefined ) { - this._setOption("tilingScheme", this._initOptions.tilingScheme || null, false); - } - - if ( this._initOptions.services ) { - // jQuery UI Widget Factory merges user services with our default, we want to clobber the default - this._options[ "services" ] = $.merge( [ ], this._initOptions.services ); - } - if (this._initOptions.bboxMax) { - this._setOption("bboxMax", this._initOptions.bboxMax, false); - this._setOption("bbox", this._initOptions.bboxMax, false); - } - if (this._initOptions.zoomMin !== undefined) { - this._setOption("zoomMin", this._initOptions.zoomMin, false); - } - if (this._initOptions.zoomMax !== undefined) { - this._setOption("zoomMax", this._initOptions.zoomMax, false); - } - if (this._initOptions.bbox) { - this._setOption("bbox", this._initOptions.bbox, false); - } - if (this._initOptions.center) { - this._setOption("center", this._initOptions.center, false); - } - if (this._initOptions.zoom !== undefined) { - this._setOption("zoom", this._initOptions.zoom, false); - } - } - - $.templates( this._tmplLengthId, this._options[ "measureLabels" ].length ); - $.templates( this._tmplAreaId, this._options[ "measureLabels" ].area ); - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._createServices(); - this._refresh(); - - this._created = true; - }, - - _setOption: function (key, value, refresh) { - if ( key == "pixelSize" ) { - return; - } - - refresh = (refresh === undefined || refresh); - - if ( this._$elem.is( ".geo-map" ) ) { - this._panFinalize(); - } - - var center, pixelSize, bbox, zoom; - - switch (key) { - case "bbox": - if ( this._created ) { - this._clearInteractiveTimeout( ); - } - - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2]; - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height); - - // clamp to zoom - zoom = this._getZoom( center, pixelSize ); - - if ( this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - if ( this._created ) { - this._setInteractiveCenterAndSize( center, pixelSize ); - this._setInteractiveTimeout( false ); - } else { - this._setCenterAndSize( center, pixelSize, false, refresh ); - } - - value = this._getBbox( center, pixelSize ); - break; - - case "bboxMax": - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - break; - - case "center": - if ( this._created ) { - this._clearInteractiveTimeout( ); - } - - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - if ( this._created ) { - this._setInteractiveCenterAndSize( value, this._pixelSizeInteractive ); - this._interactiveTransform( ); - this._setInteractiveTimeout( false ); - } else { - this._setCenterAndSize( value, this._pixelSize, false, refresh ); - } - break; - - case "measureLabels": - value = $.extend( this._options[ "measureLabels" ], value ); - - - $.templates( this._tmplLengthId, this._options[ "measureLabels" ].length ); - $.templates( this._tmplAreaId, this._options[ "measureLabels" ].area ); - - break; - - case "drawStyle": - if (this._$drawContainer) { - this._$drawContainer.geographics("option", "style", value); - value = this._$drawContainer.geographics("option", "style"); - } - break; - - case "shapeStyle": - if ( this._$elem.is( ".geo-service" ) && !this._createdGraphics ) { - this._createServiceGraphics( ); - } - - if ( this._createdGraphics ) { - this._$shapesContainer.geographics("option", "style", value); - value = this._$shapesContainer.geographics("option", "style"); - } - break; - - case "mode": - this._resetDrawing( ); - this._$eventTarget.css("cursor", this._options["cursors"][value]); - break; - - case "zoom": - if ( this._created ) { - this._setZoom(value, false, refresh); - } else { - value = Math.max( value, 0 ); - this._setCenterAndSize( this._center, this._getPixelSize( value ), false, refresh ); - } - break; - } - - $.Widget.prototype._setOption.apply(this, arguments); - - switch ( key ) { - case "bbox": - case "center": - if ( this._userGeodetic ) { - this._options[ "bbox" ] = $.geo.proj.toGeodetic( this._options[ "bbox" ] ); - this._options[ "center" ] = $.geo.proj.toGeodetic( this._center ); - } - break; - - case "tilingScheme": - if ( value !== null ) { - this._pixelSizeMax = this._getPixelSize( 0 ); - this._centerMax = [ - value.origin[ 0 ] + this._pixelSizeMax * value.tileWidth / 2, - value.origin[ 1 ] + this._pixelSizeMax * value.tileHeight / 2 - ]; - } - break; - - case "bboxMax": - if ( $.geo.proj && $.geo._isGeodetic( value ) ) { - bbox = $.geo.proj.fromGeodetic( value ); - } else { - bbox = value; - } - - this._centerMax = $.geo.center( bbox ); - this._pixelSizeMax = Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - break; - - case "services": - this._createServices(); - if (refresh) { - this._refresh(); - } - break; - - case "shapeStyle": - if ( refresh && this._createdGraphics ) { - this._$shapesContainer.geographics("clear"); - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - break; - } - }, - - destroy: function () { - if ( this._$elem.is(".geo-service") ) { - if ( this._createdGraphics ) { - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._createdGraphics = false; - } - } else { - clearTimeout( this._timeoutInteractive ); - this._timeoutInteractive = null; - - this._created = false; - - $(window).unbind("resize", this._windowHandler); - - for ( var i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap("destroy"); - $.geo["_serviceTypes"][this._currentServices[i].type].destroy(this, this._$servicesContainer, this._currentServices[i]); - } - - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._createdGraphics = false; - - this._$drawContainer.geographics("destroy"); - this._$drawContainer = undefined; - - this._$existingChildren.detach(); - this._$elem.html(""); - this._$elem.append(this._$existingChildren); - this._$elem.removeClass("geo-map"); - } - - $.Widget.prototype.destroy.apply(this, arguments); - }, - - toMap: function (p) { - p = this._toMap(p); - return this._userGeodetic ? $.geo.proj.toGeodetic(p) : p; - }, - - toPixel: function ( p, _center /* Internal Use Only */, _pixelSize /* Internal Use Only */ ) { - return this._toPixel( $.geo.proj ? $.geo.proj.fromGeodetic( p ) : p, _center, _pixelSize ); - }, - - opacity: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "opacity", value, this._$elem ); - } else { - if ( value >= 0 || value <= 1 ) { - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - service.style.opacity = value; - - // update the original service object's style property - service.serviceObject.style = $.extend( { }, service.serviceObject.style, service.style ); - - $.geo[ "_serviceTypes" ][ service.type ].opacity( this, service ); - } - } - } - } - }, - - toggle: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "toggle", value, this._$elem ); - } else { - - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - if ( value === undefined ) { - // toggle visibility - value = ( service.style.visibility !== "visible" ); - } - - service.style.visibility = ( value ? "visible" : "hidden" ); - - // update the original service object's style property - service.serviceObject.style = $.extend( { }, service.serviceObject.style, service.style ); - - service.serviceContainer.toggle( value ); - - if ( value ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service ); - } - } - } - } - }, - - zoom: function (numberOfLevels) { - if (numberOfLevels !== null) { - this._setZoom(this._options["zoom"] + numberOfLevels, false, true); - } - }, - - refresh: function ( force, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "refresh", force, this._$elem ); - } else { - this._refresh( force, _serviceContainer ); - } - }, - - resize: function ( _trigger /* Internal Use Only */ ) { - var size = this._findMapSize(), - dx = size["width"]/2 - this._contentBounds.width/2, - dy = size["height"]/2 - this._contentBounds.height/2, - i; - - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left"), 10), - y: parseInt(this._$elem.css("padding-top"), 10), - width: size["width"], - height: size["height"] - }; - - this._$resizeContainer.css( { - width: size["width"], - height: size["height"] - } ); - - for (i = 0; i < this._currentServices.length; i++) { - $.geo["_serviceTypes"][this._currentServices[i].type].resize(this, this._currentServices[i]); - } - - this._$elem.find( ".geo-graphics" ).css( { - width: size["width"], - height: size["height"] - }).geographics( "resize" ); - - for (i = 0; i < this._drawPixels.length; i++) { - this._drawPixels[i][0] += dx; - this._drawPixels[i][1] += dy; - } - - this._setCenterAndSize(this._center, this._pixelSize, _trigger, true); - }, - - append: function ( shape, style, label, refresh ) { - if ( shape && ( $.isPlainObject( shape ) || ( $.isArray( shape ) && shape.length > 0 ) ) ) { - if ( !this._createdGraphics ) { - this._createServiceGraphics( ); - } - - var shapes, arg, i, realStyle, realLabel, realRefresh; - - if ( $.isArray( shape ) ) { - shapes = shape; - } else if ( shape.type == "FeatureCollection" ) { - shapes = shape.features; - } else { - shapes = [ shape ]; - } - - for ( i = 1; i < arguments.length; i++ ) { - arg = arguments[ i ]; - - if ( typeof arg === "object" ) { - realStyle = arg; - } else if ( typeof arg === "number" || typeof arg === "string" ) { - realLabel = arg; - } else if ( typeof arg === "boolean" ) { - realRefresh = arg; - } - } - - for ( i = 0; i < shapes.length; i++ ) { - if ( shapes[ i ].type != "Point" ) { - var bbox = $.geo.bbox( shapes[ i ] ); - if ( $.geo.proj && $.geo._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - $.data( shapes[ i ], "geoBbox", bbox ); - } - - this._graphicShapes.push( { - shape: shapes[ i ], - style: realStyle, - label: realLabel - } ); - } - - if ( realRefresh === undefined || realRefresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - } - } - }, - - empty: function ( refresh ) { - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - $.removeData( this._graphicShapes[ i ].shape, "geoBbox" ); - } - - this._graphicShapes = []; - - if ( refresh === undefined || refresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - } - }, - - find: function ( selector, pixelTolerance ) { - var isPoint = $.isPlainObject( selector ), - searchPixel = isPoint ? this._map.toPixel( selector.coordinates ) : undefined, - mapTol = this._map._pixelSize * pixelTolerance, - result = [], - graphicShape, - geometries, - curGeom, - i = 0; - - for ( ; i < this._graphicShapes.length; i++ ) { - graphicShape = this._graphicShapes[ i ]; - - if ( isPoint ) { - if ( graphicShape.shape.type == "Point" ) { - if ( $.geo.distance( graphicShape.shape, selector ) <= mapTol ) { - result.push( graphicShape.shape ); - } - } else { - var bbox = $.data( graphicShape.shape, "geoBbox" ), - bboxPolygon = { - type: "Polygon", - coordinates: [ [ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ] ] - }, - projectedPoint = { - type: "Point", - coordinates: $.geo.proj && $.geo._isGeodetic( selector.coordinates ) ? $.geo.proj.fromGeodetic( selector.coordinates ) : selector.coordinates - }; - - if ( $.geo.distance( bboxPolygon, projectedPoint, true ) <= mapTol ) { - geometries = $.geo._flatten( graphicShape.shape ); - for ( curGeom = 0; curGeom < geometries.length; curGeom++ ) { - if ( $.geo.distance( geometries[ curGeom ], selector ) <= mapTol ) { - result.push( graphicShape.shape ); - break; - } - } - } - } - } else { - result.push( graphicShape.shape ); - } - } - - if ( this._$elem.is( ".geo-map" ) ) { - this._$elem.find( ".geo-service" ).each( function( ) { - result = $.merge( result, $( this ).geomap( "find", selector, pixelTolerance ) ); - } ); - } - - return result; - }, - - remove: function ( shape, refresh ) { - if ( shape && ( $.isPlainObject( shape ) || ( $.isArray( shape ) && shape.length > 0 ) ) ) { - var shapes = $.isArray( shape ) ? shape : [ shape ], - rest; - - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - if ( $.inArray( this._graphicShapes[ i ].shape, shapes ) >= 0 ) { - $.removeData( shape, "geoBbox" ); - rest = this._graphicShapes.slice( i + 1 ); - this._graphicShapes.length = i; - this._graphicShapes.push.apply( this._graphicShapes, rest ); - i--; - } - } - - if ( refresh === undefined || refresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - } - } - }, - - _getBbox: function (center, pixelSize) { - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - // calculate the internal bbox - var halfWidth = this._contentBounds[ "width" ] / 2 * pixelSize, - halfHeight = this._contentBounds[ "height" ] / 2 * pixelSize; - return [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - }, - - _setBbox: function (value, trigger, refresh) { - var center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2], - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height), - zoom = this._getZoom( center, pixelSize ); - - // clamp to zoom - if ( this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - this._setInteractiveCenterAndSize( center, pixelSize ); - this._interactiveTransform( ); - }, - - _getBboxMax: function () { - // calculate the internal bboxMax - var halfWidth = this._contentBounds["width"] / 2 * this._pixelSizeMax, - halfHeight = this._contentBounds["height"] / 2 * this._pixelSizeMax; - return [this._centerMax[0] - halfWidth, this._centerMax[1] - halfHeight, this._centerMax[0] + halfWidth, this._centerMax[1] + halfHeight]; - }, - - _getCenter: function () { - return this._center; - }, - - _getContentBounds: function () { - return this._contentBounds; - }, - - _getServicesContainer: function () { - return this._$servicesContainer; - }, - - _getZoom: function ( center, pixelSize ) { - // calculate the internal zoom level, vs. public zoom property - // this does not take zoomMin or zoomMax into account - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var tilingScheme = this._options["tilingScheme"]; - if ( tilingScheme ) { - if ( tilingScheme.pixelSizes ) { - var roundedPixelSize = Math.floor(pixelSize * 1000), - levels = tilingScheme.pixelSizes.length, - i = levels - 1; - - for ( ; i >= 0; i-- ) { - if ( Math.floor( tilingScheme.pixelSizes[ i ] * 1000 ) >= roundedPixelSize ) { - return i; - } - } - - return 0; - } else { - return Math.round( Math.log( tilingScheme.basePixelSize / pixelSize) / Math.log( 2 ) ); - } - } else { - var ratio = this._contentBounds["width"] / this._contentBounds["height"], - bbox = $.geo.reaspect( this._getBbox( center, pixelSize ), ratio, true ), - bboxMax = $.geo.reaspect(this._getBboxMax(), ratio, true); - - return Math.round( Math.log($.geo.width(bboxMax, true) / $.geo.width(bbox, true)) / Math.log(this._zoomFactor) ); - } - }, - - _setZoom: function ( value, trigger, refresh ) { - // set the map widget's zoom, taking zoomMin and zoomMax into account - this._clearInteractiveTimeout( ); - - value = Math.min( Math.max( value, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ); - this._setInteractiveCenterAndSize( this._centerInteractive, this._getPixelSize( value ) ); - this._interactiveTransform( ); - - this._setInteractiveTimeout( trigger ); - }, - - _createChildren: function () { - this._$existingChildren = this._$elem.children(); - - this._forcePosition(this._$existingChildren); - - this._$existingChildren.detach().css( { - mozUserSelect: "none" - } ); - - - var contentSizeCss = "width:" + this._contentBounds["width"] + "px; height:" + this._contentBounds["height"] + "px; margin:0; padding:0;", - contentPosCss = "position:absolute; left:0; top:0;"; - - this._$elem.prepend('
          '); - this._$eventTarget = this._$contentFrame = this._$elem.children(':first'); - - this._$contentFrame.append('
          '); - this._$servicesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
          '); - this._$shapesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append( '
            ' ); - this._$attrList = this._$contentFrame.children( ":last" ); - - this._$contentFrame.append('
            '); - this._$drawContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
            '); - this._$measureContainer = this._$contentFrame.children(':last'); - this._$measureLabel = this._$measureContainer.children(); - - this._$panContainer = $( [ this._$shapesContainer[ 0 ], this._$drawContainer[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$resizeContainer = $( [ this._$contentFrame[ 0 ], this._$servicesContainer[ 0 ], this._$eventTarget[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$contentFrame.append(this._$existingChildren); - - if ( ! $("#geo-measure-style").length ) { - $("head").prepend( '' ); - } - }, - - _createServices: function () { - var service, i; - - for ( i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap( "destroy" ); - $.geo[ "_serviceTypes" ][ this._currentServices[ i ].type ].destroy( this, this._$servicesContainer, this._currentServices[ i ] ); - } - - this._currentServices = [ ]; - this._$servicesContainer.html( "" ); - this._$attrList.html( "" ); - - for ( i = 0; i < this._options[ "services" ].length; i++ ) { - service = this._currentServices[ i ] = $.extend( { }, this._options[ "services" ][ i ] ); - - // keep a reference to the original - service.serviceObject = this._options[ "services" ][ i ]; - - // default the service style property on our copy - service.style = $.extend( { - visibility: "visible", - opacity: 1 - }, service.style ); - - var idString = service.id ? ' id="' + service.id + '"' : "", - classString = 'class="geo-service ' + ( service["class"] ? service["class"] : '' ) + '"', - scHtml = '
            ', - servicesContainer; - - this._$servicesContainer.append( scHtml ); - serviceContainer = this._$servicesContainer.children( ":last" ); - service.serviceContainer = serviceContainer; - - $.geo[ "_serviceTypes" ][ service.type ].create( this, serviceContainer, service, i ); - - serviceContainer.data( "geoMap", this ).geomap(); - - if ( service.attr ) { - this._$attrList.append( '
          • ' + service.attr + '
          • ' ); - } - } - - // start with our map-level shapesContainer - this._$shapesContainers = this._$shapesContainer; - - this._$attrList.find( "a" ).css( { - position: "relative", - zIndex: 100 - } ); - }, - - _createServiceGraphics: function( ) { - // only called in the context of a service-level geomap - var $contentFrame = this._$elem.closest( ".geo-content-frame" ); - this._$elem.append('
            '); - this._$shapesContainer = this._$elem.children(':last'); - - this._map._$shapesContainers = this._map._$shapesContainers.add( this._$shapesContainer ); - - this._$shapesContainer.geographics( ); - this._createdGraphics = true; - - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - }, - - _refreshDrawing: function ( ) { - this._$drawContainer.geographics("clear"); - - if ( this._drawPixels.length > 0 ) { - var mode = this._options[ "mode" ], - pixels = this._drawPixels, - coords = this._drawCoords, - label, - labelShape, - labelPixel, - widthOver, - heightOver; - - switch ( mode ) { - case "measureLength": - mode = "drawLineString"; - labelShape = { - type: "LineString", - coordinates: coords - }; - label = $.render[ this._tmplLengthId ]( { length: $.geo.length( labelShape, true ) } ); - labelPixel = $.merge( [], pixels[ pixels.length - 1 ] ); - break; - - case "measureArea": - mode = "drawPolygon"; - - labelShape = { - type: "Polygon", - coordinates: [ $.merge( [ ], coords ) ] - }; - labelShape.coordinates[ 0 ].push( coords[ 0 ] ); - - label = $.render[ this._tmplAreaId ]( { area: $.geo.area( labelShape, true ) } ); - labelPixel = this._toPixel( $.geo.centroid( labelShape ).coordinates ); - pixels = [ pixels ]; - break; - - case "drawPolygon": - pixels = [ pixels ]; - break; - } - - this._$drawContainer.geographics( mode, pixels ); - - if ( label ) { - this._$measureLabel.html( label ); - - widthOver = this._contentBounds.width - ( this._$measureLabel.outerWidth( true ) + labelPixel[ 0 ] ); - heightOver = this._contentBounds.height - ( this._$measureLabel.outerHeight( true ) + labelPixel[ 1 ] ); - - if ( widthOver < 0 ) { - labelPixel[ 0 ] += widthOver; - } - - if ( heightOver < 0 ) { - labelPixel[ 1 ] += heightOver; - } - - this._$measureLabel.css( { - left: Math.max( labelPixel[ 0 ], 0 ), - top: Math.max( labelPixel[ 1 ], 0 ) - } ).show(); - } - } - }, - - _resetDrawing: function () { - this._drawPixels = []; - this._drawCoords = []; - this._$drawContainer.geographics("clear"); - this._$measureLabel.hide(); - }, - - _refreshShapes: function (geographics, shapes, styles, labels, center, pixelSize) { - var i, mgi, - shape, - shapeBbox, - style, - label, - hasLabel, - labelPixel, - bbox = this._map._getBbox(center, pixelSize); - - for (i = 0; i < shapes.length; i++) { - shape = shapes[i].shape || shapes[i]; - shape = shape.geometry || shape; - shapeBbox = $.data(shape, "geoBbox"); - - if ( shapeBbox && $.geo._bboxDisjoint( bbox, shapeBbox ) ) { - continue; - } - - style = $.isArray(styles) ? styles[i].style : styles; - label = $.isArray(labels) ? labels[i].label : labels; - hasLabel = ( label !== undefined ); - labelPixel = undefined; - - switch (shape.type) { - case "Point": - labelPixel = this._map.toPixel( shape.coordinates, center, pixelSize ); - this._$shapesContainer.geographics("drawPoint", labelPixel, style); - break; - case "LineString": - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.pointAlong( shape, 0.5 ).coordinates, center, pixelSize ); - } - break; - case "Polygon": - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPoint": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPoint", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiLineString": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPolygon": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - - case "GeometryCollection": - this._refreshShapes(geographics, shape.geometries, style, label, center, pixelSize); - break; - } - - if ( hasLabel && labelPixel ) { - this._$shapesContainer.geographics( "drawLabel", labelPixel, label ); - } - } - }, - - _findMapSize: function () { - // really, really attempt to find a size for this thing - // even if it's hidden (look at parents) - var size = { width: 0, height: 0 }, - sizeContainer = this._$elem; - - while (sizeContainer.size() && !(size["width"] > 0 && size["height"] > 0)) { - size = { width: sizeContainer.width(), height: sizeContainer.height() }; - if (size["width"] <= 0 || size["height"] <= 0) { - size = { width: parseInt(sizeContainer.css("width"), 10), height: parseInt(sizeContainer.css("height"), 10) }; - } - sizeContainer = sizeContainer.parent(); - } - return size; - }, - - _forcePosition: function (elem) { - var cssPosition = elem.css("position"); - if (cssPosition != "relative" && cssPosition != "absolute" && cssPosition != "fixed") { - elem.css("position", "relative"); - } - }, - - _getPixelSize: function ( zoom ) { - var tilingScheme = this._options["tilingScheme"]; - if (tilingScheme !== null) { - if (zoom === 0) { - return tilingScheme.pixelSizes ? tilingScheme.pixelSizes[0] : tilingScheme.basePixelSize; - } - - zoom = Math.round(zoom); - zoom = Math.max(zoom, 0); - var levels = tilingScheme.pixelSizes ? tilingScheme.pixelSizes.length : tilingScheme.levels; - zoom = Math.min(zoom, levels - 1); - - if ( tilingScheme.pixelSizes ) { - return tilingScheme.pixelSizes[zoom]; - } else { - return tilingScheme.basePixelSize / Math.pow(2, zoom); - } - } else { - var bbox = $.geo.scaleBy( this._getBboxMax(), 1 / Math.pow( this._zoomFactor, zoom ), true ); - return Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - } - }, - - _getZoomCenterAndSize: function ( anchor, zoomDelta, full ) { - var zoomFactor = ( full ? this._fullZoomFactor : this._partialZoomFactor ), - scale = Math.pow( zoomFactor, -zoomDelta ), - pixelSize = this._pixelSizeInteractive * scale, - zoom = this._getZoom(this._centerInteractive, pixelSize); - - // clamp to zoom - if ( full && this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoomDelta < 0 && zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._pixelSizeInteractive; - } else if ( zoomDelta > 0 && zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._pixelSizeInteractive; - } - } - - var ratio = pixelSize / this._pixelSizeInteractive, - anchorMapCoord = this._toMap( anchor, this._centerInteractive, this._pixelSizeInteractive ), - centerDelta = [(this._centerInteractive[0] - anchorMapCoord[0]) * ratio, (this._centerInteractive[1] - anchorMapCoord[1]) * ratio], - scaleCenter = [anchorMapCoord[0] + centerDelta[0], anchorMapCoord[1] + centerDelta[1]]; - - return { pixelSize: pixelSize, center: scaleCenter }; - }, - - _mouseWheelFinish: function ( refresh ) { - this._wheelTimeout = null; - - if (this._wheelLevel !== 0) { - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, this._options[ "tilingScheme" ] !== null ); - - this._wheelLevel = 0; - } else if ( refresh ) { - this._refresh(); - } - }, - - _panFinalize: function () { - if (this._panning) { - this._velocity = [0, 0]; - - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - image = this._options[ "axisLayout" ] === "image", - dxMap = -dx * this._pixelSize, - dyMap = ( image ? -1 : 1 ) * dy * this._pixelSize; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._inOp = false; - this._anchor = this._current; - this._mouseDown = this._toolPan = this._panning = false; - } - }, - - _panMove: function () { - if ( ! this._options[ "pannable" ] ) { - return; - } - - var dx = this._current[0] - this._lastDrag[0], - dy = this._current[1] - this._lastDrag[1], - i = 0, - service, - translateObj; - - if (this._toolPan || dx > 3 || dx < -3 || dy > 3 || dy < -3) { - if (!this._toolPan) { - this._toolPan = true; - this._$eventTarget.css("cursor", this._options["cursors"]["pan"]); - } - - if (this._mouseDown) { - this._velocity = [dx, dy]; - } - - if (dx !== 0 || dy !== 0) { - this._panning = true; - this._lastDrag = this._current; - - this._centerInteractive[ 0 ] -= ( dx * this._pixelSizeInteractive ); - this._centerInteractive[ 1 ] += ( ( this._options[ "axisLayout" ] === "image" ? -1 : 1 ) * dy * this._pixelSizeInteractive ); - this._setInteractiveCenterAndSize( this._centerInteractive, this._pixelSizeInteractive ); - this._interactiveTransform( ); - } - } - }, - - _clearInteractiveTimeout: function() { - if ( this._timeoutInteractive ) { - clearTimeout( this._timeoutInteractive ); - this._timeoutInteractive = null; - return true; - } else { - this._centerInteractive[ 0 ] = this._center[ 0 ]; - this._centerInteractive[ 1 ] = this._center[ 1 ]; - this._pixelSizeInteractive = this._pixelSize; - return false; - } - }, - - _interactiveTransform: function( ) { - if ( this._$shapesContainers ) { - this._$shapesContainers.geographics("clear"); - } - - for ( var i = 0; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - $.geo[ "_serviceTypes" ][ service.type ].interactiveTransform( this, service, this._centerInteractive, this._pixelSizeInteractive ); - } - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel( this._drawCoords, this._centerInteractive, this._pixelSizeInteractive ); - this._refreshDrawing(); - } - }, - - _setInteractiveTimeout: function( trigger ) { - var geomap = this; - - function interactiveTimeoutCallback( ) { - if ( geomap._isMultiTouch ) { - geomap._timeoutInteractive = setTimeout( interactiveTimeoutCallback, 128 ); - } else if ( geomap._created && geomap._timeoutInteractive ) { - geomap._setCenterAndSize( geomap._centerInteractive, geomap._pixelSizeInteractive, geomap._triggerInteractive, true ); - geomap._timeoutInteractive = null; - geomap._triggerInteractive = false; - } - } - - this._timeoutInteractive = setTimeout( interactiveTimeoutCallback, 128 ); - this._triggerInteractive |= trigger; - }, - - _refresh: function ( force, _serviceContainer ) { - var service, - geoService, - i = 0; - - for ( ; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service, force ); - geoService = service.serviceContainer.data( "geoService" ); - - if ( geoService._createdGraphics ) { - geoService._$shapesContainer.geographics( "clear" ); - if ( geoService._graphicShapes.length > 0 ) { - geoService._refreshShapes( geoService._$shapesContainer, geoService._graphicShapes, geoService._graphicShapes, geoService._graphicShapes ); - } - } - } - } - - if ( this._createdGraphics ) { - this._$shapesContainer.geographics( "clear" ); - if ( this._graphicShapes.length > 0 ) { - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - } - }, - - _setInteractiveCenterAndSize: function ( center, pixelSize ) { - // set the temporary (interactive) center & size - // also, update the public-facing options - // this does not take zoomMin or zoomMax into account - this._centerInteractive[ 0 ] = center[ 0 ]; - this._centerInteractive[ 1 ] = center[ 1 ]; - this._pixelSizeInteractive = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox( center, pixelSize ) ); - this._options["center"] = $.geo.proj.toGeodetic( center ); - } else { - this._options["bbox"] = this._getBbox( center, pixelSize ); - this._options["center"][ 0 ] = center[ 0 ]; - this._options["center"][ 1 ] = center[ 1 ]; - } - - this._options["pixelSize"] = pixelSize; - this._options["zoom"] = this._getZoom( center, pixelSize ); - }, - - _setCenterAndSize: function (center, pixelSize, trigger, refresh) { - if ( ! $.isArray( center ) || center.length != 2 || typeof center[ 0 ] !== "number" || typeof center[ 1 ] !== "number" ) { - return; - } - - // the final call during any extent change - // only called by timeoutInteractive & resize - // clamp to zoom - var zoom = this._getZoom( center, pixelSize ); - - if ( this._options[ "tilingScheme" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - this._center[ 0 ] = center[ 0 ]; - this._center[ 1 ] = center[ 1 ]; - this._options["pixelSize"] = this._pixelSize = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox() ); - this._options["center"] = $.geo.proj.toGeodetic( this._center ); - } else { - this._options["bbox"] = this._getBbox(); - this._options["center"] = $.merge( [ ], center ); - } - - this._options["zoom"] = zoom; - - if (trigger) { - this._trigger("bboxchange", window.event, { bbox: $.merge( [ ], this._options["bbox"] ) }); - } - - if (refresh) { - this._refresh(); - this._refreshDrawing(); - } - }, - - _requestQueued: function ( ) { - if ( this._loadCount === 0 ) { - this._trigger( "loadstart", window.event ); - } - this._loadCount++; - }, - - _requestComplete: function ( ) { - this._loadCount--; - if ( this._loadCount <= 0 ) { - this._loadCount = 0; - this._trigger( "loadend", window.event ); - } - }, - - _toMap: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - xRatio = $.geo.width(bbox, true) / width, - yRatio = $.geo.height(bbox, true) / height, - yOffset, - image = this._options[ "axisLayout" ] === "image", - result = [], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - yOffset = (p[ i ][ j ][ k ][1] * yRatio); - result[ i ][ j ][ k ] = [ - bbox[ 0 ] + ( p[ i ][ j ][ k ][ 0 ] * xRatio ), - image ? bbox[ 1 ] + yOffset : bbox[ 3 ] - yOffset - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _toPixel: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - bboxWidth = $.geo.width(bbox, true), - bboxHeight = $.geo.height(bbox, true), - image = this._options[ "axisLayout" ] === "image", - xRatio = width / bboxWidth, - yRatio = height / bboxHeight, - result = [ ], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = [ - Math.round( ( p[ i ][ j ][ k ][ 0 ] - bbox[ 0 ] ) * xRatio ), - Math.round( ( image ? p[ i ][ j ][ k ][ 1 ] - bbox[ 1 ] : bbox[ 3 ] - p[ i ][ j ][ k ][ 1 ] ) * yRatio ) - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _document_keydown: function (e) { - var len = this._drawCoords.length; - if (len > 0 && e.which == 27) { - if (len <= 2) { - this._resetDrawing(); - this._inOp = false; - } else { - this._drawCoords[len - 2] = $.merge( [], this._drawCoords[ len - 1 ] ); - this._drawPixels[len - 2] = $.merge( [], this._drawPixels[ len - 1 ] ); - - this._drawCoords.length--; - this._drawPixels.length--; - - this._refreshDrawing(); - } - } - }, - - _eventTarget_dblclick_zoom: function(e) { - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - this._trigger("dblclick", e, { type: "Point", coordinates: this._toMap(this._current, this._centerInteractive, this._pixelSizeInteractive ) }); - - if (!e.isDefaultPrevented()) { - var centerAndSize = this._getZoomCenterAndSize(this._current, 1, true ); - - this._setInteractiveCenterAndSize( centerAndSize.center, centerAndSize.pixelSize ); - this._interactiveTransform( ); - - doInteractiveTimeout = true; - } - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - }, - - _eventTarget_dblclick: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - var offset = $(e.currentTarget).offset(); - - switch (this._options["mode"]) { - case "drawLineString": - case "measureLength": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - this._drawCoords.length--; - this._trigger( "shape", e, { - type: "LineString", - coordinates: this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords - } ); - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - case "drawPolygon": - case "measureArea": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - var endIndex = this._drawCoords.length - 1; - if (endIndex > 2) { - this._drawCoords[endIndex] = $.merge( [], this._drawCoords[0] ); - this._trigger( "shape", e, { - type: "Polygon", - coordinates: [ this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords ] - } ); - } - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - default: - this._eventTarget_dblclick_zoom(e); - break; - } - - this._inOp = false; - }, - - _eventTarget_touchstart: function (e) { - var mode = this._options[ "mode" ], - shift = this._options[ "shift" ]; - - if ( mode === "static" ) { - return; - } - - if ( !this._supportTouch && e.which != 1 ) { - return; - } - - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - var offset = $(e.currentTarget).offset(), - touches = e.originalEvent.changedTouches; - - if ( this._supportTouch ) { - this._multiTouchAnchor = $.merge( [ ], touches ); - - this._isMultiTouch = this._multiTouchAnchor.length > 1; - - if ( this._isMultiTouch ) { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - touches[1].pageX - offset.left, - touches[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - NaN, - NaN - ]; - - this._current = [ touches[0].pageX - offset.left, touches[0].pageY - offset.top ]; - } - } else { - this._current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - var downDate = $.now(); - if (downDate - this._downDate < 750) { - if (this._isTap) { - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - distance = Math.sqrt((dx * dx) + (dy * dy)); - if (distance > 8) { - this._isTap = false; - } else { - this._current = $.merge( [ ], this._anchor ); - } - } - - if (this._isDbltap) { - this._isDbltap = false; - } else { - this._isDbltap = this._isTap; - } - } else { - this._isDbltap = false; - } - this._isTap = true; - this._downDate = downDate; - } - - this._mouseDown = true; - this._anchor = $.merge( [ ], this._current ); - - if (!this._inOp && e.shiftKey && shift !== "off") { - this._shiftDown = true; - this._$eventTarget.css( "cursor", this._options[ "cursors" ][ shift === "default" ? "zoom" : shift ] ); - } else if ( !this._isMultiTouch && ( this._options[ "pannable" ] || mode === "dragBox" || mode === "dragCircle" ) ) { - this._inOp = true; - - if ( mode !== "zoom" && mode !== "dragBox" && mode !== "dragCircle" ) { - this._lastDrag = this._current; - - if (e.currentTarget.setCapture) { - e.currentTarget.setCapture(); - } - } - } - - e.preventDefault(); - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - return false; - }, - - _dragTarget_touchmove: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - var doInteractiveTimeout = false; - if ( this._mouseDown ) { - doInteractiveTimeout = this._clearInteractiveTimeout( ); - } - - var offset = this._$eventTarget.offset(), - drawCoordsLen = this._drawCoords.length, - touches = e.originalEvent.changedTouches, - current, - service, - i = 0; - - if ( this._supportTouch ) { - if ( !this._isMultiTouch && this._mouseDown && this._multiTouchAnchor.length > 0 && touches[ 0 ].identifier !== this._multiTouchAnchor[ 0 ].identifier ) { - // switch to multitouch - this._mouseDown = false; - this._isMultiTouch = true; - this._wheelLevel = 0; - - this._multiTouchAnchor.push( touches[ 0 ] ); - - - - - this._multiTouchCurrentBbox = [ - this._multiTouchCurrentBbox[ 0 ], - this._multiTouchCurrentBbox[ 1 ], - this._multiTouchAnchor[1].pageX - offset.left, - this._multiTouchAnchor[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._mouseDown = true; - this._anchor = this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - - if ( this._isMultiTouch ) { - - for ( ; i < touches.length; i++ ) { - if ( touches[ i ].identifier === this._multiTouchAnchor[ 0 ].identifier ) { - this._multiTouchCurrentBbox[ 0 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 1 ] = touches[ i ].pageY - offset.top; - } else if ( touches[ i ].identifier === this._multiTouchAnchor[ 1 ].identifier ) { - this._multiTouchCurrentBbox[ 2 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 3 ] = touches[ i ].pageY - offset.top; - } - } - - var anchorDistance = $.geo._distancePointPoint( [ this._multiTouchAnchorBbox[ 0 ], this._multiTouchAnchorBbox[ 1 ] ], [ this._multiTouchAnchorBbox[ 2 ], this._multiTouchAnchorBbox[ 3 ] ] ), - currentDistance = $.geo._distancePointPoint( [ this._multiTouchCurrentBbox[ 0 ], this._multiTouchCurrentBbox[ 1 ] ], [ this._multiTouchCurrentBbox[ 2 ], this._multiTouchCurrentBbox[ 3 ] ] ); - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - - var wheelLevel = ( ( currentDistance - anchorDistance ) / anchorDistance ); - - if ( wheelLevel > 0 ) { - wheelLevel *= 5; - } else { - wheelLevel *= 10; - } - - var delta = wheelLevel - this._wheelLevel; - - this._wheelLevel = wheelLevel; - - var pinchCenterAndSize = this._getZoomCenterAndSize( this._anchor, delta, false ); - - this._setInteractiveCenterAndSize( pinchCenterAndSize.center, pinchCenterAndSize.pixelSize ); - this._interactiveTransform( ); - - doInteractiveTimeout = true; - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (current[0] === this._lastMove[0] && current[1] === this._lastMove[1]) { - if ( this._inOp ) { - e.preventDefault(); - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - } - - if ( _ieVersion == 7 ) { - this._isDbltap = this._isTap = false; - } - - if (this._mouseDown) { - this._current = current; - this._moveDate = $.now(); - } - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isDbltap = this._isTap = false; - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - - var shift = this._options[ "shift" ], - mode = this._shiftDown ? ( shift === "default" ? "zoom" : shift ) : this._options["mode"], - dx, dy, circleSize; - - switch (mode) { - case "zoom": - case "dragBox": - if ( this._mouseDown ) { - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawBbox", [ - this._anchor[ 0 ], - this._anchor[ 1 ], - current[ 0 ], - current[ 1 ] - ] ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "dragCircle": - if ( this._mouseDown ) { - dx = current[ 0 ] - this._anchor[ 0 ]; - dy = current[ 1 ] - this._anchor[ 1 ]; - circleSize = Math.sqrt( ( dx * dx) + ( dy * dy ) ) * 2; - //circleSize = Math.max( Math.abs( current[ 0 ] - this._anchor[ 0 ] ), Math.abs( current[ 1 ] - this._anchor[ 1 ] ) ) * 2; - - // not part of _refreshDrawing - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawArc", this._anchor, 0, 360, { - width: circleSize, - height: circleSize - } ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (this._mouseDown || this._toolPan) { - this._panMove(); - doInteractiveTimeout = true; - } else { - if (drawCoordsLen > 0) { - this._drawCoords[drawCoordsLen - 1] = this._toMap( current, this._centerInteractive, this._pixelSizeInteractive ); - this._drawPixels[drawCoordsLen - 1] = current; - - this._refreshDrawing(); - } - - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - default: - if (this._mouseDown || this._toolPan) { - this._panMove(); - doInteractiveTimeout = true; - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - } - - this._lastMove = current; - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _dragTarget_touchstop: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if ( !this._mouseDown ) { - if ( _ieVersion == 7 ) { - // ie7 doesn't appear to trigger dblclick on this._$eventTarget, - // we fake regular click here to cause soft dblclick - this._eventTarget_touchstart(e); - } else { - // Chrome & Firefox trigger a rogue mouseup event when doing a dblclick maximize in Windows(/Linux?) - // ignore it - return false; - } - } - - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - var mouseWasDown = this._mouseDown, - wasToolPan = this._toolPan, - offset = this._$eventTarget.offset(), - shift = this._options[ "shift" ], - mode = this._shiftDown ? ( shift === "default" ? "zoom" : shift ) : this._options["mode"], - current, i, clickDate, - dx, dy, - coordBuffer, - triggerShape; - - - if (this._supportTouch) { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - this._multiTouchAnchor = []; - this._inOp = false; - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - if (this._isTap) { - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - if (Math.sqrt((dx * dx) + (dy * dy)) <= 8) { - current = $.merge( [ ], this._anchor ); - } - } - } - - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._shiftDown = this._mouseDown = this._toolPan = false; - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isMultiTouch = false; - - this._wheelLevel = 0; - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return; - } - - if (document.releaseCapture) { - document.releaseCapture(); - } - - if (mouseWasDown) { - clickDate = $.now(); - this._current = current; - - switch ( mode ) { - case "zoom": - case "dragBox": - if ( dx !== 0 || dy !== 0 ) { - var minSize = this._pixelSize * 6, - bboxCoords = this._toMap( [ [ - Math.min( this._anchor[ 0 ], current[ 0 ] ), - Math.max( this._anchor[ 1 ], current[ 1 ] ) - ], [ - Math.max( this._anchor[ 0 ], current[ 0 ] ), - Math.min( this._anchor[ 1 ], current[ 1 ] ) - ] - ] ), - bbox = [ - bboxCoords[0][0], - bboxCoords[0][1], - bboxCoords[1][0], - bboxCoords[1][1] - ]; - - if ( mode === "zoom" ) { - if ( ( bbox[2] - bbox[0] ) < minSize && ( bbox[3] - bbox[1] ) < minSize ) { - bbox = $.geo.scaleBy( this._getBbox( $.geo.center( bbox, true ) ), 0.5, true ); - } - - this._setBbox(bbox, true, true); - doInteractiveTimeout = true; - } else { - triggerShape = $.geo.polygonize( bbox, true ); - triggerShape.bbox = bbox; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - this._trigger( "shape", e, triggerShape ); - } - } else { - if ( mode === "dragBox" ) { - coordBuffer = this._toMap( current ); - - triggerShape = { - type: "Point", - coordinates: [ coordBuffer[ 0 ], coordBuffer[ 1 ] ], - bbox: [ coordBuffer[ 0 ], coordBuffer[ 1 ], coordBuffer[ 0 ], coordBuffer[ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - } - } - - this._resetDrawing(); - break; - - case "dragCircle": - if ( dx !== 0 || dy !== 0 ) { - var image = this._options[ "axisLayout" ] === "image", - d = Math.sqrt( ( dx * dx) + ( dy * dy ) ), - n = 180, - a; - - this._drawPixels.length = n + 1; - - for ( i = 0; i < n; i++ ) { - a = ( i * 360 / n ) * ( Math.PI / 180 ); - this._drawPixels[ i ] = [ - this._anchor[ 0 ] + Math.cos( a ) * d, - this._anchor[ 1 ] + Math.sin( a ) * d - ]; - } - - this._drawPixels[ n ] = [ - this._drawPixels[ 0 ][ 0 ], - this._drawPixels[ 0 ][ 1 ] - ]; - - // using coordBuffer for bbox coords - coordBuffer = this._toMap( [ - [ this._anchor[ 0 ] - d, this._anchor[ 1 ] + ( image ? -d : d ) ], - [ this._anchor[ 0 ] + d, this._anchor[ 1 ] + ( image ? d : -d ) ] - ] ); - - triggerShape = { - type: "Polygon", - coordinates: [ this._toMap( this._drawPixels ) ], - bbox: [ coordBuffer[ 0 ][ 0 ], coordBuffer[ 0 ][ 1 ], coordBuffer[ 1 ][ 0 ], coordBuffer[ 1 ][ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - - this._resetDrawing(); - } else { - coordBuffer = this._toMap( current ); - - triggerShape = { - type: "Point", - coordinates: [ coordBuffer[ 0 ], coordBuffer[ 1 ] ], - bbox: [ coordBuffer[ 0 ], coordBuffer[ 1 ], coordBuffer[ 0 ], coordBuffer[ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - } - break; - - case "drawPoint": - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - var geomap = this; - this._drawTimeout = setTimeout(function () { - if (geomap._drawTimeout) { - geomap._trigger("shape", e, { type: "Point", coordinates: geomap.toMap(current) }); - geomap._inOp = false; - geomap._drawTimeout = null; - } - }, 250); - } - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (wasToolPan) { - this._panFinalize(); - } else { - i = (this._drawCoords.length === 0 ? 0 : this._drawCoords.length - 1); - - this._drawCoords[i] = this._toMap(current); - this._drawPixels[i] = current; - - if (i < 2 || !(this._drawCoords[i][0] == this._drawCoords[i-1][0] && - this._drawCoords[i][1] == this._drawCoords[i-1][1])) { - this._drawCoords[i + 1] = this._toMap( current, this._centerInteractive, this._pixelSizeInteractive ); - this._drawPixels[i + 1] = current; - } - - this._refreshDrawing(); - } - break; - - default: - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - this._trigger("click", e, { type: "Point", coordinates: this.toMap(current) }); - this._inOp = false; - } - } - break; - } - - this._clickDate = clickDate; - - if (this._softDblClick && this._isDbltap) { - this._isDbltap = this._isTap = false; - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - this._$eventTarget.trigger("dblclick", e); - return false; - } - } - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _eventTarget_mousewheel: function (e, delta) { - if ( this._options[ "mode" ] === "static" || this._options[ "scroll" ] === "off" ) { - return; - } - - e.preventDefault(); - - if ( this._mouseDown ) { - return false; - } - - if (delta !== 0) { - this._clearInteractiveTimeout( ); - - if ( delta > 0 ) { - delta = Math.ceil( delta ); - } else { - delta = Math.floor( delta ); - } - - var offset = $(e.currentTarget).offset(); - this._anchor = [e.pageX - offset.left, e.pageY - offset.top]; - - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, delta, this._options[ "tilingScheme" ] !== null ), - service, - i = 0; - - this._setInteractiveCenterAndSize( wheelCenterAndSize.center, wheelCenterAndSize.pixelSize ); - this._interactiveTransform( ); - - this._setInteractiveTimeout( true ); - } - - return false; - } - } - ); -}(jQuery)); - - -(function ($, undefined) { - $.geo._serviceTypes.tiled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0, - reloadTiles: false - }; - - var scHtml = '
            '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children( ":last" ); - - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactiveTransform: function ( map, service, center, pixelSize ) { - //console.log( "tiled.interactiveTransform( " + center.join( ", " ) + ", " + pixelSize + ")" ); - var serviceState = $.data( service, "geoServiceState" ), - tilingScheme = map.options[ "tilingScheme" ]; - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.data("pixelSize"), - scaleRatio = scalePixelSize / pixelSize; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapCoord = $scaleContainer.data("scaleOrigin"), - newPixelPoint = map._toPixel(oldMapCoord, center, pixelSize); - - $scaleContainer.css( { - left: Math.round(newPixelPoint[0]) + "px", - top: Math.round(newPixelPoint[1]) + "px", - width: tilingScheme.tileWidth * scaleRatio, - height: tilingScheme.tileHeight * scaleRatio - } ); - - /* - if ( $("body")[0].filters !== undefined ) { - $scaleContainer.children().each( function ( i ) { - $( this ).css( "filter", "progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11=" + scaleRatio + ",M22=" + scaleRatio + ",sizingmethod='auto expand')" ); - } ); - } - */ - } - }); - } - }, - - refresh: function (map, service, force) { - //console.log( "tiled.refresh( " + map._center.join( ", " ) + ", " + map._pixelSize + ")" ); - var serviceState = $.data( service, "geoServiceState" ); - - this._cancelUnloaded(map, service); - - if ( serviceState && force ) { - // if hidden atm, we want to make sure we reload this service after it becomes visible - serviceState.reloadTiles = true; - } - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - $serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - image = map.options[ "axisLayout" ] === "image", - ySign = image ? +1 : -1, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - - tileX = Math.floor((bbox[0] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.max( Math.floor( ( image ? bbox[1] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 3 ] ) / (pixelSize * tileHeight) ), 0 ), - tileX2 = Math.ceil((bbox[2] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil( ( image ? bbox[3] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 1 ] ) / (pixelSize * tileHeight) ), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] + ySign * bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMinOrMaxY = tilingScheme.origin[1] + ySign * (fullYAtScale * tileHeight) * pixelSize, - - serviceLeft = Math.round((fullXMinX - bbox[0]) / pixelSize), - serviceTop = Math.round( ( image ? fullYMinOrMaxY - bbox[1] : bbox[3] - fullYMinOrMaxY ) / pixelSize), - - scaleContainers = $serviceContainer.children().show(), - scaleContainer = scaleContainers.filter("[data-pixel-size='" + pixelSize + "']").appendTo($serviceContainer), - - opacity = service.style.opacity, - - x, y, - - loadImageDeferredDone = function( url ) { - // when a Deferred call is done, add the image to the map - // a reference to the correct img element is on the Deferred object itself - serviceObj._loadImage( $.data( this, "img" ), url, pixelSize, map, serviceState, opacity ); - }, - - loadImageDeferredFail = function( ) { - $.data( this, "img" ).remove( ); - serviceState.loadCount--; - map._requestComplete(); - }; - - if (serviceState.reloadTiles) { - scaleContainers.find("img").attr("data-dirty", "true"); - } - - if (!scaleContainer.size()) { - $serviceContainer.append("
            "); - scaleContainer = $serviceContainer.children(":last").data("scaleOrigin", map._toMap( [ (serviceLeft % tileWidth), (serviceTop % tileHeight) ] ) ); - } else { - scaleContainer.css({ - left: (serviceLeft % tileWidth) + "px", - top: (serviceTop % tileHeight) + "px" - }).data("scaleOrigin", map._toMap( [ (serviceLeft % tileWidth), (serviceTop % tileHeight) ] ) ); - - scaleContainer.children().each(function (i) { - var - $img = $(this), - tile = $img.attr("data-tile").split(","); - - $img.css({ - left: Math.round(((parseInt(tile[0], 10) - fullXAtScale) * 100) + (serviceLeft - (serviceLeft % tileWidth)) / tileWidth * 100) + "%", - top: Math.round(((parseInt(tile[1], 10) - fullYAtScale) * 100) + (serviceTop - (serviceTop % tileHeight)) / tileHeight * 100) + "%" - }); - - if (opacity < 1) { - $img.fadeTo(0, opacity); - } - }); - } - - for (x = tileX; x < tileX2; x++) { - for (y = tileY; y < tileY2; y++) { - var tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ($img.size() === 0 || serviceState.reloadTiles) { - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] + ySign * (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] + ySign * ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - urlProp = ( service.hasOwnProperty( "src" ) ? "src" : "getUrl" ), - urlArgs = { - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl; - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.templates( "geoSrc", service[ urlProp ] ); - imageUrl = $.render[ "geoSrc" ]( urlArgs ); - } - - serviceState.loadCount++; - map._requestQueued(); - - if (serviceState.reloadTiles && $img.size() > 0) { - $img.attr("src", imageUrl); - } else { - var imgMarkup = ""; - - scaleContainer.append(imgMarkup); - $img = scaleContainer.children(":last"); - } - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, map, serviceState, opacity ); - } else if ( imageUrl ) { - // assume Deferred - $.data( imageUrl, "img", $img ); - imageUrl.done( loadImageDeferredDone ).fail( loadImageDeferredFail ); - } else { - $img.remove( ); - } - } - } - } - - scaleContainers.find("[data-dirty]").remove(); - serviceState.reloadTiles = false; - } - }, - - resize: function (map, service) { - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.css( "display", service.style.visibility === "visible" ? "block" : "none" ); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - map._requestComplete(); - } - } - }, - - _loadImage: function ( $img, url, pixelSize, map, serviceState, opacity ) { - var serviceContainer = serviceState.serviceContainer; - - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - }()); -}(jQuery)); - -(function ($, undefined) { - $.geo._serviceTypes.shingled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0 - }; - - var scHtml = '
            '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children(":last"); - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactiveTransform: function ( map, service, center, pixelSize ) { - var serviceState = $.data( service, "geoServiceState" ), - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds[ "width" ], - mapHeight = contentBounds[ "height" ], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - bbox = [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.data( "pixelSize" ), - scaleRatio = scalePixelSize / pixelSize; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapOrigin = $scaleContainer.data( "origin" ), - newPixelPoint = map._toPixel( oldMapOrigin, center, pixelSize ); - - $scaleContainer.css( { - left: Math.round( newPixelPoint[ 0 ] ), - top: Math.round( newPixelPoint[ 1 ] ), - width: mapWidth * scaleRatio, - height: mapHeight * scaleRatio - } ); - - - // #newpanzoom - /* - .children("img").each(function (i) { - var $img = $(this), - imgCenter = $img.data("center"), - x = (Math.round((imgCenter[0] - center[0]) / scalePixelSize) - halfWidth) * scaleRatio, - y = (Math.round((center[1] - imgCenter[1]) / scalePixelSize) - halfHeight) * scaleRatio; - - $img.css({ left: x + "px", top: y + "px" }); - }); - */ - } - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - this._cancelUnloaded(map, service); - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - scaleContainer = serviceContainer.children('[data-pixel-size="' + pixelSize + '"]'), - - opacity = service.style.opacity, - - $img; - - if (opacity < 1) { - serviceContainer.find("img").attr("data-keep-alive", "0"); - } - - if ( !scaleContainer.size() ) { - serviceContainer.append('
            '); - scaleContainer = serviceContainer.children(":last"); - } - - var urlProp = ( service.hasOwnProperty("src") ? "src" : "getUrl" ), - urlArgs = { - bbox: bbox, - width: mapWidth, - height: mapHeight, - zoom: map._getZoom(), - tile: null, - index: 0 - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl, - imagePos = scaleContainer.position( ); - - imagePos.left = - ( imagePos.left ); - imagePos.top = - ( imagePos.top ); - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.templates( "geoSrc", service[ urlProp ] ); - imageUrl = $.render[ "geoSrc" ]( urlArgs ); - } - - serviceState.loadCount++; - map._requestQueued(); - - scaleContainer.append(''); - $img = scaleContainer.children(":last").data("center", map._center); - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, map, serviceState, opacity ); - } else { - // assume Deferred - imageUrl.done( function( url ) { - serviceObj._loadImage( $img, url, pixelSize, map, serviceState, opacity ); - } ).fail( function( ) { - $img.remove( ); - serviceState.loadCount--; - map._requestComplete(); - } ); - } - - } - }, - - resize: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState && service && service.style.visibility === "visible" ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - scaleContainers = serviceContainer.children(); - - scaleContainers.attr("data-pixel-size", "0"); - - scaleContainers.each( function ( i ) { - var $scaleContainer = $(this), - position = $scaleContainer.position( ); - - var oldMapOrigin = $scaleContainer.data( "origin" ), - newPixelPoint = map._toPixel( oldMapOrigin ); - - $scaleContainer.css( { - left: position.left + ( mapWidth - $scaleContainer.width( ) ) / 2, - top: position.top + ( mapHeight - $scaleContainer.height( ) ) / 2 - } ); - - } ); - - - /* - scaleContainer.css({ - left: halfWidth + 'px', - top: halfHeight + 'px' - }); - */ - } - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - serviceState.serviceContainer.css("display", service.style.visibility === "visible" ? "block" : "none"); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - map._requestComplete(); - } - } - }, - - _loadImage: function ( $img, url, pixelSize, map, serviceState, opacity ) { - var serviceContainer = serviceState.serviceContainer; - - $img.load(function (e) { - if ( !$.contains(document.body, e.target.jquery ? e.target[0] : e.target) ) { - // this image has been canceled and removed from the DOM - return; - } - - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - // #newpanzoom - serviceContainer.children(':not([data-pixel-size="' + pixelSize + '"])').remove(); - - serviceContainer.find( "img[data-keep-alive]" ).remove( ); - - serviceState.loadCount = 0; - } - }).error(function (e) { - if ( !$.contains(document.body, e.target.jquery ? e.target[0] : e.target) ) { - // this image has been canceled and removed from the DOM - return; - } - - $(e.target).remove(); - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - }()); -}(jQuery)); diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.1.min.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.1.min.js deleted file mode 100755 index 8f92661..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.1.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery Geo - v1.0b1.1 - 2012-08-24 - * http://jquerygeo.com - * Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */ -document.createElement("canvas").getContext||function(){function j(){return this.context_||(this.context_=new I(this))}function l(a,b,c){var d=k.call(arguments,2);return function(){return a.apply(b,d.concat(k.call(arguments)))}}function m(a){return String(a).replace(/&/g,"&").replace(/"/g,""")}function n(a,b,c){a.namespaces[b]||a.namespaces.add(b,c,"#default#VML")}function o(a){n(a,"g_vml_","urn:schemas-microsoft-com:vml"),n(a,"g_o_","urn:schemas-microsoft-com:office:office");if(!a.styleSheets.ex_canvas_){var b=a.createStyleSheet();b.owningElement.id="ex_canvas_",b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function q(a){var b=a.srcElement;switch(a.propertyName){case"width":b.getContext().clearRect(),b.style.width=b.attributes.width.nodeValue+"px",b.firstChild.style.width=b.clientWidth+"px";break;case"height":b.getContext().clearRect(),b.style.height=b.attributes.height.nodeValue+"px",b.firstChild.style.height=b.clientHeight+"px"}}function r(a){var b=a.srcElement;b.firstChild&&(b.firstChild.style.width=b.clientWidth+"px",b.firstChild.style.height=b.clientHeight+"px")}function v(){return[[1,0,0],[0,1,0],[0,0,1]]}function w(a,b){var c=v();for(var d=0;d<3;d++)for(var e=0;e<3;e++){var f=0;for(var g=0;g<3;g++)f+=a[d][g]*b[g][e];c[d][e]=f}return c}function x(a,b){b.fillStyle=a.fillStyle,b.lineCap=a.lineCap,b.lineJoin=a.lineJoin,b.lineWidth=a.lineWidth,b.miterLimit=a.miterLimit,b.shadowBlur=a.shadowBlur,b.shadowColor=a.shadowColor,b.shadowOffsetX=a.shadowOffsetX,b.shadowOffsetY=a.shadowOffsetY,b.strokeStyle=a.strokeStyle,b.globalAlpha=a.globalAlpha,b.font=a.font,b.textAlign=a.textAlign,b.textBaseline=a.textBaseline,b.arcScaleX_=a.arcScaleX_,b.arcScaleY_=a.arcScaleY_,b.lineScale_=a.lineScale_}function y(a){var b=a.indexOf("(",3),c=a.indexOf(")",b+1),d=a.substring(b+1,c).split(",");if(d.length!=4||a.charAt(3)!="a")d[3]=1;return d}function z(a){return parseFloat(a)/100}function A(a,b,c){return Math.min(c,Math.max(b,a))}function B(a){var b,c,d,e,f,g;e=parseFloat(a[0])/360%360,e<0&&e++,f=A(z(a[1]),0,1),g=A(z(a[2]),0,1);if(f==0)b=c=d=g;else{var h=g<.5?g*(1+f):g+f-g*f,i=2*g-h;b=C(i,h,e+1/3),c=C(i,h,e),d=C(i,h,e-1/3)}return"#"+s[Math.floor(b*255)]+s[Math.floor(c*255)]+s[Math.floor(d*255)]}function C(a,b,c){return c<0&&c++,c>1&&c--,6*c<1?a+(b-a)*6*c:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}function E(a){if(a in D)return D[a];var b,c=1;a=String(a);if(a.charAt(0)=="#")b=a;else if(/^rgb/.test(a)){var d=y(a),b="#",e;for(var f=0;f<3;f++)d[f].indexOf("%")!=-1?e=Math.floor(z(d[f])*255):e=+d[f],b+=s[A(e,0,255)];c=+d[3]}else if(/^hsl/.test(a)){var d=y(a);b=B(d),c=d[3]}else b=a;return D[a]={color:b,alpha:c}}function H(a){return G[a]||"square"}function I(a){this.m_=v(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle="#000",this.fillStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=g*1,this.globalAlpha=1,this.canvas=a;var b="width:"+a.clientWidth+"px;height:"+a.clientHeight+"px;overflow:hidden;position:absolute",c=a.ownerDocument.createElement("div");c.style.cssText=b,a.appendChild(c);var d=c.cloneNode(!1);d.style.backgroundColor="red",d.style.filter="alpha(opacity=0)",a.appendChild(d),this.element_=c,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1}function K(a,b,c,d){a.currentPath_.push({type:"bezierCurveTo",cp1x:b.x,cp1y:b.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y}),a.currentX_=d.x,a.currentY_=d.y}function L(a,b){var c=E(a.strokeStyle),d=c.color,e=c.alpha*a.globalAlpha,f=a.lineScale_*a.lineWidth;f<1&&(e*=f),b.push("')}function M(a,b,c,d){var e=a.fillStyle,f=a.arcScaleX_,g=a.arcScaleY_,h=d.x-c.x,i=d.y-c.y,j=E(a.fillStyle),k=j.color,l=j.alpha*a.globalAlpha;b.push('')}function N(a,b,c){var d=a.m_;return{x:g*(b*d[0][0]+c*d[1][0]+d[2][0])-h,y:g*(b*d[0][1]+c*d[1][1]+d[2][1])-h}}function O(a){return isFinite(a[0][0])&&isFinite(a[0][1])&&isFinite(a[1][0])&&isFinite(a[1][1])&&isFinite(a[2][0])&&isFinite(a[2][1])}function P(a,b,c){if(!O(b))return;a.m_=b;if(c){var d=b[0][0]*b[1][1]-b[0][1]*b[1][0];a.lineScale_=f(e(d))}}function Q(a){throw new R(a)}function R(a){this.code=this[a],this.message=a+": DOM Exception "+this.code}var a=Math,b=a.round,c=a.sin,d=a.cos,e=a.abs,f=a.sqrt,g=10,h=g/2,i=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],k=Array.prototype.slice;o(document);var p={init:function(a){var b=a||document;b.createElement("canvas"),b.attachEvent("onreadystatechange",l(this.init_,this,b))},init_:function(a){var b=a.getElementsByTagName("canvas");for(var c=0;cj.x)j.x=l.x;if(i.y==null||l.yj.y)j.y=l.y}}c.push(' ">'),a?M(this,c,i,j):L(this,c),c.push(""),this.element_.insertAdjacentHTML("beforeEnd",c.join(""))},J.fill=function(){this.stroke(!0)},J.closePath=function(){this.currentPath_.push({type:"close"})},J.save=function(){var a={};x(this,a),this.aStack_.push(a),this.mStack_.push(this.m_),this.m_=w(v(),this.m_)},J.restore=function(){this.aStack_.length&&(x(this.aStack_.pop(),this),this.m_=this.mStack_.pop())},J.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];P(this,w(c,this.m_),!1)},J.scale=function(a,b){this.arcScaleX_*=a,this.arcScaleY_*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];P(this,w(c,this.m_),!0)};var S=R.prototype=new Error;S.INDEX_SIZE_ERR=1,S.DOMSTRING_SIZE_ERR=2,S.HIERARCHY_REQUEST_ERR=3,S.WRONG_DOCUMENT_ERR=4,S.INVALID_CHARACTER_ERR=5,S.NO_DATA_ALLOWED_ERR=6,S.NO_MODIFICATION_ALLOWED_ERR=7,S.NOT_FOUND_ERR=8,S.NOT_SUPPORTED_ERR=9,S.INUSE_ATTRIBUTE_ERR=10,S.INVALID_STATE_ERR=11,S.SYNTAX_ERR=12,S.INVALID_MODIFICATION_ERR=13,S.NAMESPACE_ERR=14,S.INVALID_ACCESS_ERR=15,S.VALIDATION_ERR=16,S.TYPE_MISMATCH_ERR=17,G_vmlCanvasManager=p,CanvasRenderingContext2D=I,DOMException=R}(),this.jsviews||this.jQuery&&jQuery.views||function(a,b){function A(a,b){var c="\\"+a.charAt(0),d="\\"+a.charAt(1),g="\\"+b.charAt(0),h="\\"+b.charAt(1);return z.rTag=e=d+"(?:(?:(\\w+(?=[\\/\\s"+g+"]))|(?:(\\w+)?(:)|(>)|(\\*)))"+"\\s*((?:[^"+g+"]|"+g+"(?!"+h+"))*?)"+"(\\/)?|(?:\\/(\\w+)))"+g,e=new RegExp(c+e+h,"g"),f=new RegExp("<.*>|"+a+".*"+b),this}function B(a){var c=this,d=c.tmpl.helpers||{};return a=(c.ctx[a]!==b?c.ctx:d[a]!==b?d:I[a]!==b?I:{})[a],typeof a!="function"?a:function(){return a.apply(c,arguments)}}function C(a,b,c){var d=b.tmpl.converters;return a=d&&d[a]||J[a],a?a.call(b,c):c}function D(a,c,d,e,f){f.props=f.props||{};var h,i=f.props.tmpl,k=c.tmpl.tags,l=c.tmpl.templates,m=arguments,n=k&&k[a]||H[a];return n?(e=e&&c.tmpl.tmpls[e-1],i=i||e||b,f.tmpl=""+i===i?l&&l[i]||G[i]||G(i):i,f.isTag=j,f.converter=d,f.view=c,f.renderContent=K,c.ctx&&g(f.ctx,c.ctx),h=n.apply(f,m.length>5?x.call(m,5):[]),h||(h==b?"":h.toString())):""}function E(a,c,e,f,g,h){var i=e.views,j={tmpl:g,path:c,parent:e,data:f,ctx:a,views:d.isArray(f)?[]:{},hlp:B};return d.isArray(i)?i.splice(j.index=h!==b?h:i.length,0,j):i[j.index="_"+r++]=j,j}function F(a,c,d,e,f){var g,i;if(d&&typeof d=="object"&&!d.nodeType){for(g in d)c(g,d[g]);return a}if(!d||e===b)f&&(e=f(b,e||d));else if(""+d===d)if(e===null)delete c[d];else if(e=f?f(d,e):e)c[d]=e;return(i=h.onStoreItem)&&i(c,d,e,f),e}function G(a,b){return F(this,G,a,b,O)}function H(a,b){return F(this,H,a,b)}function I(a,b){return F(this,I,a,b)}function J(a,b){return F(this,J,a,b)}function K(a,c,e,f,k){var l,m,n,o,p,q,r,s,t,u,v={},w=k===j,x=this,y="";x.isTag?(t=x.tmpl,c=c||x.ctx,e=e||x.view,f=f||x.path,k=k||x.index,v=x.props):t=x.jquery&&x[0]||x,e=e||z.topView,s=e.ctx,u=t.layout,a===e&&(a=e.data,u=j),c=c&&c===s?s:s?(s=g({},s),c)?g(s,c):s:c||{},v.link===i&&(c.link=i),t.fn||(t=G[t]||G(t)),p=c.link&&h.onRenderItem,q=c.link&&h.onRenderItems;if(t){if(d.isArray(a)&&!u){o=w?e:k!==b&&e||E(c,f,e,a,t,k);for(l=0,m=a.length;l-1,i+=(t===":"?u==="html"?(l=j,"e("+w):u?(r=j,'c("'+u+'",view,'+w):(m=j,"((v="+w+')!=u?v:""'):(k=j,'t("'+t+'",view,"'+(u||"")+'",'+(F?B.length:'""')+","+x+(w?",":"")+w))+")+");return i=new Function("data, view, j, b, u",v+(m?"v,":"")+(k?"t=j.tag,":"")+(r?"c=j.convert,":"")+(l?"e=j.converters.html,":"")+"ret; try{\n\n"+(A.debug?"debugger;":"")+(z?"ret=":"return ")+i.slice(0,-1)+";\n\n"+(z?"return ret;":"")+"}catch(e){return j.err(e);}"),b&&(b.fn=i,b.useVw=r||s||k),i}function N(a,b){function h(a,h,k,m,n,o,p,q,r,s,t,u,v,w,x,y){function z(a,c,d,e,f,g,h){if(c){var i=(d?'view.hlp("'+d+'")':e?"view":"data")+(h?(f?"."+f:d?"":e?"":"."+c)+(g||""):(h=d?"":e?f||"":c,""));return b&&r!=="("&&(i="b("+i+',"'+h+'")'),i+(h?"."+h:"")}return a}n=n||"",k=k||h||t,m=m||q,r=r||x||"",n=n||"";if(o)L();else return g?(g=!u,g?a:'"'):f?(f=!v,f?a:'"'):(k?(e++,k):"")+(y?e?"":c?(c=i,"\b"):",":p?(e&&L(),c=j,"\b"+m+":"):m?m.replace(l,z)+(r?(d[++e]=j,r):n):n?a:w?(d[e--]=i,w)+(r?(d[++e]=j,r):""):s?(d[e]||L(),","):h?"":(g=u,f=v,'"'))}var c,d={},e=0,f=i,g=i;return a=(a+" ").replace(m,h),a}function O(a,c,d,e){function n(b){if(""+b===b||b.nodeType>0)return i=b.nodeType>0?b:!f.test(b)&&k&&k(b)[0],i&&i.type&&(b=G[i.getAttribute(u)],b||(a=a||"_"+s++,i.setAttribute(u,a),b=O(a,i.innerHTML,d,e),G[a]=b)),b}var h,i,j,l,m;h=n(c),e=e||(c.markup?c:{}),e.name=a,l=e.templates,!h&&c.markup&&(h=n(c.markup))&&h.fn&&(h.debug!==c.debug||h.allowCode!==c.allowCode)&&(h=h.markup);if(h!==b){a&&!d&&(y[a]=function(){return c.render.apply(c,arguments)}),h.fn||c.fn?h.fn&&(a&&a!==h.name?c=g(g({},h),e):c=h):(c=P(h,e,d,0),M(h,c));for(j in l)m=l[j],m.name!==j&&(l[j]=O(j,m,c));return c}}function P(a,b,c,d){function e(a){c[a]&&(f[a]=g(g({},c[a]),b[a]))}b=b||{};var f={markup:a,tmpls:[],links:[],render:K};return c&&(c.templates&&(f.templates=g(g({},c.templates),b.templates)),f.parent=c,f.name=c.name+"["+d+"]",f.index=d),g(f,b),c&&(e("templates"),e("tags"),e("helpers"),e("converters")),f}function Q(a){return t[a]||(t[a]="&#"+a.charCodeAt(0)+";")}var c="v1.0pre",d,e,f,g,h={},i=!1,j=!0,k=a.jQuery,l=/^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g,m=/(\()(?=|\s*\()|(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g,n=/\r?\n/g,o=/\\(['"])/g,p=/\\?(['"])/g,q=/\x08(~)?([^\x08]+)\x08/g,r=0,s=0,t={"&":"&","<":"<",">":">"},u="data-jsv-tmpl",v="var j=j||"+(k?"jQuery.":"js")+"views,",w=/[\x00"&'<>]/g,x=Array.prototype.slice,y={},z={jsviews:c,sub:h,debugMode:j,err:function(a){return z.debugMode?"
            Error: "+(a.message||a)+". ":'""'},tmplFn:M,render:y,templates:G,tags:H,helpers:I,converters:J,View:E,convert:C,delimiters:A,tag:D};k?(d=k,d.templates=G,d.render=y,d.views=z,d.fn.render=K):(d=a.jsviews=z,d.extend=function(a,b){var c;a=a||{};for(c in b)a[c]=b[c];return a},d.isArray=Array&&Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}),g=d.extend,z.topView={views:{},tmpl:{},hlp:B,ctx:z.helpers},H({"if":function(){var a=this,c=a.view;return c.onElse=function(a,d){var e=0,f=d.length;while(f&&!d[e++])if(e===f)return"";return c.onElse=b,a.path="",a.renderContent(c)},c.onElse(this,arguments)},"else":function(){var a=this.view;return a.onElse?a.onElse(this,arguments):""},"for":function(){var a,b=this,c="",d=arguments,e=d.length;b.props.layout&&(b.tmpl.layout=j);for(a=0;a1&&!a.isArray(b[0]))return b[0]>=-180&&b[0]<=180&&b[1]>=-85&&b[1]<=85;b=b[0]}return!1},center:function(b,c){var d=!1;!c&&a.geo.proj&&this._isGeodetic(b)&&(d=!0,b=a.geo.proj.fromGeodetic(b));var e=[(b[0]+b[2])/2,(b[1]+b[3])/2];return d?a.geo.proj.toGeodetic(e):e},expandBy:function(b,c,d,e){var f=!1;return!e&&a.geo.proj&&this._isGeodetic(b)&&(f=!0,b=a.geo.proj.fromGeodetic(b)),b=[b[0]-c,b[1]-d,b[2]+c,b[3]+d],f?a.geo.proj.toGeodetic(b):b},height:function(b,c){return!c&&a.geo.proj&&this._isGeodetic(b)&&(b=a.geo.proj.fromGeodetic(b)),b[3]-b[1]},_in:function(a,b){return a[0]<=b[0]&&a[1]<=b[1]&&a[2]>=b[2]&&a[3]>=b[3]},_bboxDisjoint:function(a,b){return b[0]>a[2]||b[2]a[3]||b[3]0&&(f/g>c?(i=f/2,j=i/c):(j=g/2,i=j*c),b=[h[0]-i,h[1]-j,h[0]+i,h[1]+j]),e?a.geo.proj.toGeodetic(b):b},recenter:function(b,c,d){var e=!1;!d&&a.geo.proj&&(this._isGeodetic(b)&&(e=!0,b=a.geo.proj.fromGeodetic(b)),this._isGeodetic(c)&&(c=a.geo.proj.fromGeodetic(c)));var f=(b[2]-b[0])/2,g=(b[3]-b[1])/2;return b=[c[0]-f,c[1]-g,c[0]+f,c[1]+g],e?a.geo.proj.toGeodetic(b):b},scaleBy:function(b,c,d){var e=!1;!d&&a.geo.proj&&this._isGeodetic(b)&&(e=!0,b=a.geo.proj.fromGeodetic(b));var f=this.center(b,!0),g=(b[2]-b[0])*c/2,h=(b[3]-b[1])*c/2;return b=[f[0]-g,f[1]-h,f[0]+g,f[1]+h],e?a.geo.proj.toGeodetic(b):b},width:function(b,c){return!c&&a.geo.proj&&this._isGeodetic(b)&&(b=a.geo.proj.fromGeodetic(b)),b[2]-b[0]},bbox:function(b,f){var g,h=!1;if(!b)return c;if(b.bbox)g=!f&&a.geo.proj&&this._isGeodetic(b.bbox)?a.geo.proj.fromGeodetic(b.bbox):b.bbox;else{g=[d,d,e,e];var i=this._allCoordinates(b),j=0;if(i.length===0)return c;!f&&a.geo.proj&&this._isGeodetic(i)&&(h=!0,i=a.geo.proj.fromGeodetic(i));for(;j0?(h[0]=Math.min(Math.max(i[0][0],m[0]),m[2]),h[1]=Math.min(Math.max(i[0][1],m[1]),m[3]),{type:"Point",coordinates:n?a.geo.proj.toGeodetic(h):h}):c;return g*=3,h[0]=Math.min(Math.max(h[0]/g,m[0]),m[2]),h[1]=Math.min(Math.max(h[1]/g,m[1]),m[3]),{type:"Point",coordinates:n?a.geo.proj.toGeodetic(h):h}}return c},contains:function(a,b){if(a.type!="Polygon")return!1;switch(b.type){case"Point":return this._containsPolygonPoint(a.coordinates,b.coordinates);case"LineString":return this._containsPolygonLineString(a.coordinates,b.coordinates);case"Polygon":return this._containsPolygonLineString(a.coordinates,b.coordinates[0]);default:return!1}},_containsPolygonPoint:function(a,b){if(a.length===0||a[0].length<4)return!1;var c=0,d=a[0][0],e=1,f,g;for(;eb[0]&&c++;d=f}return c%2==1},_containsPolygonLineString:function(a,b){for(var c=0;c0){var e=a[0],f=b[0]-e[0],g=b[1]-e[1];if(a.length==1)return Math.sqrt(f*f+g*g);for(var h=1;h=h?e*e+f*f:c*c+d*d-g*g/h},_distanceLineStringLineString:function(a,b){var c=d;for(var e=0;e2?{type:"Point",coordinates:[parseFloat(b[1]),parseFloat(b[2])]}:null}function p(a){var b=a.match(/\s*\((.*)\)/),c=[],d,e,f=0;if(b&&b.length>1){d=b[1].match(/[\d\.\-]+\s+[\d\.\-]+/g);for(;f1){d=b[1].match(/[\d\.\-]+\s+[\d\.\-]+/g);for(;f0){for(;f
            ";while(c[0]);return a>6?a:!a}();a.widget("geo.geographics",{_$elem:b,_options:{},_trueCanvas:!0,_width:0,_height:0,_$canvas:b,_context:b,_blitcanvas:b,_blitcontext:b,_$labelsContainer:b,options:{style:{borderRadius:"8px",color:"#7f0000",fillOpacity:.2,height:"8px",opacity:1,strokeOpacity:1,strokeWidth:"2px",visibility:"visible",width:"8px"}},_create:function(){this._$elem=this.element,this._options=this.options,this._$elem.css({display:"inline-block",overflow:"hidden",textAlign:"left"}),this._$elem.css("position")=="static"&&this._$elem.css("position","relative"),this._$elem.addClass("geo-graphics"),this._width=this._$elem.width(),this._height=this._$elem.height();if(!this._width||!this._height)this._width=parseInt(this._$elem.css("width"),10),this._height=parseInt(this._$elem.css("height"),10);var a="position:absolute;left:0;top:0;margin:0;padding:0;",b="width:"+this._width+"px;height:"+this._height+"px;",d='width="'+this._width+'" height="'+this._height+'"';document.createElement("canvas").getContext?(this._$elem.append("'),this._$canvas=this._$elem.children(":last"),this._context=this._$canvas[0].getContext("2d"),this._blitcanvas=document.createElement("canvas"),this._blitcanvas.width=this._width,this._blitcanvas.height=this._height,this._blitcontext=this._blitcanvas.getContext("2d")):c<=8&&(this._trueCanvas=!1,this._$elem.append("
            '),this._$canvas=this._$elem.children(":last"),G_vmlCanvasManager.initElement(this._$canvas[0]),this._context=this._$canvas[0].getContext("2d"),this._$canvas.children().css({backgroundColor:"transparent",width:this._width,height:this._height})),this._$elem.append('
            '),this._$labelsContainer=this._$elem.children(":last")},_setOption:function(b,c){b=="style"&&(c=a.extend({},this._options.style,c)),a.Widget.prototype._setOption.apply(this,arguments)},destroy:function(){a.Widget.prototype.destroy.apply(this,arguments),this._$elem.html(""),this._$elem.removeClass("geo-graphics")},clear:function(){this._context.clearRect(0,0,this._width,this._height),this._$labelsContainer.html("")},drawArc:function(a,b,c,d){d=this._getGraphicStyle(d);if(d.visibility!="hidden"&&d.opacity>0&&d.widthValue>0&&d.heightValue>0){var e=Math.min(d.widthValue,d.heightValue)/2;b=b*Math.PI/180,c=c*Math.PI/180,this._context.save(),this._context.translate(a[0],a[1]),d.widthValue>d.heightValue?this._context.scale(d.widthValue/d.heightValue,1):this._context.scale(1,d.heightValue/d.widthValue),this._context.beginPath(),this._context.arc(0,0,e,b,c,!1),this._trueCanvas&&this._context.restore(),d.doFill&&(this._context.fillStyle=d.fill,this._context.globalAlpha=d.opacity*d.fillOpacity,this._context.fill()),d.doStroke&&(this._context.lineJoin="round",this._context.lineWidth=d.strokeWidthValue,this._context.strokeStyle=d.stroke,this._context.globalAlpha=d.opacity*d.strokeOpacity,this._context.stroke()),this._trueCanvas||this._context.restore()}},drawPoint:function(a,b){b=this._getGraphicStyle(b),b.widthValue==b.heightValue&&b.heightValue==b.borderRadiusValue?this.drawArc(a,0,360,b):b.visibility!="hidden"&&b.opacity>0&&(b.borderRadiusValue=Math.min(Math.min(b.widthValue,b.heightValue)/2,b.borderRadiusValue),a[0]-=b.widthValue/2,a[1]-=b.heightValue/2,this._context.beginPath(),this._context.moveTo(a[0]+b.borderRadiusValue,a[1]),this._context.lineTo(a[0]+b.widthValue-b.borderRadiusValue,a[1]),this._context.quadraticCurveTo(a[0]+b.widthValue,a[1],a[0]+b.widthValue,a[1]+b.borderRadiusValue),this._context.lineTo(a[0]+b.widthValue,a[1]+b.heightValue-b.borderRadiusValue),this._context.quadraticCurveTo(a[0]+b.widthValue,a[1]+b.heightValue,a[0]+b.widthValue-b.borderRadiusValue,a[1]+b.heightValue),this._context.lineTo(a[0]+b.borderRadiusValue,a[1]+b.heightValue),this._context.quadraticCurveTo(a[0],a[1]+b.heightValue,a[0],a[1]+b.heightValue-b.borderRadiusValue),this._context.lineTo(a[0],a[1]+b.borderRadiusValue),this._context.quadraticCurveTo(a[0],a[1],a[0]+b.borderRadiusValue,a[1]),this._context.closePath(),b.doFill&&(this._context.fillStyle=b.fill,this._context.globalAlpha=b.opacity*b.fillOpacity,this._context.fill()),b.doStroke&&(this._context.lineJoin="round",this._context.lineWidth=b.strokeWidthValue,this._context.strokeStyle=b.stroke,this._context.globalAlpha=b.opacity*b.strokeOpacity,this._context.stroke()))},drawLineString:function(a,b){this._drawLines([a],!1,b)},drawPolygon:function(a,b){if(!this._trueCanvas||a.length==1)this._drawLines(a,!0,b);else{if(!a||!a.length||a[0].length<3)return;b=this._getGraphicStyle(b);var c,d,e;if(b.visibility!="hidden"&&b.opacity>0){this._blitcontext.clearRect(0,0,this._width,this._height);if(b.doFill&&a.length>1){this._blitcontext.globalCompositeOperation="source-out",this._blitcontext.globalAlpha=1;for(d=1;d1)for(d=1;d'+b+"
            ")},resize:function(){this._width=this._$elem.width(),this._height=this._$elem.height();if(!this._width||!this._height)this._width=parseInt(this._$elem.css("width"),10),this._height=parseInt(this._$elem.css("height"),10);this._trueCanvas&&(this._$canvas[0].width=this._width,this._$canvas[0].height=this._height),this._$labelsContainer.css({width:this._width,height:this._height})},_getGraphicStyle:function(b){function c(a){return a=parseInt(a,10),+a+""===a?+a:a}return b=a.extend({},this._options.style,b),b.borderRadiusValue=c(b.borderRadius),b.fill=b.fill||b.color,b.doFill=b.fill&&b.fillOpacity>0,b.stroke=b.stroke||b.color,b.strokeWidthValue=c(b.strokeWidth),b.doStroke=b.stroke&&b.strokeOpacity>0&&b.strokeWidthValue>0,b.widthValue=c(b.width),b.heightValue=c(b.height),b},_drawLines:function(a,b,c){if(!a||!a.length||a[0].length<2)return;var d,e;c=this._getGraphicStyle(c);if(c.visibility!="hidden"&&c.opacity>0){this._context.beginPath();for(d=0;d
            ";while(c[0]);return a>6?a:!a}(),e={bbox:[-180,-85,180,85],bboxMax:[-180,-85,180,85],center:[0,0],cursors:{"static":"default",pan:"url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move",zoom:"crosshair",dragBox:"crosshair",dragCircle:"crosshair",drawPoint:"crosshair",drawLineString:"crosshair",drawPolygon:"crosshair",measureLength:"crosshair",measureArea:"crosshair"},measureLabels:{length:"{{:length.toFixed( 2 )}} m",area:"{{:area.toFixed( 2 )}} sq m"},drawStyle:{},shapeStyle:{},mode:"pan",pannable:!0,scroll:"default",shift:"default",services:[{"class":"osm",type:"tiled",src:function(a){return"http://otile"+(a.index%4+1)+".mqcdn.com/tiles/1.0.0/osm/"+a.zoom+"/"+a.tile.column+"/"+a.tile.row+".png"},attr:"Tiles Courtesy of MapQuest "}],tilingScheme:{tileWidth:256,tileHeight:256,levels:18,basePixelSize:156543.03392799935,origin:[-20037508.342787,20037508.342787]},axisLayout:"map",zoom:0,zoomMin:0,zoomMax:Number.POSITIVE_INFINITY,pixelSize:0};a.widget("geo.geomap",{_$elem:b,_map:b,_created:!1,_createdGraphics:!1,_widgetId:0,_tmplLengthId:"",_tmplAreaId:"",_contentBounds:{},_$resizeContainer:b,_$eventTarget:b,_$contentFrame:b,_$existingChildren:b,_$attrList:b,_$servicesContainer:b,_$shapesContainers:b,_$panContainer:b,_$shapesContainer:b,_$drawContainer:b,_$measureContainer:b,_$measureLabel:b,_dpi:96,_currentServices:[],_center:b,_pixelSize:b,_centerMax:b,_pixelSizeMax:b,_userGeodetic:!0,_centerInteractive:b,_pixelSizeInteractive:b,_timeoutInteractive:null,_triggerInteractive:!1,_loadCount:0,_wheelTimeout:null,_wheelLevel:0,_zoomFactor:2,_fullZoomFactor:2,_partialZoomFactor:1.18920711500273,_mouseDown:b,_inOp:b,_toolPan:b,_shiftDown:b,_anchor:b,_current:b,_downDate:b,_moveDate:b,_clickDate:b,_lastMove:b,_lastDrag:b,_windowHandler:null,_resizeTimeout:null,_panning:b,_velocity:b,_friction:b,_supportTouch:b,_softDblClick:b,_isTap:b,_isDbltap:b,_isMultiTouch:b,_multiTouchAnchor:[],_multiTouchAnchorBbox:b,_multiTouchCurrentBbox:b,_drawTimeout:null,_drawPixels:[],_drawCoords:[],_graphicShapes:[],_initOptions:{},_options:{},options:a.extend({},e),_createWidget:function(b,d){this._$elem=a(d);if(this._$elem.is(".geo-service")){this._graphicShapes=[],a.Widget.prototype._createWidget.apply(this,arguments);return}this._widgetId=c++,this._tmplLengthId="geoMeasureLength"+this._widgetId,this._tmplAreaId="geoMeasureArea"+this._widgetId,this._$elem.addClass("geo-map").css({webkitTransform:"translateZ(0)"}),this._initOptions=b||{},this._forcePosition(this._$elem),this._$elem.css("text-align","left");var e=this._findMapSize();this._contentBounds={x:parseInt(this._$elem.css("padding-left"),10),y:parseInt(this._$elem.css("padding-top"),10),width:e.width,height:e.height},this._createChildren(),this._center=[0,0],this._centerMax=[0,0],this._centerInteractive=[0,0],this.options.pixelSize=this._pixelSize=this._pixelSizeMax=156543.03392799935,this._mouseDown=this._inOp=this._toolPan=this._shiftDown=this._panning=this._isTap=this._isDbltap=!1,this._anchor=[0,0],this._current=[0,0],this._lastMove=[0,0],this._lastDrag=[0,0],this._velocity=[0,0],this._friction=[.8,.8],this._downDate=this._moveDate=this._clickDate=0,this._drawPixels=[],this._drawCoords=[],this._graphicShapes=[],a.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){this._options=this.options;if(this._$elem.is(".geo-service")){this._map=this._$elem.data("geoMap"),this._$elem.data("geoService",this);return}this._map=this,this._supportTouch="ontouchend"in document,this._softDblClick=this._supportTouch||d==7;var c=this,e=this._supportTouch?"touchstart":"mousedown",f=this._supportTouch?"touchend touchcancel":"mouseup",g=this._supportTouch?"touchmove":"mousemove";a(document).keydown(a.proxy(this._document_keydown,this)),this._$eventTarget.dblclick(a.proxy(this._eventTarget_dblclick,this)),this._$eventTarget.bind(e,a.proxy(this._eventTarget_touchstart,this));var h=this._$eventTarget[0].setCapture?this._$eventTarget:a(document);h.bind(g,a.proxy(this._dragTarget_touchmove,this)),h.bind(f,a.proxy(this._dragTarget_touchstop,this)),this._$eventTarget.mousewheel(a.proxy(this._eventTarget_mousewheel,this)),this._windowHandler=function(){c._resizeTimeout&&clearTimeout(c._resizeTimeout),c._resizeTimeout=setTimeout(function(){c._created&&c._$elem.geomap("resize",!0)},500)},a(window).resize(this._windowHandler),this._$drawContainer.geographics({style:this._initOptions.drawStyle||{}}),this._options.drawStyle=this._$drawContainer.geographics("option","style"),this._$shapesContainer.geographics({style:this._initOptions.shapeStyle||{}}),this._createdGraphics=!0,this._options.shapeStyle=this._$shapesContainer.geographics("option","style"),this._initOptions&&(this._initOptions.tilingScheme!==b&&this._setOption("tilingScheme",this._initOptions.tilingScheme||null,!1),this._initOptions.services&&(this._options.services=a.merge([],this._initOptions.services)),this._initOptions.bboxMax&&(this._setOption("bboxMax",this._initOptions.bboxMax,!1),this._setOption("bbox",this._initOptions.bboxMax,!1)),this._initOptions.zoomMin!==b&&this._setOption("zoomMin",this._initOptions.zoomMin,!1),this._initOptions.zoomMax!==b&&this._setOption("zoomMax",this._initOptions.zoomMax,!1),this._initOptions.bbox&&this._setOption("bbox",this._initOptions.bbox,!1),this._initOptions.center&&this._setOption("center",this._initOptions.center,!1),this._initOptions.zoom!==b&&this._setOption("zoom",this._initOptions.zoom,!1)),a.templates(this._tmplLengthId,this._options.measureLabels.length),a.templates(this._tmplAreaId,this._options.measureLabels.area),this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._createServices(),this._refresh(),this._created=!0},_setOption:function(c,d,e){if(c=="pixelSize")return;e=e===b||e,this._$elem.is(".geo-map")&&this._panFinalize();var f,g,h,i;switch(c){case"bbox":this._created&&this._clearInteractiveTimeout(),this._userGeodetic=a.geo.proj&&a.geo._isGeodetic(d),this._userGeodetic&&(d=a.geo.proj.fromGeodetic(d)),f=[d[0]+(d[2]-d[0])/2,d[1]+(d[3]-d[1])/2],g=Math.max(a.geo.width(d,!0)/this._contentBounds.width,a.geo.height(d,!0)/this._contentBounds.height),i=this._getZoom(f,g),this._options.tilingScheme?g=this._getPixelSize(Math.min(Math.max(i,this._options.zoomMin),this._options.zoomMax)):ithis._options.zoomMax&&(g=this._getPixelSize(this._options.zoomMax)),this._created?(this._setInteractiveCenterAndSize(f,g),this._setInteractiveTimeout(!1)):this._setCenterAndSize(f,g,!1,e),d=this._getBbox(f,g);break;case"bboxMax":this._userGeodetic=a.geo.proj&&a.geo._isGeodetic(d);break;case"center":this._created&&this._clearInteractiveTimeout(),this._userGeodetic=a.geo.proj&&a.geo._isGeodetic(d),this._userGeodetic&&(d=a.geo.proj.fromGeodetic(d)),this._created?(this._setInteractiveCenterAndSize(d,this._pixelSizeInteractive),this._interactiveTransform(),this._setInteractiveTimeout(!1)):this._setCenterAndSize(d,this._pixelSize,!1,e);break;case"measureLabels":d=a.extend(this._options.measureLabels,d),a.templates(this._tmplLengthId,this._options.measureLabels.length),a.templates(this._tmplAreaId,this._options.measureLabels.area);break;case"drawStyle":this._$drawContainer&&(this._$drawContainer.geographics("option","style",d),d=this._$drawContainer.geographics("option","style"));break;case"shapeStyle":this._$elem.is(".geo-service")&&!this._createdGraphics&&this._createServiceGraphics(),this._createdGraphics&&(this._$shapesContainer.geographics("option","style",d),d=this._$shapesContainer.geographics("option","style"));break;case"mode":this._resetDrawing(),this._$eventTarget.css("cursor",this._options.cursors[d]);break;case"zoom":this._created?this._setZoom(d,!1,e):(d=Math.max(d,0),this._setCenterAndSize(this._center,this._getPixelSize(d),!1,e))}a.Widget.prototype._setOption.apply(this,arguments);switch(c){case"bbox":case"center":this._userGeodetic&&(this._options.bbox=a.geo.proj.toGeodetic(this._options.bbox),this._options.center=a.geo.proj.toGeodetic(this._center));break;case"tilingScheme":d!==null&&(this._pixelSizeMax=this._getPixelSize(0),this._centerMax=[d.origin[0]+this._pixelSizeMax*d.tileWidth/2,d.origin[1]+this._pixelSizeMax*d.tileHeight/2]);break;case"bboxMax":a.geo.proj&&a.geo._isGeodetic(d)?h=a.geo.proj.fromGeodetic(d):h=d,this._centerMax=a.geo.center(h),this._pixelSizeMax=Math.max(a.geo.width(h,!0)/this._contentBounds.width,a.geo.height(h,!0)/this._contentBounds.height);break;case"services":this._createServices(),e&&this._refresh();break;case"shapeStyle":e&&this._createdGraphics&&(this._$shapesContainer.geographics("clear"),this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,this._graphicShapes))}},destroy:function(){if(this._$elem.is(".geo-service"))this._createdGraphics&&(this._$shapesContainer.geographics("destroy"),this._$shapesContainer=b,this._createdGraphics=!1);else{clearTimeout(this._timeoutInteractive),this._timeoutInteractive=null,this._created=!1,a(window).unbind("resize",this._windowHandler);for(var c=0;c=0||b<=1)for(var d=0;d0)){this._createdGraphics||this._createServiceGraphics();var g,h,i,j,k,l;a.isArray(c)?g=c:c.type=="FeatureCollection"?g=c.features:g=[c];for(i=1;i0)){var e=a.isArray(c)?c:[c],f;for(var g=0;g=0&&(a.removeData(c,"geoBbox"),f=this._graphicShapes.slice(g+1),this._graphicShapes.length=g,this._graphicShapes.push.apply(this._graphicShapes,f),g--);if(d===b||d)this._$elem.is(".geo-service")?this._refresh(!1,this._$elem):this._refresh()}},_getBbox:function(a,b){a=a||this._center,b=b||this._pixelSize;var c=this._contentBounds.width/2*b,d=this._contentBounds.height/2*b;return[a[0]-c,a[1]-d,a[0]+c,a[1]+d]},_setBbox:function(b,c,d){var e=[b[0]+(b[2]-b[0])/2,b[1]+(b[3]-b[1])/2],f=Math.max(a.geo.width(b,!0)/this._contentBounds.width,a.geo.height(b,!0)/this._contentBounds.height),g=this._getZoom(e,f);this._options.tilingScheme?f=this._getPixelSize(Math.min(Math.max(g,this._options.zoomMin),this._options.zoomMax)):gthis._options.zoomMax&&(f=this._getPixelSize(this._options.zoomMax)),this._setInteractiveCenterAndSize(e,f),this._interactiveTransform()},_getBboxMax:function(){var a=this._contentBounds.width/2*this._pixelSizeMax,b=this._contentBounds.height/2*this._pixelSizeMax;return[this._centerMax[0]-a,this._centerMax[1]-b,this._centerMax[0]+a,this._centerMax[1]+b]},_getCenter:function(){return this._center},_getContentBounds:function(){return this._contentBounds},_getServicesContainer:function(){return this._$servicesContainer},_getZoom:function(b,c){b=b||this._center,c=c||this._pixelSize;var d=this._options.tilingScheme;if(d){if(d.pixelSizes){var e=Math.floor(c*1e3),f=d.pixelSizes.length,g=f-1;for(;g>=0;g--)if(Math.floor(d.pixelSizes[g]*1e3)>=e)return g;return 0}return Math.round(Math.log(d.basePixelSize/c)/Math.log(2))}var h=this._contentBounds.width/this._contentBounds.height,i=a.geo.reaspect(this._getBbox(b,c),h,!0),j=a.geo.reaspect(this._getBboxMax(),h,!0);return Math.round(Math.log(a.geo.width(j,!0)/a.geo.width(i,!0))/Math.log(this._zoomFactor))},_setZoom:function(a,b,c){this._clearInteractiveTimeout(),a=Math.min(Math.max(a,this._options.zoomMin),this._options.zoomMax),this._setInteractiveCenterAndSize(this._centerInteractive,this._getPixelSize(a)),this._interactiveTransform(),this._setInteractiveTimeout(b)},_createChildren:function(){this._$existingChildren=this._$elem.children(),this._forcePosition(this._$existingChildren),this._$existingChildren.detach().css({mozUserSelect:"none"});var b="width:"+this._contentBounds.width+"px; height:"+this._contentBounds.height+"px; margin:0; padding:0;",c="position:absolute; left:0; top:0;";this._$elem.prepend('
            '),this._$eventTarget=this._$contentFrame=this._$elem.children(":first"),this._$contentFrame.append('
            '),this._$servicesContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
            '),this._$shapesContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
              '),this._$attrList=this._$contentFrame.children(":last"),this._$contentFrame.append('
              '),this._$drawContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
              '),this._$measureContainer=this._$contentFrame.children(":last"),this._$measureLabel=this._$measureContainer.children(),this._$panContainer=a([this._$shapesContainer[0],this._$drawContainer[0],this._$measureContainer[0]]),this._$resizeContainer=a([this._$contentFrame[0],this._$servicesContainer[0],this._$eventTarget[0],this._$measureContainer[0]]),this._$contentFrame.append(this._$existingChildren),a("#geo-measure-style").length||a("head").prepend('")},_createServices:function(){var b,c;for(c=0;c',g;this._$servicesContainer.append(f),serviceContainer=this._$servicesContainer.children(":last"),b.serviceContainer=serviceContainer,a.geo._serviceTypes[b.type].create(this,serviceContainer,b,c),serviceContainer.data("geoMap",this).geomap(),b.attr&&this._$attrList.append("
            • "+b.attr+"
            • ")}this._$shapesContainers=this._$shapesContainer,this._$attrList.find("a").css({position:"relative",zIndex:100})},_createServiceGraphics:function(){var a=this._$elem.closest(".geo-content-frame");this._$elem.append('
              '),this._$shapesContainer=this._$elem.children(":last"),this._map._$shapesContainers=this._map._$shapesContainers.add(this._$shapesContainer),this._$shapesContainer.geographics(),this._createdGraphics=!0,this._options.shapeStyle=this._$shapesContainer.geographics("option","style")},_refreshDrawing:function(){this._$drawContainer.geographics("clear");if(this._drawPixels.length>0){var b=this._options.mode,c=this._drawPixels,d=this._drawCoords,e,f,g,h,i;switch(b){case"measureLength":b="drawLineString",f={type:"LineString",coordinates:d},e=a.render[this._tmplLengthId]({length:a.geo.length(f,!0)}),g=a.merge([],c[c.length-1]);break;case"measureArea":b="drawPolygon",f={type:"Polygon",coordinates:[a.merge([],d)]},f.coordinates[0].push(d[0]),e=a.render[this._tmplAreaId]({area:a.geo.area(f,!0)}),g=this._toPixel(a.geo.centroid(f).coordinates),c=[c];break;case"drawPolygon":c=[c]}this._$drawContainer.geographics(b,c),e&&(this._$measureLabel.html(e),h=this._contentBounds.width-(this._$measureLabel.outerWidth(!0)+g[0]),i=this._contentBounds.height-(this._$measureLabel.outerHeight(!0)+g[1]),h<0&&(g[0]+=h),i<0&&(g[1]+=i),this._$measureLabel.css({left:Math.max(g[0],0),top:Math.max(g[1],0)}).show())}},_resetDrawing:function(){this._drawPixels=[],this._drawCoords=[],this._$drawContainer.geographics("clear"),this._$measureLabel.hide()},_refreshShapes:function(c,d,e,f,g,h){var i,j,k,l,m,n,o,p,q=this._map._getBbox(g,h);for(i=0;i0&&a.height>0)){a={width:b.width(),height:b.height()};if(a.width<=0||a.height<=0)a={width:parseInt(b.css("width"),10),height:parseInt(b.css("height"),10)};b=b.parent()}return a},_forcePosition:function(a){var b=a.css("position");b!="relative"&&b!="absolute"&&b!="fixed"&&a.css("position","relative")},_getPixelSize:function(b){var c=this._options.tilingScheme;if(c!==null){if(b===0)return c.pixelSizes?c.pixelSizes[0]:c.basePixelSize;b=Math.round(b),b=Math.max(b,0);var d=c.pixelSizes?c.pixelSizes.length:c.levels;return b=Math.min(b,d-1),c.pixelSizes?c.pixelSizes[b]:c.basePixelSize/Math.pow(2,b)}var e=a.geo.scaleBy(this._getBboxMax(),1/Math.pow(this._zoomFactor,b),!0);return Math.max(a.geo.width(e,!0)/this._contentBounds.width,a.geo.height(e,!0)/this._contentBounds.height)},_getZoomCenterAndSize:function(a,b,c){var d=c?this._fullZoomFactor:this._partialZoomFactor,e=Math.pow(d,-b),f=this._pixelSizeInteractive*e,g=this._getZoom(this._centerInteractive,f);c&&this._options.tilingScheme?f=this._getPixelSize(Math.min(Math.max(g,this._options.zoomMin),this._options.zoomMax)):b<0&&g0&&g>this._options.zoomMax&&(f=this._pixelSizeInteractive);var h=f/this._pixelSizeInteractive,i=this._toMap(a,this._centerInteractive,this._pixelSizeInteractive),j=[(this._centerInteractive[0]-i[0])*h,(this._centerInteractive[1]-i[1])*h],k=[i[0]+j[0],i[1]+j[1]];return{pixelSize:f,center:k}},_mouseWheelFinish:function(a){this._wheelTimeout=null;if(this._wheelLevel!==0){var b=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._options.tilingScheme!==null);this._wheelLevel=0}else a&&this._refresh()},_panFinalize:function(){if(this._panning){this._velocity=[0,0];var a=this._current[0]-this._anchor[0],b=this._current[1]-this._anchor[1],c=this._options.axisLayout==="image",d=-a*this._pixelSize,e=(c?-1:1)*b*this._pixelSize;this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._inOp=!1,this._anchor=this._current,this._mouseDown=this._toolPan=this._panning=!1}},_panMove:function(){if(!this._options.pannable)return;var a=this._current[0]-this._lastDrag[0],b=this._current[1]-this._lastDrag[1],c=0,d,e;if(this._toolPan||a>3||a<-3||b>3||b<-3){this._toolPan||(this._toolPan=!0,this._$eventTarget.css("cursor",this._options.cursors.pan)),this._mouseDown&&(this._velocity=[a,b]);if(a!==0||b!==0)this._panning=!0,this._lastDrag=this._current,this._centerInteractive[0]-=a*this._pixelSizeInteractive,this._centerInteractive[1]+=(this._options.axisLayout==="image"?-1:1)*b*this._pixelSizeInteractive,this._setInteractiveCenterAndSize(this._centerInteractive,this._pixelSizeInteractive),this._interactiveTransform()}},_clearInteractiveTimeout:function(){return this._timeoutInteractive?(clearTimeout(this._timeoutInteractive),this._timeoutInteractive=null,!0):(this._centerInteractive[0]=this._center[0],this._centerInteractive[1]=this._center[1],this._pixelSizeInteractive=this._pixelSize,!1)},_interactiveTransform:function(){this._$shapesContainers&&this._$shapesContainers.geographics("clear");for(var b=0;b0&&(this._drawPixels=this._toPixel(this._drawCoords,this._centerInteractive,this._pixelSizeInteractive),this._refreshDrawing())},_setInteractiveTimeout:function(a){function c(){b._isMultiTouch?b._timeoutInteractive=setTimeout(c,128):b._created&&b._timeoutInteractive&&(b._setCenterAndSize(b._centerInteractive,b._pixelSizeInteractive,b._triggerInteractive,!0),b._timeoutInteractive=null,b._triggerInteractive=!1)}var b=this;this._timeoutInteractive=setTimeout(c,128),this._triggerInteractive|=a},_refresh:function(b,c){var d,e,f=0;for(;f0&&e._refreshShapes(e._$shapesContainer,e._graphicShapes,e._graphicShapes,e._graphicShapes))}this._createdGraphics&&(this._$shapesContainer.geographics("clear"),this._graphicShapes.length>0&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,this._graphicShapes))},_setInteractiveCenterAndSize:function(b,c){this._centerInteractive[0]=b[0],this._centerInteractive[1]=b[1],this._pixelSizeInteractive=c,this._userGeodetic?(this._options.bbox=a.geo.proj.toGeodetic(this._getBbox(b,c)),this._options.center=a.geo.proj.toGeodetic(b)):(this._options.bbox=this._getBbox(b,c),this._options.center[0]=b[0],this._options.center[1]=b[1]),this._options.pixelSize=c,this._options.zoom=this._getZoom(b,c)},_setCenterAndSize:function(b,c,d,e){if(!a.isArray(b)||b.length!=2||typeof b[0]!="number"||typeof b[1]!="number")return;var f=this._getZoom(b,c);this._options.tilingScheme?this._pixelSizeInteractive=c=this._getPixelSize(Math.min(Math.max(f,this._options.zoomMin),this._options.zoomMax)):fthis._options.zoomMax&&(this._pixelSizeInteractive=c=this._getPixelSize(this._options.zoomMax)),this._center[0]=b[0],this._center[1]=b[1],this._options.pixelSize=this._pixelSize=c,this._userGeodetic?(this._options.bbox=a.geo.proj.toGeodetic(this._getBbox()),this._options.center=a.geo.proj.toGeodetic(this._center)):(this._options.bbox=this._getBbox(),this._options.center=a.merge([],b)),this._options.zoom=f,d&&this._trigger("bboxchange",window.event,{bbox:a.merge([],this._options.bbox)}),e&&(this._refresh(),this._refreshDrawing())},_requestQueued:function(){this._loadCount===0&&this._trigger("loadstart",window.event),this._loadCount++},_requestComplete:function(){this._loadCount--,this._loadCount<=0&&(this._loadCount=0,this._trigger("loadend",window.event))},_toMap:function(b,c,d){c=c||this._center,d=d||this._pixelSize;var e=a.isArray(b[0]),f=e&&a.isArray(b[0][0]),g=f&&a.isArray(b[0][0][0]),h=this._contentBounds.width,i=this._contentBounds.height,j=h/2*d,k=i/2*d,l=[c[0]-j,c[1]-k,c[0]+j,c[1]+k],m=a.geo.width(l,!0)/h,n=a.geo.height(l,!0)/i,o,p=this._options.axisLayout==="image",q=[],r,s,t;g||(f||(e||(b=[b]),b=[b]),b=[b]);for(r=0;r0&&b.which==27&&(c<=2?(this._resetDrawing(),this._inOp=!1):(this._drawCoords[c-2]=a.merge([],this._drawCoords[c-1]),this._drawPixels[c-2]=a.merge([],this._drawPixels[c-1]),this._drawCoords.length--,this._drawPixels.length--,this._refreshDrawing()))},_eventTarget_dblclick_zoom:function(a){var b=this._clearInteractiveTimeout();this._trigger("dblclick",a,{type:"Point",coordinates:this._toMap(this._current,this._centerInteractive,this._pixelSizeInteractive)});if(!a.isDefaultPrevented()){var c=this._getZoomCenterAndSize(this._current,1,!0);this._setInteractiveCenterAndSize(c.center,c.pixelSize),this._interactiveTransform(),b=!0}b&&this._setInteractiveTimeout(!0)},_eventTarget_dblclick:function(b){if(this._options.mode==="static")return;this._drawTimeout&&(window.clearTimeout(this._drawTimeout),this._drawTimeout=null);var c=a(b.currentTarget).offset();switch(this._options.mode){case"drawLineString":case"measureLength":this._drawCoords.length>1&&(this._drawCoords[0][0]!=this._drawCoords[1][0]||this._drawCoords[0][1]!=this._drawCoords[1][1])?(this._drawCoords.length--,this._trigger("shape",b,{type:"LineString",coordinates:this._userGeodetic?a.geo.proj.toGeodetic(this._drawCoords):this._drawCoords})):this._eventTarget_dblclick_zoom(b),this._resetDrawing();break;case"drawPolygon":case"measureArea":if(this._drawCoords.length>1&&(this._drawCoords[0][0]!=this._drawCoords[1][0]||this._drawCoords[0][1]!=this._drawCoords[1][1])){var d=this._drawCoords.length-1;d>2&&(this._drawCoords[d]=a.merge([],this._drawCoords[0]),this._trigger("shape",b,{type:"Polygon",coordinates:[this._userGeodetic?a.geo.proj.toGeodetic(this._drawCoords):this._drawCoords]}))}else this._eventTarget_dblclick_zoom(b);this._resetDrawing();break;default:this._eventTarget_dblclick_zoom(b)}this._inOp=!1},_eventTarget_touchstart:function(b){var c=this._options.mode,d=this._options.shift;if(c==="static")return;if(!this._supportTouch&&b.which!=1)return;var e=this._clearInteractiveTimeout(),f=a(b.currentTarget).offset(),g=b.originalEvent.changedTouches;this._supportTouch?(this._multiTouchAnchor=a.merge([],g),this._isMultiTouch=this._multiTouchAnchor.length>1,this._isMultiTouch?(this._multiTouchCurrentBbox=[g[0].pageX-f.left,g[0].pageY-f.top,g[1].pageX-f.left,g[1].pageY-f.top],this._multiTouchAnchorBbox=a.merge([],this._multiTouchCurrentBbox),this._current=a.geo.center(this._multiTouchCurrentBbox,!0)):(this._multiTouchCurrentBbox=[g[0].pageX-f.left,g[0].pageY-f.top,NaN,NaN],this._current=[g[0].pageX-f.left,g[0].pageY-f.top])):this._current=[b.pageX-f.left,b.pageY-f.top];if(this._softDblClick){var h=a.now();if(h-this._downDate<750){if(this._isTap){var i=this._current[0]-this._anchor[0],j=this._current[1]-this._anchor[1],k=Math.sqrt(i*i+j*j);k>8?this._isTap=!1:this._current=a.merge([],this._anchor)}this._isDbltap?this._isDbltap=!1:this._isDbltap=this._isTap}else this._isDbltap=!1;this._isTap=!0,this._downDate=h}return this._mouseDown=!0,this._anchor=a.merge([],this._current),!this._inOp&&b.shiftKey&&d!=="off"?(this._shiftDown=!0,this._$eventTarget.css("cursor",this._options.cursors[d==="default"?"zoom":d])):!this._isMultiTouch&&(this._options.pannable||c==="dragBox"||c==="dragCircle")&&(this._inOp=!0,c!=="zoom"&&c!=="dragBox"&&c!=="dragCircle"&&(this._lastDrag=this._current,b.currentTarget.setCapture&&b.currentTarget.setCapture())),b.preventDefault(),e&&this._setInteractiveTimeout(!0),!1},_dragTarget_touchmove:function(b){if(this._options.mode==="static")return;var c=!1;this._mouseDown&&(c=this._clearInteractiveTimeout());var e=this._$eventTarget.offset(),f=this._drawCoords.length,g=b.originalEvent.changedTouches,h,i,j=0;if(this._supportTouch){if(!this._isMultiTouch&&this._mouseDown&&this._multiTouchAnchor.length>0&&g[0].identifier!==this._multiTouchAnchor[0].identifier)return this._mouseDown=!1,this._isMultiTouch=!0,this._wheelLevel=0,this._multiTouchAnchor.push(g[0]),this._multiTouchCurrentBbox=[this._multiTouchCurrentBbox[0],this._multiTouchCurrentBbox[1],this._multiTouchAnchor[1].pageX-e.left,this._multiTouchAnchor[1].pageY-e.top],this._multiTouchAnchorBbox=a.merge([],this._multiTouchCurrentBbox),this._mouseDown=!0,this._anchor=this._current=a.geo.center(this._multiTouchCurrentBbox,!0),c&&this._setInteractiveTimeout(!0),!1;if(this._isMultiTouch){for(;j0?m*=5:m*=10;var n=m-this._wheelLevel;this._wheelLevel=m;var o=this._getZoomCenterAndSize(this._anchor,n,!1);this._setInteractiveCenterAndSize(o.center,o.pixelSize),this._interactiveTransform(),c=!0,h=a.geo.center(this._multiTouchCurrentBbox,!0)}else h=[b.originalEvent.changedTouches[0].pageX-e.left,b.originalEvent.changedTouches[0].pageY-e.top]}else h=[b.pageX-e.left,b.pageY-e.top];if(h[0]===this._lastMove[0]&&h[1]===this._lastMove[1]&&this._inOp)return b.preventDefault(),c&&this._setInteractiveTimeout(!0),!1;d==7&&(this._isDbltap=this._isTap=!1),this._mouseDown&&(this._current=h,this._moveDate=a.now());if(this._isMultiTouch)return b.preventDefault(),this._isDbltap=this._isTap=!1,c&&this._setInteractiveTimeout(!0),!1;var p=this._options.shift,q=this._shiftDown?p==="default"?"zoom":p:this._options.mode,r,s,t;switch(q){case"zoom":case"dragBox":this._mouseDown?(this._$drawContainer.geographics("clear"),this._$drawContainer.geographics("drawBbox",[this._anchor[0],this._anchor[1],h[0],h[1]])):this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)});break;case"dragCircle":this._mouseDown?(r=h[0]-this._anchor[0],s=h[1]-this._anchor[1],t=Math.sqrt(r*r+s*s)*2,this._$drawContainer.geographics("clear"),this._$drawContainer.geographics("drawArc",this._anchor,0,360,{width:t,height:t})):this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)});break;case"drawLineString":case"drawPolygon":case"measureLength":case"measureArea":this._mouseDown||this._toolPan?(this._panMove(),c=!0):(f>0&&(this._drawCoords[f-1]=this._toMap(h,this._centerInteractive,this._pixelSizeInteractive),this._drawPixels[f-1]=h,this._refreshDrawing()),this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)}));break;default:this._mouseDown||this._toolPan?(this._panMove(),c=!0):this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)})}this._lastMove=h,c&&this._setInteractiveTimeout(!0);if(this._inOp)return b.preventDefault(),!1},_dragTarget_touchstop:function(b){if(this._options.mode==="static")return;if(!this._mouseDown)if(d==7)this._eventTarget_touchstart(b);else return!1;var c=this._clearInteractiveTimeout(),e=this._mouseDown,f=this._toolPan,g=this._$eventTarget.offset(),h=this._options.shift,i=this._shiftDown?h==="default"?"zoom":h:this._options.mode,j,k,l,m,n,o,p;this._supportTouch?(j=[b.originalEvent.changedTouches[0].pageX-g.left,b.originalEvent.changedTouches[0].pageY-g.top],this._multiTouchAnchor=[],this._inOp=!1):j=[b.pageX-g.left,b.pageY-g.top],this._softDblClick&&this._isTap&&(m=j[0]-this._anchor[0],n=j[1]-this._anchor[1],Math.sqrt(m*m+n*n)<=8&&(j=a.merge([],this._anchor))),m=j[0]-this._anchor[0],n=j[1]-this._anchor[1],this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._shiftDown=this._mouseDown=this._toolPan=!1;if(this._isMultiTouch){b.preventDefault(),this._isMultiTouch=!1,this._wheelLevel=0,c&&this._setInteractiveTimeout(!0);return}document.releaseCapture&&document.releaseCapture();if(e){l=a.now(),this._current=j;switch(i){case"zoom":case"dragBox":if(m!==0||n!==0){var q=this._pixelSize*6,r=this._toMap([[Math.min(this._anchor[0],j[0]),Math.max(this._anchor[1],j[1])],[Math.max(this._anchor[0],j[0]),Math.min(this._anchor[1],j[1])]]),s=[r[0][0],r[0][1],r[1][0],r[1][1]];i==="zoom"?(s[2]-s[0]100){var x=this;this._drawTimeout=setTimeout(function(){x._drawTimeout&&(x._trigger("shape",b,{type:"Point",coordinates:x.toMap(j)}),x._inOp=!1,x._drawTimeout=null)},250)}break;case"drawLineString":case"drawPolygon":case"measureLength":case"measureArea":if(f)this._panFinalize();else{k=this._drawCoords.length===0?0:this._drawCoords.length-1,this._drawCoords[k]=this._toMap(j),this._drawPixels[k]=j;if(k<2||this._drawCoords[k][0]!=this._drawCoords[k-1][0]||this._drawCoords[k][1]!=this._drawCoords[k-1][1])this._drawCoords[k+1]=this._toMap(j,this._centerInteractive,this._pixelSizeInteractive),this._drawPixels[k+1]=j;this._refreshDrawing()}break;default:f?this._panFinalize():l-this._clickDate>100&&(this._trigger("click",b,{type:"Point",coordinates:this.toMap(j)}),this._inOp=!1)}this._clickDate=l;if(this._softDblClick&&this._isDbltap)return this._isDbltap=this._isTap=!1,c&&this._setInteractiveTimeout(!0),this._$eventTarget.trigger("dblclick",b),!1}c&&this._setInteractiveTimeout(!0);if(this._inOp)return b.preventDefault(),!1},_eventTarget_mousewheel:function(b,c){if(this._options.mode==="static"||this._options.scroll==="off")return;b.preventDefault();if(this._mouseDown)return!1;if(c!==0){this._clearInteractiveTimeout(),c>0?c=Math.ceil(c):c=Math.floor(c);var d=a(b.currentTarget).offset();this._anchor=[b.pageX-d.left,b.pageY-d.top];var e=this._getZoomCenterAndSize(this._anchor,c,this._options.tilingScheme!==null),f,g=0;this._setInteractiveCenterAndSize(e.center,e.pixelSize),this._interactiveTransform(),this._setInteractiveTimeout(!0)}return!1}})}(jQuery),function(a,b){a.geo._serviceTypes.tiled=function(){return{create:function(b,c,d,e){var f=a.data(d,"geoServiceState");if(!f){f={loadCount:0,reloadTiles:!1};var g='
              ';c.append(g),f.serviceContainer=c.children(":last"),a.data(d,"geoServiceState",f)}return f.serviceContainer},destroy:function(b,c,d){var e=a.data(d,"geoServiceState");e.serviceContainer.remove(),a.removeData(d,"geoServiceState")},interactiveTransform:function(b,c,d,e){var f=a.data(c,"geoServiceState"),g=b.options.tilingScheme;f&&(this._cancelUnloaded(b,c),f.serviceContainer.children().each(function(c){var f=a(this),h=f.data("pixelSize"),i=h/e;if(h>0){i=Math.round(i*1e3)/1e3;var j=f.data("scaleOrigin"),k=b._toPixel(j,d,e);f.css({left:Math.round(k[0])+"px",top:Math.round(k[1])+"px",width:g.tileWidth*i,height:g.tileHeight*i})}}))},refresh:function(b,c,d){var e=a.data(c,"geoServiceState");this._cancelUnloaded(b,c),e&&d&&(e.reloadTiles=!0);if(e&&c&&c.style.visibility==="visible"&&!e.serviceContainer.is(":hidden")){var f=b._getBbox(),g=b._pixelSize,h=this,i=e.serviceContainer,j=b._getContentBounds(),k=j.width,l=j.height,m=b.options.axisLayout==="image",n=m?1:-1,o=b.options.tilingScheme,p=o.tileWidth,q=o.tileHeight,r=Math.floor((f[0]-o.origin[0])/(g*p)),s=Math.max(Math.floor((m?f[1]-o.origin[1]:o.origin[1]-f[3])/(g*q)),0),t=Math.ceil((f[2]-o.origin[0])/(g*p)),u=Math.ceil((m?f[3]-o.origin[1]:o.origin[1]-f[1])/(g*q)),v=b._getBboxMax(),w=b._getPixelSize(0),x=w/g,y=Math.floor((v[0]-o.origin[0])/(w*p))*x,z=Math.floor((o.origin[1]+n*v[3])/(w*q))*x,A=o.origin[0]+y*p*g,B=o.origin[1]+n*z*q*g,C=Math.round((A-f[0])/g),D=Math.round((m?B-f[1]:f[3]-B)/g),E=i.children().show(),F=E.filter("[data-pixel-size='"+g+"']").appendTo(i),G=c.style.opacity,H,I,J=function(c){h._loadImage(a.data(this,"img"),c,g,b,e,G)},K=function(){a.data(this,"img").remove(),e.loadCount--,b._requestComplete()};e.reloadTiles&&E.find("img").attr("data-dirty","true"),F.size()?(F.css({left:C%p+"px",top:D%q+"px"}).data("scaleOrigin",b._toMap([C%p,D%q])),F.children().each(function(b){var c=a(this),d=c.attr("data-tile").split(",");c.css({left:Math.round((parseInt(d[0],10)-y)*100+(C-C%p)/p*100)+"%",top:Math.round((parseInt(d[1],10)-z)*100+(D-D%q)/q*100)+"%"}),G<1&&c.fadeTo(0,G)})):(i.append("
              "),F=i.children(":last").data("scaleOrigin",b._toMap([C%p,D%q])));for(H=r;H0)M.attr("src",T);else{var U="",F.append(U),M=F.children(":last")}typeof T=="string"?h._loadImage(M,T,g,b,e,G):T?(a.data(T,"img",M),T.done(J).fail(K)):M.remove()}}E.find("[data-dirty]").remove(),e.reloadTiles=!1}},resize:function(a,b){},opacity:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.find("img").stop(!0).fadeTo("fast",c.style.opacity)},toggle:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.css("display",c.style.visibility==="visible"?"block":"none")},_cancelUnloaded:function(b,c){var d=a.data(c,"geoServiceState");if(d&&d.loadCount>0){d.serviceContainer.find("img:hidden").remove();while(d.loadCount>0)d.loadCount--,b._requestComplete()}},_loadImage:function(b,c,d,e,f,g){var h=f.serviceContainer;b.load(function(b){g<1?a(b.target).fadeTo(0,g):a(b.target).show(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(":not([data-pixel-size='"+d+"'])").remove(),f.loadCount=0)}).error(function(b){a(b.target).remove(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(":not([data-pixel-size='"+d+"'])").remove(),f.loadCount=0)}).attr("src",c)}}}()}(jQuery),function(a,b){a.geo._serviceTypes.shingled=function(){return{create:function(b,c,d,e){var f=a.data(d,"geoServiceState");if(!f){f={loadCount:0};var g='
              ';c.append(g),f.serviceContainer=c.children(":last"),a.data(d,"geoServiceState",f)}return f.serviceContainer},destroy:function(b,c,d){var e=a.data(d,"geoServiceState");e.serviceContainer.remove(),a.removeData(d,"geoServiceState")},interactiveTransform:function(b,c,d,e){var f=a.data(c,"geoServiceState"),g=b._getContentBounds(),h=g.width,i=g.height,j=h/2,k=i/2,l=[d[0]-j,d[1]-k,d[0]+j,d[1]+k];f&&(this._cancelUnloaded(b,c),f.serviceContainer.children().each(function(c){var f=a(this),g=f.data("pixelSize"),j=g/e;if(g>0){j=Math.round(j*1e3)/1e3;var k=f.data("origin"),l=b._toPixel(k,d,e);f.css({left:Math.round(l[0]),top:Math.round(l[1]),width:h*j,height:i*j})}}))},refresh:function(b,c){var d=a.data(c,"geoServiceState");this._cancelUnloaded(b,c);if(d&&c&&c.style.visibility==="visible"&&!d.serviceContainer.is(":hidden")){var e=b._getBbox(),f=b._pixelSize,g=this,h=d.serviceContainer,i=b._getContentBounds(),j=i.width,k=i.height,l=h.children('[data-pixel-size="'+f+'"]'),m=c.style.opacity,n;m<1&&h.find("img").attr("data-keep-alive","0"),l.size()||(h.append('
              '),l=h.children(":last"));var o=c.hasOwnProperty("src")?"src":"getUrl",p={bbox:e,width:j,height:k,zoom:b._getZoom(),tile:null,index:0},q=a.isFunction(c[o]),r,s=l.position();s.left=-s.left,s.top=-s.top,q?r=c[o](p):(a.templates("geoSrc",c[o]),r=a.render.geoSrc(p)),d.loadCount++,b._requestQueued(),l.append(''),n=l.children(":last").data("center",b._center),typeof r=="string"?g._loadImage(n,r,f,b,d,m):r.done(function(a){g._loadImage(n,a,f,b,d,m)}).fail(function(){n.remove(),d.loadCount--,b._requestComplete()})}},resize:function(b,c){var d=a.data(c,"geoServiceState");if(d&&c&&c.style.visibility==="visible"){this._cancelUnloaded(b,c);var e=d.serviceContainer,f=b._getContentBounds(),g=f.width,h=f.height,i=e.children();i.attr("data-pixel-size","0"),i.each(function(c){var d=a(this),e=d.position(),f=d.data("origin"),i=b._toPixel(f);d.css({left:e.left+(g-d.width())/2,top:e.top+(h-d.height())/2})})}},opacity:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.find("img").stop(!0).fadeTo("fast",c.style.opacity)},toggle:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.css("display",c.style.visibility==="visible"?"block":"none")},_cancelUnloaded:function(b,c){var d=a.data(c,"geoServiceState");if(d&&d.loadCount>0){d.serviceContainer.find("img:hidden").remove();while(d.loadCount>0)d.loadCount--,b._requestComplete()}},_loadImage:function(b,c,d,e,f,g){var h=f.serviceContainer;b.load(function(b){if(!a.contains(document.body,b.target.jquery?b.target[0]:b.target))return;g<1?a(b.target).fadeTo(0,g):a(b.target).show(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(':not([data-pixel-size="'+d+'"])').remove(),h.find("img[data-keep-alive]").remove(),f.loadCount=0)}).error(function(b){if(!a.contains(document.body,b.target.jquery?b.target[0]:b.target))return;a(b.target).remove(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(":not([data-pixel-size='"+d+"'])").remove(),f.loadCount=0)}).attr("src",c)}}}()}(jQuery); \ No newline at end of file diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.js deleted file mode 100755 index 6a8c9c3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.js +++ /dev/null @@ -1,6943 +0,0 @@ -/*! jQuery Geo - v1.0b1.0.1 - 2012-08-01 - * http://jquerygeo.com - * Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */ - -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// Known Issues: -// -// * Patterns only support repeat. -// * Radial gradient are not implemented. The VML version of these look very -// different from the canvas one. -// * Clipping paths are not implemented. -// * Coordsize. The width and height attribute have higher priority than the -// width and height style values which isn't correct. -// * Painting mode isn't implemented. -// * Canvas width/height should is using content-box by default. IE in -// Quirks mode will draw the canvas using border-box. Either change your -// doctype to HTML5 -// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) -// or use Box Sizing Behavior from WebFX -// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) -// * Non uniform scaling does not correctly scale strokes. -// * Optimize. There is always room for speed improvements. - -// Only add this code if we do not already have a canvas implementation -if (!document.createElement('canvas').getContext) { - - (function () { - - // alias some functions to make (compiled) code shorter - var m = Math; - var mr = m.round; - var ms = m.sin; - var mc = m.cos; - var abs = m.abs; - var sqrt = m.sqrt; - - // this is used for sub pixel precision - var Z = 10; - var Z2 = Z / 2; - - var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1]; - - /** - * This funtion is assigned to the elements as element.getContext(). - * @this {HTMLElement} - * @return {CanvasRenderingContext2D_} - */ - function getContext() { - return this.context_ || - (this.context_ = new CanvasRenderingContext2D_(this)); - } - - var slice = Array.prototype.slice; - - /** - * Binds a function to an object. The returned function will always use the - * passed in {@code obj} as {@code this}. - * - * Example: - * - * g = bind(f, obj, a, b) - * g(c, d) // will do f.call(obj, a, b, c, d) - * - * @param {Function} f The function to bind the object to - * @param {Object} obj The object that should act as this when the function - * is called - * @param {*} var_args Rest arguments that will be used as the initial - * arguments when the function is called - * @return {Function} A new function that has bound this - */ - function bind(f, obj, var_args) { - var a = slice.call(arguments, 2); - return function () { - return f.apply(obj, a.concat(slice.call(arguments))); - }; - } - - function encodeHtmlAttribute(s) { - return String(s).replace(/&/g, '&').replace(/"/g, '"'); - } - - function addNamespace(doc, prefix, urn) { - if (!doc.namespaces[prefix]) { - doc.namespaces.add(prefix, urn, '#default#VML'); - } - } - - function addNamespacesAndStylesheet(doc) { - addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml'); - addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office'); - - // Setup default CSS. Only add one style sheet per document - if (!doc.styleSheets['ex_canvas_']) { - var ss = doc.createStyleSheet(); - ss.owningElement.id = 'ex_canvas_'; - ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + - // default size is 300x150 in Gecko and Opera - 'text-align:left;width:300px;height:150px}'; - } - } - - // Add namespaces and stylesheet at startup. - addNamespacesAndStylesheet(document); - - var G_vmlCanvasManager_ = { - init: function (opt_doc) { - var doc = opt_doc || document; - // Create a dummy element so that IE will allow canvas elements to be - // recognized. - doc.createElement('canvas'); - doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); - }, - - init_: function (doc) { - // find all canvas elements - var els = doc.getElementsByTagName('canvas'); - for (var i = 0; i < els.length; i++) { - this.initElement(els[i]); - } - }, - - /** - * Public initializes a canvas element so that it can be used as canvas - * element from now on. This is called automatically before the page is - * loaded but if you are creating elements using createElement you need to - * make sure this is called on the element. - * @param {HTMLElement} el The canvas element to initialize. - * @return {HTMLElement} the element that was created. - */ - initElement: function (el) { - if (!el.getContext) { - el.getContext = getContext; - - // Add namespaces and stylesheet to document of the element. - addNamespacesAndStylesheet(el.ownerDocument); - - // Remove fallback content. There is no way to hide text nodes so we - // just remove all childNodes. We could hide all elements and remove - // text nodes but who really cares about the fallback content. - el.innerHTML = ''; - - // do not use inline function because that will leak memory - el.attachEvent('onpropertychange', onPropertyChange); - el.attachEvent('onresize', onResize); - - var attrs = el.attributes; - if (attrs.width && attrs.width.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setWidth_(attrs.width.nodeValue); - el.style.width = attrs.width.nodeValue + 'px'; - } else { - el.width = el.clientWidth; - } - if (attrs.height && attrs.height.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setHeight_(attrs.height.nodeValue); - el.style.height = attrs.height.nodeValue + 'px'; - } else { - el.height = el.clientHeight; - } - //el.getContext().setCoordsize_() - } - return el; - } - }; - - function onPropertyChange(e) { - var el = e.srcElement; - - switch (e.propertyName) { - case 'width': - el.getContext().clearRect(); - el.style.width = el.attributes.width.nodeValue + 'px'; - // In IE8 this does not trigger onresize. - el.firstChild.style.width = el.clientWidth + 'px'; - break; - case 'height': - el.getContext().clearRect(); - el.style.height = el.attributes.height.nodeValue + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - break; - } - } - - function onResize(e) { - var el = e.srcElement; - if (el.firstChild) { - el.firstChild.style.width = el.clientWidth + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - } - } - - G_vmlCanvasManager_.init(); - - // precompute "00" to "FF" - var decToHex = []; - for (var i = 0; i < 16; i++) { - for (var j = 0; j < 16; j++) { - decToHex[i * 16 + j] = i.toString(16) + j.toString(16); - } - } - - function createMatrixIdentity() { - return [ - [1, 0, 0], - [0, 1, 0], - [0, 0, 1] - ]; - } - - function matrixMultiply(m1, m2) { - var result = createMatrixIdentity(); - - for (var x = 0; x < 3; x++) { - for (var y = 0; y < 3; y++) { - var sum = 0; - - for (var z = 0; z < 3; z++) { - sum += m1[x][z] * m2[z][y]; - } - - result[x][y] = sum; - } - } - return result; - } - - function copyState(o1, o2) { - o2.fillStyle = o1.fillStyle; - o2.lineCap = o1.lineCap; - o2.lineJoin = o1.lineJoin; - o2.lineWidth = o1.lineWidth; - o2.miterLimit = o1.miterLimit; - o2.shadowBlur = o1.shadowBlur; - o2.shadowColor = o1.shadowColor; - o2.shadowOffsetX = o1.shadowOffsetX; - o2.shadowOffsetY = o1.shadowOffsetY; - o2.strokeStyle = o1.strokeStyle; - o2.globalAlpha = o1.globalAlpha; - o2.font = o1.font; - o2.textAlign = o1.textAlign; - o2.textBaseline = o1.textBaseline; - o2.arcScaleX_ = o1.arcScaleX_; - o2.arcScaleY_ = o1.arcScaleY_; - o2.lineScale_ = o1.lineScale_; - } - - // var colorData = { - // aliceblue: '#F0F8FF', - // antiquewhite: '#FAEBD7', - // aquamarine: '#7FFFD4', - // azure: '#F0FFFF', - // beige: '#F5F5DC', - // bisque: '#FFE4C4', - // black: '#000000', - // blanchedalmond: '#FFEBCD', - // blueviolet: '#8A2BE2', - // brown: '#A52A2A', - // burlywood: '#DEB887', - // cadetblue: '#5F9EA0', - // chartreuse: '#7FFF00', - // chocolate: '#D2691E', - // coral: '#FF7F50', - // cornflowerblue: '#6495ED', - // cornsilk: '#FFF8DC', - // crimson: '#DC143C', - // cyan: '#00FFFF', - // darkblue: '#00008B', - // darkcyan: '#008B8B', - // darkgoldenrod: '#B8860B', - // darkgray: '#A9A9A9', - // darkgreen: '#006400', - // darkgrey: '#A9A9A9', - // darkkhaki: '#BDB76B', - // darkmagenta: '#8B008B', - // darkolivegreen: '#556B2F', - // darkorange: '#FF8C00', - // darkorchid: '#9932CC', - // darkred: '#8B0000', - // darksalmon: '#E9967A', - // darkseagreen: '#8FBC8F', - // darkslateblue: '#483D8B', - // darkslategray: '#2F4F4F', - // darkslategrey: '#2F4F4F', - // darkturquoise: '#00CED1', - // darkviolet: '#9400D3', - // deeppink: '#FF1493', - // deepskyblue: '#00BFFF', - // dimgray: '#696969', - // dimgrey: '#696969', - // dodgerblue: '#1E90FF', - // firebrick: '#B22222', - // floralwhite: '#FFFAF0', - // forestgreen: '#228B22', - // gainsboro: '#DCDCDC', - // ghostwhite: '#F8F8FF', - // gold: '#FFD700', - // goldenrod: '#DAA520', - // grey: '#808080', - // greenyellow: '#ADFF2F', - // honeydew: '#F0FFF0', - // hotpink: '#FF69B4', - // indianred: '#CD5C5C', - // indigo: '#4B0082', - // ivory: '#FFFFF0', - // khaki: '#F0E68C', - // lavender: '#E6E6FA', - // lavenderblush: '#FFF0F5', - // lawngreen: '#7CFC00', - // lemonchiffon: '#FFFACD', - // lightblue: '#ADD8E6', - // lightcoral: '#F08080', - // lightcyan: '#E0FFFF', - // lightgoldenrodyellow: '#FAFAD2', - // lightgreen: '#90EE90', - // lightgrey: '#D3D3D3', - // lightpink: '#FFB6C1', - // lightsalmon: '#FFA07A', - // lightseagreen: '#20B2AA', - // lightskyblue: '#87CEFA', - // lightslategray: '#778899', - // lightslategrey: '#778899', - // lightsteelblue: '#B0C4DE', - // lightyellow: '#FFFFE0', - // limegreen: '#32CD32', - // linen: '#FAF0E6', - // magenta: '#FF00FF', - // mediumaquamarine: '#66CDAA', - // mediumblue: '#0000CD', - // mediumorchid: '#BA55D3', - // mediumpurple: '#9370DB', - // mediumseagreen: '#3CB371', - // mediumslateblue: '#7B68EE', - // mediumspringgreen: '#00FA9A', - // mediumturquoise: '#48D1CC', - // mediumvioletred: '#C71585', - // midnightblue: '#191970', - // mintcream: '#F5FFFA', - // mistyrose: '#FFE4E1', - // moccasin: '#FFE4B5', - // navajowhite: '#FFDEAD', - // oldlace: '#FDF5E6', - // olivedrab: '#6B8E23', - // orange: '#FFA500', - // orangered: '#FF4500', - // orchid: '#DA70D6', - // palegoldenrod: '#EEE8AA', - // palegreen: '#98FB98', - // paleturquoise: '#AFEEEE', - // palevioletred: '#DB7093', - // papayawhip: '#FFEFD5', - // peachpuff: '#FFDAB9', - // peru: '#CD853F', - // pink: '#FFC0CB', - // plum: '#DDA0DD', - // powderblue: '#B0E0E6', - // rosybrown: '#BC8F8F', - // royalblue: '#4169E1', - // saddlebrown: '#8B4513', - // salmon: '#FA8072', - // sandybrown: '#F4A460', - // seagreen: '#2E8B57', - // seashell: '#FFF5EE', - // sienna: '#A0522D', - // skyblue: '#87CEEB', - // slateblue: '#6A5ACD', - // slategray: '#708090', - // slategrey: '#708090', - // snow: '#FFFAFA', - // springgreen: '#00FF7F', - // steelblue: '#4682B4', - // tan: '#D2B48C', - // thistle: '#D8BFD8', - // tomato: '#FF6347', - // turquoise: '#40E0D0', - // violet: '#EE82EE', - // wheat: '#F5DEB3', - // whitesmoke: '#F5F5F5', - // yellowgreen: '#9ACD32' - // }; - - - function getRgbHslContent(styleString) { - var start = styleString.indexOf('(', 3); - var end = styleString.indexOf(')', start + 1); - var parts = styleString.substring(start + 1, end).split(','); - // add alpha if needed - if (parts.length != 4 || styleString.charAt(3) != 'a') { - parts[3] = 1; - } - return parts; - } - - function percent(s) { - return parseFloat(s) / 100; - } - - function clamp(v, min, max) { - return Math.min(max, Math.max(min, v)); - } - - function hslToRgb(parts) { - var r, g, b, h, s, l; - h = parseFloat(parts[0]) / 360 % 360; - if (h < 0) - h++; - s = clamp(percent(parts[1]), 0, 1); - l = clamp(percent(parts[2]), 0, 1); - if (s == 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hueToRgb(p, q, h + 1 / 3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1 / 3); - } - - return '#' + decToHex[Math.floor(r * 255)] + - decToHex[Math.floor(g * 255)] + - decToHex[Math.floor(b * 255)]; - } - - function hueToRgb(m1, m2, h) { - if (h < 0) - h++; - if (h > 1) - h--; - - if (6 * h < 1) - return m1 + (m2 - m1) * 6 * h; - else if (2 * h < 1) - return m2; - else if (3 * h < 2) - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - else - return m1; - } - - var processStyleCache = {}; - - function processStyle(styleString) { - if (styleString in processStyleCache) { - return processStyleCache[styleString]; - } - - var str, alpha = 1; - - styleString = String(styleString); - if (styleString.charAt(0) == '#') { - str = styleString; - } else if (/^rgb/.test(styleString)) { - var parts = getRgbHslContent(styleString); - var str = '#', n; - for (var i = 0; i < 3; i++) { - if (parts[i].indexOf('%') != -1) { - n = Math.floor(percent(parts[i]) * 255); - } else { - n = +parts[i]; - } - str += decToHex[clamp(n, 0, 255)]; - } - alpha = +parts[3]; - } else if (/^hsl/.test(styleString)) { - var parts = getRgbHslContent(styleString); - str = hslToRgb(parts); - alpha = parts[3]; - } else { - str = /*colorData[styleString] ||*/styleString; - } - return processStyleCache[styleString] = { color: str, alpha: alpha }; - } - - var DEFAULT_STYLE = { - style: 'normal', - variant: 'normal', - weight: 'normal', - size: 10, - family: 'sans-serif' - }; - - // Internal text style cache - // var fontStyleCache = {}; - - // function processFontStyle(styleString) { - // if (fontStyleCache[styleString]) { - // return fontStyleCache[styleString]; - // } - - // var el = document.createElement('div'); - // var style = el.style; - // try { - // style.font = styleString; - // } catch (ex) { - // // Ignore failures to set to invalid font. - // } - - // return fontStyleCache[styleString] = { - // style: style.fontStyle || DEFAULT_STYLE.style, - // variant: style.fontVariant || DEFAULT_STYLE.variant, - // weight: style.fontWeight || DEFAULT_STYLE.weight, - // size: style.fontSize || DEFAULT_STYLE.size, - // family: style.fontFamily || DEFAULT_STYLE.family - // }; - // } - - // function getComputedStyle(style, element) { - // var computedStyle = {}; - - // for (var p in style) { - // computedStyle[p] = style[p]; - // } - - // // Compute the size - // var canvasFontSize = parseFloat(element.currentStyle.fontSize), - // fontSize = parseFloat(style.size); - - // if (typeof style.size == 'number') { - // computedStyle.size = style.size; - // } else if (style.size.indexOf('px') != -1) { - // computedStyle.size = fontSize; - // } else if (style.size.indexOf('em') != -1) { - // computedStyle.size = canvasFontSize * fontSize; - // } else if(style.size.indexOf('%') != -1) { - // computedStyle.size = (canvasFontSize / 100) * fontSize; - // } else if (style.size.indexOf('pt') != -1) { - // computedStyle.size = fontSize / .75; - // } else { - // computedStyle.size = canvasFontSize; - // } - - // // Different scaling between normal text and VML text. This was found using - // // trial and error to get the same size as non VML text. - // computedStyle.size *= 0.981; - - // return computedStyle; - // } - - // function buildStyle(style) { - // return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + - // style.size + 'px ' + style.family; - // } - - var lineCapMap = { - 'butt': 'flat', - 'round': 'round' - }; - - function processLineCap(lineCap) { - return lineCapMap[lineCap] || 'square'; - } - - /** - * This class implements CanvasRenderingContext2D interface as described by - * the WHATWG. - * @param {HTMLElement} canvasElement The element that the 2D context should - * be associated with - */ - function CanvasRenderingContext2D_(canvasElement) { - this.m_ = createMatrixIdentity(); - - this.mStack_ = []; - this.aStack_ = []; - this.currentPath_ = []; - - // Canvas context properties - this.strokeStyle = '#000'; - this.fillStyle = '#000'; - - this.lineWidth = 1; - this.lineJoin = 'miter'; - this.lineCap = 'butt'; - this.miterLimit = Z * 1; - this.globalAlpha = 1; - //this.font = '10px sans-serif'; - //this.textAlign = 'left'; - //this.textBaseline = 'alphabetic'; - this.canvas = canvasElement; - - var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' + - canvasElement.clientHeight + 'px;overflow:hidden;position:absolute'; - var el = canvasElement.ownerDocument.createElement('div'); - el.style.cssText = cssText; - canvasElement.appendChild(el); - - var overlayEl = el.cloneNode(false); - // Use a non transparent background. - overlayEl.style.backgroundColor = 'red'; - overlayEl.style.filter = 'alpha(opacity=0)'; - canvasElement.appendChild(overlayEl); - - this.element_ = el; - this.arcScaleX_ = 1; - this.arcScaleY_ = 1; - this.lineScale_ = 1; - } - - var contextPrototype = CanvasRenderingContext2D_.prototype; - contextPrototype.clearRect = function () { - if (this.textMeasureEl_) { - this.textMeasureEl_.removeNode(true); - this.textMeasureEl_ = null; - } - this.element_.innerHTML = ''; - }; - - contextPrototype.beginPath = function () { - // TODO: Branch current matrix so that save/restore has no effect - // as per safari docs. - this.currentPath_ = []; - }; - - contextPrototype.moveTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'moveTo', x: p.x, y: p.y }); - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.lineTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'lineTo', x: p.x, y: p.y }); - - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY) { - var p = getCoords(this, aX, aY); - var cp1 = getCoords(this, aCP1x, aCP1y); - var cp2 = getCoords(this, aCP2x, aCP2y); - bezierCurveTo(this, cp1, cp2, p); - }; - - // Helper function that takes the already fixed cordinates. - function bezierCurveTo(self, cp1, cp2, p) { - self.currentPath_.push({ - type: 'bezierCurveTo', - cp1x: cp1.x, - cp1y: cp1.y, - cp2x: cp2.x, - cp2y: cp2.y, - x: p.x, - y: p.y - }); - self.currentX_ = p.x; - self.currentY_ = p.y; - } - - contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { - // the following is lifted almost directly from - // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes - - var cp = getCoords(this, aCPx, aCPy); - var p = getCoords(this, aX, aY); - - var cp1 = { - x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), - y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) - }; - var cp2 = { - x: cp1.x + (p.x - this.currentX_) / 3.0, - y: cp1.y + (p.y - this.currentY_) / 3.0 - }; - - bezierCurveTo(this, cp1, cp2, p); - }; - - contextPrototype.arc = function (aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise) { - aRadius *= Z; - var arcType = aClockwise ? 'at' : 'wa'; - - var xStart = aX + mc(aStartAngle) * aRadius - Z2; - var yStart = aY + ms(aStartAngle) * aRadius - Z2; - - var xEnd = aX + mc(aEndAngle) * aRadius - Z2; - var yEnd = aY + ms(aEndAngle) * aRadius - Z2; - - // IE won't render arches drawn counter clockwise if xStart == xEnd. - if (xStart == xEnd && !aClockwise) { - xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something - // that can be represented in binary - } - - var p = getCoords(this, aX, aY); - var pStart = getCoords(this, xStart, yStart); - var pEnd = getCoords(this, xEnd, yEnd); - - this.currentPath_.push({ type: arcType, - x: p.x, - y: p.y, - radius: aRadius, - xStart: pStart.x, - yStart: pStart.y, - xEnd: pEnd.x, - yEnd: pEnd.y - }); - - }; - - // contextPrototype.rect = function(aX, aY, aWidth, aHeight) { - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // }; - - // contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.stroke(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.fill(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { - // var gradient = new CanvasGradient_('gradient'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // return gradient; - // }; - - // contextPrototype.createRadialGradient = function(aX0, aY0, aR0, - // aX1, aY1, aR1) { - // var gradient = new CanvasGradient_('gradientradial'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.r0_ = aR0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // gradient.r1_ = aR1; - // return gradient; - // }; - - // contextPrototype.drawImage = function(image, var_args) { - // var dx, dy, dw, dh, sx, sy, sw, sh; - - // // to find the original width we overide the width and height - // var oldRuntimeWidth = image.runtimeStyle.width; - // var oldRuntimeHeight = image.runtimeStyle.height; - // image.runtimeStyle.width = 'auto'; - // image.runtimeStyle.height = 'auto'; - - // // get the original size - // var w = image.width; - // var h = image.height; - - // // and remove overides - // image.runtimeStyle.width = oldRuntimeWidth; - // image.runtimeStyle.height = oldRuntimeHeight; - - // if (arguments.length == 3) { - // dx = arguments[1]; - // dy = arguments[2]; - // sx = sy = 0; - // sw = dw = w; - // sh = dh = h; - // } else if (arguments.length == 5) { - // dx = arguments[1]; - // dy = arguments[2]; - // dw = arguments[3]; - // dh = arguments[4]; - // sx = sy = 0; - // sw = w; - // sh = h; - // } else if (arguments.length == 9) { - // sx = arguments[1]; - // sy = arguments[2]; - // sw = arguments[3]; - // sh = arguments[4]; - // dx = arguments[5]; - // dy = arguments[6]; - // dw = arguments[7]; - // dh = arguments[8]; - // } else { - // throw Error('Invalid number of arguments'); - // } - - // var d = getCoords(this, dx, dy); - - // var w2 = sw / 2; - // var h2 = sh / 2; - - // var vmlStr = []; - - // var W = 10; - // var H = 10; - - // // For some reason that I've now forgotten, using divs didn't work - // vmlStr.push(' ' , - // '', - // ''); - - // this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join('')); - // }; - - contextPrototype.stroke = function (aFill) { - var lineStr = []; - var lineOpen = false; - - var W = 10; - var H = 10; - - lineStr.push(''); - - if (!aFill) { - appendStroke(this, lineStr); - } else { - appendFill(this, lineStr, min, max); - } - - lineStr.push(''); - - this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - }; - - function appendStroke(ctx, lineStr) { - var a = processStyle(ctx.strokeStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - var lineWidth = ctx.lineScale_ * ctx.lineWidth; - - // VML cannot correctly render a line if the width is less than 1px. - // In that case, we dilute the color to make the line look thinner. - if (lineWidth < 1) { - opacity *= lineWidth; - } - - lineStr.push( - '' - ); - } - - function appendFill(ctx, lineStr, min, max) { - var fillStyle = ctx.fillStyle; - var arcScaleX = ctx.arcScaleX_; - var arcScaleY = ctx.arcScaleY_; - var width = max.x - min.x; - var height = max.y - min.y; - // if (fillStyle instanceof CanvasGradient_) { - // // TODO: Gradients transformed with the transformation matrix. - // var angle = 0; - // var focus = {x: 0, y: 0}; - - // // additional offset - // var shift = 0; - // // scale factor for offset - // var expansion = 1; - - // if (fillStyle.type_ == 'gradient') { - // var x0 = fillStyle.x0_ / arcScaleX; - // var y0 = fillStyle.y0_ / arcScaleY; - // var x1 = fillStyle.x1_ / arcScaleX; - // var y1 = fillStyle.y1_ / arcScaleY; - // var p0 = getCoords(ctx, x0, y0); - // var p1 = getCoords(ctx, x1, y1); - // var dx = p1.x - p0.x; - // var dy = p1.y - p0.y; - // angle = Math.atan2(dx, dy) * 180 / Math.PI; - - // // The angle should be a non-negative number. - // if (angle < 0) { - // angle += 360; - // } - - // // Very small angles produce an unexpected result because they are - // // converted to a scientific notation string. - // if (angle < 1e-6) { - // angle = 0; - // } - // } else { - // var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_); - // focus = { - // x: (p0.x - min.x) / width, - // y: (p0.y - min.y) / height - // }; - - // width /= arcScaleX * Z; - // height /= arcScaleY * Z; - // var dimension = m.max(width, height); - // shift = 2 * fillStyle.r0_ / dimension; - // expansion = 2 * fillStyle.r1_ / dimension - shift; - // } - - // // We need to sort the color stops in ascending order by offset, - // // otherwise IE won't interpret it correctly. - // var stops = fillStyle.colors_; - // stops.sort(function(cs1, cs2) { - // return cs1.offset - cs2.offset; - // }); - - // var length = stops.length; - // var color1 = stops[0].color; - // var color2 = stops[length - 1].color; - // var opacity1 = stops[0].alpha * ctx.globalAlpha; - // var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; - - // var colors = []; - // for (var i = 0; i < length; i++) { - // var stop = stops[i]; - // colors.push(stop.offset * expansion + shift + ' ' + stop.color); - // } - - // // When colors attribute is used, the meanings of opacity and o:opacity2 - // // are reversed. - // lineStr.push(''); - // } else if (fillStyle instanceof CanvasPattern_) { - // if (width && height) { - // var deltaLeft = -min.x; - // var deltaTop = -min.y; - // lineStr.push(''); - // } - // } else { - var a = processStyle(ctx.fillStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - lineStr.push(''); - // } - } - - contextPrototype.fill = function () { - this.stroke(true); - }; - - contextPrototype.closePath = function () { - this.currentPath_.push({ type: 'close' }); - }; - - function getCoords(ctx, aX, aY) { - var m = ctx.m_; - return { - x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, - y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 - }; - }; - - contextPrototype.save = function () { - var o = {}; - copyState(this, o); - this.aStack_.push(o); - this.mStack_.push(this.m_); - this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); - }; - - contextPrototype.restore = function () { - if (this.aStack_.length) { - copyState(this.aStack_.pop(), this); - this.m_ = this.mStack_.pop(); - } - }; - - function matrixIsFinite(m) { - return isFinite(m[0][0]) && isFinite(m[0][1]) && - isFinite(m[1][0]) && isFinite(m[1][1]) && - isFinite(m[2][0]) && isFinite(m[2][1]); - } - - function setM(ctx, m, updateLineScale) { - if (!matrixIsFinite(m)) { - return; - } - ctx.m_ = m; - - if (updateLineScale) { - // Get the line scale. - // Determinant of this.m_ means how much the area is enlarged by the - // transformation. So its square root can be used as a scale factor - // for width. - var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; - ctx.lineScale_ = sqrt(abs(det)); - } - } - - contextPrototype.translate = function (aX, aY) { - var m1 = [ - [1, 0, 0], - [0, 1, 0], - [aX, aY, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), false); - }; - - // contextPrototype.rotate = function(aRot) { - // var c = mc(aRot); - // var s = ms(aRot); - - // var m1 = [ - // [c, s, 0], - // [-s, c, 0], - // [0, 0, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), false); - // }; - - contextPrototype.scale = function (aX, aY) { - this.arcScaleX_ *= aX; - this.arcScaleY_ *= aY; - var m1 = [ - [aX, 0, 0], - [0, aY, 0], - [0, 0, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), true); - }; - - // contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { - // var m1 = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), true); - // }; - - // contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { - // var m = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, m, true); - // }; - - /** - * The text drawing function. - * The maxWidth argument isn't taken in account, since no browser supports - * it yet. - */ - // contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { - // var m = this.m_, - // delta = 1000, - // left = 0, - // right = delta, - // offset = {x: 0, y: 0}, - // lineStr = []; - - // var fontStyle = getComputedStyle(processFontStyle(this.font), - // this.element_); - - // var fontStyleString = buildStyle(fontStyle); - - // var elementStyle = this.element_.currentStyle; - // var textAlign = this.textAlign.toLowerCase(); - // switch (textAlign) { - // case 'left': - // case 'center': - // case 'right': - // break; - // case 'end': - // textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; - // break; - // case 'start': - // textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; - // break; - // default: - // textAlign = 'left'; - // } - - // // 1.75 is an arbitrary number, as there is no info about the text baseline - // switch (this.textBaseline) { - // case 'hanging': - // case 'top': - // offset.y = fontStyle.size / 1.75; - // break; - // case 'middle': - // break; - // default: - // case null: - // case 'alphabetic': - // case 'ideographic': - // case 'bottom': - // offset.y = -fontStyle.size / 2.25; - // break; - // } - - // switch(textAlign) { - // case 'right': - // left = delta; - // right = 0.05; - // break; - // case 'center': - // left = right = delta / 2; - // break; - // } - - // var d = getCoords(this, x + offset.x, y + offset.y); - - // lineStr.push(''); - - // if (stroke) { - // appendStroke(this, lineStr); - // } else { - // // TODO: Fix the min and max params. - // appendFill(this, lineStr, {x: -left, y: 0}, - // {x: right, y: fontStyle.size}); - // } - - // var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + - // m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; - - // var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); - - // lineStr.push('', - // '', - // ''); - - // this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - // }; - - // contextPrototype.fillText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, false); - // }; - - // contextPrototype.strokeText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, true); - // }; - - // contextPrototype.measureText = function(text) { - // if (!this.textMeasureEl_) { - // var s = ''; - // this.element_.insertAdjacentHTML('beforeEnd', s); - // this.textMeasureEl_ = this.element_.lastChild; - // } - // var doc = this.element_.ownerDocument; - // this.textMeasureEl_.innerHTML = ''; - // this.textMeasureEl_.style.font = this.font; - // // Don't use innerHTML or innerText because they allow markup/whitespace. - // this.textMeasureEl_.appendChild(doc.createTextNode(text)); - // return {width: this.textMeasureEl_.offsetWidth}; - // }; - - /******** STUBS ********/ - // contextPrototype.clip = function() { - // // TODO: Implement - // }; - - // contextPrototype.arcTo = function() { - // // TODO: Implement - // }; - - // contextPrototype.createPattern = function(image, repetition) { - // return new CanvasPattern_(image, repetition); - // }; - - // // Gradient / Pattern Stubs - // function CanvasGradient_(aType) { - // this.type_ = aType; - // this.x0_ = 0; - // this.y0_ = 0; - // this.r0_ = 0; - // this.x1_ = 0; - // this.y1_ = 0; - // this.r1_ = 0; - // this.colors_ = []; - // } - - // CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { - // aColor = processStyle(aColor); - // this.colors_.push({offset: aOffset, - // color: aColor.color, - // alpha: aColor.alpha}); - // }; - - // function CanvasPattern_(image, repetition) { - // assertImageIsValid(image); - // switch (repetition) { - // case 'repeat': - // case null: - // case '': - // this.repetition_ = 'repeat'; - // break - // case 'repeat-x': - // case 'repeat-y': - // case 'no-repeat': - // this.repetition_ = repetition; - // break; - // default: - // throwException('SYNTAX_ERR'); - // } - - // this.src_ = image.src; - // this.width_ = image.width; - // this.height_ = image.height; - // } - - function throwException(s) { - throw new DOMException_(s); - } - - // function assertImageIsValid(img) { - // if (!img || img.nodeType != 1 || img.tagName != 'IMG') { - // throwException('TYPE_MISMATCH_ERR'); - // } - // if (img.readyState != 'complete') { - // throwException('INVALID_STATE_ERR'); - // } - // } - - function DOMException_(s) { - this.code = this[s]; - this.message = s + ': DOM Exception ' + this.code; - } - var p = DOMException_.prototype = new Error; - p.INDEX_SIZE_ERR = 1; - p.DOMSTRING_SIZE_ERR = 2; - p.HIERARCHY_REQUEST_ERR = 3; - p.WRONG_DOCUMENT_ERR = 4; - p.INVALID_CHARACTER_ERR = 5; - p.NO_DATA_ALLOWED_ERR = 6; - p.NO_MODIFICATION_ALLOWED_ERR = 7; - p.NOT_FOUND_ERR = 8; - p.NOT_SUPPORTED_ERR = 9; - p.INUSE_ATTRIBUTE_ERR = 10; - p.INVALID_STATE_ERR = 11; - p.SYNTAX_ERR = 12; - p.INVALID_MODIFICATION_ERR = 13; - p.NAMESPACE_ERR = 14; - p.INVALID_ACCESS_ERR = 15; - p.VALIDATION_ERR = 16; - p.TYPE_MISMATCH_ERR = 17; - - // set up externs - G_vmlCanvasManager = G_vmlCanvasManager_; - CanvasRenderingContext2D = CanvasRenderingContext2D_; - //CanvasGradient = CanvasGradient_; - //CanvasPattern = CanvasPattern_; - DOMException = DOMException_; - })(); - -} // if - -/*! JsRender v1.0pre: http://github.com/BorisMoore/jsrender */ -/* - * Optimized version of jQuery Templates, for rendering to string. - * Does not require jQuery, or HTML DOM - * Integrates with JsViews (http://github.com/BorisMoore/jsviews) - * Copyright 2012, Boris Moore - * Released under the MIT License. - */ -// informal pre beta commit counter: 3 - -this.jsviews || this.jQuery && jQuery.views || (function( window, undefined ) { - -//========================== Top-level vars ========================== - -var versionNumber = "v1.0pre", - - $, rTag, rTmplString, extend, - sub = {}, - FALSE = false, TRUE = true, - jQuery = window.jQuery, - - rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g, - // nil object helper view viewProperty pathTokens leafToken string - - rParams = /(\()(?=|\s*\()|(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g, - // lftPrn lftPrn2 path operator err eq path2 prn comma lftPrn2 apos quot rtPrn prn2 space - // (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space - - rNewLine = /\r?\n/g, - rUnescapeQuotes = /\\(['"])/g, - rEscapeQuotes = /\\?(['"])/g, - rBuildHash = /\x08(~)?([^\x08]+)\x08/g, - - autoViewKey = 0, - autoTmplName = 0, - escapeMapForHtml = { - "&": "&", - "<": "<", - ">": ">" - }, - tmplAttr = "data-jsv-tmpl", - fnDeclStr = "var j=j||" + (jQuery ? "jQuery." : "js") + "views,", - htmlSpecialChar = /[\x00"&'<>]/g, - slice = Array.prototype.slice, - - render = {}, - - // jsviews object ($.views if jQuery is loaded) - jsv = { - jsviews: versionNumber, - sub: sub, // subscription, e.g. JsViews integration - debugMode: TRUE, - err: function( e ) { - return jsv.debugMode ? ("
              Error: " + (e.message || e) + ". ") : '""'; - }, - tmplFn: tmplFn, - render: render, - templates: templates, - tags: tags, - helpers: helpers, - converters: converters, - View: View, - convert: convert, - delimiters: setDelimiters, - tag: renderTag - }; - -//========================== Top-level functions ========================== - -//=================== -// jsviews.delimiters -//=================== - -function setDelimiters( openChars, closeChars ) { - // Set the tag opening and closing delimiters. Default is "{{" and "}}" - // openChar, closeChars: opening and closing strings, each with two characters - var firstOpenChar = "\\" + openChars.charAt( 0 ), // Escape the characters - since they could be regex special characters - secondOpenChar = "\\" + openChars.charAt( 1 ), - firstCloseChar = "\\" + closeChars.charAt( 0 ), - secondCloseChar = "\\" + closeChars.charAt( 1 ); - // Build regex with new delimiters - jsv.rTag = rTag // make rTag available to JsViews (or other components) for parsing binding expressions - = secondOpenChar - // tag (followed by / space or }) or colon or html or code - + "(?:(?:(\\w+(?=[\\/\\s" + firstCloseChar + "]))|(?:(\\w+)?(:)|(>)|(\\*)))" - // params - + "\\s*((?:[^" + firstCloseChar + "]|" + firstCloseChar + "(?!" + secondCloseChar + "))*?)" - // slash or closeBlock - + "(\\/)?|(?:\\/(\\w+)))" - // }} - + firstCloseChar; - - // Default rTag: tag converter colon html code params slash closeBlock - // /{{(?:(?:(\w+(?=[\/\s\}]))|(?:(\w+)?(:)|(>)|(\*)))\s*((?:[^}]|}(?!\}))*?)(\/)?|(?:\/(\w+)))}} - - // /{{(?:(?:(\w+(?=[\/!\s\}!]))|(?:(\w+)?(:)|(>)|(\*)))((?:[^\}]|}(?!}))*?)(\/)?|(?:\/(\w+)))}}/g; - rTag = new RegExp( firstOpenChar + rTag + secondCloseChar, "g" ); - rTmplString = new RegExp( "<.*>|" + openChars + ".*" + closeChars ); - return this; -} - -//================= -// View.hlp -//================= - -function getHelper( helper ) { - // Helper method called as view.hlp() from compiled template, for helper functions or template parameters ~foo - var view = this, - tmplHelpers = view.tmpl.helpers || {}; - helper = (view.ctx[ helper ] !== undefined ? view.ctx : tmplHelpers[ helper ] !== undefined ? tmplHelpers : helpers[ helper ] !== undefined ? helpers : {})[ helper ]; - return typeof helper !== "function" ? helper : function() { - return helper.apply(view, arguments); - }; -} - -//================= -// jsviews.convert -//================= - -function convert( converter, view, text ) { - var tmplConverters = view.tmpl.converters; - converter = tmplConverters && tmplConverters[ converter ] || converters[ converter ]; - return converter ? converter.call( view, text ) : text; -} - -//================= -// jsviews.tag -//================= - -function renderTag( tag, parentView, converter, content, tagObject ) { - // Called from within compiled template function, to render a nested tag - // Returns the rendered tag - tagObject.props = tagObject.props || {}; - var ret, - tmpl = tagObject.props.tmpl, - tmplTags = parentView.tmpl.tags, - nestedTemplates = parentView.tmpl.templates, - args = arguments, - tagFn = tmplTags && tmplTags[ tag ] || tags[ tag ]; - - if ( !tagFn ) { - return ""; - } - // Set the tmpl property to the content of the block tag, unless set as an override property on the tag - content = content && parentView.tmpl.tmpls[ content - 1 ]; - tmpl = tmpl || content || undefined; - tagObject.tmpl = - "" + tmpl === tmpl // if a string - ? nestedTemplates && nestedTemplates[ tmpl ] || templates[ tmpl ] || templates( tmpl ) - : tmpl; - - tagObject.isTag = TRUE; - tagObject.converter = converter; - tagObject.view = parentView; - tagObject.renderContent = renderContent; - if ( parentView.ctx ) { - extend( tagObject.ctx, parentView.ctx); - } - - ret = tagFn.apply( tagObject, args.length > 5 ? slice.call( args, 5 ) : [] ); - return ret || ( ret == undefined ? "" : ret.toString()); // (If ret is the value 0 or false, will render to string) -} - -//================= -// View constructor -//================= - -function View( context, path, parentView, data, template, index ) { - // Constructor for view object in view hierarchy. (Augmented by JsViews if JsViews is loaded) - var views = parentView.views, -// TODO: add this, as part of smart re-linking on existing content ($.link method), or remove completely -// self = parentView.views[ index ]; -// if ( !self ) { ... } - self = { - tmpl: template, - path: path, - parent: parentView, - data: data, - ctx: context, - views: $.isArray( data ) ? [] : {}, - hlp: getHelper - }; - - if ( $.isArray( views )) { - views.splice( - self.index = index !== undefined - ? index - : views.length, 0, self - ); - } else { - views[ self.index = "_" + autoViewKey++ ] = self; - } - return self; -} - -//================= -// Registration -//================= - -function addToStore( self, store, name, item, process ) { - // Add item to named store such as templates, helpers, converters... - var key, onStore; - if ( name && typeof name === "object" && !name.nodeType ) { - // If name is a map, iterate over map and call store for key - for ( key in name ) { - store( key, name[ key ]); - } - return self; - } - if ( !name || item === undefined ) { - if ( process ) { - item = process( undefined, item || name ); - } - } else if ( "" + name === name ) { // name must be a string - if ( item === null ) { - // If item is null, delete this entry - delete store[name]; - } else if ( item = process ? process( name, item ) : item ) { - store[ name ] = item; - } - } - if ( onStore = sub.onStoreItem ) { - // e.g. JsViews integration - onStore( store, name, item, process ); - } - return item; -} - -function templates( name, tmpl ) { - // Register templates - // Setter: Use $.view.tags( name, tagFn ) or $.view.tags({ name: tagFn, ... }) to add additional tags to the registered tags collection. - // Getter: Use var tagFn = $.views.tags( name ) or $.views.tags[name] or $.views.tags.name to return the function for the registered tag. - // Remove: Use $.view.tags( name, null ) to remove a registered tag from $.view.tags. - - // When registering for {{foo a b c==d e=f}}, tagFn should be a function with the signature: - // function(a,b). The 'this' pointer will be a hash with properties c and e. - return addToStore( this, templates, name, tmpl, compile ); -} - -function tags( name, tagFn ) { - // Register template tags - // Setter: Use $.view.tags( name, tagFn ) or $.view.tags({ name: tagFn, ... }) to add additional tags to the registered tags collection. - // Getter: Use var tagFn = $.views.tags( name ) or $.views.tags[name] or $.views.tags.name to return the function for the registered tag. - // Remove: Use $.view.tags( name, null ) to remove a registered tag from $.view.tags. - - // When registering for {{foo a b c==d e=f}}, tagFn should be a function with the signature: - // function(a,b). The 'this' pointer will be a hash with properties c and e. - return addToStore( this, tags, name, tagFn ); -} - -function helpers( name, helperFn ) { - // Register helper functions for use in templates (or in data-link expressions if JsViews is loaded) - // Setter: Use $.view.helpers( name, helperFn ) or $.view.helpers({ name: helperFn, ... }) to add additional helpers to the registered helpers collection. - // Getter: Use var helperFn = $.views.helpers( name ) or $.views.helpers[name] or $.views.helpers.name to return the function. - // Remove: Use $.view.helpers( name, null ) to remove a registered helper function from $.view.helpers. - // Within a template, access the helper using the syntax: {{... ~myHelper(...) ...}}. - return addToStore( this, helpers, name, helperFn ); -} - -function converters( name, converterFn ) { - // Register converter functions for use in templates (or in data-link expressions if JsViews is loaded) - // Setter: Use $.view.converters( name, converterFn ) or $.view.converters({ name: converterFn, ... }) to add additional converters to the registered converters collection. - // Getter: Use var converterFn = $.views.converters( name ) or $.views.converters[name] or $.views.converters.name to return the converter function. - // Remove: Use $.view.converters( name, null ) to remove a registered converter from $.view.converters. - // Within a template, access the converter using the syntax: {{myConverter:...}}. - return addToStore( this, converters, name, converterFn ); -} - -//================= -// renderContent -//================= - -function renderContent( data, context, parentView, path, index ) { - // Render template against data as a tree of subviews (nested template), or as a string (top-level template). - // tagName parameter for internal use only. Used for rendering templates registered as tags (which may have associated presenter objects) - var i, l, dataItem, newView, itemWrap, itemsWrap, itemResult, parentContext, tmpl, layout, - props = {}, - swapContent = index === TRUE, - self = this, - result = ""; - - if ( self.isTag ) { - // This is a call from renderTag - tmpl = self.tmpl; - context = context || self.ctx; - parentView = parentView || self.view; - path = path || self.path; - index = index || self.index; - props = self.props; - } else { - tmpl = self.jquery && self[0] // This is a call $.fn.render - || self; // This is a call from tmpl.render - } - parentView = parentView || jsv.topView; - parentContext = parentView.ctx; - layout = tmpl.layout; - if ( data === parentView ) { - // Inherit the data from the parent view. - // This may be the contents of an {{if}} block - data = parentView.data; - layout = TRUE; - } - - // Set additional context on views created here, (as modified context inherited from the parent, and be inherited by child views) - // Note: If no jQuery, extend does not support chained copies - so limit extend() to two parameters - context = (context && context === parentContext) - ? parentContext - : (parentContext - // if parentContext, make copy - ? ((parentContext = extend( {}, parentContext ), context) - // If context, merge context with copied parentContext - ? extend( parentContext, context ) - : parentContext) - // if no parentContext, use context, or default to {} - : context || {}); - - if ( props.link === FALSE ) { - // Override inherited value of link by an explicit setting in props: link=false - // The child views of an unlinked view are also unlinked. So setting child back to true will not have any effect. - context.link = FALSE; - } - if ( !tmpl.fn ) { - tmpl = templates[ tmpl ] || templates( tmpl ); - } - itemWrap = context.link && sub.onRenderItem; - itemsWrap = context.link && sub.onRenderItems; - - if ( tmpl ) { - if ( $.isArray( data ) && !layout ) { - // Create a view for the array, whose child views correspond to each data item. - // (Note: if index and parentView are passed in along with parent view, treat as - // insert -e.g. from view.addViews - so parentView is already the view item for array) - newView = swapContent ? parentView : (index !== undefined && parentView) || View( context, path, parentView, data, tmpl, index ); - - for ( i = 0, l = data.length; i < l; i++ ) { - // Create a view for each data item. - dataItem = data[ i ]; - itemResult = tmpl.fn( dataItem, View( context, path, newView, dataItem, tmpl, (index||0) + i ), jsv ); - result += itemWrap ? itemWrap( itemResult, props ) : itemResult; - } - } else { - // Create a view for singleton data object. - newView = swapContent ? parentView : View( context, path, parentView, data, tmpl, index ); - result += (data || layout) ? tmpl.fn( data, newView, jsv ) : ""; - } - parentView.topKey = newView.index; - return itemsWrap ? itemsWrap( result, path, newView.index, tmpl, props ) : result; - } - return ""; // No tmpl. Could throw... -} - -//=========================== -// Build and compile template -//=========================== - -// Generate a reusable function that will serve to render a template against data -// (Compile AST then build template function) - -function syntaxError() { - throw "Syntax error"; -} - -function tmplFn( markup, tmpl, bind ) { - // Compile markup to AST (abtract syntax tree) then build the template function code from the AST nodes - // Used for compiling templates, and also by JsViews to build functions for data link expressions - var newNode, node, i, l, code, hasTag, hasEncoder, getsValue, hasConverter, hasViewPath, tag, converter, params, hash, nestedTmpl, allowCode, - tmplOptions = tmpl ? { - allowCode: allowCode = tmpl.allowCode, - debug: tmpl.debug - } : {}, - nested = tmpl && tmpl.tmpls, - astTop = [], - loc = 0, - stack = [], - content = astTop, - current = [,,,astTop], - nestedIndex = 0; - - //==== nested functions ==== - function pushPreceedingContent( shift ) { - shift -= loc; - if ( shift ) { - content.push( markup.substr( loc, shift ).replace( rNewLine, "\\n" )); - } - } - - function parseTag( all, tagName, converter, colon, html, code, params, slash, closeBlock, index ) { - // tag converter colon html code params slash closeBlock - // /{{(?:(?:(\w+(?=[\/!\s\}!]))|(?:(\w+)?(:)|(?:(>)|(\*)))((?:[^\}]|}(?!}))*?)(\/)?|(?:\/(\w+)))}}/g; - // Build abstract syntax tree (AST): [ tagName, converter, params, content, hash, contentMarkup ] - if ( html ) { - colon = ":"; - converter = "html"; - } - var hash = "", - passedCtx = "", - block = !slash && !colon; // Block tag if not self-closing and not {{:}} or {{>}} (special case) - - //==== nested helper function ==== - - tagName = tagName || colon; - pushPreceedingContent( index ); - loc = index + all.length; // location marker - parsed up to here - if ( code ) { - if ( allowCode ) { - content.push([ "*", params.replace( rUnescapeQuotes, "$1" ) ]); - } - } else if ( tagName ) { - if ( tagName === "else" ) { - current[ 5 ] = markup.substring( current[ 5 ], index ); // contentMarkup for block tag - current = stack.pop(); - content = current[ 3 ]; - block = TRUE; - } - params = (params - ? parseParams( params, bind ) - .replace( rBuildHash, function( all, isCtx, keyValue ) { - if ( isCtx ) { - passedCtx += keyValue + ","; - } else { - hash += keyValue + ","; - } - return ""; - }) - : ""); - hash = hash.slice( 0, -1 ); - params = params.slice( 0, -1 ); - newNode = [ - tagName, - converter || "", - params, - block && [], - "{" + (hash ? ("props:{" + hash + "},"): "") + "path:'" + params + "'" + (passedCtx ? ",ctx:{" + passedCtx.slice( 0, -1 ) + "}" : "") + "}" - ]; - if ( block ) { - stack.push( current ); - current = newNode; - current[ 5 ] = loc; // Store current location of open tag, to be able to add contentMarkup when we reach closing tag - } - content.push( newNode ); - } else if ( closeBlock ) { - //if ( closeBlock !== current[ 0 ]) { - // throw "unmatched close tag: /" + closeBlock + ". Expected /" + current[ 0 ]; - //} - current[ 5 ] = markup.substring( current[ 5 ], index ); // contentMarkup for block tag - current = stack.pop(); - } - if ( !current ) { - throw "Expected block tag"; - } - content = current[ 3 ]; - } - //==== /end of nested functions ==== - - markup = markup.replace( rEscapeQuotes, "\\$1" ); - - // Build the AST (abstract syntax tree) under astTop - markup.replace( rTag, parseTag ); - - pushPreceedingContent( markup.length ); - - // Use the AST (astTop) to build the template function - l = astTop.length; - code = (l ? "" : '"";'); - - for ( i = 0; i < l; i++ ) { - // AST nodes: [ tagName, converter, params, content, hash, contentMarkup ] - node = astTop[ i ]; - if ( node[ 0 ] === "*" ) { - code = code.slice( 0, i ? -1 : -3 ) + ";" + node[ 1 ] + (i + 1 < l ? "ret+=" : ""); - } else if ( "" + node === node ) { // type string - code += '"' + node + '"+'; - } else { - tag = node[ 0 ]; - converter = node[ 1 ]; - params = node[ 2 ]; - content = node[ 3 ]; - hash = node[ 4 ]; - markup = node[ 5 ]; - if ( content ) { - // Create template object for nested template - nestedTmpl = TmplObject( markup, tmplOptions, tmpl, nestedIndex++ ); - // Compile to AST and then to compiled function - tmplFn( markup, nestedTmpl); - nested.push( nestedTmpl ); - } - hasViewPath = hasViewPath || hash.indexOf( "view" ) > -1; - code += (tag === ":" - ? (converter === "html" - ? (hasEncoder = TRUE, "e(" + params) - : converter - ? (hasConverter = TRUE, 'c("' + converter + '",view,' + params) - : (getsValue = TRUE, "((v=" + params + ')!=u?v:""') - ) - : (hasTag = TRUE, 't("' + tag + '",view,"' + (converter || "") + '",' - + (content ? nested.length : '""') // For block tags, pass in the key (nested.length) to the nested content template - + "," + hash + (params ? "," : "") + params)) - + ")+"; - } - } - code = new Function( "data, view, j, b, u", fnDeclStr - + (getsValue ? "v," : "") - + (hasTag ? "t=j.tag," : "") - + (hasConverter ? "c=j.convert," : "") - + (hasEncoder ? "e=j.converters.html," : "") - + "ret; try{\n\n" - + (tmplOptions.debug ? "debugger;" : "") - + (allowCode ? 'ret=' : 'return ') - + code.slice( 0, -1 ) + ";\n\n" - + (allowCode ? "return ret;" : "") - + "}catch(e){return j.err(e);}" - ); - - // Include only the var references that are needed in the code - if ( tmpl ) { - tmpl.fn = code; - tmpl.useVw = hasConverter || hasViewPath || hasTag; - } - return code; -} - -function parseParams( params, bind ) { - var named, - fnCall = {}, - parenDepth = 0, - quoted = FALSE, // boolean for string content in double quotes - aposed = FALSE; // or in single quotes - - function parseTokens( all, lftPrn0, lftPrn, path, operator, err, eq, path2, prn, comma, lftPrn2, apos, quot, rtPrn, prn2, space ) { - // rParams = /(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g, - // lftPrn path operator err eq path2 prn comma lftPrn3 apos quot rtPrn prn2 space - // (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space - operator = operator || ""; - lftPrn = lftPrn || lftPrn0 || lftPrn2; - path = path || path2; - prn = prn || prn2 || ""; - operator = operator || ""; - - function parsePath( all, object, helper, view, viewProperty, pathTokens, leafToken ) { - // rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g, - // object helper view viewProperty pathTokens leafToken string - if ( object ) { - var ret = (helper - ? 'view.hlp("' + helper + '")' - : view - ? "view" - : "data") - + (leafToken - ? (viewProperty - ? "." + viewProperty - : helper - ? "" - : (view ? "" : "." + object) - ) + (pathTokens || "") - : (leafToken = helper ? "" : view ? viewProperty || "" : object, "")); - - if ( bind && prn !== "(" ) { - ret = "b(" + ret + ',"' + leafToken + '")'; - } - return ret + (leafToken ? "." + leafToken : ""); - } - return all; - } - - if ( err ) { - syntaxError(); - } else { - return (aposed - // within single-quoted string - ? (aposed = !apos, (aposed ? all : '"')) - : quoted - // within double-quoted string - ? (quoted = !quot, (quoted ? all : '"')) - : - ( - (lftPrn - ? (parenDepth++, lftPrn) - : "") - + (space - ? (parenDepth - ? "" - : named - ? (named = FALSE, "\b") - : "," - ) - : eq - // named param - ? (parenDepth && syntaxError(), named = TRUE, '\b' + path + ':') - : path - // path - ? (path.replace( rPath, parsePath ) - + (prn - ? (fnCall[ ++parenDepth ] = TRUE, prn) - : operator) - ) - : operator - ? all - : rtPrn - // function - ? ((fnCall[ parenDepth-- ] = FALSE, rtPrn) - + (prn - ? (fnCall[ ++parenDepth ] = TRUE, prn) - : "") - ) - : comma - ? (fnCall[ parenDepth ] || syntaxError(), ",") // We don't allow top-level literal arrays or objects - : lftPrn0 - ? "" - : (aposed = apos, quoted = quot, '"') - )) - ); - } - } - params = (params + " " ).replace( rParams, parseTokens ); - return params; -} - -function compile( name, tmpl, parent, options ) { - // tmpl is either a template object, a selector for a template script block, the name of a compiled template, or a template object - // options is the set of template properties, c - var tmplOrMarkup, elem, key, nested, nestedItem; - - //==== nested functions ==== - function tmplOrMarkupFromStr( value ) { - // If value is of type string - treat as selector, or name of compiled template - // Return the template object, if already compiled, or the markup string - - if ( ("" + value === value) || value.nodeType > 0 ) { - // If selector is valid and returns at least one element, get first element - elem = value.nodeType > 0 ? value : !rTmplString.test( value ) && jQuery && jQuery( value )[0]; - if ( elem && elem.type ) { - // It is a script element - // Create a name for data linking if none provided - value = templates[ elem.getAttribute( tmplAttr )]; - if ( !value ) { - // Not already compiled and cached, so compile and cache the name - name = name || "_" + autoTmplName++; - elem.setAttribute( tmplAttr, name ); - value = compile( name, elem.innerHTML, parent, options ); // Use tmpl as options - templates[ name ] = value; - } - } - return value; - } - // If value is not a string or dom element, return undefined - } - - //==== Compile the template ==== - tmplOrMarkup = tmplOrMarkupFromStr( tmpl ); - - // If tmpl is a template object, use it for options - options = options || (tmpl.markup ? tmpl : {}); - options.name = name; - nested = options.templates; - - // If tmpl is not a markup string or a selector string, then it must be a template object - // In that case, get it from the markup property of the object - if ( !tmplOrMarkup && tmpl.markup && (tmplOrMarkup = tmplOrMarkupFromStr( tmpl.markup ))) { - if ( tmplOrMarkup.fn && (tmplOrMarkup.debug !== tmpl.debug || tmplOrMarkup.allowCode !== tmpl.allowCode )) { - // if the string references a compiled template object, but the debug or allowCode props are different, need to recompile - tmplOrMarkup = tmplOrMarkup.markup; - } - } - if ( tmplOrMarkup !== undefined ) { - if ( name && !parent ) { - render[ name ] = function() { - return tmpl.render.apply( tmpl, arguments ); - }; - } - if ( tmplOrMarkup.fn || tmpl.fn ) { - // tmpl is already compiled, so use it, or if different name is provided, clone it - if ( tmplOrMarkup.fn ) { - if ( name && name !== tmplOrMarkup.name ) { - tmpl = extend( extend( {}, tmplOrMarkup ), options); - } else { - tmpl = tmplOrMarkup; - } - } - } else { - // tmplOrMarkup is a markup string, not a compiled template - // Create template object - tmpl = TmplObject( tmplOrMarkup, options, parent, 0 ); - // Compile to AST and then to compiled function - tmplFn( tmplOrMarkup, tmpl ); - } - for ( key in nested ) { - // compile nested template declarations - nestedItem = nested[ key ]; - if ( nestedItem.name !== key ) { - nested[ key ] = compile( key, nestedItem, tmpl ); - } - } - return tmpl; - } -} -//==== /end of function compile ==== - -function TmplObject( markup, options, parent, index ) { - // Template object constructor - - // nested helper function - function extendStore( storeName ) { - if ( parent[ storeName ]) { - // Include parent items except if overridden by item of same name in options - tmpl[ storeName ] = extend( extend( {}, parent[ storeName ] ), options[ storeName ] ); - } - } - - options = options || {}; - var tmpl = { - markup: markup, - tmpls: [], - links: [], - render: renderContent - }; - if ( parent ) { - if ( parent.templates ) { - tmpl.templates = extend( extend( {}, parent.templates ), options.templates ); - } - tmpl.parent = parent; - tmpl.name = parent.name + "[" + index + "]"; - tmpl.index = index; - } - - extend( tmpl, options ); - if ( parent ) { - extendStore( "templates" ); - extendStore( "tags" ); - extendStore( "helpers" ); - extendStore( "converters" ); - } - return tmpl; -} - -//========================== Initialize ========================== - -if ( jQuery ) { - //////////////////////////////////////////////////////////////////////////////////////////////// - // jQuery is loaded, so make $ the jQuery object - $ = jQuery; - $.templates = templates; - $.render = render; - $.views = jsv; - $.fn.render = renderContent; - -} else { - //////////////////////////////////////////////////////////////////////////////////////////////// - // jQuery is not loaded. - - $ = window.jsviews = jsv; - $.extend = function( target, source ) { - var name; - target = target || {}; - for ( name in source ) { - target[ name ] = source[ name ]; - } - return target; - }; - - $.isArray = Array && Array.isArray || function( obj ) { - return Object.prototype.toString.call( obj ) === "[object Array]"; - }; -} - -extend = $.extend; - -jsv.topView = { views: {}, tmpl: {}, hlp: getHelper, ctx: jsv.helpers }; - -function replacerForHtml( ch ) { - // Original code from Mike Samuel - return escapeMapForHtml[ ch ] - // Intentional assignment that caches the result of encoding ch. - || (escapeMapForHtml[ ch ] = "&#" + ch.charCodeAt( 0 ) + ";"); -} - -//========================== Register tags ========================== - -tags({ - "if": function() { - var ifTag = this, - view = ifTag.view; - - view.onElse = function( tagObject, args ) { - var i = 0, - l = args.length; - - while ( l && !args[ i++ ]) { - // Only render content if args.length === 0 (i.e. this is an else with no condition) or if a condition argument is truey - if ( i === l ) { - return ""; - } - } - view.onElse = undefined; // If condition satisfied, so won't run 'else'. - tagObject.path = ""; - return tagObject.renderContent( view ); - // Test is satisfied, so render content, while remaining in current data context - // By passing the view, we inherit data context from the parent view, and the content is treated as a layout template - // (so if the data is an array, it will not iterate over the data - }; - return view.onElse( this, arguments ); - }, - "else": function() { - var view = this.view; - return view.onElse ? view.onElse( this, arguments ) : ""; - }, - "for": function() { - var i, - self = this, - result = "", - args = arguments, - l = args.length; - if ( self.props.layout ) { - self.tmpl.layout = TRUE; - } - for ( i = 0; i < l; i++ ) { - result += self.renderContent( args[ i ]); - } - return result; - }, - "=": function( value ) { - return value; - }, - "*": function( value ) { - return value; - } -}); - -//========================== Register global helpers ========================== - -// helpers({ // Global helper functions -// // TODO add any useful built-in helper functions -// }); - -//========================== Register converters ========================== - -converters({ - html: function( text ) { - // HTML encoding helper: Replace < > & and ' and " by corresponding entities. - // inspired by Mike Samuel - return text != undefined ? String( text ).replace( htmlSpecialChar, replacerForHtml ) : ""; - } -}); - -//========================== Define default delimiters ========================== -setDelimiters( "{{", "}}" ); - -})( this ); - -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.6 - * - * Requires: 1.2.2+ - */ - -(function($) { - -var types = ['DOMMouseScroll', 'mousewheel']; - -if ($.event.fixHooks) { - for ( var i=types.length; i; ) { - $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; - } -} - -$.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) { - for ( var i=types.length; i; ) { - this.addEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i=types.length; i; ) { - this.removeEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = null; - } - } -}; - -$.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } -}); - - -function handler(event) { - var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; - event = $.event.fix(orgEvent); - event.type = "mousewheel"; - - // Old school scrollwheel delta - if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } - if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } - - // New school multidimensional scroll (touchpads) deltas - deltaY = delta; - - // Gecko - if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaY = 0; - deltaX = -1*delta; - } - - // Webkit - if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } - if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - return ($.event.dispatch || $.event.handle).apply(this, args); -} - -})(jQuery); - -/*! - * jQuery UI Widget 1.8.18 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ - -if ( ! $.widget ) { - -(function( $, undefined ) { - -// jQuery 1.4+ -if ( $.cleanData ) { - var _cleanData = $.cleanData; - $.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - try { - $( elem ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - } - _cleanData( elems ); - }; -} else { - var _remove = $.fn.remove; - $.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( [ this ] ).each(function() { - try { - $( this ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - }); - } - } - return _remove.call( $(this), selector, keepData ); - }); - }; -} - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from -// $.each( basePrototype, function( key, val ) { -// if ( $.isPlainObject(val) ) { -// basePrototype[ key ] = $.extend( {}, val ); -// } -// }); - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = Array.prototype.slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - // prevent calls to internal methods - if ( isMethodCall && options.charAt( 0 ) === "_" ) { - return returnValue; - } - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ), - methodValue = instance && $.isFunction( instance[options] ) ? - instance[ options ].apply( instance, args ) : - instance; - // TODO: add this back in 1.9 and use $.error() (see #5972) -// if ( !instance ) { -// throw "cannot call methods on " + name + " prior to initialization; " + -// "attempted to call method '" + options + "'"; -// } -// if ( !$.isFunction( instance[options] ) ) { -// throw "no such method '" + options + "' for " + name + " widget instance"; -// } -// var methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - $.data( this, name, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - // $.widget.bridge stores the plugin instance, but we do it anyway - // so that it's stored even before the _create function runs - $.data( element, this.widgetName, this ); - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - this._getCreateOptions(), - options ); - - var self = this; - this.element.bind( "remove." + this.widgetName, function() { - self.destroy(); - }); - - this._create(); - this._trigger( "create" ); - this._init(); - }, - _getCreateOptions: function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }, - _create: function() {}, - _init: function() {}, - - destroy: function() { - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - }, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, this.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var self = this; - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - [ value ? "addClass" : "removeClass"]( - this.widgetBaseClass + "-disabled" + " " + - "ui-state-disabled" ) - .attr( "aria-disabled", value ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - - return !( $.isFunction(callback) && - callback.call( this.element[0], event, data ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); - -}; - - -(function ($, window, undefined) { - var pos_oo = Number.POSITIVE_INFINITY, - neg_oo = Number.NEGATIVE_INFINITY; - - $.geo = { - // - // utility functions - // - - _allCoordinates: function (geom) { - // return array of all positions in all geometries of geom - // not in JTS - var geometries = this._flatten(geom), - curGeom = 0, - result = []; - - for (; curGeom < geometries.length; curGeom++) { - var coordinates = geometries[curGeom].coordinates, - isArray = coordinates && $.isArray(coordinates[0]), - isDblArray = isArray && $.isArray(coordinates[0][0]), - isTriArray = isDblArray && $.isArray(coordinates[0][0][0]), - i, j, k; - - if (!isTriArray) { - if (!isDblArray) { - if (!isArray) { - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - - for (i = 0; i < coordinates.length; i++) { - for (j = 0; j < coordinates[i].length; j++) { - for (k = 0; k < coordinates[i][j].length; k++) { - result.push(coordinates[i][j][k]); - } - } - } - } - return result; - }, - - _isGeodetic: function( coords ) { - // returns true if the first coordinate it can find is geodetic - - while ( $.isArray( coords ) ) { - if ( coords.length > 1 && ! $.isArray( coords[ 0 ] ) ) { - return ( coords[ 0 ] >= -180 && coords[ 0 ] <= 180 && coords[ 1 ] >= -85 && coords[ 1 ] <= 85 ); - } else { - coords = coords[ 0 ]; - } - } - - return false; - }, - - // - // bbox functions - // - - center: function (bbox, _ignoreGeo /* Internal Use Only */) { - // Envelope.centre in JTS - // bbox only, use centroid for geom - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2]; - return wasGeodetic ? $.geo.proj.toGeodetic(center) : center; - }, - - expandBy: function (bbox, dx, dy, _ignoreGeo /* Internal Use Only */) { - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - bbox = [bbox[0] - dx, bbox[1] - dy, bbox[2] + dx, bbox[3] + dy]; - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - height: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - - return bbox[3] - bbox[1]; - }, - - _in: function(bbox1, bbox2) { - return bbox1[0] <= bbox2[0] && - bbox1[1] <= bbox2[1] && - bbox1[2] >= bbox2[2] && - bbox1[3] >= bbox2[3]; - }, - - _bboxDisjoint: function( bbox1, bbox2 ) { - return bbox2[ 0 ] > bbox1[ 2 ] || - bbox2[ 2 ] < bbox1[ 0 ] || - bbox2[ 1 ] > bbox1[ 3 ] || - bbox2[ 3 ] < bbox1[ 1 ]; - }, - - include: function( bbox, value, _ignoreGeo /* Internal Use Only */ ) { - // similar to Envelope.expandToInclude in JTS - if ( !value || !$.isArray( value ) ) { - return bbox; - } - - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox || value ) ) { - wasGeodetic = true; - } - - if ( !bbox ) { - bbox = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - } else if ( wasGeodetic ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - - if ( value.length === 2 ) { - value = [ value[ 0 ], value[ 1 ], value[ 0 ], value[ 1 ] ]; - } - - value = $.geo.proj.fromGeodetic( value ); - - bbox[0] = Math.min( value[ 0 ], bbox[ 0 ] ); - bbox[1] = Math.min( value[ 1 ], bbox[ 1 ] ); - bbox[2] = Math.max( value[ 2 ], bbox[ 2 ] ); - bbox[3] = Math.max( value[ 3 ], bbox[ 3 ] ); - - return wasGeodetic ? $.geo.proj.toGeodetic( bbox ) : bbox; - }, - - polygonize: function( bbox, _ignoreGeo /* Internal Use Only */ ) { - // adaptation of Polygonizer class in JTS for use with bboxes - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var polygon = { - type: "Polygon", - coordinates: [ [ - [ bbox[ 0 ], bbox[ 1 ] ], - [ bbox[ 0 ], bbox[ 3 ] ], - [ bbox[ 2 ], bbox[ 3 ] ], - [ bbox[ 2 ], bbox[ 1 ] ], - [ bbox[ 0 ], bbox[ 1 ] ] - ] ] - }; - - if ( wasGeodetic ) { - polygon.coordinates = $.geo.proj.toGeodetic( polygon.coordinates ); - } - - return polygon; - }, - - reaspect: function (bbox, ratio, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var width = this.width(bbox, true), - height = this.height(bbox, true), - center = this.center(bbox, true), - dx, dy; - - if (width !== 0 && height !== 0 && ratio > 0) { - if (width / height > ratio) { - dx = width / 2; - dy = dx / ratio; - } else { - dy = height / 2; - dx = dy * ratio; - } - - bbox = [center[0] - dx, center[1] - dy, center[0] + dx, center[1] + dy]; - } - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - recenter: function( bbox, center, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj ) { - if ( this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - if ( this._isGeodetic( center ) ) { - center = $.geo.proj.fromGeodetic(center); - } - } - - var halfWidth = ( bbox[ 2 ] - bbox[ 0 ] ) / 2, - halfHeight = ( bbox[ 3 ] - bbox[ 1 ] ) / 2; - - bbox = [ - center[ 0 ] - halfWidth, - center[ 1 ] - halfHeight, - center[ 0 ] + halfWidth, - center[ 1 ] + halfHeight - ]; - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - scaleBy: function ( bbox, scale, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var c = this.center(bbox, true), - dx = (bbox[2] - bbox[0]) * scale / 2, - dy = (bbox[3] - bbox[1]) * scale / 2; - - bbox = [c[0] - dx, c[1] - dy, c[0] + dx, c[1] + dy]; - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - width: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - - return bbox[2] - bbox[0]; - }, - - // - // geometry functions - // - - // bbox (Geometry.getEnvelope in JTS) - - bbox: function ( geom, _ignoreGeo /* Internal Use Only */ ) { - var result, wasGeodetic = false; - if ( !geom ) { - return undefined; - } else if ( geom.bbox ) { - result = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom.bbox ) ) ? $.geo.proj.fromGeodetic( geom.bbox ) : geom.bbox; - } else { - result = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - - var coordinates = this._allCoordinates( geom ), - curCoord = 0; - - if ( coordinates.length === 0 ) { - return undefined; - } - - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( coordinates ) ) { - wasGeodetic = true; - coordinates = $.geo.proj.fromGeodetic( coordinates ); - } - - for ( ; curCoord < coordinates.length; curCoord++ ) { - result[0] = Math.min(coordinates[curCoord][0], result[0]); - result[1] = Math.min(coordinates[curCoord][1], result[1]); - result[2] = Math.max(coordinates[curCoord][0], result[2]); - result[3] = Math.max(coordinates[curCoord][1], result[3]); - } - } - - return wasGeodetic ? $.geo.proj.toGeodetic(result) : result; - }, - - // centroid - - centroid: function( geom, _ignoreGeo /* Internal Use Only */ ) { - switch (geom.type) { - case "Point": - return $.extend({}, geom); - - case "LineString": - case "Polygon": - var a = 0, - c = [0, 0], - coords = $.merge( [ ], geom.type == "Polygon" ? geom.coordinates[0] : geom.coordinates ), - i = 1, j, n, - bbox = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( coords ) ) { - wasGeodetic = true; - coords = $.geo.proj.fromGeodetic(coords); - } - - //if (coords[0][0] != coords[coords.length - 1][0] || coords[0][1] != coords[coords.length - 1][1]) { - // coords.push(coords[0]); - //} - - for (; i <= coords.length; i++) { - j = i % coords.length; - - bbox[0] = Math.min(coords[j][0], bbox[0]); - bbox[1] = Math.min(coords[j][1], bbox[1]); - bbox[2] = Math.max(coords[j][0], bbox[2]); - bbox[3] = Math.max(coords[j][1], bbox[3]); - - n = (coords[i - 1][0] * coords[j][1]) - (coords[j][0] * coords[i - 1][1]); - a += n; - c[0] += (coords[i - 1][0] + coords[j][0]) * n; - c[1] += (coords[i - 1][1] + coords[j][1]) * n; - } - - if (a === 0) { - if (coords.length > 0) { - c[0] = Math.min( Math.max( coords[0][0], bbox[ 0 ] ), bbox[ 2 ] ); - c[1] = Math.min( Math.max( coords[0][1], bbox[ 1 ] ), bbox[ 3 ] ); - return { type: "Point", coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c }; - } else { - return undefined; - } - } - - a *= 3; - //c[0] /= a; - //c[1] /= a; - - c[0] = Math.min( Math.max( c[0] / a, bbox[ 0 ] ), bbox[ 2 ] ); - c[1] = Math.min( Math.max( c[1] / a, bbox[ 1 ] ), bbox[ 3 ] ); - - return { type: "Point", coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c }; - } - return undefined; - }, - - // contains - - contains: function (geom1, geom2) { - if (geom1.type != "Polygon") { - return false; - } - - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1.coordinates, geom2.coordinates); - - case "LineString": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates); - - case "Polygon": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates[0]); - - default: - return false; - } - }, - - _containsPolygonPoint: function (polygonCoordinates, pointCoordinate) { - if (polygonCoordinates.length === 0 || polygonCoordinates[0].length < 4) { - return false; - } - - var rayCross = 0, - a = polygonCoordinates[0][0], - i = 1, - b, - x; - - for (; i < polygonCoordinates[0].length; i++) { - b = polygonCoordinates[0][i]; - - if ((a[1] <= pointCoordinate[1] && pointCoordinate[1] < b[1]) || (b[1] <= pointCoordinate[1] && pointCoordinate[1] < a[1]) && (pointCoordinate[0] < a[0] || pointCoordinate[0] < b[0])) { - x = a[0] + (b[0] - a[0]) * (pointCoordinate[1] - a[1]) / (b[1] - a[1]); - - if (x > pointCoordinate[0]) { - rayCross++; - } - } - - a = b; - } - - return rayCross % 2 == 1; - }, - - _containsPolygonLineString: function (polygonCoordinates, lineStringCoordinates) { - for (var i = 0; i < lineStringCoordinates.length; i++) { - if (!this._containsPolygonPoint(polygonCoordinates, lineStringCoordinates[i])) { - return false; - } - } - return true; - }, - - // distance - - distance: function ( geom1, geom2, _ignoreGeo /* Internal Use Only */ ) { - var geom1CoordinatesProjected = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom1.coordinates ) ) ? $.geo.proj.fromGeodetic(geom1.coordinates) : geom1.coordinates, - geom2CoordinatesProjected = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom2.coordinates ) ) ? $.geo.proj.fromGeodetic(geom2.coordinates) : geom2.coordinates; - - switch (geom1.type) { - case "Point": - switch (geom2.type) { - case "Point": - return this._distancePointPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "LineString": - return this._distanceLineStringPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "Polygon": - return this._containsPolygonPoint(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "LineString": - switch (geom2.type) { - case "Point": - return this._distanceLineStringPoint(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "LineString": - return this._distanceLineStringLineString(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "Polygon": - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "LineString": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected[0]) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected[0]); - default: - return undefined; - } - break; - } - }, - - _distancePointPoint: function (coordinate1, coordinate2) { - var dx = coordinate2[0] - coordinate1[0], - dy = coordinate2[1] - coordinate1[1]; - return Math.sqrt((dx * dx) + (dy * dy)); - }, - - _distanceLineStringPoint: function (lineStringCoordinates, pointCoordinate) { - var minDist = pos_oo; - - if (lineStringCoordinates.length > 0) { - var a = lineStringCoordinates[0], - - apx = pointCoordinate[0] - a[0], - apy = pointCoordinate[1] - a[1]; - - if (lineStringCoordinates.length == 1) { - return Math.sqrt(apx * apx + apy * apy); - } else { - for (var i = 1; i < lineStringCoordinates.length; i++) { - var b = lineStringCoordinates[i], - - abx = b[0] - a[0], - aby = b[1] - a[1], - bpx = pointCoordinate[0] - b[0], - bpy = pointCoordinate[1] - b[1], - - d = this._distanceSegmentPoint(abx, aby, apx, apy, bpx, bpy); - - if (d === 0) { - return 0; - } - - if (d < minDist) { - minDist = d; - } - - a = b; - apx = bpx; - apy = bpy; - } - } - } - - return Math.sqrt(minDist); - }, - - _distanceSegmentPoint: function (abx, aby, apx, apy, bpx, bpy) { - var dot1 = abx * apx + aby * apy; - - if (dot1 <= 0) { - return apx * apx + apy * apy; - } - - var dot2 = abx * abx + aby * aby; - - if (dot1 >= dot2) { - return bpx * bpx + bpy * bpy; - } - - return apx * apx + apy * apy - dot1 * dot1 / dot2; - }, - - _distanceLineStringLineString: function (lineStringCoordinates1, lineStringCoordinates2) { - var minDist = pos_oo; - for (var i = 0; i < lineStringCoordinates2.length; i++) { - minDist = Math.min(minDist, this._distanceLineStringPoint(lineStringCoordinates1, lineStringCoordinates2[i])); - } - return minDist; - }, - - // buffer - - _buffer: function( geom, distance, _ignoreGeo /* Internal Use Only */ ) { - var wasGeodetic = false, - coords = geom.coordinates; - - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom.coordinates ) ) { - wasGeodetic = true; - coords = $.geo.proj.fromGeodetic( geom.coordinates ); - } - - if ( geom.type === "Point" ) { - var resultCoords = [], - slices = 180, - i = 0, - a; - - for ( ; i <= slices; i++ ) { - a = ( i * 360 / slices ) * ( Math.PI / 180 ); - resultCoords.push( [ - coords[ 0 ] + Math.cos( a ) * distance, - coords[ 1 ] + Math.sin( a ) * distance - ] ); - } - - return { - type: "Polygon", - coordinates: [ ( wasGeodetic ? $.geo.proj.toGeodetic( resultCoords ) : resultCoords ) ] - }; - } else { - return undefined; - } - }, - - - // - // feature - // - - _flatten: function (geom) { - // return an array of all basic geometries - // not in JTS - var geometries = [], - curGeom = 0; - switch (geom.type) { - case "Feature": - $.merge(geometries, this._flatten(geom.geometry)); - break; - - case "FeatureCollection": - for (; curGeom < geom.features.length; curGeom++) { - $.merge(geometries, this._flatten(geom.features[curGeom].geometry)); - } - break; - - case "GeometryCollection": - for (; curGeom < geom.geometries.length; curGeom++) { - $.merge(geometries, this._flatten(geom.geometries[curGeom])); - } - break; - - default: - geometries[0] = geom; - break; - } - return geometries; - }, - - length: function( geom, _ignoreGeo /* Internal Use Only */ ) { - var sum = 0, - lineStringCoordinates, - i = 1, dx, dy; - - switch ( geom.type ) { - case "Point": - return 0; - - case "LineString": - lineStringCoordinates = geom.coordinates; - break; - - case "Polygon": - lineStringCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( lineStringCoordinates ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( lineStringCoordinates ) ) { - lineStringCoordinates = $.geo.proj.fromGeodetic( lineStringCoordinates ); - } - - for ( ; i < lineStringCoordinates.length; i++ ) { - dx = lineStringCoordinates[ i ][0] - lineStringCoordinates[ i - 1 ][0]; - dy = lineStringCoordinates[ i ][1] - lineStringCoordinates[ i - 1 ][1]; - sum += Math.sqrt((dx * dx) + (dy * dy)); - } - - return sum; - } - - // return undefined; - }, - - area: function( geom, _ignoreGeo /* Internal Use Only */ ) { - var sum = 0, - polygonCoordinates, - i = 1, j; - - switch ( geom.type ) { - case "Point": - case "LineString": - return 0; - - case "Polygon": - polygonCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( polygonCoordinates ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( polygonCoordinates ) ) { - polygonCoordinates = $.geo.proj.fromGeodetic( polygonCoordinates ); - } - - for ( ; i <= polygonCoordinates.length; i++) { - j = i % polygonCoordinates.length; - sum += ( polygonCoordinates[ i - 1 ][ 0 ] - polygonCoordinates[ j ][ 0 ] ) * ( polygonCoordinates[ i - 1 ][ 1 ] + polygonCoordinates[ j ][ 1 ] ) / 2; - } - - return Math.abs( sum ); - } - }, - - pointAlong: function( geom, percentage, _ignoreGeo /* Internal Use Only */ ) { - var totalLength = 0, - previousPercentageSum = 0, - percentageSum = 0, - remainderPercentageSum, - len, - lineStringCoordinates, - segmentLengths = [], - i = 1, dx, dy, - c, c0, c1, - wasGeodetic = false; - - switch ( geom.type ) { - case "Point": - return $.extend( { }, geom ); - - case "LineString": - lineStringCoordinates = geom.coordinates; - break; - - case "Polygon": - lineStringCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( lineStringCoordinates ) { - if ( percentage === 0 ) { - return { - type: "Point", - coordinates: [ lineStringCoordinates[ 0 ][ 0 ], lineStringCoordinates[ 0 ][ 1 ] ] - }; - } else if ( percentage === 1 ) { - i = lineStringCoordinates.length - 1; - return { - type: "Point", - coordinates: [ lineStringCoordinates[ i ][ 0 ], lineStringCoordinates[ i ][ 1 ] ] - }; - } else { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( lineStringCoordinates ) ) { - wasGeodetic = true; - lineStringCoordinates = $.geo.proj.fromGeodetic( lineStringCoordinates ); - } - - for ( ; i < lineStringCoordinates.length; i++ ) { - dx = lineStringCoordinates[ i ][ 0 ] - lineStringCoordinates[ i - 1 ][ 0 ]; - dy = lineStringCoordinates[ i ][ 1 ] - lineStringCoordinates[ i - 1 ][ 1 ]; - len = Math.sqrt((dx * dx) + (dy * dy)); - segmentLengths.push( len ); - totalLength += len; - } - - for ( i = 0; i < segmentLengths.length && percentageSum < percentage; i++ ) { - previousPercentageSum = percentageSum; - percentageSum += ( segmentLengths[ i ] / totalLength ); - } - - remainderPercentageSum = percentage - previousPercentageSum; - - c0 = lineStringCoordinates[ i - 1 ]; - c1 = lineStringCoordinates[ i ]; - - c = [ - c0[ 0 ] + ( remainderPercentageSum * ( c1[ 0 ] - c0[ 0 ] ) ), - c0[ 1 ] + ( remainderPercentageSum * ( c1[ 1 ] - c0[ 1 ] ) ) - ]; - - return { - type: "Point", - coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c - }; - } - } - }, - - // - // WKT functions - // - - _WKT: (function () { - function pointToString(value) { - return "POINT " + pointToUntaggedString(value.coordinates); - } - - function pointToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - return "(" + coordinates.join(" ") + ")"; - } - } - - function lineStringToString(value) { - return "LINESTRING " + lineStringToUntaggedString(value.coordinates); - } - - function lineStringToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var points = []; - - for (var i = 0; i < coordinates.length; i++) { - points.push(coordinates[i].join(" ")); - } - - return "(" + points + ")"; - } - } - - function polygonToString(value) { - return "POLYGON " + polygonToUntaggedString(value.coordinates); - } - - function polygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMTPY"; - } else { - var lineStrings = []; - - for (var i = 0; i < coordinates.length; i++) { - lineStrings.push(lineStringToUntaggedString(coordinates[i])); - } - - return "(" + lineStrings + ")"; - } - } - - function multiPointToString(value) { - return "MULTIPOINT " + lineStringToUntaggedString(value.coordinates); - } - - function multiLineStringToString(value) { - return "MULTILINSTRING " + polygonToUntaggedString(value.coordinates); - } - - function multiPolygonToString(value) { - return "MULTIPOLYGON " + multiPolygonToUntaggedString(value.coordinates); - } - - function multiPolygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var polygons = []; - for (var i = 0; i < coordinates.length; i++) { - polygons.push(polygonToUntaggedString(coordinates[i])); - } - return "(" + polygons + ")"; - } - } - - function geometryCollectionToString(value) { - return "GEOMETRYCOLLECTION " + geometryCollectionToUntaggedString(value.geometries); - } - - function geometryCollectionToUntaggedString(geometries) { - if (!(geometries && geometries.length)) { - return "EMPTY"; - } else { - var geometryText = []; - for (var i = 0; i < geometries.length; i++) { - geometryText.push(stringify(geometries[i])); - } - return "(" + geometries + ")"; - } - } - - function stringify(value) { - if (!(value && value.type)) { - return ""; - } else { - switch (value.type) { - case "Point": - return pointToString(value); - - case "LineString": - return lineStringToString(value); - - case "Polygon": - return polygonToString(value); - - case "MultiPoint": - return multiPointToString(value); - - case "MultiLineString": - return multiLineStringToString(value); - - case "MultiPolygon": - return multiPolygonToString(value); - - case "GeometryCollection": - return geometryCollectionToString(value); - - default: - return ""; - } - } - } - - function pointParseUntagged(wkt) { - var pointString = wkt.match( /\(\s*([\d\.\-]+)\s+([\d\.\-]+)\s*\)/ ); - return pointString && pointString.length > 2 ? { - type: "Point", - coordinates: [ - parseFloat(pointString[1]), - parseFloat(pointString[2]) - ] - } : null; - } - - function lineStringParseUntagged(wkt) { - var lineString = wkt.match( /\s*\((.*)\)/ ), - coords = [], - pointStrings, - pointParts, - i = 0; - - if ( lineString && lineString.length > 1 ) { - pointStrings = lineString[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g ); - - for ( ; i < pointStrings.length; i++ ) { - pointParts = pointStrings[ i ].match( /\s*([\d\.\-]+)\s+([\d\.\-]+)\s*/ ); - coords[ i ] = [ parseFloat( pointParts[ 1 ] ), parseFloat( pointParts[ 2 ] ) ]; - } - - return { - type: "LineString", - coordinates: coords - }; - } else { - return null; - } - } - - function polygonParseUntagged(wkt) { - var polygon = wkt.match( /\s*\(\s*\((.*)\)\s*\)/ ), - coords = [], - pointStrings, - pointParts, - i = 0; - - if ( polygon && polygon.length > 1 ) { - pointStrings = polygon[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g ); - - for ( ; i < pointStrings.length; i++ ) { - pointParts = pointStrings[ i ].match( /\s*([\d\.\-]+)\s+([\d\.\-]+)\s*/ ); - coords[ i ] = [ parseFloat( pointParts[ 1 ] ), parseFloat( pointParts[ 2 ] ) ]; - } - - return { - type: "Polygon", - coordinates: [ coords ] - }; - } else { - return null; - } - } - - function multiPointParseUntagged(wkt) { - var multiSomething; - - if ( wkt.indexOf( "((" ) === -1 ) { - multiSomething = lineStringParseUntagged( wkt ); - } else { - multiSomething = multiLineStringParseUntagged( wkt ); - multiSomething.coordinates = $.geo._allCoordinates( multiSomething ); - } - - multiSomething.type = "MultiPoint"; - - return multiSomething; - } - - function multiLineStringParseUntagged(wkt) { - var lineStringsWkt = wkt.substr( 1, wkt.length - 2 ), - lineStrings = lineStringsWkt.split( ")),((" ), - i = 0, - multiLineString = { - type: "MultiLineString", - coordinates: [ ] - }; - - for ( ; i < lineStrings.length; i++ ) { - multiLineString.coordinates.push( lineStringParseUntagged( lineStrings[ i ] ).coordinates ); - } - - return multiLineString; - } - - function multiPolygonParseUntagged(wkt) { - var polygonsWkt = wkt.substr( 1, wkt.length - 2 ), - polygons = polygonsWkt.split( ")),((" ), - i = 0, - multiPolygon = { - type: "MultiPolygon", - coordinates: [ ] - }; - - for ( ; i < polygons.length; i++ ) { - multiPolygon.coordinates.push( polygonParseUntagged( polygons[ i ] ).coordinates ); - } - - return multiPolygon; - } - - function geometryCollectionParseUntagged( wkt ) { - var geometriesWkt = wkt.substr( 1, wkt.length - 2 ), - geometries = geometriesWkt.match( /\),[a-zA-Z]/g ), - geometryCollection = { - type: "GeometryCollection", - geometries: [ ] - }, - curGeom, - i = 0, curStart = 0, curLen; - - if ( geometries && geometries.length > 0 ) { - for ( ; i < geometries.length; i++ ) { - curLen = geometriesWkt.indexOf( geometries[ i ], curStart ) - curStart + 1; - curGeom = parse( geometriesWkt.substr( curStart, curLen ) ); - if ( curGeom ) { - geometryCollection.geometries.push( curGeom ); - } - curStart += curLen + 1; - } - - // one more - curGeom = parse( geometriesWkt.substr( curStart ) ); - if ( curGeom ) { - geometryCollection.geometries.push( curGeom ); - } - - return geometryCollection; - } else { - return null; - } - } - - function parse(wkt) { - wkt = $.trim(wkt); - - var typeIndex = wkt.indexOf( "(" ), - untagged = wkt.substr( typeIndex ); - - switch ($.trim(wkt.substr(0, typeIndex)).toUpperCase()) { - case "POINT": - return pointParseUntagged( untagged ); - - case "LINESTRING": - return lineStringParseUntagged( untagged ); - - case "POLYGON": - return polygonParseUntagged( untagged ); - - case "MULTIPOINT": - return multiPointParseUntagged( untagged ); - - case "MULTILINESTRING": - return multiLineStringParseUntagged( untagged ); - - case "MULTIPOLYGON": - return multiPolygonParseUntagged( untagged ); - - case "GEOMETRYCOLLECTION": - return geometryCollectionParseUntagged( untagged ); - - default: - return null; - } - } - - return { - stringify: stringify, - - parse: parse - }; - }()), - - // - // projection functions - // - - proj: (function () { - var halfPi = 1.5707963267948966192, - quarterPi = 0.7853981633974483096, - radiansPerDegree = 0.0174532925199432958, - degreesPerRadian = 57.295779513082320877, - semiMajorAxis = 6378137; - - return { - fromGeodeticPos: function (coordinate) { - return [ - semiMajorAxis * coordinate[ 0 ] * radiansPerDegree, - semiMajorAxis * Math.log(Math.tan(quarterPi + coordinate[ 1 ] * radiansPerDegree / 2)) - ]; - }, - - fromGeodetic: function ( coordinates ) { - if ( ! $.geo._isGeodetic( coordinates ) ) { - return coordinates; - } - - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - fromGeodeticPos = this.fromGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = fromGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = fromGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ], - i, j, k; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = fromGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - }, - - toGeodeticPos: function (coordinate) { - return [ - (coordinate[ 0 ] / semiMajorAxis) * degreesPerRadian, - (halfPi - 2 * Math.atan(1 / Math.exp(coordinate[ 1 ] / semiMajorAxis))) * degreesPerRadian - ]; - }, - - toGeodetic: function (coordinates) { - if ( $.geo._isGeodetic( coordinates ) ) { - return coordinates; - } - - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - toGeodeticPos = this.toGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = toGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = toGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ], - i, j, k; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = toGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - } - }; - }()), - - // - // service types (defined in other files) - // - - _serviceTypes: {} - }; -}(jQuery, this)); - -(function ($, undefined) { - var _ieVersion = ( function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - do { - div.innerHTML = ""; - } while ( a[0] ); - return v > 6 ? v : !v; - }() ); - - $.widget("geo.geographics", { - _$elem: undefined, - _options: {}, - _trueCanvas: true, - - _width: 0, - _height: 0, - - _$canvas: undefined, - _context: undefined, - - _blitcanvas: undefined, - _blitcontext: undefined, - - _$labelsContainer: undefined, - - options: { - style: { - borderRadius: "8px", - color: "#7f0000", - //fill: undefined, - fillOpacity: 0.2, - height: "8px", - opacity: 1, - //stroke: undefined, - strokeOpacity: 1, - strokeWidth: "2px", - visibility: "visible", - width: "8px" - } - }, - - _create: function () { - this._$elem = this.element; - this._options = this.options; - - this._$elem.css({ display: "inline-block", overflow: "hidden", textAlign: "left" }); - - if (this._$elem.css("position") == "static") { - this._$elem.css("position", "relative"); - } - - this._$elem.addClass( "geo-graphics" ); - - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width"), 10); - this._height = parseInt(this._$elem.css("height"), 10); - } - - var posCss = 'position:absolute;left:0;top:0;margin:0;padding:0;', - sizeCss = 'width:' + this._width + 'px;height:' + this._height + 'px;', - sizeAttr = 'width="' + this._width + '" height="' + this._height + '"'; - - if (document.createElement('canvas').getContext) { - this._$elem.append(''); - this._$canvas = this._$elem.children(':last'); - this._context = this._$canvas[0].getContext("2d"); - - this._blitcanvas = document.createElement( "canvas" ); - this._blitcanvas.width = this._width; - this._blitcanvas.height = this._height; - this._blitcontext = this._blitcanvas.getContext("2d"); - } else if (_ieVersion <= 8) { - this._trueCanvas = false; - this._$elem.append( '
              '); - this._$canvas = this._$elem.children(':last'); - - G_vmlCanvasManager.initElement(this._$canvas[0]); - this._context = this._$canvas[0].getContext("2d"); - this._$canvas.children().css({ backgroundColor: "transparent", width: this._width, height: this._height }); - } - - this._$elem.append('
              '); - this._$labelsContainer = this._$elem.children(':last'); - }, - - _setOption: function (key, value) { - if (key == "style") { - value = $.extend({}, this._options.style, value); - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - destroy: function () { - $.Widget.prototype.destroy.apply(this, arguments); - this._$elem.html(""); - this._$elem.removeClass( "geo-graphics" ); - }, - - clear: function () { - this._context.clearRect(0, 0, this._width, this._height); - this._$labelsContainer.html(""); - }, - - drawArc: function (coordinates, startAngle, sweepAngle, style) { - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0 && style.widthValue > 0 && style.heightValue > 0) { - var r = Math.min(style.widthValue, style.heightValue) / 2; - - startAngle = (startAngle * Math.PI / 180); - sweepAngle = (sweepAngle * Math.PI / 180); - - this._context.save(); - this._context.translate(coordinates[0], coordinates[1]); - if (style.widthValue > style.heightValue) { - this._context.scale(style.widthValue / style.heightValue, 1); - } else { - this._context.scale(1, style.heightValue / style.widthValue); - } - - this._context.beginPath(); - this._context.arc(0, 0, r, startAngle, sweepAngle, false); - - if (this._trueCanvas) { - this._context.restore(); - } - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - - if (!this._trueCanvas) { - this._context.restore(); - } - } - }, - - drawPoint: function (coordinates, style) { - style = this._getGraphicStyle(style); - if (style.widthValue == style.heightValue && style.heightValue == style.borderRadiusValue) { - this.drawArc(coordinates, 0, 360, style); - } else if (style.visibility != "hidden" && style.opacity > 0) { - style.borderRadiusValue = Math.min(Math.min(style.widthValue, style.heightValue) / 2, style.borderRadiusValue); - coordinates[0] -= style.widthValue / 2; - coordinates[1] -= style.heightValue / 2; - this._context.beginPath(); - this._context.moveTo(coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.lineTo(coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1]); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1], coordinates[0] + style.widthValue, coordinates[1] + style.borderRadiusValue); - this._context.lineTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue, coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.lineTo(coordinates[0] + style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1] + style.heightValue, coordinates[0], coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.lineTo(coordinates[0], coordinates[1] + style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1], coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.closePath(); - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - - this._context.stroke(); - } - } - }, - - drawLineString: function (coordinates, style) { - this._drawLines([coordinates], false, style); - }, - - drawPolygon: function (coordinates, style) { - if ( !this._trueCanvas || coordinates.length == 1 ) { - // either we don't have fancy rendering or there's no need for it (no holes) - this._drawLines( coordinates, true, style ); - } else { - if ( !coordinates || !coordinates.length || coordinates[ 0 ].length < 3 ) { - // this is not a Polygon or it doesn't have a proper outer ring - return; - } - - style = this._getGraphicStyle(style); - - var pixelBbox, i, j; - - if ( style.visibility != "hidden" && style.opacity > 0 ) { - this._blitcontext.clearRect(0, 0, this._width, this._height); - - if ( style.doFill ) { - if ( coordinates.length > 1 ) { - // stencil inner rings - this._blitcontext.globalCompositeOperation = "source-out"; - this._blitcontext.globalAlpha = 1; - - for ( i = 1; i < coordinates.length; i++ ) { - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ i ][ 0 ][ 0 ], coordinates[ i ][ 0 ][ 1 ] ); - for ( j = 1; j < coordinates[ i ].length; j++ ) { - this._blitcontext.lineTo( coordinates[ i ][ j ][ 0 ], coordinates[ i ][ j ][ 1 ] ); - } - this._blitcontext.closePath(); - - this._blitcontext.fill( ); - } - } - } - - // path outer ring - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ 0 ][ 0 ][ 0 ], coordinates[ 0 ][ 0 ][ 1 ] ); - - pixelBbox = [ coordinates[ 0 ][ 0 ][ 0 ] - style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 1 ] - style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 0 ] + style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 1 ] + style.strokeWidthValue ]; - - for ( i = 1; i < coordinates[ 0 ].length - 1; i++ ) { - this._blitcontext.lineTo( coordinates[ 0 ][ i ][ 0 ], coordinates[ 0 ][ i ][ 1 ] ); - - pixelBbox[ 0 ] = Math.min( coordinates[ 0 ][ i ][ 0 ] - style.strokeWidthValue, pixelBbox[ 0 ] ); - pixelBbox[ 1 ] = Math.min( coordinates[ 0 ][ i ][ 1 ] - style.strokeWidthValue, pixelBbox[ 1 ] ); - pixelBbox[ 2 ] = Math.max( coordinates[ 0 ][ i ][ 0 ] + style.strokeWidthValue, pixelBbox[ 2 ] ); - pixelBbox[ 3 ] = Math.max( coordinates[ 0 ][ i ][ 1 ] + style.strokeWidthValue, pixelBbox[ 3 ] ); - } - - this._blitcontext.closePath(); - - this._blitcontext.globalCompositeOperation = "source-out"; - if ( style.doFill ) { - // fill outer ring - this._blitcontext.fillStyle = style.fill; - this._blitcontext.globalAlpha = style.opacity * style.fillOpacity; - this._blitcontext.fill( ); - } - - this._blitcontext.globalCompositeOperation = "source-over"; - if ( style.doStroke ) { - // stroke outer ring - this._blitcontext.lineCap = this._blitcontext.lineJoin = "round"; - this._blitcontext.lineWidth = style.strokeWidthValue; - this._blitcontext.strokeStyle = style.stroke; - - this._blitcontext.globalAlpha = style.opacity * style.strokeOpacity; - this._blitcontext.stroke( ); - - if ( coordinates.length > 1 ) { - // stroke inner rings - for ( i = 1; i < coordinates.length; i++ ) { - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ i ][ 0 ][ 0 ], coordinates[ i ][ 0 ][ 1 ] ); - for ( j = 1; j < coordinates[ i ].length; j++ ) { - this._blitcontext.lineTo( coordinates[ i ][ j ][ 0 ], coordinates[ i ][ j ][ 1 ] ); - } - this._blitcontext.closePath(); - - this._blitcontext.stroke( ); - } - } - } - - // blit - pixelBbox[ 0 ] = Math.max( pixelBbox[ 0 ], 0 ); - pixelBbox[ 1 ] = Math.max( pixelBbox[ 1 ], 0 ); - pixelBbox[ 2 ] = Math.min( pixelBbox[ 2 ], this._width ); - pixelBbox[ 3 ] = Math.min( pixelBbox[ 3 ], this._height ); - - this._context.drawImage(this._blitcanvas, pixelBbox[ 0 ], pixelBbox[ 1 ], pixelBbox[ 2 ] - pixelBbox[ 0 ], pixelBbox[ 3 ] - pixelBbox[ 1 ], pixelBbox[ 0 ], pixelBbox[ 1 ], pixelBbox[ 2 ] - pixelBbox[ 0 ], pixelBbox[ 3 ] - pixelBbox[ 1 ] ); - } - } - }, - - drawBbox: function (bbox, style) { - this._drawLines([[ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ]], true, style); - }, - - drawLabel: function( coordinates, label ) { - this._$labelsContainer.append( '
              ' + label + '
              '); - }, - - resize: function( ) { - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width"), 10); - this._height = parseInt(this._$elem.css("height"), 10); - } - - if ( this._trueCanvas ) { - this._$canvas[0].width = this._width; - this._$canvas[0].height = this._height; - } else { - } - - this._$labelsContainer.css( { - width: this._width, - height: this._height - } ); - }, - - _getGraphicStyle: function (style) { - function safeParse(value) { - value = parseInt(value, 10); - return (+value + '') === value ? +value : value; - } - - style = $.extend({}, this._options.style, style); - style.borderRadiusValue = safeParse(style.borderRadius); - style.fill = style.fill || style.color; - style.doFill = style.fill && style.fillOpacity > 0; - style.stroke = style.stroke || style.color; - style.strokeWidthValue = safeParse(style.strokeWidth); - style.doStroke = style.stroke && style.strokeOpacity > 0 && style.strokeWidthValue > 0; - style.widthValue = safeParse(style.width); - style.heightValue = safeParse(style.height); - return style; - }, - - _drawLines: function (coordinates, close, style) { - if (!coordinates || !coordinates.length || coordinates[0].length < 2) { - return; - } - - var i, j; - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0) { - this._context.beginPath(); - - for (i = 0; i < coordinates.length; i++) { - this._context.moveTo(coordinates[i][0][0], coordinates[i][0][1]); - for (j = 1; j < coordinates[i].length; j++) { - this._context.lineTo(coordinates[i][j][0], coordinates[i][j][1]); - } - } - - if (close) { - this._context.closePath(); - } - - if (close && style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineCap = this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - } - } - }); -}(jQuery)); - - -(function ($, undefined) { - var _widgetIdSeed = 0, - _ieVersion = ( function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - do { - div.innerHTML = ""; - } while ( a[0] ); - return v > 6 ? v : !v; - }() ), - - _defaultOptions = { - bbox: [-180, -85, 180, 85], - bboxMax: [-180, -85, 180, 85], - center: [0, 0], - cursors: { - "static": "default", - pan: "url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move", - zoom: "crosshair", - dragBox: "crosshair", - dragCircle: "crosshair", - drawPoint: "crosshair", - drawLineString: "crosshair", - drawPolygon: "crosshair", - measureLength: "crosshair", - measureArea: "crosshair" - }, - measureLabels: { - length: "{{:length.toFixed( 2 )}} m", - area: "{{:area.toFixed( 2 )}} sq m" - }, - drawStyle: {}, - shapeStyle: {}, - mode: "pan", - pannable: true, - scroll: "default", - shift: "default", - services: [ - { - "class": "osm", - type: "tiled", - src: function (view) { - return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png"; - }, - attr: "Tiles Courtesy of MapQuest " - } - ], - tilingScheme: { - tileWidth: 256, - tileHeight: 256, - levels: 18, - basePixelSize: 156543.03392799936, - origin: [-20037508.342787, 20037508.342787] - }, - axisLayout: "map", - zoom: 0, - zoomMin: 0, - zoomMax: Number.POSITIVE_INFINITY, - pixelSize: 0 - }; - - $.widget("geo.geomap", { - // private widget members - _$elem: undefined, //< map div for maps, service div for services - _map: undefined, //< only defined in services - _created: false, - _createdGraphics: false, - _widgetId: 0, - _tmplLengthId: "", - _tmplAreaId: "", - - _contentBounds: {}, - - _$resizeContainer: undefined, //< all elements that should match _contentBounds' size - - _$eventTarget: undefined, - _$contentFrame: undefined, - _$existingChildren: undefined, - _$attrList: undefined, - _$servicesContainer: undefined, - _$shapesContainers: undefined, //< all shapesContainer divs (map only) - - _$panContainer: undefined, //< all non-service elements that move while panning - _$shapesContainer: undefined, //< just "our" shapesContainer div (map & service) - _$drawContainer: undefined, - _$measureContainer: undefined, - _$measureLabel: undefined, - - _dpi: 96, - - _currentServices: [], //< internal copy - - _center: undefined, - _pixelSize: undefined, - _centerMax: undefined, - _pixelSizeMax: undefined, - - _userGeodetic: true, - - _centerInteractive: undefined, - _pixelSizeInteractive: undefined, - _timeoutInteractive: null, - _triggerInteractive: false, - - _loadCount: 0, - - _wheelTimeout: null, - _wheelLevel: 0, - - _zoomFactor: 2, //< determines what a zoom level means - - _fullZoomFactor: 2, //< interactiveScale factor needed to zoom a whole level - _partialZoomFactor: 1.18920711500273, //< interactiveScale factor needed to zoom a fraction of a level (the fourth root of 2) - - _mouseDown: undefined, - _inOp: undefined, - _toolPan: undefined, - _shiftDown: undefined, - _anchor: undefined, - _current: undefined, - _downDate: undefined, - _moveDate: undefined, - _clickDate: undefined, - _lastMove: undefined, - _lastDrag: undefined, - - _windowHandler: null, - _resizeTimeout: null, - - _panning: undefined, - _velocity: undefined, - _friction: undefined, - - _supportTouch: undefined, - _softDblClick: undefined, - _isTap: undefined, - _isDbltap: undefined, - - _isMultiTouch: undefined, - _multiTouchAnchor: [], //< TouchList - _multiTouchAnchorBbox: undefined, //< bbox - _multiTouchCurrentBbox: undefined, //< bbox - - _drawTimeout: null, //< used in drawPoint mode so we don't send two shape events on dbltap - _drawPixels: [], //< an array of coordinate arrays for drawing lines & polygons, in pixel coordinates - _drawCoords: [], - - _graphicShapes: [], //< an array of objects containing style object refs & GeoJSON object refs - - _initOptions: {}, - - _options: {}, - - options: $.extend({}, _defaultOptions), - - _createWidget: function (options, element) { - this._$elem = $(element); - - if (this._$elem.is(".geo-service")) { - this._graphicShapes = []; - $.Widget.prototype._createWidget.apply(this, arguments); - return; - } - - this._widgetId = _widgetIdSeed++; - this._tmplLengthId = "geoMeasureLength" + this._widgetId; - this._tmplAreaId = "geoMeasureArea" + this._widgetId; - - this._$elem.addClass("geo-map").css( { - webkitTransform: "translateZ(0)" - } ); - - - this._initOptions = options || {}; - - this._forcePosition(this._$elem); - - this._$elem.css("text-align", "left"); - - var size = this._findMapSize(); - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left"), 10), - y: parseInt(this._$elem.css("padding-top"), 10), - width: size["width"], - height: size["height"] - }; - - this._createChildren(); - - this._center = [ 0, 0 ]; - this._centerMax = [ 0, 0 ]; - this._centerInteractive = [ 0, 0 ]; - - this.options["pixelSize"] = this._pixelSize = this._pixelSizeMax = 156543.03392799936; - - this._mouseDown = - this._inOp = - this._toolPan = - this._shiftDown = - this._panning = - this._isTap = - this._isDbltap = false; - - this._anchor = [ 0, 0 ]; - this._current = [ 0, 0 ]; - this._lastMove = [ 0, 0 ]; - this._lastDrag = [ 0, 0 ]; - this._velocity = [ 0, 0 ]; - - this._friction = [0.8, 0.8]; - - this._downDate = - this._moveDate = - this._clickDate = 0; - - this._drawPixels = []; - this._drawCoords = []; - this._graphicShapes = []; - - - $.Widget.prototype._createWidget.apply(this, arguments); - }, - - _create: function () { - this._options = this.options; - - if (this._$elem.is(".geo-service")) { - this._map = this._$elem.data( "geoMap" ); - this._$elem.data( "geoService", this ); - return; - } - - this._map = this; - - this._supportTouch = "ontouchend" in document; - this._softDblClick = this._supportTouch || _ieVersion == 7; - - var geomap = this, - touchStartEvent = this._supportTouch ? "touchstart" : "mousedown", - touchStopEvent = this._supportTouch ? "touchend touchcancel" : "mouseup", - touchMoveEvent = this._supportTouch ? "touchmove" : "mousemove"; - - $(document).keydown($.proxy(this._document_keydown, this)); - - this._$eventTarget.dblclick($.proxy(this._eventTarget_dblclick, this)); - - this._$eventTarget.bind(touchStartEvent, $.proxy(this._eventTarget_touchstart, this)); - - var dragTarget = (this._$eventTarget[0].setCapture) ? this._$eventTarget : $(document); - dragTarget.bind(touchMoveEvent, $.proxy(this._dragTarget_touchmove, this)); - dragTarget.bind(touchStopEvent, $.proxy(this._dragTarget_touchstop, this)); - - this._$eventTarget.mousewheel($.proxy(this._eventTarget_mousewheel, this)); - - this._windowHandler = function () { - if (geomap._resizeTimeout) { - clearTimeout(geomap._resizeTimeout); - } - geomap._resizeTimeout = setTimeout(function () { - if (geomap._created) { - geomap._$elem.geomap( "resize", true ); - } - }, 500); - }; - - $(window).resize(this._windowHandler); - - this._$drawContainer.geographics({ style: this._initOptions.drawStyle || {} }); - this._options["drawStyle"] = this._$drawContainer.geographics("option", "style"); - - this._$shapesContainer.geographics( { style: this._initOptions.shapeStyle || { } } ); - this._createdGraphics = true; - - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - - if (this._initOptions) { - // always init tilingScheme right away, even if it's null - if ( this._initOptions.tilingScheme !== undefined ) { - this._setOption("tilingScheme", this._initOptions.tilingScheme || null, false); - } - - if ( this._initOptions.services ) { - // jQuery UI Widget Factory merges user services with our default, we want to clobber the default - this._options[ "services" ] = $.merge( [ ], this._initOptions.services ); - } - if (this._initOptions.bboxMax) { - this._setOption("bboxMax", this._initOptions.bboxMax, false); - this._setOption("bbox", this._initOptions.bboxMax, false); - } - if (this._initOptions.zoomMin !== undefined) { - this._setOption("zoomMin", this._initOptions.zoomMin, false); - } - if (this._initOptions.zoomMax !== undefined) { - this._setOption("zoomMax", this._initOptions.zoomMax, false); - } - if (this._initOptions.bbox) { - this._setOption("bbox", this._initOptions.bbox, false); - } - if (this._initOptions.center) { - this._setOption("center", this._initOptions.center, false); - } - if (this._initOptions.zoom !== undefined) { - this._setOption("zoom", this._initOptions.zoom, false); - } - } - - $.templates( this._tmplLengthId, this._options[ "measureLabels" ].length ); - $.templates( this._tmplAreaId, this._options[ "measureLabels" ].area ); - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._createServices(); - this._refresh(); - - this._created = true; - }, - - _setOption: function (key, value, refresh) { - if ( key == "pixelSize" ) { - return; - } - - refresh = (refresh === undefined || refresh); - - if ( this._$elem.is( ".geo-map" ) ) { - this._panFinalize(); - } - - var center, pixelSize, bbox, zoom; - - switch (key) { - case "bbox": - if ( this._created ) { - this._clearInteractiveTimeout( ); - } - - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2]; - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height); - - // clamp to zoom - zoom = this._getZoom( center, pixelSize ); - - if ( this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - if ( this._created ) { - this._setInteractiveCenterAndSize( center, pixelSize ); - this._setInteractiveTimeout( false ); - } else { - this._setCenterAndSize( center, pixelSize, false, refresh ); - } - - value = this._getBbox( center, pixelSize ); - break; - - case "bboxMax": - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - break; - - case "center": - if ( this._created ) { - this._clearInteractiveTimeout( ); - } - - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - if ( this._created ) { - this._setInteractiveCenterAndSize( value, this._pixelSize ); - this._setInteractiveTimeout( false ); - } else { - this._setCenterAndSize( value, this._pixelSize, false, refresh ); - } - break; - - case "measureLabels": - value = $.extend( this._options[ "measureLabels" ], value ); - - - $.templates( this._tmplLengthId, this._options[ "measureLabels" ].length ); - $.templates( this._tmplAreaId, this._options[ "measureLabels" ].area ); - - break; - - case "drawStyle": - if (this._$drawContainer) { - this._$drawContainer.geographics("option", "style", value); - value = this._$drawContainer.geographics("option", "style"); - } - break; - - case "shapeStyle": - if ( this._$elem.is( ".geo-service" ) && !this._createdGraphics ) { - this._createServiceGraphics( ); - } - - if ( this._createdGraphics ) { - this._$shapesContainer.geographics("option", "style", value); - value = this._$shapesContainer.geographics("option", "style"); - } - break; - - case "mode": - this._resetDrawing( ); - this._$eventTarget.css("cursor", this._options["cursors"][value]); - break; - - case "zoom": - if ( this._created ) { - this._setZoom(value, false, refresh); - } else { - value = Math.max( value, 0 ); - this._setCenterAndSize( this._center, this._getPixelSize( value ), false, refresh ); - } - break; - } - - $.Widget.prototype._setOption.apply(this, arguments); - - switch ( key ) { - case "bbox": - case "center": - if ( this._userGeodetic ) { - this._options[ "bbox" ] = $.geo.proj.toGeodetic( this._options[ "bbox" ] ); - this._options[ "center" ] = $.geo.proj.toGeodetic( this._center ); - } - break; - - case "tilingScheme": - if ( value !== null ) { - this._pixelSizeMax = this._getPixelSize( 0 ); - this._centerMax = [ - value.origin[ 0 ] + this._pixelSizeMax * value.tileWidth / 2, - value.origin[ 1 ] + this._pixelSizeMax * value.tileHeight / 2 - ]; - } - break; - - case "bboxMax": - if ( $.geo.proj && $.geo._isGeodetic( value ) ) { - bbox = $.geo.proj.fromGeodetic( value ); - } else { - bbox = value; - } - - this._centerMax = $.geo.center( bbox ); - this._pixelSizeMax = Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - break; - - case "services": - this._createServices(); - if (refresh) { - this._refresh(); - } - break; - - case "shapeStyle": - if ( refresh && this._createdGraphics ) { - this._$shapesContainer.geographics("clear"); - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - break; - } - }, - - destroy: function () { - if ( this._$elem.is(".geo-service") ) { - if ( this._createdGraphics ) { - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._createdGraphics = false; - } - } else { - clearTimeout( this._timeoutInteractive ); - this._timeoutInteractive = null; - - this._created = false; - - $(window).unbind("resize", this._windowHandler); - - for ( var i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap("destroy"); - $.geo["_serviceTypes"][this._currentServices[i].type].destroy(this, this._$servicesContainer, this._currentServices[i]); - } - - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._createdGraphics = false; - - this._$drawContainer.geographics("destroy"); - this._$drawContainer = undefined; - - this._$existingChildren.detach(); - this._$elem.html(""); - this._$elem.append(this._$existingChildren); - this._$elem.removeClass("geo-map"); - } - - $.Widget.prototype.destroy.apply(this, arguments); - }, - - toMap: function (p) { - p = this._toMap(p); - return this._userGeodetic ? $.geo.proj.toGeodetic(p) : p; - }, - - toPixel: function ( p, _center /* Internal Use Only */, _pixelSize /* Internal Use Only */ ) { - return this._toPixel( $.geo.proj ? $.geo.proj.fromGeodetic( p ) : p, _center, _pixelSize ); - }, - - opacity: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "opacity", value, this._$elem ); - } else { - if ( value >= 0 || value <= 1 ) { - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - service.style.opacity = value; - - // update the original service object's style property - service.serviceObject.style = $.extend( { }, service.serviceObject.style, service.style ); - - $.geo[ "_serviceTypes" ][ service.type ].opacity( this, service ); - } - } - } - } - }, - - toggle: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "toggle", value, this._$elem ); - } else { - - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - if ( value === undefined ) { - // toggle visibility - value = ( service.style.visibility !== "visible" ); - } - - service.style.visibility = ( value ? "visible" : "hidden" ); - - // update the original service object's style property - service.serviceObject.style = $.extend( { }, service.serviceObject.style, service.style ); - - service.serviceContainer.toggle( value ); - - if ( value ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service ); - } - } - } - } - }, - - zoom: function (numberOfLevels) { - if (numberOfLevels !== null) { - this._setZoom(this._options["zoom"] + numberOfLevels, false, true); - } - }, - - refresh: function ( force, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "refresh", force, this._$elem ); - } else { - this._refresh( force, _serviceContainer ); - } - }, - - resize: function ( _trigger /* Internal Use Only */ ) { - var size = this._findMapSize(), - dx = size["width"]/2 - this._contentBounds.width/2, - dy = size["height"]/2 - this._contentBounds.height/2, - i; - - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left"), 10), - y: parseInt(this._$elem.css("padding-top"), 10), - width: size["width"], - height: size["height"] - }; - - this._$resizeContainer.css( { - width: size["width"], - height: size["height"] - } ); - - for (i = 0; i < this._currentServices.length; i++) { - $.geo["_serviceTypes"][this._currentServices[i].type].resize(this, this._currentServices[i]); - } - - this._$elem.find( ".geo-graphics" ).css( { - width: size["width"], - height: size["height"] - }).geographics( "resize" ); - - for (i = 0; i < this._drawPixels.length; i++) { - this._drawPixels[i][0] += dx; - this._drawPixels[i][1] += dy; - } - - this._setCenterAndSize(this._center, this._pixelSize, _trigger, true); - }, - - append: function ( shape, style, label, refresh ) { - if ( shape && ( $.isPlainObject( shape ) || ( $.isArray( shape ) && shape.length > 0 ) ) ) { - if ( !this._createdGraphics ) { - this._createServiceGraphics( ); - } - - var shapes, arg, i, realStyle, realLabel, realRefresh; - - if ( $.isArray( shape ) ) { - shapes = shape; - } else if ( shape.type == "FeatureCollection" ) { - shapes = shape.features; - } else { - shapes = [ shape ]; - } - - for ( i = 1; i < arguments.length; i++ ) { - arg = arguments[ i ]; - - if ( typeof arg === "object" ) { - realStyle = arg; - } else if ( typeof arg === "number" || typeof arg === "string" ) { - realLabel = arg; - } else if ( typeof arg === "boolean" ) { - realRefresh = arg; - } - } - - for ( i = 0; i < shapes.length; i++ ) { - if ( shapes[ i ].type != "Point" ) { - var bbox = $.geo.bbox( shapes[ i ] ); - if ( $.geo.proj && $.geo._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - $.data( shapes[ i ], "geoBbox", bbox ); - } - - this._graphicShapes.push( { - shape: shapes[ i ], - style: realStyle, - label: realLabel - } ); - } - - if ( realRefresh === undefined || realRefresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - } - } - }, - - empty: function ( refresh ) { - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - $.removeData( this._graphicShapes[ i ].shape, "geoBbox" ); - } - - this._graphicShapes = []; - - if ( refresh === undefined || refresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - } - }, - - find: function ( selector, pixelTolerance ) { - var isPoint = $.isPlainObject( selector ), - searchPixel = isPoint ? this._map.toPixel( selector.coordinates ) : undefined, - mapTol = this._map._pixelSize * pixelTolerance, - result = [], - graphicShape, - geometries, - curGeom, - i = 0; - - for ( ; i < this._graphicShapes.length; i++ ) { - graphicShape = this._graphicShapes[ i ]; - - if ( isPoint ) { - if ( graphicShape.shape.type == "Point" ) { - if ( $.geo.distance( graphicShape.shape, selector ) <= mapTol ) { - result.push( graphicShape.shape ); - } - } else { - var bbox = $.data( graphicShape.shape, "geoBbox" ), - bboxPolygon = { - type: "Polygon", - coordinates: [ [ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ] ] - }, - projectedPoint = { - type: "Point", - coordinates: $.geo.proj && $.geo._isGeodetic( selector.coordinates ) ? $.geo.proj.fromGeodetic( selector.coordinates ) : selector.coordinates - }; - - if ( $.geo.distance( bboxPolygon, projectedPoint, true ) <= mapTol ) { - geometries = $.geo._flatten( graphicShape.shape ); - for ( curGeom = 0; curGeom < geometries.length; curGeom++ ) { - if ( $.geo.distance( geometries[ curGeom ], selector ) <= mapTol ) { - result.push( graphicShape.shape ); - break; - } - } - } - } - } else { - result.push( graphicShape.shape ); - } - } - - if ( this._$elem.is( ".geo-map" ) ) { - this._$elem.find( ".geo-service" ).each( function( ) { - result = $.merge( result, $( this ).geomap( "find", selector, pixelTolerance ) ); - } ); - } - - return result; - }, - - remove: function ( shape, refresh ) { - if ( shape && ( $.isPlainObject( shape ) || ( $.isArray( shape ) && shape.length > 0 ) ) ) { - var shapes = $.isArray( shape ) ? shape : [ shape ], - rest; - - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - if ( $.inArray( this._graphicShapes[ i ].shape, shapes ) >= 0 ) { - $.removeData( shape, "geoBbox" ); - rest = this._graphicShapes.slice( i + 1 ); - this._graphicShapes.length = i; - this._graphicShapes.push.apply( this._graphicShapes, rest ); - i--; - } - } - - if ( refresh === undefined || refresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - } - } - }, - - _getBbox: function (center, pixelSize) { - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - // calculate the internal bbox - var halfWidth = this._contentBounds[ "width" ] / 2 * pixelSize, - halfHeight = this._contentBounds[ "height" ] / 2 * pixelSize; - return [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - }, - - _setBbox: function (value, trigger, refresh) { - var center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2], - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height), - zoom = this._getZoom( center, pixelSize ); - - // clamp to zoom - if ( this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - this._setInteractiveCenterAndSize( center, pixelSize ); - this._interactiveTransform( ); - }, - - _getBboxMax: function () { - // calculate the internal bboxMax - var halfWidth = this._contentBounds["width"] / 2 * this._pixelSizeMax, - halfHeight = this._contentBounds["height"] / 2 * this._pixelSizeMax; - return [this._centerMax[0] - halfWidth, this._centerMax[1] - halfHeight, this._centerMax[0] + halfWidth, this._centerMax[1] + halfHeight]; - }, - - _getCenter: function () { - return this._center; - }, - - _getContentBounds: function () { - return this._contentBounds; - }, - - _getServicesContainer: function () { - return this._$servicesContainer; - }, - - _getZoom: function ( center, pixelSize ) { - // calculate the internal zoom level, vs. public zoom property - // this does not take zoomMin or zoomMax into account - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var tilingScheme = this._options["tilingScheme"]; - if ( tilingScheme ) { - if ( tilingScheme.pixelSizes ) { - var roundedPixelSize = Math.floor(pixelSize * 1000), - levels = tilingScheme.pixelSizes.length, - i = levels - 1; - - for ( ; i >= 0; i-- ) { - if ( Math.floor( tilingScheme.pixelSizes[ i ] * 1000 ) >= roundedPixelSize ) { - return i; - } - } - - return 0; - } else { - return Math.round( Math.log( tilingScheme.basePixelSize / pixelSize) / Math.log( 2 ) ); - } - } else { - var ratio = this._contentBounds["width"] / this._contentBounds["height"], - bbox = $.geo.reaspect( this._getBbox( center, pixelSize ), ratio, true ), - bboxMax = $.geo.reaspect(this._getBboxMax(), ratio, true); - - return Math.round( Math.log($.geo.width(bboxMax, true) / $.geo.width(bbox, true)) / Math.log(this._zoomFactor) ); - } - }, - - _setZoom: function ( value, trigger, refresh ) { - // set the map widget's zoom, taking zoomMin and zoomMax into account - this._clearInteractiveTimeout( ); - - value = Math.min( Math.max( value, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ); - this._setInteractiveCenterAndSize( this._center, this._getPixelSize( value ) ); - this._interactiveTransform( ); - - this._setInteractiveTimeout( trigger ); - }, - - _createChildren: function () { - this._$existingChildren = this._$elem.children(); - - this._forcePosition(this._$existingChildren); - - this._$existingChildren.detach().css( { - mozUserSelect: "none" - } ); - - - var contentSizeCss = "width:" + this._contentBounds["width"] + "px; height:" + this._contentBounds["height"] + "px; margin:0; padding:0;", - contentPosCss = "position:absolute; left:0; top:0;"; - - this._$elem.prepend('
              '); - this._$eventTarget = this._$contentFrame = this._$elem.children(':first'); - - this._$contentFrame.append('
              '); - this._$servicesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
              '); - this._$shapesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append( '
                ' ); - this._$attrList = this._$contentFrame.children( ":last" ); - - this._$contentFrame.append('
                '); - this._$drawContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
                '); - this._$measureContainer = this._$contentFrame.children(':last'); - this._$measureLabel = this._$measureContainer.children(); - - this._$panContainer = $( [ this._$shapesContainer[ 0 ], this._$drawContainer[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$resizeContainer = $( [ this._$contentFrame[ 0 ], this._$servicesContainer[ 0 ], this._$eventTarget[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$contentFrame.append(this._$existingChildren); - - if ( ! $("#geo-measure-style").length ) { - $("head").prepend( '' ); - } - }, - - _createServices: function () { - var service, i; - - for ( i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap( "destroy" ); - $.geo[ "_serviceTypes" ][ this._currentServices[ i ].type ].destroy( this, this._$servicesContainer, this._currentServices[ i ] ); - } - - this._currentServices = [ ]; - this._$servicesContainer.html( "" ); - this._$attrList.html( "" ); - - for ( i = 0; i < this._options[ "services" ].length; i++ ) { - service = this._currentServices[ i ] = $.extend( { }, this._options[ "services" ][ i ] ); - - // keep a reference to the original - service.serviceObject = this._options[ "services" ][ i ]; - - // default the service style property on our copy - service.style = $.extend( { - visibility: "visible", - opacity: 1 - }, service.style ); - - var idString = service.id ? ' id="' + service.id + '"' : "", - classString = 'class="geo-service ' + ( service["class"] ? service["class"] : '' ) + '"', - scHtml = '
                ', - servicesContainer; - - this._$servicesContainer.append( scHtml ); - serviceContainer = this._$servicesContainer.children( ":last" ); - service.serviceContainer = serviceContainer; - - $.geo[ "_serviceTypes" ][ service.type ].create( this, serviceContainer, service, i ); - - serviceContainer.data( "geoMap", this ).geomap(); - - if ( service.attr ) { - this._$attrList.append( '
              • ' + service.attr + '
              • ' ); - } - } - - // start with our map-level shapesContainer - this._$shapesContainers = this._$shapesContainer; - - this._$attrList.find( "a" ).css( { - position: "relative", - zIndex: 100 - } ); - }, - - _createServiceGraphics: function( ) { - // only called in the context of a service-level geomap - var $contentFrame = this._$elem.closest( ".geo-content-frame" ); - this._$elem.append('
                '); - this._$shapesContainer = this._$elem.children(':last'); - - this._map._$shapesContainers = this._map._$shapesContainers.add( this._$shapesContainer ); - - this._$shapesContainer.geographics( ); - this._createdGraphics = true; - - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - }, - - _refreshDrawing: function ( ) { - this._$drawContainer.geographics("clear"); - - if ( this._drawPixels.length > 0 ) { - var mode = this._options[ "mode" ], - pixels = this._drawPixels, - coords = this._drawCoords, - label, - labelShape, - labelPixel, - widthOver, - heightOver; - - switch ( mode ) { - case "measureLength": - mode = "drawLineString"; - labelShape = { - type: "LineString", - coordinates: coords - }; - label = $.render[ this._tmplLengthId ]( { length: $.geo.length( labelShape, true ) } ); - labelPixel = $.merge( [], pixels[ pixels.length - 1 ] ); - break; - - case "measureArea": - mode = "drawPolygon"; - - labelShape = { - type: "Polygon", - coordinates: [ $.merge( [ ], coords ) ] - }; - labelShape.coordinates[ 0 ].push( coords[ 0 ] ); - - label = $.render[ this._tmplAreaId ]( { area: $.geo.area( labelShape, true ) } ); - labelPixel = this._toPixel( $.geo.centroid( labelShape ).coordinates ); - pixels = [ pixels ]; - break; - - case "drawPolygon": - pixels = [ pixels ]; - break; - } - - this._$drawContainer.geographics( mode, pixels ); - - if ( label ) { - this._$measureLabel.html( label ); - - widthOver = this._contentBounds.width - ( this._$measureLabel.outerWidth( true ) + labelPixel[ 0 ] ); - heightOver = this._contentBounds.height - ( this._$measureLabel.outerHeight( true ) + labelPixel[ 1 ] ); - - if ( widthOver < 0 ) { - labelPixel[ 0 ] += widthOver; - } - - if ( heightOver < 0 ) { - labelPixel[ 1 ] += heightOver; - } - - this._$measureLabel.css( { - left: Math.max( labelPixel[ 0 ], 0 ), - top: Math.max( labelPixel[ 1 ], 0 ) - } ).show(); - } - } - }, - - _resetDrawing: function () { - this._drawPixels = []; - this._drawCoords = []; - this._$drawContainer.geographics("clear"); - this._$measureLabel.hide(); - }, - - _refreshShapes: function (geographics, shapes, styles, labels, center, pixelSize) { - var i, mgi, - shape, - shapeBbox, - style, - label, - hasLabel, - labelPixel, - bbox = this._map._getBbox(center, pixelSize); - - for (i = 0; i < shapes.length; i++) { - shape = shapes[i].shape || shapes[i]; - shape = shape.geometry || shape; - shapeBbox = $.data(shape, "geoBbox"); - - if ( shapeBbox && $.geo._bboxDisjoint( bbox, shapeBbox ) ) { - continue; - } - - style = $.isArray(styles) ? styles[i].style : styles; - label = $.isArray(labels) ? labels[i].label : labels; - hasLabel = ( label !== undefined ); - labelPixel = undefined; - - switch (shape.type) { - case "Point": - labelPixel = this._map.toPixel( shape.coordinates, center, pixelSize ); - this._$shapesContainer.geographics("drawPoint", labelPixel, style); - break; - case "LineString": - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.pointAlong( shape, 0.5 ).coordinates, center, pixelSize ); - } - break; - case "Polygon": - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPoint": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPoint", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiLineString": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPolygon": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - - case "GeometryCollection": - this._refreshShapes(geographics, shape.geometries, style, label, center, pixelSize); - break; - } - - if ( hasLabel && labelPixel ) { - this._$shapesContainer.geographics( "drawLabel", labelPixel, label ); - } - } - }, - - _findMapSize: function () { - // really, really attempt to find a size for this thing - // even if it's hidden (look at parents) - var size = { width: 0, height: 0 }, - sizeContainer = this._$elem; - - while (sizeContainer.size() && !(size["width"] > 0 && size["height"] > 0)) { - size = { width: sizeContainer.width(), height: sizeContainer.height() }; - if (size["width"] <= 0 || size["height"] <= 0) { - size = { width: parseInt(sizeContainer.css("width"), 10), height: parseInt(sizeContainer.css("height"), 10) }; - } - sizeContainer = sizeContainer.parent(); - } - return size; - }, - - _forcePosition: function (elem) { - var cssPosition = elem.css("position"); - if (cssPosition != "relative" && cssPosition != "absolute" && cssPosition != "fixed") { - elem.css("position", "relative"); - } - }, - - _getPixelSize: function ( zoom ) { - var tilingScheme = this._options["tilingScheme"]; - if (tilingScheme !== null) { - if (zoom === 0) { - return tilingScheme.pixelSizes ? tilingScheme.pixelSizes[0] : tilingScheme.basePixelSize; - } - - zoom = Math.round(zoom); - zoom = Math.max(zoom, 0); - var levels = tilingScheme.pixelSizes ? tilingScheme.pixelSizes.length : tilingScheme.levels; - zoom = Math.min(zoom, levels - 1); - - if ( tilingScheme.pixelSizes ) { - return tilingScheme.pixelSizes[zoom]; - } else { - return tilingScheme.basePixelSize / Math.pow(2, zoom); - } - } else { - var bbox = $.geo.scaleBy( this._getBboxMax(), 1 / Math.pow( this._zoomFactor, zoom ), true ); - return Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - } - }, - - _getZoomCenterAndSize: function ( anchor, zoomDelta, full ) { - var zoomFactor = ( full ? this._fullZoomFactor : this._partialZoomFactor ), - scale = Math.pow( zoomFactor, -zoomDelta ), - pixelSize = this._pixelSizeInteractive * scale, - zoom = this._getZoom(this._centerInteractive, pixelSize); - - // clamp to zoom - if ( full && this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoomDelta < 0 && zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._pixelSizeInteractive; - } else if ( zoomDelta > 0 && zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._pixelSizeInteractive; - } - } - - var ratio = pixelSize / this._pixelSizeInteractive, - anchorMapCoord = this._toMap( anchor, this._centerInteractive, this._pixelSizeInteractive ), - centerDelta = [(this._centerInteractive[0] - anchorMapCoord[0]) * ratio, (this._centerInteractive[1] - anchorMapCoord[1]) * ratio], - scaleCenter = [anchorMapCoord[0] + centerDelta[0], anchorMapCoord[1] + centerDelta[1]]; - - return { pixelSize: pixelSize, center: scaleCenter }; - }, - - _mouseWheelFinish: function ( refresh ) { - this._wheelTimeout = null; - - if (this._wheelLevel !== 0) { - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, this._options[ "tilingScheme" ] !== null ); - - this._wheelLevel = 0; - } else if ( refresh ) { - this._refresh(); - } - }, - - _panFinalize: function () { - if (this._panning) { - this._velocity = [0, 0]; - - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - image = this._options[ "axisLayout" ] === "image", - dxMap = -dx * this._pixelSize, - dyMap = ( image ? -1 : 1 ) * dy * this._pixelSize; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._inOp = false; - this._anchor = this._current; - this._mouseDown = this._toolPan = this._panning = false; - } - }, - - _panMove: function () { - if ( ! this._options[ "pannable" ] ) { - return; - } - - var dx = this._current[0] - this._lastDrag[0], - dy = this._current[1] - this._lastDrag[1], - i = 0, - service, - translateObj; - - if (this._toolPan || dx > 3 || dx < -3 || dy > 3 || dy < -3) { - if (!this._toolPan) { - this._toolPan = true; - this._$eventTarget.css("cursor", this._options["cursors"]["pan"]); - } - - if (this._mouseDown) { - this._velocity = [dx, dy]; - } - - if (dx !== 0 || dy !== 0) { - this._panning = true; - this._lastDrag = this._current; - - this._centerInteractive[ 0 ] -= ( dx * this._pixelSizeInteractive ); - this._centerInteractive[ 1 ] += ( ( this._options[ "axisLayout" ] === "image" ? -1 : 1 ) * dy * this._pixelSizeInteractive ); - this._setInteractiveCenterAndSize( this._centerInteractive, this._pixelSizeInteractive ); - this._interactiveTransform( ); - } - } - }, - - _clearInteractiveTimeout: function() { - if ( this._timeoutInteractive ) { - clearTimeout( this._timeoutInteractive ); - this._timeoutInteractive = null; - return true; - } else { - this._centerInteractive[ 0 ] = this._center[ 0 ]; - this._centerInteractive[ 1 ] = this._center[ 1 ]; - this._pixelSizeInteractive = this._pixelSize; - return false; - } - }, - - _interactiveTransform: function( ) { - if ( this._$shapesContainers ) { - this._$shapesContainers.geographics("clear"); - } - - for ( var i = 0; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - $.geo[ "_serviceTypes" ][ service.type ].interactiveTransform( this, service, this._centerInteractive, this._pixelSizeInteractive ); - } - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel( this._drawCoords, this._centerInteractive, this._pixelSizeInteractive ); - this._refreshDrawing(); - } - }, - - _setInteractiveTimeout: function( trigger ) { - var geomap = this; - - function interactiveTimeoutCallback( ) { - if ( geomap._isMultiTouch ) { - geomap._timeoutInteractive = setTimeout( interactiveTimeoutCallback, 128 ); - } else if ( geomap._created && geomap._timeoutInteractive ) { - geomap._setCenterAndSize( geomap._centerInteractive, geomap._pixelSizeInteractive, geomap._triggerInteractive, true ); - geomap._timeoutInteractive = null; - geomap._triggerInteractive = false; - } - } - - this._timeoutInteractive = setTimeout( interactiveTimeoutCallback, 128 ); - this._triggerInteractive |= trigger; - }, - - _refresh: function ( force, _serviceContainer ) { - var service, - geoService, - i = 0; - - for ( ; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service, force ); - geoService = service.serviceContainer.data( "geoService" ); - - if ( geoService._createdGraphics ) { - geoService._$shapesContainer.geographics( "clear" ); - if ( geoService._graphicShapes.length > 0 ) { - geoService._refreshShapes( geoService._$shapesContainer, geoService._graphicShapes, geoService._graphicShapes, geoService._graphicShapes ); - } - } - } - } - - if ( this._createdGraphics ) { - this._$shapesContainer.geographics( "clear" ); - if ( this._graphicShapes.length > 0 ) { - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - } - }, - - _setInteractiveCenterAndSize: function ( center, pixelSize ) { - // set the temporary (interactive) center & size - // also, update the public-facing options - // this does not take zoomMin or zoomMax into account - this._centerInteractive[ 0 ] = center[ 0 ]; - this._centerInteractive[ 1 ] = center[ 1 ]; - this._pixelSizeInteractive = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox( center, pixelSize ) ); - this._options["center"] = $.geo.proj.toGeodetic( center ); - } else { - this._options["bbox"] = this._getBbox( center, pixelSize ); - this._options["center"][ 0 ] = center[ 0 ]; - this._options["center"][ 1 ] = center[ 1 ]; - } - - this._options["pixelSize"] = pixelSize; - this._options["zoom"] = this._getZoom( center, pixelSize ); - }, - - _setCenterAndSize: function (center, pixelSize, trigger, refresh) { - if ( ! $.isArray( center ) || center.length != 2 || typeof center[ 0 ] !== "number" || typeof center[ 1 ] !== "number" ) { - return; - } - - // the final call during any extent change - // only called by timeoutInteractive & resize - // clamp to zoom - var zoom = this._getZoom( center, pixelSize ); - - if ( this._options[ "tilingScheme" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - this._center[ 0 ] = center[ 0 ]; - this._center[ 1 ] = center[ 1 ]; - this._options["pixelSize"] = this._pixelSize = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox() ); - this._options["center"] = $.geo.proj.toGeodetic( this._center ); - } else { - this._options["bbox"] = this._getBbox(); - this._options["center"] = $.merge( [ ], center ); - } - - this._options["zoom"] = zoom; - - if (trigger) { - this._trigger("bboxchange", window.event, { bbox: $.merge( [ ], this._options["bbox"] ) }); - } - - if (refresh) { - this._refresh(); - this._refreshDrawing(); - } - }, - - _requestQueued: function ( ) { - if ( this._loadCount === 0 ) { - this._trigger( "loadstart", window.event ); - } - this._loadCount++; - }, - - _requestComplete: function ( ) { - this._loadCount--; - if ( this._loadCount <= 0 ) { - this._loadCount = 0; - this._trigger( "loadend", window.event ); - } - }, - - _toMap: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - xRatio = $.geo.width(bbox, true) / width, - yRatio = $.geo.height(bbox, true) / height, - yOffset, - image = this._options[ "axisLayout" ] === "image", - result = [], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - yOffset = (p[ i ][ j ][ k ][1] * yRatio); - result[ i ][ j ][ k ] = [ - bbox[ 0 ] + ( p[ i ][ j ][ k ][ 0 ] * xRatio ), - image ? bbox[ 1 ] + yOffset : bbox[ 3 ] - yOffset - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _toPixel: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - bboxWidth = $.geo.width(bbox, true), - bboxHeight = $.geo.height(bbox, true), - image = this._options[ "axisLayout" ] === "image", - xRatio = width / bboxWidth, - yRatio = height / bboxHeight, - result = [ ], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = [ - Math.round( ( p[ i ][ j ][ k ][ 0 ] - bbox[ 0 ] ) * xRatio ), - Math.round( ( image ? p[ i ][ j ][ k ][ 1 ] - bbox[ 1 ] : bbox[ 3 ] - p[ i ][ j ][ k ][ 1 ] ) * yRatio ) - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _document_keydown: function (e) { - var len = this._drawCoords.length; - if (len > 0 && e.which == 27) { - if (len <= 2) { - this._resetDrawing(); - this._inOp = false; - } else { - this._drawCoords[len - 2] = $.merge( [], this._drawCoords[ len - 1 ] ); - this._drawPixels[len - 2] = $.merge( [], this._drawPixels[ len - 1 ] ); - - this._drawCoords.length--; - this._drawPixels.length--; - - this._refreshDrawing(); - } - } - }, - - _eventTarget_dblclick_zoom: function(e) { - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - this._trigger("dblclick", e, { type: "Point", coordinates: this._toMap(this._current, this._centerInteractive, this._pixelSizeInteractive ) }); - - if (!e.isDefaultPrevented()) { - var centerAndSize = this._getZoomCenterAndSize(this._current, 1, true ); - - this._setInteractiveCenterAndSize( centerAndSize.center, centerAndSize.pixelSize ); - this._interactiveTransform( ); - - doInteractiveTimeout = true; - } - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - }, - - _eventTarget_dblclick: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - var offset = $(e.currentTarget).offset(); - - switch (this._options["mode"]) { - case "drawLineString": - case "measureLength": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - this._drawCoords.length--; - this._trigger( "shape", e, { - type: "LineString", - coordinates: this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords - } ); - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - case "drawPolygon": - case "measureArea": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - var endIndex = this._drawCoords.length - 1; - if (endIndex > 2) { - this._drawCoords[endIndex] = $.merge( [], this._drawCoords[0] ); - this._trigger( "shape", e, { - type: "Polygon", - coordinates: [ this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords ] - } ); - } - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - default: - this._eventTarget_dblclick_zoom(e); - break; - } - - this._inOp = false; - }, - - _eventTarget_touchstart: function (e) { - var mode = this._options[ "mode" ], - shift = this._options[ "shift" ]; - - if ( mode === "static" ) { - return; - } - - if ( !this._supportTouch && e.which != 1 ) { - return; - } - - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - var offset = $(e.currentTarget).offset(), - touches = e.originalEvent.changedTouches; - - if ( this._supportTouch ) { - this._multiTouchAnchor = $.merge( [ ], touches ); - - this._isMultiTouch = this._multiTouchAnchor.length > 1; - - if ( this._isMultiTouch ) { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - touches[1].pageX - offset.left, - touches[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - NaN, - NaN - ]; - - this._current = [ touches[0].pageX - offset.left, touches[0].pageY - offset.top ]; - } - } else { - this._current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - var downDate = $.now(); - if (downDate - this._downDate < 750) { - if (this._isTap) { - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - distance = Math.sqrt((dx * dx) + (dy * dy)); - if (distance > 8) { - this._isTap = false; - } else { - this._current = $.merge( [ ], this._anchor ); - } - } - - if (this._isDbltap) { - this._isDbltap = false; - } else { - this._isDbltap = this._isTap; - } - } else { - this._isDbltap = false; - } - this._isTap = true; - this._downDate = downDate; - } - - this._mouseDown = true; - this._anchor = $.merge( [ ], this._current ); - - if (!this._inOp && e.shiftKey && shift !== "off") { - this._shiftDown = true; - this._$eventTarget.css( "cursor", this._options[ "cursors" ][ shift === "default" ? "zoom" : shift ] ); - } else if ( !this._isMultiTouch && ( this._options[ "pannable" ] || mode === "dragBox" || mode === "dragCircle" ) ) { - this._inOp = true; - - if ( mode !== "zoom" && mode !== "dragBox" && mode !== "dragCircle" ) { - this._lastDrag = this._current; - - if (e.currentTarget.setCapture) { - e.currentTarget.setCapture(); - } - } - } - - e.preventDefault(); - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - return false; - }, - - _dragTarget_touchmove: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - var doInteractiveTimeout = false; - if ( this._mouseDown ) { - doInteractiveTimeout = this._clearInteractiveTimeout( ); - } - - var offset = this._$eventTarget.offset(), - drawCoordsLen = this._drawCoords.length, - touches = e.originalEvent.changedTouches, - current, - service, - i = 0; - - if ( this._supportTouch ) { - if ( !this._isMultiTouch && this._mouseDown && this._multiTouchAnchor.length > 0 && touches[ 0 ].identifier !== this._multiTouchAnchor[ 0 ].identifier ) { - // switch to multitouch - this._mouseDown = false; - this._isMultiTouch = true; - this._wheelLevel = 0; - - this._multiTouchAnchor.push( touches[ 0 ] ); - - - - - this._multiTouchCurrentBbox = [ - this._multiTouchCurrentBbox[ 0 ], - this._multiTouchCurrentBbox[ 1 ], - this._multiTouchAnchor[1].pageX - offset.left, - this._multiTouchAnchor[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._mouseDown = true; - this._anchor = this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - - if ( this._isMultiTouch ) { - - for ( ; i < touches.length; i++ ) { - if ( touches[ i ].identifier === this._multiTouchAnchor[ 0 ].identifier ) { - this._multiTouchCurrentBbox[ 0 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 1 ] = touches[ i ].pageY - offset.top; - } else if ( touches[ i ].identifier === this._multiTouchAnchor[ 1 ].identifier ) { - this._multiTouchCurrentBbox[ 2 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 3 ] = touches[ i ].pageY - offset.top; - } - } - - var anchorDistance = $.geo._distancePointPoint( [ this._multiTouchAnchorBbox[ 0 ], this._multiTouchAnchorBbox[ 1 ] ], [ this._multiTouchAnchorBbox[ 2 ], this._multiTouchAnchorBbox[ 3 ] ] ), - currentDistance = $.geo._distancePointPoint( [ this._multiTouchCurrentBbox[ 0 ], this._multiTouchCurrentBbox[ 1 ] ], [ this._multiTouchCurrentBbox[ 2 ], this._multiTouchCurrentBbox[ 3 ] ] ); - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - - var wheelLevel = ( ( currentDistance - anchorDistance ) / anchorDistance ); - - if ( wheelLevel > 0 ) { - wheelLevel *= 5; - } else { - wheelLevel *= 10; - } - - var delta = wheelLevel - this._wheelLevel; - - this._wheelLevel = wheelLevel; - - var pinchCenterAndSize = this._getZoomCenterAndSize( this._anchor, delta, false ); - - this._setInteractiveCenterAndSize( pinchCenterAndSize.center, pinchCenterAndSize.pixelSize ); - this._interactiveTransform( ); - - doInteractiveTimeout = true; - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (current[0] === this._lastMove[0] && current[1] === this._lastMove[1]) { - if ( this._inOp ) { - e.preventDefault(); - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - } - - if ( _ieVersion == 7 ) { - this._isDbltap = this._isTap = false; - } - - if (this._mouseDown) { - this._current = current; - this._moveDate = $.now(); - } - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isDbltap = this._isTap = false; - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - - var shift = this._options[ "shift" ], - mode = this._shiftDown ? ( shift === "default" ? "zoom" : shift ) : this._options["mode"], - dx, dy, circleSize; - - switch (mode) { - case "zoom": - case "dragBox": - if ( this._mouseDown ) { - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawBbox", [ - this._anchor[ 0 ], - this._anchor[ 1 ], - current[ 0 ], - current[ 1 ] - ] ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "dragCircle": - if ( this._mouseDown ) { - dx = current[ 0 ] - this._anchor[ 0 ]; - dy = current[ 1 ] - this._anchor[ 1 ]; - circleSize = Math.sqrt( ( dx * dx) + ( dy * dy ) ) * 2; - //circleSize = Math.max( Math.abs( current[ 0 ] - this._anchor[ 0 ] ), Math.abs( current[ 1 ] - this._anchor[ 1 ] ) ) * 2; - - // not part of _refreshDrawing - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawArc", this._anchor, 0, 360, { - width: circleSize, - height: circleSize - } ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (this._mouseDown || this._toolPan) { - this._panMove(); - doInteractiveTimeout = true; - } else { - if (drawCoordsLen > 0) { - this._drawCoords[drawCoordsLen - 1] = this._toMap( current, this._centerInteractive, this._pixelSizeInteractive ); - this._drawPixels[drawCoordsLen - 1] = current; - - this._refreshDrawing(); - } - - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - default: - if (this._mouseDown || this._toolPan) { - this._panMove(); - doInteractiveTimeout = true; - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - } - - this._lastMove = current; - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _dragTarget_touchstop: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if ( !this._mouseDown ) { - if ( _ieVersion == 7 ) { - // ie7 doesn't appear to trigger dblclick on this._$eventTarget, - // we fake regular click here to cause soft dblclick - this._eventTarget_touchstart(e); - } else { - // Chrome & Firefox trigger a rogue mouseup event when doing a dblclick maximize in Windows(/Linux?) - // ignore it - return false; - } - } - - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - var mouseWasDown = this._mouseDown, - wasToolPan = this._toolPan, - offset = this._$eventTarget.offset(), - shift = this._options[ "shift" ], - mode = this._shiftDown ? ( shift === "default" ? "zoom" : shift ) : this._options["mode"], - current, i, clickDate, - dx, dy, - coordBuffer, - triggerShape; - - - if (this._supportTouch) { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - this._multiTouchAnchor = []; - this._inOp = false; - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - if (this._isTap) { - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - if (Math.sqrt((dx * dx) + (dy * dy)) <= 8) { - current = $.merge( [ ], this._anchor ); - } - } - } - - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._shiftDown = this._mouseDown = this._toolPan = false; - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isMultiTouch = false; - - this._wheelLevel = 0; - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return; - } - - if (document.releaseCapture) { - document.releaseCapture(); - } - - if (mouseWasDown) { - clickDate = $.now(); - this._current = current; - - switch ( mode ) { - case "zoom": - case "dragBox": - if ( dx !== 0 || dy !== 0 ) { - var minSize = this._pixelSize * 6, - bboxCoords = this._toMap( [ [ - Math.min( this._anchor[ 0 ], current[ 0 ] ), - Math.max( this._anchor[ 1 ], current[ 1 ] ) - ], [ - Math.max( this._anchor[ 0 ], current[ 0 ] ), - Math.min( this._anchor[ 1 ], current[ 1 ] ) - ] - ] ), - bbox = [ - bboxCoords[0][0], - bboxCoords[0][1], - bboxCoords[1][0], - bboxCoords[1][1] - ]; - - if ( mode === "zoom" ) { - if ( ( bbox[2] - bbox[0] ) < minSize && ( bbox[3] - bbox[1] ) < minSize ) { - bbox = $.geo.scaleBy( this._getBbox( $.geo.center( bbox, true ) ), 0.5, true ); - } - - this._setBbox(bbox, true, true); - doInteractiveTimeout = true; - } else { - triggerShape = $.geo.polygonize( bbox, true ); - triggerShape.bbox = bbox; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - this._trigger( "shape", e, triggerShape ); - } - } else { - if ( mode === "dragBox" ) { - coordBuffer = this._toMap( current ); - - triggerShape = { - type: "Point", - coordinates: [ coordBuffer[ 0 ], coordBuffer[ 1 ] ], - bbox: [ coordBuffer[ 0 ], coordBuffer[ 1 ], coordBuffer[ 0 ], coordBuffer[ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - } - } - - this._resetDrawing(); - break; - - case "dragCircle": - if ( dx !== 0 || dy !== 0 ) { - var image = this._options[ "axisLayout" ] === "image", - d = Math.sqrt( ( dx * dx) + ( dy * dy ) ), - n = 180, - a; - - this._drawPixels.length = n + 1; - - for ( i = 0; i < n; i++ ) { - a = ( i * 360 / n ) * ( Math.PI / 180 ); - this._drawPixels[ i ] = [ - this._anchor[ 0 ] + Math.cos( a ) * d, - this._anchor[ 1 ] + Math.sin( a ) * d - ]; - } - - this._drawPixels[ n ] = [ - this._drawPixels[ 0 ][ 0 ], - this._drawPixels[ 0 ][ 1 ] - ]; - - // using coordBuffer for bbox coords - coordBuffer = this._toMap( [ - [ this._anchor[ 0 ] - d, this._anchor[ 1 ] + ( image ? -d : d ) ], - [ this._anchor[ 0 ] + d, this._anchor[ 1 ] + ( image ? d : -d ) ] - ] ); - - triggerShape = { - type: "Polygon", - coordinates: [ this._toMap( this._drawPixels ) ], - bbox: [ coordBuffer[ 0 ][ 0 ], coordBuffer[ 0 ][ 1 ], coordBuffer[ 1 ][ 0 ], coordBuffer[ 1 ][ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - - this._resetDrawing(); - } else { - coordBuffer = this._toMap( current ); - - triggerShape = { - type: "Point", - coordinates: [ coordBuffer[ 0 ], coordBuffer[ 1 ] ], - bbox: [ coordBuffer[ 0 ], coordBuffer[ 1 ], coordBuffer[ 0 ], coordBuffer[ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - } - break; - - case "drawPoint": - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - var geomap = this; - this._drawTimeout = setTimeout(function () { - if (geomap._drawTimeout) { - geomap._trigger("shape", e, { type: "Point", coordinates: geomap.toMap(current) }); - geomap._inOp = false; - geomap._drawTimeout = null; - } - }, 250); - } - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (wasToolPan) { - this._panFinalize(); - } else { - i = (this._drawCoords.length === 0 ? 0 : this._drawCoords.length - 1); - - this._drawCoords[i] = this._toMap(current); - this._drawPixels[i] = current; - - if (i < 2 || !(this._drawCoords[i][0] == this._drawCoords[i-1][0] && - this._drawCoords[i][1] == this._drawCoords[i-1][1])) { - this._drawCoords[i + 1] = this._toMap( current, this._centerInteractive, this._pixelSizeInteractive ); - this._drawPixels[i + 1] = current; - } - - this._refreshDrawing(); - } - break; - - default: - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - this._trigger("click", e, { type: "Point", coordinates: this.toMap(current) }); - this._inOp = false; - } - } - break; - } - - this._clickDate = clickDate; - - if (this._softDblClick && this._isDbltap) { - this._isDbltap = this._isTap = false; - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - this._$eventTarget.trigger("dblclick", e); - return false; - } - } - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _eventTarget_mousewheel: function (e, delta) { - if ( this._options[ "mode" ] === "static" || this._options[ "scroll" ] === "off" ) { - return; - } - - e.preventDefault(); - - if ( this._mouseDown ) { - return false; - } - - if (delta !== 0) { - this._clearInteractiveTimeout( ); - - if ( delta > 0 ) { - delta = Math.ceil( delta ); - } else { - delta = Math.floor( delta ); - } - - var offset = $(e.currentTarget).offset(); - this._anchor = [e.pageX - offset.left, e.pageY - offset.top]; - - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, delta, this._options[ "tilingScheme" ] !== null ), - service, - i = 0; - - this._setInteractiveCenterAndSize( wheelCenterAndSize.center, wheelCenterAndSize.pixelSize ); - this._interactiveTransform( ); - - this._setInteractiveTimeout( true ); - } - - return false; - } - } - ); -}(jQuery)); - - -(function ($, undefined) { - $.geo._serviceTypes.tiled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0, - reloadTiles: false - }; - - var scHtml = '
                '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children( ":last" ); - - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactiveTransform: function ( map, service, center, pixelSize ) { - //console.log( "tiled.interactiveTransform( " + center.join( ", " ) + ", " + pixelSize + ")" ); - var serviceState = $.data( service, "geoServiceState" ), - tilingScheme = map.options[ "tilingScheme" ]; - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.data("pixelSize"), - scaleRatio = scalePixelSize / pixelSize; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapCoord = $scaleContainer.data("scaleOrigin"), - newPixelPoint = map._toPixel(oldMapCoord, center, pixelSize); - - $scaleContainer.css( { - left: Math.round(newPixelPoint[0]) + "px", - top: Math.round(newPixelPoint[1]) + "px", - width: tilingScheme.tileWidth * scaleRatio, - height: tilingScheme.tileHeight * scaleRatio - } ); - - /* - if ( $("body")[0].filters !== undefined ) { - $scaleContainer.children().each( function ( i ) { - $( this ).css( "filter", "progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11=" + scaleRatio + ",M22=" + scaleRatio + ",sizingmethod='auto expand')" ); - } ); - } - */ - } - }); - } - }, - - refresh: function (map, service, force) { - //console.log( "tiled.refresh( " + map._center.join( ", " ) + ", " + map._pixelSize + ")" ); - var serviceState = $.data( service, "geoServiceState" ); - - this._cancelUnloaded(map, service); - - if ( serviceState && force ) { - // if hidden atm, we want to make sure we reload this service after it becomes visible - serviceState.reloadTiles = true; - } - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - $serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - image = map.options[ "axisLayout" ] === "image", - ySign = image ? +1 : -1, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - - tileX = Math.floor((bbox[0] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.max( Math.floor( ( image ? bbox[1] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 3 ] ) / (pixelSize * tileHeight) ), 0 ), - tileX2 = Math.ceil((bbox[2] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil( ( image ? bbox[3] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 1 ] ) / (pixelSize * tileHeight) ), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] + ySign * bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMinOrMaxY = tilingScheme.origin[1] + ySign * (fullYAtScale * tileHeight) * pixelSize, - - serviceLeft = Math.round((fullXMinX - bbox[0]) / pixelSize), - serviceTop = Math.round( ( image ? fullYMinOrMaxY - bbox[1] : bbox[3] - fullYMinOrMaxY ) / pixelSize), - - scaleContainers = $serviceContainer.children().show(), - scaleContainer = scaleContainers.filter("[data-pixel-size='" + pixelSize + "']").appendTo($serviceContainer), - - opacity = service.style.opacity, - - x, y, - - loadImageDeferredDone = function( url ) { - // when a Deferred call is done, add the image to the map - // a reference to the correct img element is on the Deferred object itself - serviceObj._loadImage( $.data( this, "img" ), url, pixelSize, map, serviceState, opacity ); - }, - - loadImageDeferredFail = function( ) { - $.data( this, "img" ).remove( ); - serviceState.loadCount--; - map._requestComplete(); - }; - - if (serviceState.reloadTiles) { - scaleContainers.find("img").attr("data-dirty", "true"); - } - - if (!scaleContainer.size()) { - $serviceContainer.append("
                "); - scaleContainer = $serviceContainer.children(":last").data("scaleOrigin", map._toMap( [ (serviceLeft % tileWidth), (serviceTop % tileHeight) ] ) ); - } else { - scaleContainer.css({ - left: (serviceLeft % tileWidth) + "px", - top: (serviceTop % tileHeight) + "px" - }).data("scaleOrigin", map._toMap( [ (serviceLeft % tileWidth), (serviceTop % tileHeight) ] ) ); - - scaleContainer.children().each(function (i) { - var - $img = $(this), - tile = $img.attr("data-tile").split(","); - - $img.css({ - left: Math.round(((parseInt(tile[0], 10) - fullXAtScale) * 100) + (serviceLeft - (serviceLeft % tileWidth)) / tileWidth * 100) + "%", - top: Math.round(((parseInt(tile[1], 10) - fullYAtScale) * 100) + (serviceTop - (serviceTop % tileHeight)) / tileHeight * 100) + "%" - }); - - if (opacity < 1) { - $img.fadeTo(0, opacity); - } - }); - } - - for (x = tileX; x < tileX2; x++) { - for (y = tileY; y < tileY2; y++) { - var tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ($img.size() === 0 || serviceState.reloadTiles) { - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] + ySign * (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] + ySign * ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - urlProp = ( service.hasOwnProperty( "src" ) ? "src" : "getUrl" ), - urlArgs = { - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl; - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.templates( "geoSrc", service[ urlProp ] ); - imageUrl = $.render[ "geoSrc" ]( urlArgs ); - } - - serviceState.loadCount++; - map._requestQueued(); - - if (serviceState.reloadTiles && $img.size() > 0) { - $img.attr("src", imageUrl); - } else { - var imgMarkup = ""; - - scaleContainer.append(imgMarkup); - $img = scaleContainer.children(":last"); - } - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, map, serviceState, opacity ); - } else if ( imageUrl ) { - // assume Deferred - $.data( imageUrl, "img", $img ); - imageUrl.done( loadImageDeferredDone ).fail( loadImageDeferredFail ); - } else { - $img.remove( ); - } - } - } - } - - scaleContainers.find("[data-dirty]").remove(); - serviceState.reloadTiles = false; - } - }, - - resize: function (map, service) { - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.css( "display", service.style.visibility === "visible" ? "block" : "none" ); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - map._requestComplete(); - } - } - }, - - _loadImage: function ( $img, url, pixelSize, map, serviceState, opacity ) { - var serviceContainer = serviceState.serviceContainer; - - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - }()); -}(jQuery)); - -(function ($, undefined) { - $.geo._serviceTypes.shingled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0 - }; - - var scHtml = '
                '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children(":last"); - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactiveTransform: function ( map, service, center, pixelSize ) { - var serviceState = $.data( service, "geoServiceState" ), - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds[ "width" ], - mapHeight = contentBounds[ "height" ], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - bbox = [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.data( "pixelSize" ), - scaleRatio = scalePixelSize / pixelSize; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapOrigin = $scaleContainer.data( "origin" ), - newPixelPoint = map._toPixel( oldMapOrigin, center, pixelSize ); - - $scaleContainer.css( { - left: Math.round( newPixelPoint[ 0 ] ), - top: Math.round( newPixelPoint[ 1 ] ), - width: mapWidth * scaleRatio, - height: mapHeight * scaleRatio - } ); - - - // #newpanzoom - /* - .children("img").each(function (i) { - var $img = $(this), - imgCenter = $img.data("center"), - x = (Math.round((imgCenter[0] - center[0]) / scalePixelSize) - halfWidth) * scaleRatio, - y = (Math.round((center[1] - imgCenter[1]) / scalePixelSize) - halfHeight) * scaleRatio; - - $img.css({ left: x + "px", top: y + "px" }); - }); - */ - } - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - this._cancelUnloaded(map, service); - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - scaleContainer = serviceContainer.children('[data-pixel-size="' + pixelSize + '"]'), - - opacity = service.style.opacity, - - $img; - - if (opacity < 1) { - serviceContainer.find("img").attr("data-keep-alive", "0"); - } - - if ( !scaleContainer.size() ) { - serviceContainer.append('
                '); - scaleContainer = serviceContainer.children(":last"); - } - - var urlProp = ( service.hasOwnProperty("src") ? "src" : "getUrl" ), - urlArgs = { - bbox: bbox, - width: mapWidth, - height: mapHeight, - zoom: map._getZoom(), - tile: null, - index: 0 - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl, - imagePos = scaleContainer.position( ); - - imagePos.left = - ( imagePos.left ); - imagePos.top = - ( imagePos.top ); - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.templates( "geoSrc", service[ urlProp ] ); - imageUrl = $.render[ "geoSrc" ]( urlArgs ); - } - - serviceState.loadCount++; - map._requestQueued(); - - scaleContainer.append(''); - $img = scaleContainer.children(":last").data("center", map._center); - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, map, serviceState, opacity ); - } else { - // assume Deferred - imageUrl.done( function( url ) { - serviceObj._loadImage( $img, url, pixelSize, map, serviceState, opacity ); - } ).fail( function( ) { - $img.remove( ); - serviceState.loadCount--; - map._requestComplete(); - } ); - } - - } - }, - - resize: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState && service && service.style.visibility === "visible" ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - scaleContainers = serviceContainer.children(); - - scaleContainers.attr("data-pixel-size", "0"); - - scaleContainers.each( function ( i ) { - var $scaleContainer = $(this), - position = $scaleContainer.position( ); - - var oldMapOrigin = $scaleContainer.data( "origin" ), - newPixelPoint = map._toPixel( oldMapOrigin ); - - $scaleContainer.css( { - left: position.left + ( mapWidth - $scaleContainer.width( ) ) / 2, - top: position.top + ( mapHeight - $scaleContainer.height( ) ) / 2 - } ); - - } ); - - - /* - scaleContainer.css({ - left: halfWidth + 'px', - top: halfHeight + 'px' - }); - */ - } - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - serviceState.serviceContainer.css("display", service.style.visibility === "visible" ? "block" : "none"); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - map._requestComplete(); - } - } - }, - - _loadImage: function ( $img, url, pixelSize, map, serviceState, opacity ) { - var serviceContainer = serviceState.serviceContainer; - - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - // #newpanzoom - serviceContainer.children(':not([data-pixel-size="' + pixelSize + '"])').remove(); - - serviceContainer.find( "img[data-keep-alive]" ).remove( ); - - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - }()); -}(jQuery)); diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.min.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.min.js deleted file mode 100755 index c3c1f38..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-1.0b1.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery Geo - v1.0b1.0.1 - 2012-08-01 - * http://jquerygeo.com - * Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */ -document.createElement("canvas").getContext||function(){function j(){return this.context_||(this.context_=new I(this))}function l(a,b,c){var d=k.call(arguments,2);return function(){return a.apply(b,d.concat(k.call(arguments)))}}function m(a){return String(a).replace(/&/g,"&").replace(/"/g,""")}function n(a,b,c){a.namespaces[b]||a.namespaces.add(b,c,"#default#VML")}function o(a){n(a,"g_vml_","urn:schemas-microsoft-com:vml"),n(a,"g_o_","urn:schemas-microsoft-com:office:office");if(!a.styleSheets.ex_canvas_){var b=a.createStyleSheet();b.owningElement.id="ex_canvas_",b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function q(a){var b=a.srcElement;switch(a.propertyName){case"width":b.getContext().clearRect(),b.style.width=b.attributes.width.nodeValue+"px",b.firstChild.style.width=b.clientWidth+"px";break;case"height":b.getContext().clearRect(),b.style.height=b.attributes.height.nodeValue+"px",b.firstChild.style.height=b.clientHeight+"px"}}function r(a){var b=a.srcElement;b.firstChild&&(b.firstChild.style.width=b.clientWidth+"px",b.firstChild.style.height=b.clientHeight+"px")}function v(){return[[1,0,0],[0,1,0],[0,0,1]]}function w(a,b){var c=v();for(var d=0;d<3;d++)for(var e=0;e<3;e++){var f=0;for(var g=0;g<3;g++)f+=a[d][g]*b[g][e];c[d][e]=f}return c}function x(a,b){b.fillStyle=a.fillStyle,b.lineCap=a.lineCap,b.lineJoin=a.lineJoin,b.lineWidth=a.lineWidth,b.miterLimit=a.miterLimit,b.shadowBlur=a.shadowBlur,b.shadowColor=a.shadowColor,b.shadowOffsetX=a.shadowOffsetX,b.shadowOffsetY=a.shadowOffsetY,b.strokeStyle=a.strokeStyle,b.globalAlpha=a.globalAlpha,b.font=a.font,b.textAlign=a.textAlign,b.textBaseline=a.textBaseline,b.arcScaleX_=a.arcScaleX_,b.arcScaleY_=a.arcScaleY_,b.lineScale_=a.lineScale_}function y(a){var b=a.indexOf("(",3),c=a.indexOf(")",b+1),d=a.substring(b+1,c).split(",");if(d.length!=4||a.charAt(3)!="a")d[3]=1;return d}function z(a){return parseFloat(a)/100}function A(a,b,c){return Math.min(c,Math.max(b,a))}function B(a){var b,c,d,e,f,g;e=parseFloat(a[0])/360%360,e<0&&e++,f=A(z(a[1]),0,1),g=A(z(a[2]),0,1);if(f==0)b=c=d=g;else{var h=g<.5?g*(1+f):g+f-g*f,i=2*g-h;b=C(i,h,e+1/3),c=C(i,h,e),d=C(i,h,e-1/3)}return"#"+s[Math.floor(b*255)]+s[Math.floor(c*255)]+s[Math.floor(d*255)]}function C(a,b,c){return c<0&&c++,c>1&&c--,6*c<1?a+(b-a)*6*c:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}function E(a){if(a in D)return D[a];var b,c=1;a=String(a);if(a.charAt(0)=="#")b=a;else if(/^rgb/.test(a)){var d=y(a),b="#",e;for(var f=0;f<3;f++)d[f].indexOf("%")!=-1?e=Math.floor(z(d[f])*255):e=+d[f],b+=s[A(e,0,255)];c=+d[3]}else if(/^hsl/.test(a)){var d=y(a);b=B(d),c=d[3]}else b=a;return D[a]={color:b,alpha:c}}function H(a){return G[a]||"square"}function I(a){this.m_=v(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle="#000",this.fillStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=g*1,this.globalAlpha=1,this.canvas=a;var b="width:"+a.clientWidth+"px;height:"+a.clientHeight+"px;overflow:hidden;position:absolute",c=a.ownerDocument.createElement("div");c.style.cssText=b,a.appendChild(c);var d=c.cloneNode(!1);d.style.backgroundColor="red",d.style.filter="alpha(opacity=0)",a.appendChild(d),this.element_=c,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1}function K(a,b,c,d){a.currentPath_.push({type:"bezierCurveTo",cp1x:b.x,cp1y:b.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y}),a.currentX_=d.x,a.currentY_=d.y}function L(a,b){var c=E(a.strokeStyle),d=c.color,e=c.alpha*a.globalAlpha,f=a.lineScale_*a.lineWidth;f<1&&(e*=f),b.push("')}function M(a,b,c,d){var e=a.fillStyle,f=a.arcScaleX_,g=a.arcScaleY_,h=d.x-c.x,i=d.y-c.y,j=E(a.fillStyle),k=j.color,l=j.alpha*a.globalAlpha;b.push('')}function N(a,b,c){var d=a.m_;return{x:g*(b*d[0][0]+c*d[1][0]+d[2][0])-h,y:g*(b*d[0][1]+c*d[1][1]+d[2][1])-h}}function O(a){return isFinite(a[0][0])&&isFinite(a[0][1])&&isFinite(a[1][0])&&isFinite(a[1][1])&&isFinite(a[2][0])&&isFinite(a[2][1])}function P(a,b,c){if(!O(b))return;a.m_=b;if(c){var d=b[0][0]*b[1][1]-b[0][1]*b[1][0];a.lineScale_=f(e(d))}}function Q(a){throw new R(a)}function R(a){this.code=this[a],this.message=a+": DOM Exception "+this.code}var a=Math,b=a.round,c=a.sin,d=a.cos,e=a.abs,f=a.sqrt,g=10,h=g/2,i=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],k=Array.prototype.slice;o(document);var p={init:function(a){var b=a||document;b.createElement("canvas"),b.attachEvent("onreadystatechange",l(this.init_,this,b))},init_:function(a){var b=a.getElementsByTagName("canvas");for(var c=0;cj.x)j.x=l.x;if(i.y==null||l.yj.y)j.y=l.y}}c.push(' ">'),a?M(this,c,i,j):L(this,c),c.push(""),this.element_.insertAdjacentHTML("beforeEnd",c.join(""))},J.fill=function(){this.stroke(!0)},J.closePath=function(){this.currentPath_.push({type:"close"})},J.save=function(){var a={};x(this,a),this.aStack_.push(a),this.mStack_.push(this.m_),this.m_=w(v(),this.m_)},J.restore=function(){this.aStack_.length&&(x(this.aStack_.pop(),this),this.m_=this.mStack_.pop())},J.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];P(this,w(c,this.m_),!1)},J.scale=function(a,b){this.arcScaleX_*=a,this.arcScaleY_*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];P(this,w(c,this.m_),!0)};var S=R.prototype=new Error;S.INDEX_SIZE_ERR=1,S.DOMSTRING_SIZE_ERR=2,S.HIERARCHY_REQUEST_ERR=3,S.WRONG_DOCUMENT_ERR=4,S.INVALID_CHARACTER_ERR=5,S.NO_DATA_ALLOWED_ERR=6,S.NO_MODIFICATION_ALLOWED_ERR=7,S.NOT_FOUND_ERR=8,S.NOT_SUPPORTED_ERR=9,S.INUSE_ATTRIBUTE_ERR=10,S.INVALID_STATE_ERR=11,S.SYNTAX_ERR=12,S.INVALID_MODIFICATION_ERR=13,S.NAMESPACE_ERR=14,S.INVALID_ACCESS_ERR=15,S.VALIDATION_ERR=16,S.TYPE_MISMATCH_ERR=17,G_vmlCanvasManager=p,CanvasRenderingContext2D=I,DOMException=R}(),this.jsviews||this.jQuery&&jQuery.views||function(a,b){function A(a,b){var c="\\"+a.charAt(0),d="\\"+a.charAt(1),g="\\"+b.charAt(0),h="\\"+b.charAt(1);return z.rTag=e=d+"(?:(?:(\\w+(?=[\\/\\s"+g+"]))|(?:(\\w+)?(:)|(>)|(\\*)))"+"\\s*((?:[^"+g+"]|"+g+"(?!"+h+"))*?)"+"(\\/)?|(?:\\/(\\w+)))"+g,e=new RegExp(c+e+h,"g"),f=new RegExp("<.*>|"+a+".*"+b),this}function B(a){var c=this,d=c.tmpl.helpers||{};return a=(c.ctx[a]!==b?c.ctx:d[a]!==b?d:I[a]!==b?I:{})[a],typeof a!="function"?a:function(){return a.apply(c,arguments)}}function C(a,b,c){var d=b.tmpl.converters;return a=d&&d[a]||J[a],a?a.call(b,c):c}function D(a,c,d,e,f){f.props=f.props||{};var h,i=f.props.tmpl,k=c.tmpl.tags,l=c.tmpl.templates,m=arguments,n=k&&k[a]||H[a];return n?(e=e&&c.tmpl.tmpls[e-1],i=i||e||b,f.tmpl=""+i===i?l&&l[i]||G[i]||G(i):i,f.isTag=j,f.converter=d,f.view=c,f.renderContent=K,c.ctx&&g(f.ctx,c.ctx),h=n.apply(f,m.length>5?x.call(m,5):[]),h||(h==b?"":h.toString())):""}function E(a,c,e,f,g,h){var i=e.views,j={tmpl:g,path:c,parent:e,data:f,ctx:a,views:d.isArray(f)?[]:{},hlp:B};return d.isArray(i)?i.splice(j.index=h!==b?h:i.length,0,j):i[j.index="_"+r++]=j,j}function F(a,c,d,e,f){var g,i;if(d&&typeof d=="object"&&!d.nodeType){for(g in d)c(g,d[g]);return a}if(!d||e===b)f&&(e=f(b,e||d));else if(""+d===d)if(e===null)delete c[d];else if(e=f?f(d,e):e)c[d]=e;return(i=h.onStoreItem)&&i(c,d,e,f),e}function G(a,b){return F(this,G,a,b,O)}function H(a,b){return F(this,H,a,b)}function I(a,b){return F(this,I,a,b)}function J(a,b){return F(this,J,a,b)}function K(a,c,e,f,k){var l,m,n,o,p,q,r,s,t,u,v={},w=k===j,x=this,y="";x.isTag?(t=x.tmpl,c=c||x.ctx,e=e||x.view,f=f||x.path,k=k||x.index,v=x.props):t=x.jquery&&x[0]||x,e=e||z.topView,s=e.ctx,u=t.layout,a===e&&(a=e.data,u=j),c=c&&c===s?s:s?(s=g({},s),c)?g(s,c):s:c||{},v.link===i&&(c.link=i),t.fn||(t=G[t]||G(t)),p=c.link&&h.onRenderItem,q=c.link&&h.onRenderItems;if(t){if(d.isArray(a)&&!u){o=w?e:k!==b&&e||E(c,f,e,a,t,k);for(l=0,m=a.length;l-1,i+=(t===":"?u==="html"?(l=j,"e("+w):u?(r=j,'c("'+u+'",view,'+w):(m=j,"((v="+w+')!=u?v:""'):(k=j,'t("'+t+'",view,"'+(u||"")+'",'+(F?B.length:'""')+","+x+(w?",":"")+w))+")+");return i=new Function("data, view, j, b, u",v+(m?"v,":"")+(k?"t=j.tag,":"")+(r?"c=j.convert,":"")+(l?"e=j.converters.html,":"")+"ret; try{\n\n"+(A.debug?"debugger;":"")+(z?"ret=":"return ")+i.slice(0,-1)+";\n\n"+(z?"return ret;":"")+"}catch(e){return j.err(e);}"),b&&(b.fn=i,b.useVw=r||s||k),i}function N(a,b){function h(a,h,k,m,n,o,p,q,r,s,t,u,v,w,x,y){function z(a,c,d,e,f,g,h){if(c){var i=(d?'view.hlp("'+d+'")':e?"view":"data")+(h?(f?"."+f:d?"":e?"":"."+c)+(g||""):(h=d?"":e?f||"":c,""));return b&&r!=="("&&(i="b("+i+',"'+h+'")'),i+(h?"."+h:"")}return a}n=n||"",k=k||h||t,m=m||q,r=r||x||"",n=n||"";if(o)L();else return g?(g=!u,g?a:'"'):f?(f=!v,f?a:'"'):(k?(e++,k):"")+(y?e?"":c?(c=i,"\b"):",":p?(e&&L(),c=j,"\b"+m+":"):m?m.replace(l,z)+(r?(d[++e]=j,r):n):n?a:w?(d[e--]=i,w)+(r?(d[++e]=j,r):""):s?(d[e]||L(),","):h?"":(g=u,f=v,'"'))}var c,d={},e=0,f=i,g=i;return a=(a+" ").replace(m,h),a}function O(a,c,d,e){function n(b){if(""+b===b||b.nodeType>0)return i=b.nodeType>0?b:!f.test(b)&&k&&k(b)[0],i&&i.type&&(b=G[i.getAttribute(u)],b||(a=a||"_"+s++,i.setAttribute(u,a),b=O(a,i.innerHTML,d,e),G[a]=b)),b}var h,i,j,l,m;h=n(c),e=e||(c.markup?c:{}),e.name=a,l=e.templates,!h&&c.markup&&(h=n(c.markup))&&h.fn&&(h.debug!==c.debug||h.allowCode!==c.allowCode)&&(h=h.markup);if(h!==b){a&&!d&&(y[a]=function(){return c.render.apply(c,arguments)}),h.fn||c.fn?h.fn&&(a&&a!==h.name?c=g(g({},h),e):c=h):(c=P(h,e,d,0),M(h,c));for(j in l)m=l[j],m.name!==j&&(l[j]=O(j,m,c));return c}}function P(a,b,c,d){function e(a){c[a]&&(f[a]=g(g({},c[a]),b[a]))}b=b||{};var f={markup:a,tmpls:[],links:[],render:K};return c&&(c.templates&&(f.templates=g(g({},c.templates),b.templates)),f.parent=c,f.name=c.name+"["+d+"]",f.index=d),g(f,b),c&&(e("templates"),e("tags"),e("helpers"),e("converters")),f}function Q(a){return t[a]||(t[a]="&#"+a.charCodeAt(0)+";")}var c="v1.0pre",d,e,f,g,h={},i=!1,j=!0,k=a.jQuery,l=/^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g,m=/(\()(?=|\s*\()|(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g,n=/\r?\n/g,o=/\\(['"])/g,p=/\\?(['"])/g,q=/\x08(~)?([^\x08]+)\x08/g,r=0,s=0,t={"&":"&","<":"<",">":">"},u="data-jsv-tmpl",v="var j=j||"+(k?"jQuery.":"js")+"views,",w=/[\x00"&'<>]/g,x=Array.prototype.slice,y={},z={jsviews:c,sub:h,debugMode:j,err:function(a){return z.debugMode?"
                Error: "+(a.message||a)+". ":'""'},tmplFn:M,render:y,templates:G,tags:H,helpers:I,converters:J,View:E,convert:C,delimiters:A,tag:D};k?(d=k,d.templates=G,d.render=y,d.views=z,d.fn.render=K):(d=a.jsviews=z,d.extend=function(a,b){var c;a=a||{};for(c in b)a[c]=b[c];return a},d.isArray=Array&&Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}),g=d.extend,z.topView={views:{},tmpl:{},hlp:B,ctx:z.helpers},H({"if":function(){var a=this,c=a.view;return c.onElse=function(a,d){var e=0,f=d.length;while(f&&!d[e++])if(e===f)return"";return c.onElse=b,a.path="",a.renderContent(c)},c.onElse(this,arguments)},"else":function(){var a=this.view;return a.onElse?a.onElse(this,arguments):""},"for":function(){var a,b=this,c="",d=arguments,e=d.length;b.props.layout&&(b.tmpl.layout=j);for(a=0;a1&&!a.isArray(b[0]))return b[0]>=-180&&b[0]<=180&&b[1]>=-85&&b[1]<=85;b=b[0]}return!1},center:function(b,c){var d=!1;!c&&a.geo.proj&&this._isGeodetic(b)&&(d=!0,b=a.geo.proj.fromGeodetic(b));var e=[(b[0]+b[2])/2,(b[1]+b[3])/2];return d?a.geo.proj.toGeodetic(e):e},expandBy:function(b,c,d,e){var f=!1;return!e&&a.geo.proj&&this._isGeodetic(b)&&(f=!0,b=a.geo.proj.fromGeodetic(b)),b=[b[0]-c,b[1]-d,b[2]+c,b[3]+d],f?a.geo.proj.toGeodetic(b):b},height:function(b,c){return!c&&a.geo.proj&&this._isGeodetic(b)&&(b=a.geo.proj.fromGeodetic(b)),b[3]-b[1]},_in:function(a,b){return a[0]<=b[0]&&a[1]<=b[1]&&a[2]>=b[2]&&a[3]>=b[3]},_bboxDisjoint:function(a,b){return b[0]>a[2]||b[2]a[3]||b[3]0&&(f/g>c?(i=f/2,j=i/c):(j=g/2,i=j*c),b=[h[0]-i,h[1]-j,h[0]+i,h[1]+j]),e?a.geo.proj.toGeodetic(b):b},recenter:function(b,c,d){var e=!1;!d&&a.geo.proj&&(this._isGeodetic(b)&&(e=!0,b=a.geo.proj.fromGeodetic(b)),this._isGeodetic(c)&&(c=a.geo.proj.fromGeodetic(c)));var f=(b[2]-b[0])/2,g=(b[3]-b[1])/2;return b=[c[0]-f,c[1]-g,c[0]+f,c[1]+g],e?a.geo.proj.toGeodetic(b):b},scaleBy:function(b,c,d){var e=!1;!d&&a.geo.proj&&this._isGeodetic(b)&&(e=!0,b=a.geo.proj.fromGeodetic(b));var f=this.center(b,!0),g=(b[2]-b[0])*c/2,h=(b[3]-b[1])*c/2;return b=[f[0]-g,f[1]-h,f[0]+g,f[1]+h],e?a.geo.proj.toGeodetic(b):b},width:function(b,c){return!c&&a.geo.proj&&this._isGeodetic(b)&&(b=a.geo.proj.fromGeodetic(b)),b[2]-b[0]},bbox:function(b,f){var g,h=!1;if(!b)return c;if(b.bbox)g=!f&&a.geo.proj&&this._isGeodetic(b.bbox)?a.geo.proj.fromGeodetic(b.bbox):b.bbox;else{g=[d,d,e,e];var i=this._allCoordinates(b),j=0;if(i.length===0)return c;!f&&a.geo.proj&&this._isGeodetic(i)&&(h=!0,i=a.geo.proj.fromGeodetic(i));for(;j0?(h[0]=Math.min(Math.max(i[0][0],m[0]),m[2]),h[1]=Math.min(Math.max(i[0][1],m[1]),m[3]),{type:"Point",coordinates:n?a.geo.proj.toGeodetic(h):h}):c;return g*=3,h[0]=Math.min(Math.max(h[0]/g,m[0]),m[2]),h[1]=Math.min(Math.max(h[1]/g,m[1]),m[3]),{type:"Point",coordinates:n?a.geo.proj.toGeodetic(h):h}}return c},contains:function(a,b){if(a.type!="Polygon")return!1;switch(b.type){case"Point":return this._containsPolygonPoint(a.coordinates,b.coordinates);case"LineString":return this._containsPolygonLineString(a.coordinates,b.coordinates);case"Polygon":return this._containsPolygonLineString(a.coordinates,b.coordinates[0]);default:return!1}},_containsPolygonPoint:function(a,b){if(a.length===0||a[0].length<4)return!1;var c=0,d=a[0][0],e=1,f,g;for(;eb[0]&&c++;d=f}return c%2==1},_containsPolygonLineString:function(a,b){for(var c=0;c0){var e=a[0],f=b[0]-e[0],g=b[1]-e[1];if(a.length==1)return Math.sqrt(f*f+g*g);for(var h=1;h=h?e*e+f*f:c*c+d*d-g*g/h},_distanceLineStringLineString:function(a,b){var c=d;for(var e=0;e2?{type:"Point",coordinates:[parseFloat(b[1]),parseFloat(b[2])]}:null}function p(a){var b=a.match(/\s*\((.*)\)/),c=[],d,e,f=0;if(b&&b.length>1){d=b[1].match(/[\d\.\-]+\s+[\d\.\-]+/g);for(;f1){d=b[1].match(/[\d\.\-]+\s+[\d\.\-]+/g);for(;f0){for(;f
                ";while(c[0]);return a>6?a:!a}();a.widget("geo.geographics",{_$elem:b,_options:{},_trueCanvas:!0,_width:0,_height:0,_$canvas:b,_context:b,_blitcanvas:b,_blitcontext:b,_$labelsContainer:b,options:{style:{borderRadius:"8px",color:"#7f0000",fillOpacity:.2,height:"8px",opacity:1,strokeOpacity:1,strokeWidth:"2px",visibility:"visible",width:"8px"}},_create:function(){this._$elem=this.element,this._options=this.options,this._$elem.css({display:"inline-block",overflow:"hidden",textAlign:"left"}),this._$elem.css("position")=="static"&&this._$elem.css("position","relative"),this._$elem.addClass("geo-graphics"),this._width=this._$elem.width(),this._height=this._$elem.height();if(!this._width||!this._height)this._width=parseInt(this._$elem.css("width"),10),this._height=parseInt(this._$elem.css("height"),10);var a="position:absolute;left:0;top:0;margin:0;padding:0;",b="width:"+this._width+"px;height:"+this._height+"px;",d='width="'+this._width+'" height="'+this._height+'"';document.createElement("canvas").getContext?(this._$elem.append("'),this._$canvas=this._$elem.children(":last"),this._context=this._$canvas[0].getContext("2d"),this._blitcanvas=document.createElement("canvas"),this._blitcanvas.width=this._width,this._blitcanvas.height=this._height,this._blitcontext=this._blitcanvas.getContext("2d")):c<=8&&(this._trueCanvas=!1,this._$elem.append("
                '),this._$canvas=this._$elem.children(":last"),G_vmlCanvasManager.initElement(this._$canvas[0]),this._context=this._$canvas[0].getContext("2d"),this._$canvas.children().css({backgroundColor:"transparent",width:this._width,height:this._height})),this._$elem.append('
                '),this._$labelsContainer=this._$elem.children(":last")},_setOption:function(b,c){b=="style"&&(c=a.extend({},this._options.style,c)),a.Widget.prototype._setOption.apply(this,arguments)},destroy:function(){a.Widget.prototype.destroy.apply(this,arguments),this._$elem.html(""),this._$elem.removeClass("geo-graphics")},clear:function(){this._context.clearRect(0,0,this._width,this._height),this._$labelsContainer.html("")},drawArc:function(a,b,c,d){d=this._getGraphicStyle(d);if(d.visibility!="hidden"&&d.opacity>0&&d.widthValue>0&&d.heightValue>0){var e=Math.min(d.widthValue,d.heightValue)/2;b=b*Math.PI/180,c=c*Math.PI/180,this._context.save(),this._context.translate(a[0],a[1]),d.widthValue>d.heightValue?this._context.scale(d.widthValue/d.heightValue,1):this._context.scale(1,d.heightValue/d.widthValue),this._context.beginPath(),this._context.arc(0,0,e,b,c,!1),this._trueCanvas&&this._context.restore(),d.doFill&&(this._context.fillStyle=d.fill,this._context.globalAlpha=d.opacity*d.fillOpacity,this._context.fill()),d.doStroke&&(this._context.lineJoin="round",this._context.lineWidth=d.strokeWidthValue,this._context.strokeStyle=d.stroke,this._context.globalAlpha=d.opacity*d.strokeOpacity,this._context.stroke()),this._trueCanvas||this._context.restore()}},drawPoint:function(a,b){b=this._getGraphicStyle(b),b.widthValue==b.heightValue&&b.heightValue==b.borderRadiusValue?this.drawArc(a,0,360,b):b.visibility!="hidden"&&b.opacity>0&&(b.borderRadiusValue=Math.min(Math.min(b.widthValue,b.heightValue)/2,b.borderRadiusValue),a[0]-=b.widthValue/2,a[1]-=b.heightValue/2,this._context.beginPath(),this._context.moveTo(a[0]+b.borderRadiusValue,a[1]),this._context.lineTo(a[0]+b.widthValue-b.borderRadiusValue,a[1]),this._context.quadraticCurveTo(a[0]+b.widthValue,a[1],a[0]+b.widthValue,a[1]+b.borderRadiusValue),this._context.lineTo(a[0]+b.widthValue,a[1]+b.heightValue-b.borderRadiusValue),this._context.quadraticCurveTo(a[0]+b.widthValue,a[1]+b.heightValue,a[0]+b.widthValue-b.borderRadiusValue,a[1]+b.heightValue),this._context.lineTo(a[0]+b.borderRadiusValue,a[1]+b.heightValue),this._context.quadraticCurveTo(a[0],a[1]+b.heightValue,a[0],a[1]+b.heightValue-b.borderRadiusValue),this._context.lineTo(a[0],a[1]+b.borderRadiusValue),this._context.quadraticCurveTo(a[0],a[1],a[0]+b.borderRadiusValue,a[1]),this._context.closePath(),b.doFill&&(this._context.fillStyle=b.fill,this._context.globalAlpha=b.opacity*b.fillOpacity,this._context.fill()),b.doStroke&&(this._context.lineJoin="round",this._context.lineWidth=b.strokeWidthValue,this._context.strokeStyle=b.stroke,this._context.globalAlpha=b.opacity*b.strokeOpacity,this._context.stroke()))},drawLineString:function(a,b){this._drawLines([a],!1,b)},drawPolygon:function(a,b){if(!this._trueCanvas||a.length==1)this._drawLines(a,!0,b);else{if(!a||!a.length||a[0].length<3)return;b=this._getGraphicStyle(b);var c,d,e;if(b.visibility!="hidden"&&b.opacity>0){this._blitcontext.clearRect(0,0,this._width,this._height);if(b.doFill&&a.length>1){this._blitcontext.globalCompositeOperation="source-out",this._blitcontext.globalAlpha=1;for(d=1;d1)for(d=1;d'+b+"")},resize:function(){this._width=this._$elem.width(),this._height=this._$elem.height();if(!this._width||!this._height)this._width=parseInt(this._$elem.css("width"),10),this._height=parseInt(this._$elem.css("height"),10);this._trueCanvas&&(this._$canvas[0].width=this._width,this._$canvas[0].height=this._height),this._$labelsContainer.css({width:this._width,height:this._height})},_getGraphicStyle:function(b){function c(a){return a=parseInt(a,10),+a+""===a?+a:a}return b=a.extend({},this._options.style,b),b.borderRadiusValue=c(b.borderRadius),b.fill=b.fill||b.color,b.doFill=b.fill&&b.fillOpacity>0,b.stroke=b.stroke||b.color,b.strokeWidthValue=c(b.strokeWidth),b.doStroke=b.stroke&&b.strokeOpacity>0&&b.strokeWidthValue>0,b.widthValue=c(b.width),b.heightValue=c(b.height),b},_drawLines:function(a,b,c){if(!a||!a.length||a[0].length<2)return;var d,e;c=this._getGraphicStyle(c);if(c.visibility!="hidden"&&c.opacity>0){this._context.beginPath();for(d=0;d
                ";while(c[0]);return a>6?a:!a}(),e={bbox:[-180,-85,180,85],bboxMax:[-180,-85,180,85],center:[0,0],cursors:{"static":"default",pan:"url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move",zoom:"crosshair",dragBox:"crosshair",dragCircle:"crosshair",drawPoint:"crosshair",drawLineString:"crosshair",drawPolygon:"crosshair",measureLength:"crosshair",measureArea:"crosshair"},measureLabels:{length:"{{:length.toFixed( 2 )}} m",area:"{{:area.toFixed( 2 )}} sq m"},drawStyle:{},shapeStyle:{},mode:"pan",pannable:!0,scroll:"default",shift:"default",services:[{"class":"osm",type:"tiled",src:function(a){return"http://otile"+(a.index%4+1)+".mqcdn.com/tiles/1.0.0/osm/"+a.zoom+"/"+a.tile.column+"/"+a.tile.row+".png"},attr:"Tiles Courtesy of MapQuest "}],tilingScheme:{tileWidth:256,tileHeight:256,levels:18,basePixelSize:156543.03392799935,origin:[-20037508.342787,20037508.342787]},axisLayout:"map",zoom:0,zoomMin:0,zoomMax:Number.POSITIVE_INFINITY,pixelSize:0};a.widget("geo.geomap",{_$elem:b,_map:b,_created:!1,_createdGraphics:!1,_widgetId:0,_tmplLengthId:"",_tmplAreaId:"",_contentBounds:{},_$resizeContainer:b,_$eventTarget:b,_$contentFrame:b,_$existingChildren:b,_$attrList:b,_$servicesContainer:b,_$shapesContainers:b,_$panContainer:b,_$shapesContainer:b,_$drawContainer:b,_$measureContainer:b,_$measureLabel:b,_dpi:96,_currentServices:[],_center:b,_pixelSize:b,_centerMax:b,_pixelSizeMax:b,_userGeodetic:!0,_centerInteractive:b,_pixelSizeInteractive:b,_timeoutInteractive:null,_triggerInteractive:!1,_loadCount:0,_wheelTimeout:null,_wheelLevel:0,_zoomFactor:2,_fullZoomFactor:2,_partialZoomFactor:1.18920711500273,_mouseDown:b,_inOp:b,_toolPan:b,_shiftDown:b,_anchor:b,_current:b,_downDate:b,_moveDate:b,_clickDate:b,_lastMove:b,_lastDrag:b,_windowHandler:null,_resizeTimeout:null,_panning:b,_velocity:b,_friction:b,_supportTouch:b,_softDblClick:b,_isTap:b,_isDbltap:b,_isMultiTouch:b,_multiTouchAnchor:[],_multiTouchAnchorBbox:b,_multiTouchCurrentBbox:b,_drawTimeout:null,_drawPixels:[],_drawCoords:[],_graphicShapes:[],_initOptions:{},_options:{},options:a.extend({},e),_createWidget:function(b,d){this._$elem=a(d);if(this._$elem.is(".geo-service")){this._graphicShapes=[],a.Widget.prototype._createWidget.apply(this,arguments);return}this._widgetId=c++,this._tmplLengthId="geoMeasureLength"+this._widgetId,this._tmplAreaId="geoMeasureArea"+this._widgetId,this._$elem.addClass("geo-map").css({webkitTransform:"translateZ(0)"}),this._initOptions=b||{},this._forcePosition(this._$elem),this._$elem.css("text-align","left");var e=this._findMapSize();this._contentBounds={x:parseInt(this._$elem.css("padding-left"),10),y:parseInt(this._$elem.css("padding-top"),10),width:e.width,height:e.height},this._createChildren(),this._center=[0,0],this._centerMax=[0,0],this._centerInteractive=[0,0],this.options.pixelSize=this._pixelSize=this._pixelSizeMax=156543.03392799935,this._mouseDown=this._inOp=this._toolPan=this._shiftDown=this._panning=this._isTap=this._isDbltap=!1,this._anchor=[0,0],this._current=[0,0],this._lastMove=[0,0],this._lastDrag=[0,0],this._velocity=[0,0],this._friction=[.8,.8],this._downDate=this._moveDate=this._clickDate=0,this._drawPixels=[],this._drawCoords=[],this._graphicShapes=[],a.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){this._options=this.options;if(this._$elem.is(".geo-service")){this._map=this._$elem.data("geoMap"),this._$elem.data("geoService",this);return}this._map=this,this._supportTouch="ontouchend"in document,this._softDblClick=this._supportTouch||d==7;var c=this,e=this._supportTouch?"touchstart":"mousedown",f=this._supportTouch?"touchend touchcancel":"mouseup",g=this._supportTouch?"touchmove":"mousemove";a(document).keydown(a.proxy(this._document_keydown,this)),this._$eventTarget.dblclick(a.proxy(this._eventTarget_dblclick,this)),this._$eventTarget.bind(e,a.proxy(this._eventTarget_touchstart,this));var h=this._$eventTarget[0].setCapture?this._$eventTarget:a(document);h.bind(g,a.proxy(this._dragTarget_touchmove,this)),h.bind(f,a.proxy(this._dragTarget_touchstop,this)),this._$eventTarget.mousewheel(a.proxy(this._eventTarget_mousewheel,this)),this._windowHandler=function(){c._resizeTimeout&&clearTimeout(c._resizeTimeout),c._resizeTimeout=setTimeout(function(){c._created&&c._$elem.geomap("resize",!0)},500)},a(window).resize(this._windowHandler),this._$drawContainer.geographics({style:this._initOptions.drawStyle||{}}),this._options.drawStyle=this._$drawContainer.geographics("option","style"),this._$shapesContainer.geographics({style:this._initOptions.shapeStyle||{}}),this._createdGraphics=!0,this._options.shapeStyle=this._$shapesContainer.geographics("option","style"),this._initOptions&&(this._initOptions.tilingScheme!==b&&this._setOption("tilingScheme",this._initOptions.tilingScheme||null,!1),this._initOptions.services&&(this._options.services=a.merge([],this._initOptions.services)),this._initOptions.bboxMax&&(this._setOption("bboxMax",this._initOptions.bboxMax,!1),this._setOption("bbox",this._initOptions.bboxMax,!1)),this._initOptions.zoomMin!==b&&this._setOption("zoomMin",this._initOptions.zoomMin,!1),this._initOptions.zoomMax!==b&&this._setOption("zoomMax",this._initOptions.zoomMax,!1),this._initOptions.bbox&&this._setOption("bbox",this._initOptions.bbox,!1),this._initOptions.center&&this._setOption("center",this._initOptions.center,!1),this._initOptions.zoom!==b&&this._setOption("zoom",this._initOptions.zoom,!1)),a.templates(this._tmplLengthId,this._options.measureLabels.length),a.templates(this._tmplAreaId,this._options.measureLabels.area),this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._createServices(),this._refresh(),this._created=!0},_setOption:function(c,d,e){if(c=="pixelSize")return;e=e===b||e,this._$elem.is(".geo-map")&&this._panFinalize();var f,g,h,i;switch(c){case"bbox":this._created&&this._clearInteractiveTimeout(),this._userGeodetic=a.geo.proj&&a.geo._isGeodetic(d),this._userGeodetic&&(d=a.geo.proj.fromGeodetic(d)),f=[d[0]+(d[2]-d[0])/2,d[1]+(d[3]-d[1])/2],g=Math.max(a.geo.width(d,!0)/this._contentBounds.width,a.geo.height(d,!0)/this._contentBounds.height),i=this._getZoom(f,g),this._options.tilingScheme?g=this._getPixelSize(Math.min(Math.max(i,this._options.zoomMin),this._options.zoomMax)):ithis._options.zoomMax&&(g=this._getPixelSize(this._options.zoomMax)),this._created?(this._setInteractiveCenterAndSize(f,g),this._setInteractiveTimeout(!1)):this._setCenterAndSize(f,g,!1,e),d=this._getBbox(f,g);break;case"bboxMax":this._userGeodetic=a.geo.proj&&a.geo._isGeodetic(d);break;case"center":this._created&&this._clearInteractiveTimeout(),this._userGeodetic=a.geo.proj&&a.geo._isGeodetic(d),this._userGeodetic&&(d=a.geo.proj.fromGeodetic(d)),this._created?(this._setInteractiveCenterAndSize(d,this._pixelSize),this._setInteractiveTimeout(!1)):this._setCenterAndSize(d,this._pixelSize,!1,e);break;case"measureLabels":d=a.extend(this._options.measureLabels,d),a.templates(this._tmplLengthId,this._options.measureLabels.length),a.templates(this._tmplAreaId,this._options.measureLabels.area);break;case"drawStyle":this._$drawContainer&&(this._$drawContainer.geographics("option","style",d),d=this._$drawContainer.geographics("option","style"));break;case"shapeStyle":this._$elem.is(".geo-service")&&!this._createdGraphics&&this._createServiceGraphics(),this._createdGraphics&&(this._$shapesContainer.geographics("option","style",d),d=this._$shapesContainer.geographics("option","style"));break;case"mode":this._resetDrawing(),this._$eventTarget.css("cursor",this._options.cursors[d]);break;case"zoom":this._created?this._setZoom(d,!1,e):(d=Math.max(d,0),this._setCenterAndSize(this._center,this._getPixelSize(d),!1,e))}a.Widget.prototype._setOption.apply(this,arguments);switch(c){case"bbox":case"center":this._userGeodetic&&(this._options.bbox=a.geo.proj.toGeodetic(this._options.bbox),this._options.center=a.geo.proj.toGeodetic(this._center));break;case"tilingScheme":d!==null&&(this._pixelSizeMax=this._getPixelSize(0),this._centerMax=[d.origin[0]+this._pixelSizeMax*d.tileWidth/2,d.origin[1]+this._pixelSizeMax*d.tileHeight/2]);break;case"bboxMax":a.geo.proj&&a.geo._isGeodetic(d)?h=a.geo.proj.fromGeodetic(d):h=d,this._centerMax=a.geo.center(h),this._pixelSizeMax=Math.max(a.geo.width(h,!0)/this._contentBounds.width,a.geo.height(h,!0)/this._contentBounds.height);break;case"services":this._createServices(),e&&this._refresh();break;case"shapeStyle":e&&this._createdGraphics&&(this._$shapesContainer.geographics("clear"),this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,this._graphicShapes))}},destroy:function(){if(this._$elem.is(".geo-service"))this._createdGraphics&&(this._$shapesContainer.geographics("destroy"),this._$shapesContainer=b,this._createdGraphics=!1);else{clearTimeout(this._timeoutInteractive),this._timeoutInteractive=null,this._created=!1,a(window).unbind("resize",this._windowHandler);for(var c=0;c=0||b<=1)for(var d=0;d0)){this._createdGraphics||this._createServiceGraphics();var g,h,i,j,k,l;a.isArray(c)?g=c:c.type=="FeatureCollection"?g=c.features:g=[c];for(i=1;i0)){var e=a.isArray(c)?c:[c],f;for(var g=0;g=0&&(a.removeData(c,"geoBbox"),f=this._graphicShapes.slice(g+1),this._graphicShapes.length=g,this._graphicShapes.push.apply(this._graphicShapes,f),g--);if(d===b||d)this._$elem.is(".geo-service")?this._refresh(!1,this._$elem):this._refresh()}},_getBbox:function(a,b){a=a||this._center,b=b||this._pixelSize;var c=this._contentBounds.width/2*b,d=this._contentBounds.height/2*b;return[a[0]-c,a[1]-d,a[0]+c,a[1]+d]},_setBbox:function(b,c,d){var e=[b[0]+(b[2]-b[0])/2,b[1]+(b[3]-b[1])/2],f=Math.max(a.geo.width(b,!0)/this._contentBounds.width,a.geo.height(b,!0)/this._contentBounds.height),g=this._getZoom(e,f);this._options.tilingScheme?f=this._getPixelSize(Math.min(Math.max(g,this._options.zoomMin),this._options.zoomMax)):gthis._options.zoomMax&&(f=this._getPixelSize(this._options.zoomMax)),this._setInteractiveCenterAndSize(e,f),this._interactiveTransform()},_getBboxMax:function(){var a=this._contentBounds.width/2*this._pixelSizeMax,b=this._contentBounds.height/2*this._pixelSizeMax;return[this._centerMax[0]-a,this._centerMax[1]-b,this._centerMax[0]+a,this._centerMax[1]+b]},_getCenter:function(){return this._center},_getContentBounds:function(){return this._contentBounds},_getServicesContainer:function(){return this._$servicesContainer},_getZoom:function(b,c){b=b||this._center,c=c||this._pixelSize;var d=this._options.tilingScheme;if(d){if(d.pixelSizes){var e=Math.floor(c*1e3),f=d.pixelSizes.length,g=f-1;for(;g>=0;g--)if(Math.floor(d.pixelSizes[g]*1e3)>=e)return g;return 0}return Math.round(Math.log(d.basePixelSize/c)/Math.log(2))}var h=this._contentBounds.width/this._contentBounds.height,i=a.geo.reaspect(this._getBbox(b,c),h,!0),j=a.geo.reaspect(this._getBboxMax(),h,!0);return Math.round(Math.log(a.geo.width(j,!0)/a.geo.width(i,!0))/Math.log(this._zoomFactor))},_setZoom:function(a,b,c){this._clearInteractiveTimeout(),a=Math.min(Math.max(a,this._options.zoomMin),this._options.zoomMax),this._setInteractiveCenterAndSize(this._center,this._getPixelSize(a)),this._interactiveTransform(),this._setInteractiveTimeout(b)},_createChildren:function(){this._$existingChildren=this._$elem.children(),this._forcePosition(this._$existingChildren),this._$existingChildren.detach().css({mozUserSelect:"none"});var b="width:"+this._contentBounds.width+"px; height:"+this._contentBounds.height+"px; margin:0; padding:0;",c="position:absolute; left:0; top:0;";this._$elem.prepend('
                '),this._$eventTarget=this._$contentFrame=this._$elem.children(":first"),this._$contentFrame.append('
                '),this._$servicesContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
                '),this._$shapesContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
                  '),this._$attrList=this._$contentFrame.children(":last"),this._$contentFrame.append('
                  '),this._$drawContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
                  '),this._$measureContainer=this._$contentFrame.children(":last"),this._$measureLabel=this._$measureContainer.children(),this._$panContainer=a([this._$shapesContainer[0],this._$drawContainer[0],this._$measureContainer[0]]),this._$resizeContainer=a([this._$contentFrame[0],this._$servicesContainer[0],this._$eventTarget[0],this._$measureContainer[0]]),this._$contentFrame.append(this._$existingChildren),a("#geo-measure-style").length||a("head").prepend('")},_createServices:function(){var b,c;for(c=0;c',g;this._$servicesContainer.append(f),serviceContainer=this._$servicesContainer.children(":last"),b.serviceContainer=serviceContainer,a.geo._serviceTypes[b.type].create(this,serviceContainer,b,c),serviceContainer.data("geoMap",this).geomap(),b.attr&&this._$attrList.append("
                • "+b.attr+"
                • ")}this._$shapesContainers=this._$shapesContainer,this._$attrList.find("a").css({position:"relative",zIndex:100})},_createServiceGraphics:function(){var a=this._$elem.closest(".geo-content-frame");this._$elem.append('
                  '),this._$shapesContainer=this._$elem.children(":last"),this._map._$shapesContainers=this._map._$shapesContainers.add(this._$shapesContainer),this._$shapesContainer.geographics(),this._createdGraphics=!0,this._options.shapeStyle=this._$shapesContainer.geographics("option","style")},_refreshDrawing:function(){this._$drawContainer.geographics("clear");if(this._drawPixels.length>0){var b=this._options.mode,c=this._drawPixels,d=this._drawCoords,e,f,g,h,i;switch(b){case"measureLength":b="drawLineString",f={type:"LineString",coordinates:d},e=a.render[this._tmplLengthId]({length:a.geo.length(f,!0)}),g=a.merge([],c[c.length-1]);break;case"measureArea":b="drawPolygon",f={type:"Polygon",coordinates:[a.merge([],d)]},f.coordinates[0].push(d[0]),e=a.render[this._tmplAreaId]({area:a.geo.area(f,!0)}),g=this._toPixel(a.geo.centroid(f).coordinates),c=[c];break;case"drawPolygon":c=[c]}this._$drawContainer.geographics(b,c),e&&(this._$measureLabel.html(e),h=this._contentBounds.width-(this._$measureLabel.outerWidth(!0)+g[0]),i=this._contentBounds.height-(this._$measureLabel.outerHeight(!0)+g[1]),h<0&&(g[0]+=h),i<0&&(g[1]+=i),this._$measureLabel.css({left:Math.max(g[0],0),top:Math.max(g[1],0)}).show())}},_resetDrawing:function(){this._drawPixels=[],this._drawCoords=[],this._$drawContainer.geographics("clear"),this._$measureLabel.hide()},_refreshShapes:function(c,d,e,f,g,h){var i,j,k,l,m,n,o,p,q=this._map._getBbox(g,h);for(i=0;i0&&a.height>0)){a={width:b.width(),height:b.height()};if(a.width<=0||a.height<=0)a={width:parseInt(b.css("width"),10),height:parseInt(b.css("height"),10)};b=b.parent()}return a},_forcePosition:function(a){var b=a.css("position");b!="relative"&&b!="absolute"&&b!="fixed"&&a.css("position","relative")},_getPixelSize:function(b){var c=this._options.tilingScheme;if(c!==null){if(b===0)return c.pixelSizes?c.pixelSizes[0]:c.basePixelSize;b=Math.round(b),b=Math.max(b,0);var d=c.pixelSizes?c.pixelSizes.length:c.levels;return b=Math.min(b,d-1),c.pixelSizes?c.pixelSizes[b]:c.basePixelSize/Math.pow(2,b)}var e=a.geo.scaleBy(this._getBboxMax(),1/Math.pow(this._zoomFactor,b),!0);return Math.max(a.geo.width(e,!0)/this._contentBounds.width,a.geo.height(e,!0)/this._contentBounds.height)},_getZoomCenterAndSize:function(a,b,c){var d=c?this._fullZoomFactor:this._partialZoomFactor,e=Math.pow(d,-b),f=this._pixelSizeInteractive*e,g=this._getZoom(this._centerInteractive,f);c&&this._options.tilingScheme?f=this._getPixelSize(Math.min(Math.max(g,this._options.zoomMin),this._options.zoomMax)):b<0&&g0&&g>this._options.zoomMax&&(f=this._pixelSizeInteractive);var h=f/this._pixelSizeInteractive,i=this._toMap(a,this._centerInteractive,this._pixelSizeInteractive),j=[(this._centerInteractive[0]-i[0])*h,(this._centerInteractive[1]-i[1])*h],k=[i[0]+j[0],i[1]+j[1]];return{pixelSize:f,center:k}},_mouseWheelFinish:function(a){this._wheelTimeout=null;if(this._wheelLevel!==0){var b=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._options.tilingScheme!==null);this._wheelLevel=0}else a&&this._refresh()},_panFinalize:function(){if(this._panning){this._velocity=[0,0];var a=this._current[0]-this._anchor[0],b=this._current[1]-this._anchor[1],c=this._options.axisLayout==="image",d=-a*this._pixelSize,e=(c?-1:1)*b*this._pixelSize;this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._inOp=!1,this._anchor=this._current,this._mouseDown=this._toolPan=this._panning=!1}},_panMove:function(){if(!this._options.pannable)return;var a=this._current[0]-this._lastDrag[0],b=this._current[1]-this._lastDrag[1],c=0,d,e;if(this._toolPan||a>3||a<-3||b>3||b<-3){this._toolPan||(this._toolPan=!0,this._$eventTarget.css("cursor",this._options.cursors.pan)),this._mouseDown&&(this._velocity=[a,b]);if(a!==0||b!==0)this._panning=!0,this._lastDrag=this._current,this._centerInteractive[0]-=a*this._pixelSizeInteractive,this._centerInteractive[1]+=(this._options.axisLayout==="image"?-1:1)*b*this._pixelSizeInteractive,this._setInteractiveCenterAndSize(this._centerInteractive,this._pixelSizeInteractive),this._interactiveTransform()}},_clearInteractiveTimeout:function(){return this._timeoutInteractive?(clearTimeout(this._timeoutInteractive),this._timeoutInteractive=null,!0):(this._centerInteractive[0]=this._center[0],this._centerInteractive[1]=this._center[1],this._pixelSizeInteractive=this._pixelSize,!1)},_interactiveTransform:function(){this._$shapesContainers&&this._$shapesContainers.geographics("clear");for(var b=0;b0&&(this._drawPixels=this._toPixel(this._drawCoords,this._centerInteractive,this._pixelSizeInteractive),this._refreshDrawing())},_setInteractiveTimeout:function(a){function c(){b._isMultiTouch?b._timeoutInteractive=setTimeout(c,128):b._created&&b._timeoutInteractive&&(b._setCenterAndSize(b._centerInteractive,b._pixelSizeInteractive,b._triggerInteractive,!0),b._timeoutInteractive=null,b._triggerInteractive=!1)}var b=this;this._timeoutInteractive=setTimeout(c,128),this._triggerInteractive|=a},_refresh:function(b,c){var d,e,f=0;for(;f0&&e._refreshShapes(e._$shapesContainer,e._graphicShapes,e._graphicShapes,e._graphicShapes))}this._createdGraphics&&(this._$shapesContainer.geographics("clear"),this._graphicShapes.length>0&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,this._graphicShapes))},_setInteractiveCenterAndSize:function(b,c){this._centerInteractive[0]=b[0],this._centerInteractive[1]=b[1],this._pixelSizeInteractive=c,this._userGeodetic?(this._options.bbox=a.geo.proj.toGeodetic(this._getBbox(b,c)),this._options.center=a.geo.proj.toGeodetic(b)):(this._options.bbox=this._getBbox(b,c),this._options.center[0]=b[0],this._options.center[1]=b[1]),this._options.pixelSize=c,this._options.zoom=this._getZoom(b,c)},_setCenterAndSize:function(b,c,d,e){if(!a.isArray(b)||b.length!=2||typeof b[0]!="number"||typeof b[1]!="number")return;var f=this._getZoom(b,c);this._options.tilingScheme?this._pixelSizeInteractive=c=this._getPixelSize(Math.min(Math.max(f,this._options.zoomMin),this._options.zoomMax)):fthis._options.zoomMax&&(this._pixelSizeInteractive=c=this._getPixelSize(this._options.zoomMax)),this._center[0]=b[0],this._center[1]=b[1],this._options.pixelSize=this._pixelSize=c,this._userGeodetic?(this._options.bbox=a.geo.proj.toGeodetic(this._getBbox()),this._options.center=a.geo.proj.toGeodetic(this._center)):(this._options.bbox=this._getBbox(),this._options.center=a.merge([],b)),this._options.zoom=f,d&&this._trigger("bboxchange",window.event,{bbox:a.merge([],this._options.bbox)}),e&&(this._refresh(),this._refreshDrawing())},_requestQueued:function(){this._loadCount===0&&this._trigger("loadstart",window.event),this._loadCount++},_requestComplete:function(){this._loadCount--,this._loadCount<=0&&(this._loadCount=0,this._trigger("loadend",window.event))},_toMap:function(b,c,d){c=c||this._center,d=d||this._pixelSize;var e=a.isArray(b[0]),f=e&&a.isArray(b[0][0]),g=f&&a.isArray(b[0][0][0]),h=this._contentBounds.width,i=this._contentBounds.height,j=h/2*d,k=i/2*d,l=[c[0]-j,c[1]-k,c[0]+j,c[1]+k],m=a.geo.width(l,!0)/h,n=a.geo.height(l,!0)/i,o,p=this._options.axisLayout==="image",q=[],r,s,t;g||(f||(e||(b=[b]),b=[b]),b=[b]);for(r=0;r0&&b.which==27&&(c<=2?(this._resetDrawing(),this._inOp=!1):(this._drawCoords[c-2]=a.merge([],this._drawCoords[c-1]),this._drawPixels[c-2]=a.merge([],this._drawPixels[c-1]),this._drawCoords.length--,this._drawPixels.length--,this._refreshDrawing()))},_eventTarget_dblclick_zoom:function(a){var b=this._clearInteractiveTimeout();this._trigger("dblclick",a,{type:"Point",coordinates:this._toMap(this._current,this._centerInteractive,this._pixelSizeInteractive)});if(!a.isDefaultPrevented()){var c=this._getZoomCenterAndSize(this._current,1,!0);this._setInteractiveCenterAndSize(c.center,c.pixelSize),this._interactiveTransform(),b=!0}b&&this._setInteractiveTimeout(!0)},_eventTarget_dblclick:function(b){if(this._options.mode==="static")return;this._drawTimeout&&(window.clearTimeout(this._drawTimeout),this._drawTimeout=null);var c=a(b.currentTarget).offset();switch(this._options.mode){case"drawLineString":case"measureLength":this._drawCoords.length>1&&(this._drawCoords[0][0]!=this._drawCoords[1][0]||this._drawCoords[0][1]!=this._drawCoords[1][1])?(this._drawCoords.length--,this._trigger("shape",b,{type:"LineString",coordinates:this._userGeodetic?a.geo.proj.toGeodetic(this._drawCoords):this._drawCoords})):this._eventTarget_dblclick_zoom(b),this._resetDrawing();break;case"drawPolygon":case"measureArea":if(this._drawCoords.length>1&&(this._drawCoords[0][0]!=this._drawCoords[1][0]||this._drawCoords[0][1]!=this._drawCoords[1][1])){var d=this._drawCoords.length-1;d>2&&(this._drawCoords[d]=a.merge([],this._drawCoords[0]),this._trigger("shape",b,{type:"Polygon",coordinates:[this._userGeodetic?a.geo.proj.toGeodetic(this._drawCoords):this._drawCoords]}))}else this._eventTarget_dblclick_zoom(b);this._resetDrawing();break;default:this._eventTarget_dblclick_zoom(b)}this._inOp=!1},_eventTarget_touchstart:function(b){var c=this._options.mode,d=this._options.shift;if(c==="static")return;if(!this._supportTouch&&b.which!=1)return;var e=this._clearInteractiveTimeout(),f=a(b.currentTarget).offset(),g=b.originalEvent.changedTouches;this._supportTouch?(this._multiTouchAnchor=a.merge([],g),this._isMultiTouch=this._multiTouchAnchor.length>1,this._isMultiTouch?(this._multiTouchCurrentBbox=[g[0].pageX-f.left,g[0].pageY-f.top,g[1].pageX-f.left,g[1].pageY-f.top],this._multiTouchAnchorBbox=a.merge([],this._multiTouchCurrentBbox),this._current=a.geo.center(this._multiTouchCurrentBbox,!0)):(this._multiTouchCurrentBbox=[g[0].pageX-f.left,g[0].pageY-f.top,NaN,NaN],this._current=[g[0].pageX-f.left,g[0].pageY-f.top])):this._current=[b.pageX-f.left,b.pageY-f.top];if(this._softDblClick){var h=a.now();if(h-this._downDate<750){if(this._isTap){var i=this._current[0]-this._anchor[0],j=this._current[1]-this._anchor[1],k=Math.sqrt(i*i+j*j);k>8?this._isTap=!1:this._current=a.merge([],this._anchor)}this._isDbltap?this._isDbltap=!1:this._isDbltap=this._isTap}else this._isDbltap=!1;this._isTap=!0,this._downDate=h}return this._mouseDown=!0,this._anchor=a.merge([],this._current),!this._inOp&&b.shiftKey&&d!=="off"?(this._shiftDown=!0,this._$eventTarget.css("cursor",this._options.cursors[d==="default"?"zoom":d])):!this._isMultiTouch&&(this._options.pannable||c==="dragBox"||c==="dragCircle")&&(this._inOp=!0,c!=="zoom"&&c!=="dragBox"&&c!=="dragCircle"&&(this._lastDrag=this._current,b.currentTarget.setCapture&&b.currentTarget.setCapture())),b.preventDefault(),e&&this._setInteractiveTimeout(!0),!1},_dragTarget_touchmove:function(b){if(this._options.mode==="static")return;var c=!1;this._mouseDown&&(c=this._clearInteractiveTimeout());var e=this._$eventTarget.offset(),f=this._drawCoords.length,g=b.originalEvent.changedTouches,h,i,j=0;if(this._supportTouch){if(!this._isMultiTouch&&this._mouseDown&&this._multiTouchAnchor.length>0&&g[0].identifier!==this._multiTouchAnchor[0].identifier)return this._mouseDown=!1,this._isMultiTouch=!0,this._wheelLevel=0,this._multiTouchAnchor.push(g[0]),this._multiTouchCurrentBbox=[this._multiTouchCurrentBbox[0],this._multiTouchCurrentBbox[1],this._multiTouchAnchor[1].pageX-e.left,this._multiTouchAnchor[1].pageY-e.top],this._multiTouchAnchorBbox=a.merge([],this._multiTouchCurrentBbox),this._mouseDown=!0,this._anchor=this._current=a.geo.center(this._multiTouchCurrentBbox,!0),c&&this._setInteractiveTimeout(!0),!1;if(this._isMultiTouch){for(;j0?m*=5:m*=10;var n=m-this._wheelLevel;this._wheelLevel=m;var o=this._getZoomCenterAndSize(this._anchor,n,!1);this._setInteractiveCenterAndSize(o.center,o.pixelSize),this._interactiveTransform(),c=!0,h=a.geo.center(this._multiTouchCurrentBbox,!0)}else h=[b.originalEvent.changedTouches[0].pageX-e.left,b.originalEvent.changedTouches[0].pageY-e.top]}else h=[b.pageX-e.left,b.pageY-e.top];if(h[0]===this._lastMove[0]&&h[1]===this._lastMove[1]&&this._inOp)return b.preventDefault(),c&&this._setInteractiveTimeout(!0),!1;d==7&&(this._isDbltap=this._isTap=!1),this._mouseDown&&(this._current=h,this._moveDate=a.now());if(this._isMultiTouch)return b.preventDefault(),this._isDbltap=this._isTap=!1,c&&this._setInteractiveTimeout(!0),!1;var p=this._options.shift,q=this._shiftDown?p==="default"?"zoom":p:this._options.mode,r,s,t;switch(q){case"zoom":case"dragBox":this._mouseDown?(this._$drawContainer.geographics("clear"),this._$drawContainer.geographics("drawBbox",[this._anchor[0],this._anchor[1],h[0],h[1]])):this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)});break;case"dragCircle":this._mouseDown?(r=h[0]-this._anchor[0],s=h[1]-this._anchor[1],t=Math.sqrt(r*r+s*s)*2,this._$drawContainer.geographics("clear"),this._$drawContainer.geographics("drawArc",this._anchor,0,360,{width:t,height:t})):this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)});break;case"drawLineString":case"drawPolygon":case"measureLength":case"measureArea":this._mouseDown||this._toolPan?(this._panMove(),c=!0):(f>0&&(this._drawCoords[f-1]=this._toMap(h,this._centerInteractive,this._pixelSizeInteractive),this._drawPixels[f-1]=h,this._refreshDrawing()),this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)}));break;default:this._mouseDown||this._toolPan?(this._panMove(),c=!0):this._trigger("move",b,{type:"Point",coordinates:this.toMap(h)})}this._lastMove=h,c&&this._setInteractiveTimeout(!0);if(this._inOp)return b.preventDefault(),!1},_dragTarget_touchstop:function(b){if(this._options.mode==="static")return;if(!this._mouseDown)if(d==7)this._eventTarget_touchstart(b);else return!1;var c=this._clearInteractiveTimeout(),e=this._mouseDown,f=this._toolPan,g=this._$eventTarget.offset(),h=this._options.shift,i=this._shiftDown?h==="default"?"zoom":h:this._options.mode,j,k,l,m,n,o,p;this._supportTouch?(j=[b.originalEvent.changedTouches[0].pageX-g.left,b.originalEvent.changedTouches[0].pageY-g.top],this._multiTouchAnchor=[],this._inOp=!1):j=[b.pageX-g.left,b.pageY-g.top],this._softDblClick&&this._isTap&&(m=j[0]-this._anchor[0],n=j[1]-this._anchor[1],Math.sqrt(m*m+n*n)<=8&&(j=a.merge([],this._anchor))),m=j[0]-this._anchor[0],n=j[1]-this._anchor[1],this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._shiftDown=this._mouseDown=this._toolPan=!1;if(this._isMultiTouch){b.preventDefault(),this._isMultiTouch=!1,this._wheelLevel=0,c&&this._setInteractiveTimeout(!0);return}document.releaseCapture&&document.releaseCapture();if(e){l=a.now(),this._current=j;switch(i){case"zoom":case"dragBox":if(m!==0||n!==0){var q=this._pixelSize*6,r=this._toMap([[Math.min(this._anchor[0],j[0]),Math.max(this._anchor[1],j[1])],[Math.max(this._anchor[0],j[0]),Math.min(this._anchor[1],j[1])]]),s=[r[0][0],r[0][1],r[1][0],r[1][1]];i==="zoom"?(s[2]-s[0]100){var x=this;this._drawTimeout=setTimeout(function(){x._drawTimeout&&(x._trigger("shape",b,{type:"Point",coordinates:x.toMap(j)}),x._inOp=!1,x._drawTimeout=null)},250)}break;case"drawLineString":case"drawPolygon":case"measureLength":case"measureArea":if(f)this._panFinalize();else{k=this._drawCoords.length===0?0:this._drawCoords.length-1,this._drawCoords[k]=this._toMap(j),this._drawPixels[k]=j;if(k<2||this._drawCoords[k][0]!=this._drawCoords[k-1][0]||this._drawCoords[k][1]!=this._drawCoords[k-1][1])this._drawCoords[k+1]=this._toMap(j,this._centerInteractive,this._pixelSizeInteractive),this._drawPixels[k+1]=j;this._refreshDrawing()}break;default:f?this._panFinalize():l-this._clickDate>100&&(this._trigger("click",b,{type:"Point",coordinates:this.toMap(j)}),this._inOp=!1)}this._clickDate=l;if(this._softDblClick&&this._isDbltap)return this._isDbltap=this._isTap=!1,c&&this._setInteractiveTimeout(!0),this._$eventTarget.trigger("dblclick",b),!1}c&&this._setInteractiveTimeout(!0);if(this._inOp)return b.preventDefault(),!1},_eventTarget_mousewheel:function(b,c){if(this._options.mode==="static"||this._options.scroll==="off")return;b.preventDefault();if(this._mouseDown)return!1;if(c!==0){this._clearInteractiveTimeout(),c>0?c=Math.ceil(c):c=Math.floor(c);var d=a(b.currentTarget).offset();this._anchor=[b.pageX-d.left,b.pageY-d.top];var e=this._getZoomCenterAndSize(this._anchor,c,this._options.tilingScheme!==null),f,g=0;this._setInteractiveCenterAndSize(e.center,e.pixelSize),this._interactiveTransform(),this._setInteractiveTimeout(!0)}return!1}})}(jQuery),function(a,b){a.geo._serviceTypes.tiled=function(){return{create:function(b,c,d,e){var f=a.data(d,"geoServiceState");if(!f){f={loadCount:0,reloadTiles:!1};var g='
                  ';c.append(g),f.serviceContainer=c.children(":last"),a.data(d,"geoServiceState",f)}return f.serviceContainer},destroy:function(b,c,d){var e=a.data(d,"geoServiceState");e.serviceContainer.remove(),a.removeData(d,"geoServiceState")},interactiveTransform:function(b,c,d,e){var f=a.data(c,"geoServiceState"),g=b.options.tilingScheme;f&&(this._cancelUnloaded(b,c),f.serviceContainer.children().each(function(c){var f=a(this),h=f.data("pixelSize"),i=h/e;if(h>0){i=Math.round(i*1e3)/1e3;var j=f.data("scaleOrigin"),k=b._toPixel(j,d,e);f.css({left:Math.round(k[0])+"px",top:Math.round(k[1])+"px",width:g.tileWidth*i,height:g.tileHeight*i})}}))},refresh:function(b,c,d){var e=a.data(c,"geoServiceState");this._cancelUnloaded(b,c),e&&d&&(e.reloadTiles=!0);if(e&&c&&c.style.visibility==="visible"&&!e.serviceContainer.is(":hidden")){var f=b._getBbox(),g=b._pixelSize,h=this,i=e.serviceContainer,j=b._getContentBounds(),k=j.width,l=j.height,m=b.options.axisLayout==="image",n=m?1:-1,o=b.options.tilingScheme,p=o.tileWidth,q=o.tileHeight,r=Math.floor((f[0]-o.origin[0])/(g*p)),s=Math.max(Math.floor((m?f[1]-o.origin[1]:o.origin[1]-f[3])/(g*q)),0),t=Math.ceil((f[2]-o.origin[0])/(g*p)),u=Math.ceil((m?f[3]-o.origin[1]:o.origin[1]-f[1])/(g*q)),v=b._getBboxMax(),w=b._getPixelSize(0),x=w/g,y=Math.floor((v[0]-o.origin[0])/(w*p))*x,z=Math.floor((o.origin[1]+n*v[3])/(w*q))*x,A=o.origin[0]+y*p*g,B=o.origin[1]+n*z*q*g,C=Math.round((A-f[0])/g),D=Math.round((m?B-f[1]:f[3]-B)/g),E=i.children().show(),F=E.filter("[data-pixel-size='"+g+"']").appendTo(i),G=c.style.opacity,H,I,J=function(c){h._loadImage(a.data(this,"img"),c,g,b,e,G)},K=function(){a.data(this,"img").remove(),e.loadCount--,b._requestComplete()};e.reloadTiles&&E.find("img").attr("data-dirty","true"),F.size()?(F.css({left:C%p+"px",top:D%q+"px"}).data("scaleOrigin",b._toMap([C%p,D%q])),F.children().each(function(b){var c=a(this),d=c.attr("data-tile").split(",");c.css({left:Math.round((parseInt(d[0],10)-y)*100+(C-C%p)/p*100)+"%",top:Math.round((parseInt(d[1],10)-z)*100+(D-D%q)/q*100)+"%"}),G<1&&c.fadeTo(0,G)})):(i.append("
                  "),F=i.children(":last").data("scaleOrigin",b._toMap([C%p,D%q])));for(H=r;H0)M.attr("src",T);else{var U="",F.append(U),M=F.children(":last")}typeof T=="string"?h._loadImage(M,T,g,b,e,G):T?(a.data(T,"img",M),T.done(J).fail(K)):M.remove()}}E.find("[data-dirty]").remove(),e.reloadTiles=!1}},resize:function(a,b){},opacity:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.find("img").stop(!0).fadeTo("fast",c.style.opacity)},toggle:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.css("display",c.style.visibility==="visible"?"block":"none")},_cancelUnloaded:function(b,c){var d=a.data(c,"geoServiceState");if(d&&d.loadCount>0){d.serviceContainer.find("img:hidden").remove();while(d.loadCount>0)d.loadCount--,b._requestComplete()}},_loadImage:function(b,c,d,e,f,g){var h=f.serviceContainer;b.load(function(b){g<1?a(b.target).fadeTo(0,g):a(b.target).show(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(":not([data-pixel-size='"+d+"'])").remove(),f.loadCount=0)}).error(function(b){a(b.target).remove(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(":not([data-pixel-size='"+d+"'])").remove(),f.loadCount=0)}).attr("src",c)}}}()}(jQuery),function(a,b){a.geo._serviceTypes.shingled=function(){return{create:function(b,c,d,e){var f=a.data(d,"geoServiceState");if(!f){f={loadCount:0};var g='
                  ';c.append(g),f.serviceContainer=c.children(":last"),a.data(d,"geoServiceState",f)}return f.serviceContainer},destroy:function(b,c,d){var e=a.data(d,"geoServiceState");e.serviceContainer.remove(),a.removeData(d,"geoServiceState")},interactiveTransform:function(b,c,d,e){var f=a.data(c,"geoServiceState"),g=b._getContentBounds(),h=g.width,i=g.height,j=h/2,k=i/2,l=[d[0]-j,d[1]-k,d[0]+j,d[1]+k];f&&(this._cancelUnloaded(b,c),f.serviceContainer.children().each(function(c){var f=a(this),g=f.data("pixelSize"),j=g/e;if(g>0){j=Math.round(j*1e3)/1e3;var k=f.data("origin"),l=b._toPixel(k,d,e);f.css({left:Math.round(l[0]),top:Math.round(l[1]),width:h*j,height:i*j})}}))},refresh:function(b,c){var d=a.data(c,"geoServiceState");this._cancelUnloaded(b,c);if(d&&c&&c.style.visibility==="visible"&&!d.serviceContainer.is(":hidden")){var e=b._getBbox(),f=b._pixelSize,g=this,h=d.serviceContainer,i=b._getContentBounds(),j=i.width,k=i.height,l=h.children('[data-pixel-size="'+f+'"]'),m=c.style.opacity,n;m<1&&h.find("img").attr("data-keep-alive","0"),l.size()||(h.append('
                  '),l=h.children(":last"));var o=c.hasOwnProperty("src")?"src":"getUrl",p={bbox:e,width:j,height:k,zoom:b._getZoom(),tile:null,index:0},q=a.isFunction(c[o]),r,s=l.position();s.left=-s.left,s.top=-s.top,q?r=c[o](p):(a.templates("geoSrc",c[o]),r=a.render.geoSrc(p)),d.loadCount++,b._requestQueued(),l.append(''),n=l.children(":last").data("center",b._center),typeof r=="string"?g._loadImage(n,r,f,b,d,m):r.done(function(a){g._loadImage(n,a,f,b,d,m)}).fail(function(){n.remove(),d.loadCount--,b._requestComplete()})}},resize:function(b,c){var d=a.data(c,"geoServiceState");if(d&&c&&c.style.visibility==="visible"){this._cancelUnloaded(b,c);var e=d.serviceContainer,f=b._getContentBounds(),g=f.width,h=f.height,i=e.children();i.attr("data-pixel-size","0"),i.each(function(c){var d=a(this),e=d.position(),f=d.data("origin"),i=b._toPixel(f);d.css({left:e.left+(g-d.width())/2,top:e.top+(h-d.height())/2})})}},opacity:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.find("img").stop(!0).fadeTo("fast",c.style.opacity)},toggle:function(b,c){var d=a.data(c,"geoServiceState");d.serviceContainer.css("display",c.style.visibility==="visible"?"block":"none")},_cancelUnloaded:function(b,c){var d=a.data(c,"geoServiceState");if(d&&d.loadCount>0){d.serviceContainer.find("img:hidden").remove();while(d.loadCount>0)d.loadCount--,b._requestComplete()}},_loadImage:function(b,c,d,e,f,g){var h=f.serviceContainer;b.load(function(b){g<1?a(b.target).fadeTo(0,g):a(b.target).show(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(':not([data-pixel-size="'+d+'"])').remove(),h.find("img[data-keep-alive]").remove(),f.loadCount=0)}).error(function(b){a(b.target).remove(),f.loadCount--,e._requestComplete(),f.loadCount<=0&&(h.children(":not([data-pixel-size='"+d+"'])").remove(),f.loadCount=0)}).attr("src",c)}}}()}(jQuery) \ No newline at end of file diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.js deleted file mode 100755 index e3db452..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.js +++ /dev/null @@ -1,7215 +0,0 @@ -/*! jQuery Geo - vtest - 2012-11-02 - * http://jquerygeo.com - * Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */ - -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// Known Issues: -// -// * Patterns only support repeat. -// * Radial gradient are not implemented. The VML version of these look very -// different from the canvas one. -// * Clipping paths are not implemented. -// * Coordsize. The width and height attribute have higher priority than the -// width and height style values which isn't correct. -// * Painting mode isn't implemented. -// * Canvas width/height should is using content-box by default. IE in -// Quirks mode will draw the canvas using border-box. Either change your -// doctype to HTML5 -// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) -// or use Box Sizing Behavior from WebFX -// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) -// * Non uniform scaling does not correctly scale strokes. -// * Optimize. There is always room for speed improvements. - -// Only add this code if we do not already have a canvas implementation -if (!document.createElement('canvas').getContext) { - - (function () { - - // alias some functions to make (compiled) code shorter - var m = Math; - var mr = m.round; - var ms = m.sin; - var mc = m.cos; - var abs = m.abs; - var sqrt = m.sqrt; - - // this is used for sub pixel precision - var Z = 10; - var Z2 = Z / 2; - - var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1]; - - /** - * This funtion is assigned to the elements as element.getContext(). - * @this {HTMLElement} - * @return {CanvasRenderingContext2D_} - */ - function getContext() { - return this.context_ || - (this.context_ = new CanvasRenderingContext2D_(this)); - } - - var slice = Array.prototype.slice; - - /** - * Binds a function to an object. The returned function will always use the - * passed in {@code obj} as {@code this}. - * - * Example: - * - * g = bind(f, obj, a, b) - * g(c, d) // will do f.call(obj, a, b, c, d) - * - * @param {Function} f The function to bind the object to - * @param {Object} obj The object that should act as this when the function - * is called - * @param {*} var_args Rest arguments that will be used as the initial - * arguments when the function is called - * @return {Function} A new function that has bound this - */ - function bind(f, obj, var_args) { - var a = slice.call(arguments, 2); - return function () { - return f.apply(obj, a.concat(slice.call(arguments))); - }; - } - - function encodeHtmlAttribute(s) { - return String(s).replace(/&/g, '&').replace(/"/g, '"'); - } - - function addNamespace(doc, prefix, urn) { - if (!doc.namespaces[prefix]) { - doc.namespaces.add(prefix, urn, '#default#VML'); - } - } - - function addNamespacesAndStylesheet(doc) { - addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml'); - addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office'); - - // Setup default CSS. Only add one style sheet per document - if (!doc.styleSheets['ex_canvas_']) { - var ss = doc.createStyleSheet(); - ss.owningElement.id = 'ex_canvas_'; - ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + - // default size is 300x150 in Gecko and Opera - 'text-align:left;width:300px;height:150px}'; - } - } - - // Add namespaces and stylesheet at startup. - addNamespacesAndStylesheet(document); - - var G_vmlCanvasManager_ = { - init: function (opt_doc) { - var doc = opt_doc || document; - // Create a dummy element so that IE will allow canvas elements to be - // recognized. - doc.createElement('canvas'); - doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); - }, - - init_: function (doc) { - // find all canvas elements - var els = doc.getElementsByTagName('canvas'); - for (var i = 0; i < els.length; i++) { - this.initElement(els[i]); - } - }, - - /** - * Public initializes a canvas element so that it can be used as canvas - * element from now on. This is called automatically before the page is - * loaded but if you are creating elements using createElement you need to - * make sure this is called on the element. - * @param {HTMLElement} el The canvas element to initialize. - * @return {HTMLElement} the element that was created. - */ - initElement: function (el) { - if (!el.getContext) { - el.getContext = getContext; - - // Add namespaces and stylesheet to document of the element. - addNamespacesAndStylesheet(el.ownerDocument); - - // Remove fallback content. There is no way to hide text nodes so we - // just remove all childNodes. We could hide all elements and remove - // text nodes but who really cares about the fallback content. - el.innerHTML = ''; - - // do not use inline function because that will leak memory - el.attachEvent('onpropertychange', onPropertyChange); - el.attachEvent('onresize', onResize); - - var attrs = el.attributes; - if (attrs.width && attrs.width.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setWidth_(attrs.width.nodeValue); - el.style.width = attrs.width.nodeValue + 'px'; - } else { - el.width = el.clientWidth; - } - if (attrs.height && attrs.height.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setHeight_(attrs.height.nodeValue); - el.style.height = attrs.height.nodeValue + 'px'; - } else { - el.height = el.clientHeight; - } - //el.getContext().setCoordsize_() - } - return el; - } - }; - - function onPropertyChange(e) { - var el = e.srcElement; - - switch (e.propertyName) { - case 'width': - el.getContext().clearRect(); - el.style.width = el.attributes.width.nodeValue + 'px'; - // In IE8 this does not trigger onresize. - el.firstChild.style.width = el.clientWidth + 'px'; - break; - case 'height': - el.getContext().clearRect(); - el.style.height = el.attributes.height.nodeValue + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - break; - } - } - - function onResize(e) { - var el = e.srcElement; - if (el.firstChild) { - el.firstChild.style.width = el.clientWidth + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - } - } - - G_vmlCanvasManager_.init(); - - // precompute "00" to "FF" - var decToHex = []; - for (var i = 0; i < 16; i++) { - for (var j = 0; j < 16; j++) { - decToHex[i * 16 + j] = i.toString(16) + j.toString(16); - } - } - - function createMatrixIdentity() { - return [ - [1, 0, 0], - [0, 1, 0], - [0, 0, 1] - ]; - } - - function matrixMultiply(m1, m2) { - var result = createMatrixIdentity(); - - for (var x = 0; x < 3; x++) { - for (var y = 0; y < 3; y++) { - var sum = 0; - - for (var z = 0; z < 3; z++) { - sum += m1[x][z] * m2[z][y]; - } - - result[x][y] = sum; - } - } - return result; - } - - function copyState(o1, o2) { - o2.fillStyle = o1.fillStyle; - o2.lineCap = o1.lineCap; - o2.lineJoin = o1.lineJoin; - o2.lineWidth = o1.lineWidth; - o2.miterLimit = o1.miterLimit; - o2.shadowBlur = o1.shadowBlur; - o2.shadowColor = o1.shadowColor; - o2.shadowOffsetX = o1.shadowOffsetX; - o2.shadowOffsetY = o1.shadowOffsetY; - o2.strokeStyle = o1.strokeStyle; - o2.globalAlpha = o1.globalAlpha; - o2.font = o1.font; - o2.textAlign = o1.textAlign; - o2.textBaseline = o1.textBaseline; - o2.arcScaleX_ = o1.arcScaleX_; - o2.arcScaleY_ = o1.arcScaleY_; - o2.lineScale_ = o1.lineScale_; - } - - // var colorData = { - // aliceblue: '#F0F8FF', - // antiquewhite: '#FAEBD7', - // aquamarine: '#7FFFD4', - // azure: '#F0FFFF', - // beige: '#F5F5DC', - // bisque: '#FFE4C4', - // black: '#000000', - // blanchedalmond: '#FFEBCD', - // blueviolet: '#8A2BE2', - // brown: '#A52A2A', - // burlywood: '#DEB887', - // cadetblue: '#5F9EA0', - // chartreuse: '#7FFF00', - // chocolate: '#D2691E', - // coral: '#FF7F50', - // cornflowerblue: '#6495ED', - // cornsilk: '#FFF8DC', - // crimson: '#DC143C', - // cyan: '#00FFFF', - // darkblue: '#00008B', - // darkcyan: '#008B8B', - // darkgoldenrod: '#B8860B', - // darkgray: '#A9A9A9', - // darkgreen: '#006400', - // darkgrey: '#A9A9A9', - // darkkhaki: '#BDB76B', - // darkmagenta: '#8B008B', - // darkolivegreen: '#556B2F', - // darkorange: '#FF8C00', - // darkorchid: '#9932CC', - // darkred: '#8B0000', - // darksalmon: '#E9967A', - // darkseagreen: '#8FBC8F', - // darkslateblue: '#483D8B', - // darkslategray: '#2F4F4F', - // darkslategrey: '#2F4F4F', - // darkturquoise: '#00CED1', - // darkviolet: '#9400D3', - // deeppink: '#FF1493', - // deepskyblue: '#00BFFF', - // dimgray: '#696969', - // dimgrey: '#696969', - // dodgerblue: '#1E90FF', - // firebrick: '#B22222', - // floralwhite: '#FFFAF0', - // forestgreen: '#228B22', - // gainsboro: '#DCDCDC', - // ghostwhite: '#F8F8FF', - // gold: '#FFD700', - // goldenrod: '#DAA520', - // grey: '#808080', - // greenyellow: '#ADFF2F', - // honeydew: '#F0FFF0', - // hotpink: '#FF69B4', - // indianred: '#CD5C5C', - // indigo: '#4B0082', - // ivory: '#FFFFF0', - // khaki: '#F0E68C', - // lavender: '#E6E6FA', - // lavenderblush: '#FFF0F5', - // lawngreen: '#7CFC00', - // lemonchiffon: '#FFFACD', - // lightblue: '#ADD8E6', - // lightcoral: '#F08080', - // lightcyan: '#E0FFFF', - // lightgoldenrodyellow: '#FAFAD2', - // lightgreen: '#90EE90', - // lightgrey: '#D3D3D3', - // lightpink: '#FFB6C1', - // lightsalmon: '#FFA07A', - // lightseagreen: '#20B2AA', - // lightskyblue: '#87CEFA', - // lightslategray: '#778899', - // lightslategrey: '#778899', - // lightsteelblue: '#B0C4DE', - // lightyellow: '#FFFFE0', - // limegreen: '#32CD32', - // linen: '#FAF0E6', - // magenta: '#FF00FF', - // mediumaquamarine: '#66CDAA', - // mediumblue: '#0000CD', - // mediumorchid: '#BA55D3', - // mediumpurple: '#9370DB', - // mediumseagreen: '#3CB371', - // mediumslateblue: '#7B68EE', - // mediumspringgreen: '#00FA9A', - // mediumturquoise: '#48D1CC', - // mediumvioletred: '#C71585', - // midnightblue: '#191970', - // mintcream: '#F5FFFA', - // mistyrose: '#FFE4E1', - // moccasin: '#FFE4B5', - // navajowhite: '#FFDEAD', - // oldlace: '#FDF5E6', - // olivedrab: '#6B8E23', - // orange: '#FFA500', - // orangered: '#FF4500', - // orchid: '#DA70D6', - // palegoldenrod: '#EEE8AA', - // palegreen: '#98FB98', - // paleturquoise: '#AFEEEE', - // palevioletred: '#DB7093', - // papayawhip: '#FFEFD5', - // peachpuff: '#FFDAB9', - // peru: '#CD853F', - // pink: '#FFC0CB', - // plum: '#DDA0DD', - // powderblue: '#B0E0E6', - // rosybrown: '#BC8F8F', - // royalblue: '#4169E1', - // saddlebrown: '#8B4513', - // salmon: '#FA8072', - // sandybrown: '#F4A460', - // seagreen: '#2E8B57', - // seashell: '#FFF5EE', - // sienna: '#A0522D', - // skyblue: '#87CEEB', - // slateblue: '#6A5ACD', - // slategray: '#708090', - // slategrey: '#708090', - // snow: '#FFFAFA', - // springgreen: '#00FF7F', - // steelblue: '#4682B4', - // tan: '#D2B48C', - // thistle: '#D8BFD8', - // tomato: '#FF6347', - // turquoise: '#40E0D0', - // violet: '#EE82EE', - // wheat: '#F5DEB3', - // whitesmoke: '#F5F5F5', - // yellowgreen: '#9ACD32' - // }; - - - function getRgbHslContent(styleString) { - var start = styleString.indexOf('(', 3); - var end = styleString.indexOf(')', start + 1); - var parts = styleString.substring(start + 1, end).split(','); - // add alpha if needed - if (parts.length != 4 || styleString.charAt(3) != 'a') { - parts[3] = 1; - } - return parts; - } - - function percent(s) { - return parseFloat(s) / 100; - } - - function clamp(v, min, max) { - return Math.min(max, Math.max(min, v)); - } - - function hslToRgb(parts) { - var r, g, b, h, s, l; - h = parseFloat(parts[0]) / 360 % 360; - if (h < 0) - h++; - s = clamp(percent(parts[1]), 0, 1); - l = clamp(percent(parts[2]), 0, 1); - if (s == 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hueToRgb(p, q, h + 1 / 3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1 / 3); - } - - return '#' + decToHex[Math.floor(r * 255)] + - decToHex[Math.floor(g * 255)] + - decToHex[Math.floor(b * 255)]; - } - - function hueToRgb(m1, m2, h) { - if (h < 0) - h++; - if (h > 1) - h--; - - if (6 * h < 1) - return m1 + (m2 - m1) * 6 * h; - else if (2 * h < 1) - return m2; - else if (3 * h < 2) - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - else - return m1; - } - - var processStyleCache = {}; - - function processStyle(styleString) { - if (styleString in processStyleCache) { - return processStyleCache[styleString]; - } - - var str, alpha = 1; - - styleString = String(styleString); - if (styleString.charAt(0) == '#') { - str = styleString; - } else if (/^rgb/.test(styleString)) { - var parts = getRgbHslContent(styleString); - var str = '#', n; - for (var i = 0; i < 3; i++) { - if (parts[i].indexOf('%') != -1) { - n = Math.floor(percent(parts[i]) * 255); - } else { - n = +parts[i]; - } - str += decToHex[clamp(n, 0, 255)]; - } - alpha = +parts[3]; - } else if (/^hsl/.test(styleString)) { - var parts = getRgbHslContent(styleString); - str = hslToRgb(parts); - alpha = parts[3]; - } else { - str = /*colorData[styleString] ||*/styleString; - } - return processStyleCache[styleString] = { color: str, alpha: alpha }; - } - - var DEFAULT_STYLE = { - style: 'normal', - variant: 'normal', - weight: 'normal', - size: 10, - family: 'sans-serif' - }; - - // Internal text style cache - // var fontStyleCache = {}; - - // function processFontStyle(styleString) { - // if (fontStyleCache[styleString]) { - // return fontStyleCache[styleString]; - // } - - // var el = document.createElement('div'); - // var style = el.style; - // try { - // style.font = styleString; - // } catch (ex) { - // // Ignore failures to set to invalid font. - // } - - // return fontStyleCache[styleString] = { - // style: style.fontStyle || DEFAULT_STYLE.style, - // variant: style.fontVariant || DEFAULT_STYLE.variant, - // weight: style.fontWeight || DEFAULT_STYLE.weight, - // size: style.fontSize || DEFAULT_STYLE.size, - // family: style.fontFamily || DEFAULT_STYLE.family - // }; - // } - - // function getComputedStyle(style, element) { - // var computedStyle = {}; - - // for (var p in style) { - // computedStyle[p] = style[p]; - // } - - // // Compute the size - // var canvasFontSize = parseFloat(element.currentStyle.fontSize), - // fontSize = parseFloat(style.size); - - // if (typeof style.size == 'number') { - // computedStyle.size = style.size; - // } else if (style.size.indexOf('px') != -1) { - // computedStyle.size = fontSize; - // } else if (style.size.indexOf('em') != -1) { - // computedStyle.size = canvasFontSize * fontSize; - // } else if(style.size.indexOf('%') != -1) { - // computedStyle.size = (canvasFontSize / 100) * fontSize; - // } else if (style.size.indexOf('pt') != -1) { - // computedStyle.size = fontSize / .75; - // } else { - // computedStyle.size = canvasFontSize; - // } - - // // Different scaling between normal text and VML text. This was found using - // // trial and error to get the same size as non VML text. - // computedStyle.size *= 0.981; - - // return computedStyle; - // } - - // function buildStyle(style) { - // return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + - // style.size + 'px ' + style.family; - // } - - var lineCapMap = { - 'butt': 'flat', - 'round': 'round' - }; - - function processLineCap(lineCap) { - return lineCapMap[lineCap] || 'square'; - } - - /** - * This class implements CanvasRenderingContext2D interface as described by - * the WHATWG. - * @param {HTMLElement} canvasElement The element that the 2D context should - * be associated with - */ - function CanvasRenderingContext2D_(canvasElement) { - this.m_ = createMatrixIdentity(); - - this.mStack_ = []; - this.aStack_ = []; - this.currentPath_ = []; - - // Canvas context properties - this.strokeStyle = '#000'; - this.fillStyle = '#000'; - - this.lineWidth = 1; - this.lineJoin = 'miter'; - this.lineCap = 'butt'; - this.miterLimit = Z * 1; - this.globalAlpha = 1; - //this.font = '10px sans-serif'; - //this.textAlign = 'left'; - //this.textBaseline = 'alphabetic'; - this.canvas = canvasElement; - - var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' + - canvasElement.clientHeight + 'px;overflow:hidden;position:absolute'; - var el = canvasElement.ownerDocument.createElement('div'); - el.style.cssText = cssText; - canvasElement.appendChild(el); - - var overlayEl = el.cloneNode(false); - // Use a non transparent background. - overlayEl.style.backgroundColor = 'red'; - overlayEl.style.filter = 'alpha(opacity=0)'; - canvasElement.appendChild(overlayEl); - - this.element_ = el; - this.arcScaleX_ = 1; - this.arcScaleY_ = 1; - this.lineScale_ = 1; - } - - var contextPrototype = CanvasRenderingContext2D_.prototype; - contextPrototype.clearRect = function () { - if (this.textMeasureEl_) { - this.textMeasureEl_.removeNode(true); - this.textMeasureEl_ = null; - } - this.element_.innerHTML = ''; - }; - - contextPrototype.beginPath = function () { - // TODO: Branch current matrix so that save/restore has no effect - // as per safari docs. - this.currentPath_ = []; - }; - - contextPrototype.moveTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'moveTo', x: p.x, y: p.y }); - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.lineTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'lineTo', x: p.x, y: p.y }); - - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY) { - var p = getCoords(this, aX, aY); - var cp1 = getCoords(this, aCP1x, aCP1y); - var cp2 = getCoords(this, aCP2x, aCP2y); - bezierCurveTo(this, cp1, cp2, p); - }; - - // Helper function that takes the already fixed cordinates. - function bezierCurveTo(self, cp1, cp2, p) { - self.currentPath_.push({ - type: 'bezierCurveTo', - cp1x: cp1.x, - cp1y: cp1.y, - cp2x: cp2.x, - cp2y: cp2.y, - x: p.x, - y: p.y - }); - self.currentX_ = p.x; - self.currentY_ = p.y; - } - - contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { - // the following is lifted almost directly from - // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes - - var cp = getCoords(this, aCPx, aCPy); - var p = getCoords(this, aX, aY); - - var cp1 = { - x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), - y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) - }; - var cp2 = { - x: cp1.x + (p.x - this.currentX_) / 3.0, - y: cp1.y + (p.y - this.currentY_) / 3.0 - }; - - bezierCurveTo(this, cp1, cp2, p); - }; - - contextPrototype.arc = function (aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise) { - aRadius *= Z; - var arcType = aClockwise ? 'at' : 'wa'; - - var xStart = aX + mc(aStartAngle) * aRadius - Z2; - var yStart = aY + ms(aStartAngle) * aRadius - Z2; - - var xEnd = aX + mc(aEndAngle) * aRadius - Z2; - var yEnd = aY + ms(aEndAngle) * aRadius - Z2; - - // IE won't render arches drawn counter clockwise if xStart == xEnd. - if (xStart == xEnd && !aClockwise) { - xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something - // that can be represented in binary - } - - var p = getCoords(this, aX, aY); - var pStart = getCoords(this, xStart, yStart); - var pEnd = getCoords(this, xEnd, yEnd); - - this.currentPath_.push({ type: arcType, - x: p.x, - y: p.y, - radius: aRadius, - xStart: pStart.x, - yStart: pStart.y, - xEnd: pEnd.x, - yEnd: pEnd.y - }); - - }; - - // contextPrototype.rect = function(aX, aY, aWidth, aHeight) { - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // }; - - // contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.stroke(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.fill(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { - // var gradient = new CanvasGradient_('gradient'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // return gradient; - // }; - - // contextPrototype.createRadialGradient = function(aX0, aY0, aR0, - // aX1, aY1, aR1) { - // var gradient = new CanvasGradient_('gradientradial'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.r0_ = aR0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // gradient.r1_ = aR1; - // return gradient; - // }; - - // contextPrototype.drawImage = function(image, var_args) { - // var dx, dy, dw, dh, sx, sy, sw, sh; - - // // to find the original width we overide the width and height - // var oldRuntimeWidth = image.runtimeStyle.width; - // var oldRuntimeHeight = image.runtimeStyle.height; - // image.runtimeStyle.width = 'auto'; - // image.runtimeStyle.height = 'auto'; - - // // get the original size - // var w = image.width; - // var h = image.height; - - // // and remove overides - // image.runtimeStyle.width = oldRuntimeWidth; - // image.runtimeStyle.height = oldRuntimeHeight; - - // if (arguments.length == 3) { - // dx = arguments[1]; - // dy = arguments[2]; - // sx = sy = 0; - // sw = dw = w; - // sh = dh = h; - // } else if (arguments.length == 5) { - // dx = arguments[1]; - // dy = arguments[2]; - // dw = arguments[3]; - // dh = arguments[4]; - // sx = sy = 0; - // sw = w; - // sh = h; - // } else if (arguments.length == 9) { - // sx = arguments[1]; - // sy = arguments[2]; - // sw = arguments[3]; - // sh = arguments[4]; - // dx = arguments[5]; - // dy = arguments[6]; - // dw = arguments[7]; - // dh = arguments[8]; - // } else { - // throw Error('Invalid number of arguments'); - // } - - // var d = getCoords(this, dx, dy); - - // var w2 = sw / 2; - // var h2 = sh / 2; - - // var vmlStr = []; - - // var W = 10; - // var H = 10; - - // // For some reason that I've now forgotten, using divs didn't work - // vmlStr.push(' ' , - // '', - // ''); - - // this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join('')); - // }; - - contextPrototype.stroke = function (aFill) { - var lineStr = []; - var lineOpen = false; - - var W = 10; - var H = 10; - - lineStr.push(''); - - if (!aFill) { - appendStroke(this, lineStr); - } else { - appendFill(this, lineStr, min, max); - } - - lineStr.push(''); - - this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - }; - - function appendStroke(ctx, lineStr) { - var a = processStyle(ctx.strokeStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - var lineWidth = ctx.lineScale_ * ctx.lineWidth; - - // VML cannot correctly render a line if the width is less than 1px. - // In that case, we dilute the color to make the line look thinner. - if (lineWidth < 1) { - opacity *= lineWidth; - } - - lineStr.push( - '' - ); - } - - function appendFill(ctx, lineStr, min, max) { - var fillStyle = ctx.fillStyle; - var arcScaleX = ctx.arcScaleX_; - var arcScaleY = ctx.arcScaleY_; - var width = max.x - min.x; - var height = max.y - min.y; - // if (fillStyle instanceof CanvasGradient_) { - // // TODO: Gradients transformed with the transformation matrix. - // var angle = 0; - // var focus = {x: 0, y: 0}; - - // // additional offset - // var shift = 0; - // // scale factor for offset - // var expansion = 1; - - // if (fillStyle.type_ == 'gradient') { - // var x0 = fillStyle.x0_ / arcScaleX; - // var y0 = fillStyle.y0_ / arcScaleY; - // var x1 = fillStyle.x1_ / arcScaleX; - // var y1 = fillStyle.y1_ / arcScaleY; - // var p0 = getCoords(ctx, x0, y0); - // var p1 = getCoords(ctx, x1, y1); - // var dx = p1.x - p0.x; - // var dy = p1.y - p0.y; - // angle = Math.atan2(dx, dy) * 180 / Math.PI; - - // // The angle should be a non-negative number. - // if (angle < 0) { - // angle += 360; - // } - - // // Very small angles produce an unexpected result because they are - // // converted to a scientific notation string. - // if (angle < 1e-6) { - // angle = 0; - // } - // } else { - // var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_); - // focus = { - // x: (p0.x - min.x) / width, - // y: (p0.y - min.y) / height - // }; - - // width /= arcScaleX * Z; - // height /= arcScaleY * Z; - // var dimension = m.max(width, height); - // shift = 2 * fillStyle.r0_ / dimension; - // expansion = 2 * fillStyle.r1_ / dimension - shift; - // } - - // // We need to sort the color stops in ascending order by offset, - // // otherwise IE won't interpret it correctly. - // var stops = fillStyle.colors_; - // stops.sort(function(cs1, cs2) { - // return cs1.offset - cs2.offset; - // }); - - // var length = stops.length; - // var color1 = stops[0].color; - // var color2 = stops[length - 1].color; - // var opacity1 = stops[0].alpha * ctx.globalAlpha; - // var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; - - // var colors = []; - // for (var i = 0; i < length; i++) { - // var stop = stops[i]; - // colors.push(stop.offset * expansion + shift + ' ' + stop.color); - // } - - // // When colors attribute is used, the meanings of opacity and o:opacity2 - // // are reversed. - // lineStr.push(''); - // } else if (fillStyle instanceof CanvasPattern_) { - // if (width && height) { - // var deltaLeft = -min.x; - // var deltaTop = -min.y; - // lineStr.push(''); - // } - // } else { - var a = processStyle(ctx.fillStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - lineStr.push(''); - // } - } - - contextPrototype.fill = function () { - this.stroke(true); - }; - - contextPrototype.closePath = function () { - this.currentPath_.push({ type: 'close' }); - }; - - function getCoords(ctx, aX, aY) { - var m = ctx.m_; - return { - x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, - y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 - }; - }; - - contextPrototype.save = function () { - var o = {}; - copyState(this, o); - this.aStack_.push(o); - this.mStack_.push(this.m_); - this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); - }; - - contextPrototype.restore = function () { - if (this.aStack_.length) { - copyState(this.aStack_.pop(), this); - this.m_ = this.mStack_.pop(); - } - }; - - function matrixIsFinite(m) { - return isFinite(m[0][0]) && isFinite(m[0][1]) && - isFinite(m[1][0]) && isFinite(m[1][1]) && - isFinite(m[2][0]) && isFinite(m[2][1]); - } - - function setM(ctx, m, updateLineScale) { - if (!matrixIsFinite(m)) { - return; - } - ctx.m_ = m; - - if (updateLineScale) { - // Get the line scale. - // Determinant of this.m_ means how much the area is enlarged by the - // transformation. So its square root can be used as a scale factor - // for width. - var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; - ctx.lineScale_ = sqrt(abs(det)); - } - } - - contextPrototype.translate = function (aX, aY) { - var m1 = [ - [1, 0, 0], - [0, 1, 0], - [aX, aY, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), false); - }; - - // contextPrototype.rotate = function(aRot) { - // var c = mc(aRot); - // var s = ms(aRot); - - // var m1 = [ - // [c, s, 0], - // [-s, c, 0], - // [0, 0, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), false); - // }; - - contextPrototype.scale = function (aX, aY) { - this.arcScaleX_ *= aX; - this.arcScaleY_ *= aY; - var m1 = [ - [aX, 0, 0], - [0, aY, 0], - [0, 0, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), true); - }; - - // contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { - // var m1 = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), true); - // }; - - // contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { - // var m = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, m, true); - // }; - - /** - * The text drawing function. - * The maxWidth argument isn't taken in account, since no browser supports - * it yet. - */ - // contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { - // var m = this.m_, - // delta = 1000, - // left = 0, - // right = delta, - // offset = {x: 0, y: 0}, - // lineStr = []; - - // var fontStyle = getComputedStyle(processFontStyle(this.font), - // this.element_); - - // var fontStyleString = buildStyle(fontStyle); - - // var elementStyle = this.element_.currentStyle; - // var textAlign = this.textAlign.toLowerCase(); - // switch (textAlign) { - // case 'left': - // case 'center': - // case 'right': - // break; - // case 'end': - // textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; - // break; - // case 'start': - // textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; - // break; - // default: - // textAlign = 'left'; - // } - - // // 1.75 is an arbitrary number, as there is no info about the text baseline - // switch (this.textBaseline) { - // case 'hanging': - // case 'top': - // offset.y = fontStyle.size / 1.75; - // break; - // case 'middle': - // break; - // default: - // case null: - // case 'alphabetic': - // case 'ideographic': - // case 'bottom': - // offset.y = -fontStyle.size / 2.25; - // break; - // } - - // switch(textAlign) { - // case 'right': - // left = delta; - // right = 0.05; - // break; - // case 'center': - // left = right = delta / 2; - // break; - // } - - // var d = getCoords(this, x + offset.x, y + offset.y); - - // lineStr.push(''); - - // if (stroke) { - // appendStroke(this, lineStr); - // } else { - // // TODO: Fix the min and max params. - // appendFill(this, lineStr, {x: -left, y: 0}, - // {x: right, y: fontStyle.size}); - // } - - // var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + - // m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; - - // var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); - - // lineStr.push('', - // '', - // ''); - - // this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - // }; - - // contextPrototype.fillText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, false); - // }; - - // contextPrototype.strokeText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, true); - // }; - - // contextPrototype.measureText = function(text) { - // if (!this.textMeasureEl_) { - // var s = ''; - // this.element_.insertAdjacentHTML('beforeEnd', s); - // this.textMeasureEl_ = this.element_.lastChild; - // } - // var doc = this.element_.ownerDocument; - // this.textMeasureEl_.innerHTML = ''; - // this.textMeasureEl_.style.font = this.font; - // // Don't use innerHTML or innerText because they allow markup/whitespace. - // this.textMeasureEl_.appendChild(doc.createTextNode(text)); - // return {width: this.textMeasureEl_.offsetWidth}; - // }; - - /******** STUBS ********/ - // contextPrototype.clip = function() { - // // TODO: Implement - // }; - - // contextPrototype.arcTo = function() { - // // TODO: Implement - // }; - - // contextPrototype.createPattern = function(image, repetition) { - // return new CanvasPattern_(image, repetition); - // }; - - // // Gradient / Pattern Stubs - // function CanvasGradient_(aType) { - // this.type_ = aType; - // this.x0_ = 0; - // this.y0_ = 0; - // this.r0_ = 0; - // this.x1_ = 0; - // this.y1_ = 0; - // this.r1_ = 0; - // this.colors_ = []; - // } - - // CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { - // aColor = processStyle(aColor); - // this.colors_.push({offset: aOffset, - // color: aColor.color, - // alpha: aColor.alpha}); - // }; - - // function CanvasPattern_(image, repetition) { - // assertImageIsValid(image); - // switch (repetition) { - // case 'repeat': - // case null: - // case '': - // this.repetition_ = 'repeat'; - // break - // case 'repeat-x': - // case 'repeat-y': - // case 'no-repeat': - // this.repetition_ = repetition; - // break; - // default: - // throwException('SYNTAX_ERR'); - // } - - // this.src_ = image.src; - // this.width_ = image.width; - // this.height_ = image.height; - // } - - function throwException(s) { - throw new DOMException_(s); - } - - // function assertImageIsValid(img) { - // if (!img || img.nodeType != 1 || img.tagName != 'IMG') { - // throwException('TYPE_MISMATCH_ERR'); - // } - // if (img.readyState != 'complete') { - // throwException('INVALID_STATE_ERR'); - // } - // } - - function DOMException_(s) { - this.code = this[s]; - this.message = s + ': DOM Exception ' + this.code; - } - var p = DOMException_.prototype = new Error; - p.INDEX_SIZE_ERR = 1; - p.DOMSTRING_SIZE_ERR = 2; - p.HIERARCHY_REQUEST_ERR = 3; - p.WRONG_DOCUMENT_ERR = 4; - p.INVALID_CHARACTER_ERR = 5; - p.NO_DATA_ALLOWED_ERR = 6; - p.NO_MODIFICATION_ALLOWED_ERR = 7; - p.NOT_FOUND_ERR = 8; - p.NOT_SUPPORTED_ERR = 9; - p.INUSE_ATTRIBUTE_ERR = 10; - p.INVALID_STATE_ERR = 11; - p.SYNTAX_ERR = 12; - p.INVALID_MODIFICATION_ERR = 13; - p.NAMESPACE_ERR = 14; - p.INVALID_ACCESS_ERR = 15; - p.VALIDATION_ERR = 16; - p.TYPE_MISMATCH_ERR = 17; - - // set up externs - G_vmlCanvasManager = G_vmlCanvasManager_; - CanvasRenderingContext2D = CanvasRenderingContext2D_; - //CanvasGradient = CanvasGradient_; - //CanvasPattern = CanvasPattern_; - DOMException = DOMException_; - })(); - -} // if - -/*! JsRender v1.0pre: http://github.com/BorisMoore/jsrender */ -/* - * Optimized version of jQuery Templates, for rendering to string. - * Does not require jQuery, or HTML DOM - * Integrates with JsViews (http://github.com/BorisMoore/jsviews) - * Copyright 2012, Boris Moore - * Released under the MIT License. - */ -// informal pre beta commit counter: 3 - -this.jsviews || this.jQuery && jQuery.views || (function( window, undefined ) { - -//========================== Top-level vars ========================== - -var versionNumber = "v1.0pre", - - $, rTag, rTmplString, extend, - sub = {}, - FALSE = false, TRUE = true, - jQuery = window.jQuery, - - rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g, - // nil object helper view viewProperty pathTokens leafToken string - - rParams = /(\()(?=|\s*\()|(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g, - // lftPrn lftPrn2 path operator err eq path2 prn comma lftPrn2 apos quot rtPrn prn2 space - // (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space - - rNewLine = /\r?\n/g, - rUnescapeQuotes = /\\(['"])/g, - rEscapeQuotes = /\\?(['"])/g, - rBuildHash = /\x08(~)?([^\x08]+)\x08/g, - - autoViewKey = 0, - autoTmplName = 0, - escapeMapForHtml = { - "&": "&", - "<": "<", - ">": ">" - }, - tmplAttr = "data-jsv-tmpl", - fnDeclStr = "var j=j||" + (jQuery ? "jQuery." : "js") + "views,", - htmlSpecialChar = /[\x00"&'<>]/g, - slice = Array.prototype.slice, - - render = {}, - - // jsviews object ($.views if jQuery is loaded) - jsv = { - jsviews: versionNumber, - sub: sub, // subscription, e.g. JsViews integration - debugMode: TRUE, - err: function( e ) { - return jsv.debugMode ? ("
                  Error: " + (e.message || e) + ". ") : '""'; - }, - tmplFn: tmplFn, - render: render, - templates: templates, - tags: tags, - helpers: helpers, - converters: converters, - View: View, - convert: convert, - delimiters: setDelimiters, - tag: renderTag - }; - -//========================== Top-level functions ========================== - -//=================== -// jsviews.delimiters -//=================== - -function setDelimiters( openChars, closeChars ) { - // Set the tag opening and closing delimiters. Default is "{{" and "}}" - // openChar, closeChars: opening and closing strings, each with two characters - var firstOpenChar = "\\" + openChars.charAt( 0 ), // Escape the characters - since they could be regex special characters - secondOpenChar = "\\" + openChars.charAt( 1 ), - firstCloseChar = "\\" + closeChars.charAt( 0 ), - secondCloseChar = "\\" + closeChars.charAt( 1 ); - // Build regex with new delimiters - jsv.rTag = rTag // make rTag available to JsViews (or other components) for parsing binding expressions - = secondOpenChar - // tag (followed by / space or }) or colon or html or code - + "(?:(?:(\\w+(?=[\\/\\s" + firstCloseChar + "]))|(?:(\\w+)?(:)|(>)|(\\*)))" - // params - + "\\s*((?:[^" + firstCloseChar + "]|" + firstCloseChar + "(?!" + secondCloseChar + "))*?)" - // slash or closeBlock - + "(\\/)?|(?:\\/(\\w+)))" - // }} - + firstCloseChar; - - // Default rTag: tag converter colon html code params slash closeBlock - // /{{(?:(?:(\w+(?=[\/\s\}]))|(?:(\w+)?(:)|(>)|(\*)))\s*((?:[^}]|}(?!\}))*?)(\/)?|(?:\/(\w+)))}} - - // /{{(?:(?:(\w+(?=[\/!\s\}!]))|(?:(\w+)?(:)|(>)|(\*)))((?:[^\}]|}(?!}))*?)(\/)?|(?:\/(\w+)))}}/g; - rTag = new RegExp( firstOpenChar + rTag + secondCloseChar, "g" ); - rTmplString = new RegExp( "<.*>|" + openChars + ".*" + closeChars ); - return this; -} - -//================= -// View.hlp -//================= - -function getHelper( helper ) { - // Helper method called as view.hlp() from compiled template, for helper functions or template parameters ~foo - var view = this, - tmplHelpers = view.tmpl.helpers || {}; - helper = (view.ctx[ helper ] !== undefined ? view.ctx : tmplHelpers[ helper ] !== undefined ? tmplHelpers : helpers[ helper ] !== undefined ? helpers : {})[ helper ]; - return typeof helper !== "function" ? helper : function() { - return helper.apply(view, arguments); - }; -} - -//================= -// jsviews.convert -//================= - -function convert( converter, view, text ) { - var tmplConverters = view.tmpl.converters; - converter = tmplConverters && tmplConverters[ converter ] || converters[ converter ]; - return converter ? converter.call( view, text ) : text; -} - -//================= -// jsviews.tag -//================= - -function renderTag( tag, parentView, converter, content, tagObject ) { - // Called from within compiled template function, to render a nested tag - // Returns the rendered tag - tagObject.props = tagObject.props || {}; - var ret, - tmpl = tagObject.props.tmpl, - tmplTags = parentView.tmpl.tags, - nestedTemplates = parentView.tmpl.templates, - args = arguments, - tagFn = tmplTags && tmplTags[ tag ] || tags[ tag ]; - - if ( !tagFn ) { - return ""; - } - // Set the tmpl property to the content of the block tag, unless set as an override property on the tag - content = content && parentView.tmpl.tmpls[ content - 1 ]; - tmpl = tmpl || content || undefined; - tagObject.tmpl = - "" + tmpl === tmpl // if a string - ? nestedTemplates && nestedTemplates[ tmpl ] || templates[ tmpl ] || templates( tmpl ) - : tmpl; - - tagObject.isTag = TRUE; - tagObject.converter = converter; - tagObject.view = parentView; - tagObject.renderContent = renderContent; - if ( parentView.ctx ) { - extend( tagObject.ctx, parentView.ctx); - } - - ret = tagFn.apply( tagObject, args.length > 5 ? slice.call( args, 5 ) : [] ); - return ret || ( ret == undefined ? "" : ret.toString()); // (If ret is the value 0 or false, will render to string) -} - -//================= -// View constructor -//================= - -function View( context, path, parentView, data, template, index ) { - // Constructor for view object in view hierarchy. (Augmented by JsViews if JsViews is loaded) - var views = parentView.views, -// TODO: add this, as part of smart re-linking on existing content ($.link method), or remove completely -// self = parentView.views[ index ]; -// if ( !self ) { ... } - self = { - tmpl: template, - path: path, - parent: parentView, - data: data, - ctx: context, - views: $.isArray( data ) ? [] : {}, - hlp: getHelper - }; - - if ( $.isArray( views )) { - views.splice( - self.index = index !== undefined - ? index - : views.length, 0, self - ); - } else { - views[ self.index = "_" + autoViewKey++ ] = self; - } - return self; -} - -//================= -// Registration -//================= - -function addToStore( self, store, name, item, process ) { - // Add item to named store such as templates, helpers, converters... - var key, onStore; - if ( name && typeof name === "object" && !name.nodeType ) { - // If name is a map, iterate over map and call store for key - for ( key in name ) { - store( key, name[ key ]); - } - return self; - } - if ( !name || item === undefined ) { - if ( process ) { - item = process( undefined, item || name ); - } - } else if ( "" + name === name ) { // name must be a string - if ( item === null ) { - // If item is null, delete this entry - delete store[name]; - } else if ( item = process ? process( name, item ) : item ) { - store[ name ] = item; - } - } - if ( onStore = sub.onStoreItem ) { - // e.g. JsViews integration - onStore( store, name, item, process ); - } - return item; -} - -function templates( name, tmpl ) { - // Register templates - // Setter: Use $.view.tags( name, tagFn ) or $.view.tags({ name: tagFn, ... }) to add additional tags to the registered tags collection. - // Getter: Use var tagFn = $.views.tags( name ) or $.views.tags[name] or $.views.tags.name to return the function for the registered tag. - // Remove: Use $.view.tags( name, null ) to remove a registered tag from $.view.tags. - - // When registering for {{foo a b c==d e=f}}, tagFn should be a function with the signature: - // function(a,b). The 'this' pointer will be a hash with properties c and e. - return addToStore( this, templates, name, tmpl, compile ); -} - -function tags( name, tagFn ) { - // Register template tags - // Setter: Use $.view.tags( name, tagFn ) or $.view.tags({ name: tagFn, ... }) to add additional tags to the registered tags collection. - // Getter: Use var tagFn = $.views.tags( name ) or $.views.tags[name] or $.views.tags.name to return the function for the registered tag. - // Remove: Use $.view.tags( name, null ) to remove a registered tag from $.view.tags. - - // When registering for {{foo a b c==d e=f}}, tagFn should be a function with the signature: - // function(a,b). The 'this' pointer will be a hash with properties c and e. - return addToStore( this, tags, name, tagFn ); -} - -function helpers( name, helperFn ) { - // Register helper functions for use in templates (or in data-link expressions if JsViews is loaded) - // Setter: Use $.view.helpers( name, helperFn ) or $.view.helpers({ name: helperFn, ... }) to add additional helpers to the registered helpers collection. - // Getter: Use var helperFn = $.views.helpers( name ) or $.views.helpers[name] or $.views.helpers.name to return the function. - // Remove: Use $.view.helpers( name, null ) to remove a registered helper function from $.view.helpers. - // Within a template, access the helper using the syntax: {{... ~myHelper(...) ...}}. - return addToStore( this, helpers, name, helperFn ); -} - -function converters( name, converterFn ) { - // Register converter functions for use in templates (or in data-link expressions if JsViews is loaded) - // Setter: Use $.view.converters( name, converterFn ) or $.view.converters({ name: converterFn, ... }) to add additional converters to the registered converters collection. - // Getter: Use var converterFn = $.views.converters( name ) or $.views.converters[name] or $.views.converters.name to return the converter function. - // Remove: Use $.view.converters( name, null ) to remove a registered converter from $.view.converters. - // Within a template, access the converter using the syntax: {{myConverter:...}}. - return addToStore( this, converters, name, converterFn ); -} - -//================= -// renderContent -//================= - -function renderContent( data, context, parentView, path, index ) { - // Render template against data as a tree of subviews (nested template), or as a string (top-level template). - // tagName parameter for internal use only. Used for rendering templates registered as tags (which may have associated presenter objects) - var i, l, dataItem, newView, itemWrap, itemsWrap, itemResult, parentContext, tmpl, layout, - props = {}, - swapContent = index === TRUE, - self = this, - result = ""; - - if ( self.isTag ) { - // This is a call from renderTag - tmpl = self.tmpl; - context = context || self.ctx; - parentView = parentView || self.view; - path = path || self.path; - index = index || self.index; - props = self.props; - } else { - tmpl = self.jquery && self[0] // This is a call $.fn.render - || self; // This is a call from tmpl.render - } - parentView = parentView || jsv.topView; - parentContext = parentView.ctx; - layout = tmpl.layout; - if ( data === parentView ) { - // Inherit the data from the parent view. - // This may be the contents of an {{if}} block - data = parentView.data; - layout = TRUE; - } - - // Set additional context on views created here, (as modified context inherited from the parent, and be inherited by child views) - // Note: If no jQuery, extend does not support chained copies - so limit extend() to two parameters - context = (context && context === parentContext) - ? parentContext - : (parentContext - // if parentContext, make copy - ? ((parentContext = extend( {}, parentContext ), context) - // If context, merge context with copied parentContext - ? extend( parentContext, context ) - : parentContext) - // if no parentContext, use context, or default to {} - : context || {}); - - if ( props.link === FALSE ) { - // Override inherited value of link by an explicit setting in props: link=false - // The child views of an unlinked view are also unlinked. So setting child back to true will not have any effect. - context.link = FALSE; - } - if ( !tmpl.fn ) { - tmpl = templates[ tmpl ] || templates( tmpl ); - } - itemWrap = context.link && sub.onRenderItem; - itemsWrap = context.link && sub.onRenderItems; - - if ( tmpl ) { - if ( $.isArray( data ) && !layout ) { - // Create a view for the array, whose child views correspond to each data item. - // (Note: if index and parentView are passed in along with parent view, treat as - // insert -e.g. from view.addViews - so parentView is already the view item for array) - newView = swapContent ? parentView : (index !== undefined && parentView) || View( context, path, parentView, data, tmpl, index ); - - for ( i = 0, l = data.length; i < l; i++ ) { - // Create a view for each data item. - dataItem = data[ i ]; - itemResult = tmpl.fn( dataItem, View( context, path, newView, dataItem, tmpl, (index||0) + i ), jsv ); - result += itemWrap ? itemWrap( itemResult, props ) : itemResult; - } - } else { - // Create a view for singleton data object. - newView = swapContent ? parentView : View( context, path, parentView, data, tmpl, index ); - result += (data || layout) ? tmpl.fn( data, newView, jsv ) : ""; - } - parentView.topKey = newView.index; - return itemsWrap ? itemsWrap( result, path, newView.index, tmpl, props ) : result; - } - return ""; // No tmpl. Could throw... -} - -//=========================== -// Build and compile template -//=========================== - -// Generate a reusable function that will serve to render a template against data -// (Compile AST then build template function) - -function syntaxError() { - throw "Syntax error"; -} - -function tmplFn( markup, tmpl, bind ) { - // Compile markup to AST (abtract syntax tree) then build the template function code from the AST nodes - // Used for compiling templates, and also by JsViews to build functions for data link expressions - var newNode, node, i, l, code, hasTag, hasEncoder, getsValue, hasConverter, hasViewPath, tag, converter, params, hash, nestedTmpl, allowCode, - tmplOptions = tmpl ? { - allowCode: allowCode = tmpl.allowCode, - debug: tmpl.debug - } : {}, - nested = tmpl && tmpl.tmpls, - astTop = [], - loc = 0, - stack = [], - content = astTop, - current = [,,,astTop], - nestedIndex = 0; - - //==== nested functions ==== - function pushPreceedingContent( shift ) { - shift -= loc; - if ( shift ) { - content.push( markup.substr( loc, shift ).replace( rNewLine, "\\n" )); - } - } - - function parseTag( all, tagName, converter, colon, html, code, params, slash, closeBlock, index ) { - // tag converter colon html code params slash closeBlock - // /{{(?:(?:(\w+(?=[\/!\s\}!]))|(?:(\w+)?(:)|(?:(>)|(\*)))((?:[^\}]|}(?!}))*?)(\/)?|(?:\/(\w+)))}}/g; - // Build abstract syntax tree (AST): [ tagName, converter, params, content, hash, contentMarkup ] - if ( html ) { - colon = ":"; - converter = "html"; - } - var hash = "", - passedCtx = "", - block = !slash && !colon; // Block tag if not self-closing and not {{:}} or {{>}} (special case) - - //==== nested helper function ==== - - tagName = tagName || colon; - pushPreceedingContent( index ); - loc = index + all.length; // location marker - parsed up to here - if ( code ) { - if ( allowCode ) { - content.push([ "*", params.replace( rUnescapeQuotes, "$1" ) ]); - } - } else if ( tagName ) { - if ( tagName === "else" ) { - current[ 5 ] = markup.substring( current[ 5 ], index ); // contentMarkup for block tag - current = stack.pop(); - content = current[ 3 ]; - block = TRUE; - } - params = (params - ? parseParams( params, bind ) - .replace( rBuildHash, function( all, isCtx, keyValue ) { - if ( isCtx ) { - passedCtx += keyValue + ","; - } else { - hash += keyValue + ","; - } - return ""; - }) - : ""); - hash = hash.slice( 0, -1 ); - params = params.slice( 0, -1 ); - newNode = [ - tagName, - converter || "", - params, - block && [], - "{" + (hash ? ("props:{" + hash + "},"): "") + "path:'" + params + "'" + (passedCtx ? ",ctx:{" + passedCtx.slice( 0, -1 ) + "}" : "") + "}" - ]; - if ( block ) { - stack.push( current ); - current = newNode; - current[ 5 ] = loc; // Store current location of open tag, to be able to add contentMarkup when we reach closing tag - } - content.push( newNode ); - } else if ( closeBlock ) { - //if ( closeBlock !== current[ 0 ]) { - // throw "unmatched close tag: /" + closeBlock + ". Expected /" + current[ 0 ]; - //} - current[ 5 ] = markup.substring( current[ 5 ], index ); // contentMarkup for block tag - current = stack.pop(); - } - if ( !current ) { - throw "Expected block tag"; - } - content = current[ 3 ]; - } - //==== /end of nested functions ==== - - markup = markup.replace( rEscapeQuotes, "\\$1" ); - - // Build the AST (abstract syntax tree) under astTop - markup.replace( rTag, parseTag ); - - pushPreceedingContent( markup.length ); - - // Use the AST (astTop) to build the template function - l = astTop.length; - code = (l ? "" : '"";'); - - for ( i = 0; i < l; i++ ) { - // AST nodes: [ tagName, converter, params, content, hash, contentMarkup ] - node = astTop[ i ]; - if ( node[ 0 ] === "*" ) { - code = code.slice( 0, i ? -1 : -3 ) + ";" + node[ 1 ] + (i + 1 < l ? "ret+=" : ""); - } else if ( "" + node === node ) { // type string - code += '"' + node + '"+'; - } else { - tag = node[ 0 ]; - converter = node[ 1 ]; - params = node[ 2 ]; - content = node[ 3 ]; - hash = node[ 4 ]; - markup = node[ 5 ]; - if ( content ) { - // Create template object for nested template - nestedTmpl = TmplObject( markup, tmplOptions, tmpl, nestedIndex++ ); - // Compile to AST and then to compiled function - tmplFn( markup, nestedTmpl); - nested.push( nestedTmpl ); - } - hasViewPath = hasViewPath || hash.indexOf( "view" ) > -1; - code += (tag === ":" - ? (converter === "html" - ? (hasEncoder = TRUE, "e(" + params) - : converter - ? (hasConverter = TRUE, 'c("' + converter + '",view,' + params) - : (getsValue = TRUE, "((v=" + params + ')!=u?v:""') - ) - : (hasTag = TRUE, 't("' + tag + '",view,"' + (converter || "") + '",' - + (content ? nested.length : '""') // For block tags, pass in the key (nested.length) to the nested content template - + "," + hash + (params ? "," : "") + params)) - + ")+"; - } - } - code = new Function( "data, view, j, b, u", fnDeclStr - + (getsValue ? "v," : "") - + (hasTag ? "t=j.tag," : "") - + (hasConverter ? "c=j.convert," : "") - + (hasEncoder ? "e=j.converters.html," : "") - + "ret; try{\n\n" - + (tmplOptions.debug ? "debugger;" : "") - + (allowCode ? 'ret=' : 'return ') - + code.slice( 0, -1 ) + ";\n\n" - + (allowCode ? "return ret;" : "") - + "}catch(e){return j.err(e);}" - ); - - // Include only the var references that are needed in the code - if ( tmpl ) { - tmpl.fn = code; - tmpl.useVw = hasConverter || hasViewPath || hasTag; - } - return code; -} - -function parseParams( params, bind ) { - var named, - fnCall = {}, - parenDepth = 0, - quoted = FALSE, // boolean for string content in double quotes - aposed = FALSE; // or in single quotes - - function parseTokens( all, lftPrn0, lftPrn, path, operator, err, eq, path2, prn, comma, lftPrn2, apos, quot, rtPrn, prn2, space ) { - // rParams = /(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g, - // lftPrn path operator err eq path2 prn comma lftPrn3 apos quot rtPrn prn2 space - // (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space - operator = operator || ""; - lftPrn = lftPrn || lftPrn0 || lftPrn2; - path = path || path2; - prn = prn || prn2 || ""; - operator = operator || ""; - - function parsePath( all, object, helper, view, viewProperty, pathTokens, leafToken ) { - // rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g, - // object helper view viewProperty pathTokens leafToken string - if ( object ) { - var ret = (helper - ? 'view.hlp("' + helper + '")' - : view - ? "view" - : "data") - + (leafToken - ? (viewProperty - ? "." + viewProperty - : helper - ? "" - : (view ? "" : "." + object) - ) + (pathTokens || "") - : (leafToken = helper ? "" : view ? viewProperty || "" : object, "")); - - if ( bind && prn !== "(" ) { - ret = "b(" + ret + ',"' + leafToken + '")'; - } - return ret + (leafToken ? "." + leafToken : ""); - } - return all; - } - - if ( err ) { - syntaxError(); - } else { - return (aposed - // within single-quoted string - ? (aposed = !apos, (aposed ? all : '"')) - : quoted - // within double-quoted string - ? (quoted = !quot, (quoted ? all : '"')) - : - ( - (lftPrn - ? (parenDepth++, lftPrn) - : "") - + (space - ? (parenDepth - ? "" - : named - ? (named = FALSE, "\b") - : "," - ) - : eq - // named param - ? (parenDepth && syntaxError(), named = TRUE, '\b' + path + ':') - : path - // path - ? (path.replace( rPath, parsePath ) - + (prn - ? (fnCall[ ++parenDepth ] = TRUE, prn) - : operator) - ) - : operator - ? all - : rtPrn - // function - ? ((fnCall[ parenDepth-- ] = FALSE, rtPrn) - + (prn - ? (fnCall[ ++parenDepth ] = TRUE, prn) - : "") - ) - : comma - ? (fnCall[ parenDepth ] || syntaxError(), ",") // We don't allow top-level literal arrays or objects - : lftPrn0 - ? "" - : (aposed = apos, quoted = quot, '"') - )) - ); - } - } - params = (params + " " ).replace( rParams, parseTokens ); - return params; -} - -function compile( name, tmpl, parent, options ) { - // tmpl is either a template object, a selector for a template script block, the name of a compiled template, or a template object - // options is the set of template properties, c - var tmplOrMarkup, elem, key, nested, nestedItem; - - //==== nested functions ==== - function tmplOrMarkupFromStr( value ) { - // If value is of type string - treat as selector, or name of compiled template - // Return the template object, if already compiled, or the markup string - - if ( ("" + value === value) || value.nodeType > 0 ) { - // If selector is valid and returns at least one element, get first element - elem = value.nodeType > 0 ? value : !rTmplString.test( value ) && jQuery && jQuery( value )[0]; - if ( elem && elem.type ) { - // It is a script element - // Create a name for data linking if none provided - value = templates[ elem.getAttribute( tmplAttr )]; - if ( !value ) { - // Not already compiled and cached, so compile and cache the name - name = name || "_" + autoTmplName++; - elem.setAttribute( tmplAttr, name ); - value = compile( name, elem.innerHTML, parent, options ); // Use tmpl as options - templates[ name ] = value; - } - } - return value; - } - // If value is not a string or dom element, return undefined - } - - //==== Compile the template ==== - tmplOrMarkup = tmplOrMarkupFromStr( tmpl ); - - // If tmpl is a template object, use it for options - options = options || (tmpl.markup ? tmpl : {}); - options.name = name; - nested = options.templates; - - // If tmpl is not a markup string or a selector string, then it must be a template object - // In that case, get it from the markup property of the object - if ( !tmplOrMarkup && tmpl.markup && (tmplOrMarkup = tmplOrMarkupFromStr( tmpl.markup ))) { - if ( tmplOrMarkup.fn && (tmplOrMarkup.debug !== tmpl.debug || tmplOrMarkup.allowCode !== tmpl.allowCode )) { - // if the string references a compiled template object, but the debug or allowCode props are different, need to recompile - tmplOrMarkup = tmplOrMarkup.markup; - } - } - if ( tmplOrMarkup !== undefined ) { - if ( name && !parent ) { - render[ name ] = function() { - return tmpl.render.apply( tmpl, arguments ); - }; - } - if ( tmplOrMarkup.fn || tmpl.fn ) { - // tmpl is already compiled, so use it, or if different name is provided, clone it - if ( tmplOrMarkup.fn ) { - if ( name && name !== tmplOrMarkup.name ) { - tmpl = extend( extend( {}, tmplOrMarkup ), options); - } else { - tmpl = tmplOrMarkup; - } - } - } else { - // tmplOrMarkup is a markup string, not a compiled template - // Create template object - tmpl = TmplObject( tmplOrMarkup, options, parent, 0 ); - // Compile to AST and then to compiled function - tmplFn( tmplOrMarkup, tmpl ); - } - for ( key in nested ) { - // compile nested template declarations - nestedItem = nested[ key ]; - if ( nestedItem.name !== key ) { - nested[ key ] = compile( key, nestedItem, tmpl ); - } - } - return tmpl; - } -} -//==== /end of function compile ==== - -function TmplObject( markup, options, parent, index ) { - // Template object constructor - - // nested helper function - function extendStore( storeName ) { - if ( parent[ storeName ]) { - // Include parent items except if overridden by item of same name in options - tmpl[ storeName ] = extend( extend( {}, parent[ storeName ] ), options[ storeName ] ); - } - } - - options = options || {}; - var tmpl = { - markup: markup, - tmpls: [], - links: [], - render: renderContent - }; - if ( parent ) { - if ( parent.templates ) { - tmpl.templates = extend( extend( {}, parent.templates ), options.templates ); - } - tmpl.parent = parent; - tmpl.name = parent.name + "[" + index + "]"; - tmpl.index = index; - } - - extend( tmpl, options ); - if ( parent ) { - extendStore( "templates" ); - extendStore( "tags" ); - extendStore( "helpers" ); - extendStore( "converters" ); - } - return tmpl; -} - -//========================== Initialize ========================== - -if ( jQuery ) { - //////////////////////////////////////////////////////////////////////////////////////////////// - // jQuery is loaded, so make $ the jQuery object - $ = jQuery; - $.templates = templates; - $.render = render; - $.views = jsv; - $.fn.render = renderContent; - -} else { - //////////////////////////////////////////////////////////////////////////////////////////////// - // jQuery is not loaded. - - $ = window.jsviews = jsv; - $.extend = function( target, source ) { - var name; - target = target || {}; - for ( name in source ) { - target[ name ] = source[ name ]; - } - return target; - }; - - $.isArray = Array && Array.isArray || function( obj ) { - return Object.prototype.toString.call( obj ) === "[object Array]"; - }; -} - -extend = $.extend; - -jsv.topView = { views: {}, tmpl: {}, hlp: getHelper, ctx: jsv.helpers }; - -function replacerForHtml( ch ) { - // Original code from Mike Samuel - return escapeMapForHtml[ ch ] - // Intentional assignment that caches the result of encoding ch. - || (escapeMapForHtml[ ch ] = "&#" + ch.charCodeAt( 0 ) + ";"); -} - -//========================== Register tags ========================== - -tags({ - "if": function() { - var ifTag = this, - view = ifTag.view; - - view.onElse = function( tagObject, args ) { - var i = 0, - l = args.length; - - while ( l && !args[ i++ ]) { - // Only render content if args.length === 0 (i.e. this is an else with no condition) or if a condition argument is truey - if ( i === l ) { - return ""; - } - } - view.onElse = undefined; // If condition satisfied, so won't run 'else'. - tagObject.path = ""; - return tagObject.renderContent( view ); - // Test is satisfied, so render content, while remaining in current data context - // By passing the view, we inherit data context from the parent view, and the content is treated as a layout template - // (so if the data is an array, it will not iterate over the data - }; - return view.onElse( this, arguments ); - }, - "else": function() { - var view = this.view; - return view.onElse ? view.onElse( this, arguments ) : ""; - }, - "for": function() { - var i, - self = this, - result = "", - args = arguments, - l = args.length; - if ( self.props.layout ) { - self.tmpl.layout = TRUE; - } - for ( i = 0; i < l; i++ ) { - result += self.renderContent( args[ i ]); - } - return result; - }, - "=": function( value ) { - return value; - }, - "*": function( value ) { - return value; - } -}); - -//========================== Register global helpers ========================== - -// helpers({ // Global helper functions -// // TODO add any useful built-in helper functions -// }); - -//========================== Register converters ========================== - -converters({ - html: function( text ) { - // HTML encoding helper: Replace < > & and ' and " by corresponding entities. - // inspired by Mike Samuel - return text != undefined ? String( text ).replace( htmlSpecialChar, replacerForHtml ) : ""; - } -}); - -//========================== Define default delimiters ========================== -setDelimiters( "{{", "}}" ); - -})( this ); - -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.6 - * - * Requires: 1.2.2+ - */ - -(function($) { - -var types = ['DOMMouseScroll', 'mousewheel']; - -if ($.event.fixHooks) { - for ( var i=types.length; i; ) { - $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; - } -} - -$.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) { - for ( var i=types.length; i; ) { - this.addEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i=types.length; i; ) { - this.removeEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = null; - } - } -}; - -$.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } -}); - - -function handler(event) { - var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; - event = $.event.fix(orgEvent); - event.type = "mousewheel"; - - // Old school scrollwheel delta - if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } - if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } - - // New school multidimensional scroll (touchpads) deltas - deltaY = delta; - - // Gecko - if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaY = 0; - deltaX = -1*delta; - } - - // Webkit - if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } - if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - return ($.event.dispatch || $.event.handle).apply(this, args); -} - -})(jQuery); - -/*! - * jQuery UI Widget 1.8.18 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ - -if ( ! $.widget ) { - -(function( $, undefined ) { - -// jQuery 1.4+ -if ( $.cleanData ) { - var _cleanData = $.cleanData; - $.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - try { - $( elem ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - } - _cleanData( elems ); - }; -} else { - var _remove = $.fn.remove; - $.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( [ this ] ).each(function() { - try { - $( this ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - }); - } - } - return _remove.call( $(this), selector, keepData ); - }); - }; -} - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from -// $.each( basePrototype, function( key, val ) { -// if ( $.isPlainObject(val) ) { -// basePrototype[ key ] = $.extend( {}, val ); -// } -// }); - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = Array.prototype.slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - // prevent calls to internal methods - if ( isMethodCall && options.charAt( 0 ) === "_" ) { - return returnValue; - } - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ), - methodValue = instance && $.isFunction( instance[options] ) ? - instance[ options ].apply( instance, args ) : - instance; - // TODO: add this back in 1.9 and use $.error() (see #5972) -// if ( !instance ) { -// throw "cannot call methods on " + name + " prior to initialization; " + -// "attempted to call method '" + options + "'"; -// } -// if ( !$.isFunction( instance[options] ) ) { -// throw "no such method '" + options + "' for " + name + " widget instance"; -// } -// var methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - $.data( this, name, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - // $.widget.bridge stores the plugin instance, but we do it anyway - // so that it's stored even before the _create function runs - $.data( element, this.widgetName, this ); - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - this._getCreateOptions(), - options ); - - var self = this; - this.element.bind( "remove." + this.widgetName, function() { - self.destroy(); - }); - - this._create(); - this._trigger( "create" ); - this._init(); - }, - _getCreateOptions: function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }, - _create: function() {}, - _init: function() {}, - - destroy: function() { - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - }, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, this.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var self = this; - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - [ value ? "addClass" : "removeClass"]( - this.widgetBaseClass + "-disabled" + " " + - "ui-state-disabled" ) - .attr( "aria-disabled", value ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - - return !( $.isFunction(callback) && - callback.call( this.element[0], event, data ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); - -}; - - -(function ($, window, undefined) { - var pos_oo = Number.POSITIVE_INFINITY, - neg_oo = Number.NEGATIVE_INFINITY; - - $.geo = { - // - // utility functions - // - - _allCoordinates: function (geom) { - // return array of all positions in all geometries of geom - // not in JTS - var geometries = this._flatten(geom), - curGeom = 0, - result = []; - - for (; curGeom < geometries.length; curGeom++) { - var coordinates = geometries[curGeom].coordinates, - isArray = coordinates && $.isArray(coordinates[0]), - isDblArray = isArray && $.isArray(coordinates[0][0]), - isTriArray = isDblArray && $.isArray(coordinates[0][0][0]), - i, j, k; - - if (!isTriArray) { - if (!isDblArray) { - if (!isArray) { - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - coordinates = [coordinates]; - } - - for (i = 0; i < coordinates.length; i++) { - for (j = 0; j < coordinates[i].length; j++) { - for (k = 0; k < coordinates[i][j].length; k++) { - result.push(coordinates[i][j][k]); - } - } - } - } - return result; - }, - - _isGeodetic: function( coords ) { - // returns true if the first coordinate it can find is geodetic - - while ( $.isArray( coords ) ) { - if ( coords.length > 1 && ! $.isArray( coords[ 0 ] ) ) { - return ( coords[ 0 ] >= -180 && coords[ 0 ] <= 180 && coords[ 1 ] >= -85 && coords[ 1 ] <= 85 ); - } else { - coords = coords[ 0 ]; - } - } - - return false; - }, - - // - // bbox functions - // - - center: function (bbox, _ignoreGeo /* Internal Use Only */) { - // Envelope.centre in JTS - // bbox only, use centroid for geom - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2]; - return wasGeodetic ? $.geo.proj.toGeodetic(center) : center; - }, - - expandBy: function (bbox, dx, dy, _ignoreGeo /* Internal Use Only */) { - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - bbox = [bbox[0] - dx, bbox[1] - dy, bbox[2] + dx, bbox[3] + dy]; - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - height: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - - return bbox[3] - bbox[1]; - }, - - _in: function(bbox1, bbox2) { - return bbox1[0] <= bbox2[0] && - bbox1[1] <= bbox2[1] && - bbox1[2] >= bbox2[2] && - bbox1[3] >= bbox2[3]; - }, - - _bboxDisjoint: function( bbox1, bbox2 ) { - return bbox2[ 0 ] > bbox1[ 2 ] || - bbox2[ 2 ] < bbox1[ 0 ] || - bbox2[ 1 ] > bbox1[ 3 ] || - bbox2[ 3 ] < bbox1[ 1 ]; - }, - - include: function( bbox, value, _ignoreGeo /* Internal Use Only */ ) { - // similar to Envelope.expandToInclude in JTS - if ( !value || !$.isArray( value ) ) { - return bbox; - } - - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox || value ) ) { - wasGeodetic = true; - } - - if ( !bbox ) { - bbox = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - } else if ( wasGeodetic ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - - if ( value.length === 2 ) { - value = [ value[ 0 ], value[ 1 ], value[ 0 ], value[ 1 ] ]; - } - - value = $.geo.proj.fromGeodetic( value ); - - bbox[0] = Math.min( value[ 0 ], bbox[ 0 ] ); - bbox[1] = Math.min( value[ 1 ], bbox[ 1 ] ); - bbox[2] = Math.max( value[ 2 ], bbox[ 2 ] ); - bbox[3] = Math.max( value[ 3 ], bbox[ 3 ] ); - - return wasGeodetic ? $.geo.proj.toGeodetic( bbox ) : bbox; - }, - - polygonize: function( bbox, _ignoreGeo /* Internal Use Only */ ) { - // adaptation of Polygonizer class in JTS for use with bboxes - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var polygon = { - type: "Polygon", - coordinates: [ [ - [ bbox[ 0 ], bbox[ 1 ] ], - [ bbox[ 0 ], bbox[ 3 ] ], - [ bbox[ 2 ], bbox[ 3 ] ], - [ bbox[ 2 ], bbox[ 1 ] ], - [ bbox[ 0 ], bbox[ 1 ] ] - ] ] - }; - - if ( wasGeodetic ) { - polygon.coordinates = $.geo.proj.toGeodetic( polygon.coordinates ); - } - - return polygon; - }, - - reaspect: function (bbox, ratio, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var width = this.width(bbox, true), - height = this.height(bbox, true), - center = this.center(bbox, true), - dx, dy; - - if (width !== 0 && height !== 0 && ratio > 0) { - if (width / height > ratio) { - dx = width / 2; - dy = dx / ratio; - } else { - dy = height / 2; - dx = dy * ratio; - } - - bbox = [center[0] - dx, center[1] - dy, center[0] + dx, center[1] + dy]; - } - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - recenter: function( bbox, center, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj ) { - if ( this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - if ( this._isGeodetic( center ) ) { - center = $.geo.proj.fromGeodetic(center); - } - } - - var halfWidth = ( bbox[ 2 ] - bbox[ 0 ] ) / 2, - halfHeight = ( bbox[ 3 ] - bbox[ 1 ] ) / 2; - - bbox = [ - center[ 0 ] - halfWidth, - center[ 1 ] - halfHeight, - center[ 0 ] + halfWidth, - center[ 1 ] + halfHeight - ]; - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - scaleBy: function ( bbox, scale, _ignoreGeo /* Internal Use Only */ ) { - // not in JTS - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - wasGeodetic = true; - bbox = $.geo.proj.fromGeodetic(bbox); - } - - var c = this.center(bbox, true), - dx = (bbox[2] - bbox[0]) * scale / 2, - dy = (bbox[3] - bbox[1]) * scale / 2; - - bbox = [c[0] - dx, c[1] - dy, c[0] + dx, c[1] + dy]; - - return wasGeodetic ? $.geo.proj.toGeodetic(bbox) : bbox; - }, - - width: function (bbox, _ignoreGeo /* Internal Use Only */ ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic(bbox); - } - - return bbox[2] - bbox[0]; - }, - - // - // geometry functions - // - - // bbox (Geometry.getEnvelope in JTS) - - bbox: function ( geom, _ignoreGeo /* Internal Use Only */ ) { - var result, wasGeodetic = false; - if ( !geom ) { - return undefined; - } else if ( geom.bbox ) { - result = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom.bbox ) ) ? $.geo.proj.fromGeodetic( geom.bbox ) : geom.bbox; - } else { - result = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - - var coordinates = this._allCoordinates( geom ), - curCoord = 0; - - if ( coordinates.length === 0 ) { - return undefined; - } - - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( coordinates ) ) { - wasGeodetic = true; - coordinates = $.geo.proj.fromGeodetic( coordinates ); - } - - for ( ; curCoord < coordinates.length; curCoord++ ) { - result[0] = Math.min(coordinates[curCoord][0], result[0]); - result[1] = Math.min(coordinates[curCoord][1], result[1]); - result[2] = Math.max(coordinates[curCoord][0], result[2]); - result[3] = Math.max(coordinates[curCoord][1], result[3]); - } - } - - return wasGeodetic ? $.geo.proj.toGeodetic(result) : result; - }, - - // centroid - - centroid: function( geom, _ignoreGeo /* Internal Use Only */ ) { - switch (geom.type) { - case "Point": - return $.extend({}, geom); - - case "LineString": - case "Polygon": - var a = 0, - c = [0, 0], - coords = $.merge( [ ], geom.type == "Polygon" ? geom.coordinates[0] : geom.coordinates ), - i = 1, j, n, - bbox = [ pos_oo, pos_oo, neg_oo, neg_oo ]; - - var wasGeodetic = false; - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( coords ) ) { - wasGeodetic = true; - coords = $.geo.proj.fromGeodetic(coords); - } - - //if (coords[0][0] != coords[coords.length - 1][0] || coords[0][1] != coords[coords.length - 1][1]) { - // coords.push(coords[0]); - //} - - for (; i <= coords.length; i++) { - j = i % coords.length; - - bbox[0] = Math.min(coords[j][0], bbox[0]); - bbox[1] = Math.min(coords[j][1], bbox[1]); - bbox[2] = Math.max(coords[j][0], bbox[2]); - bbox[3] = Math.max(coords[j][1], bbox[3]); - - n = (coords[i - 1][0] * coords[j][1]) - (coords[j][0] * coords[i - 1][1]); - a += n; - c[0] += (coords[i - 1][0] + coords[j][0]) * n; - c[1] += (coords[i - 1][1] + coords[j][1]) * n; - } - - if (a === 0) { - if (coords.length > 0) { - c[0] = Math.min( Math.max( coords[0][0], bbox[ 0 ] ), bbox[ 2 ] ); - c[1] = Math.min( Math.max( coords[0][1], bbox[ 1 ] ), bbox[ 3 ] ); - return { type: "Point", coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c }; - } else { - return undefined; - } - } - - a *= 3; - //c[0] /= a; - //c[1] /= a; - - c[0] = Math.min( Math.max( c[0] / a, bbox[ 0 ] ), bbox[ 2 ] ); - c[1] = Math.min( Math.max( c[1] / a, bbox[ 1 ] ), bbox[ 3 ] ); - - return { type: "Point", coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c }; - } - return undefined; - }, - - // contains - - contains: function (geom1, geom2) { - if (geom1.type != "Polygon") { - return false; - } - - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1.coordinates, geom2.coordinates); - - case "LineString": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates); - - case "Polygon": - return this._containsPolygonLineString(geom1.coordinates, geom2.coordinates[0]); - - default: - return false; - } - }, - - _containsPolygonPoint: function (polygonCoordinates, pointCoordinate) { - if (polygonCoordinates.length === 0 || polygonCoordinates[0].length < 4) { - return false; - } - - var rayCross = 0, - a = polygonCoordinates[0][0], - i = 1, - b, - x; - - for (; i < polygonCoordinates[0].length; i++) { - b = polygonCoordinates[0][i]; - - if ((a[1] <= pointCoordinate[1] && pointCoordinate[1] < b[1]) || (b[1] <= pointCoordinate[1] && pointCoordinate[1] < a[1]) && (pointCoordinate[0] < a[0] || pointCoordinate[0] < b[0])) { - x = a[0] + (b[0] - a[0]) * (pointCoordinate[1] - a[1]) / (b[1] - a[1]); - - if (x > pointCoordinate[0]) { - rayCross++; - } - } - - a = b; - } - - return rayCross % 2 == 1; - }, - - _containsPolygonLineString: function (polygonCoordinates, lineStringCoordinates) { - for (var i = 0; i < lineStringCoordinates.length; i++) { - if (!this._containsPolygonPoint(polygonCoordinates, lineStringCoordinates[i])) { - return false; - } - } - return true; - }, - - // distance - - distance: function ( geom1, geom2, _ignoreGeo /* Internal Use Only */ ) { - var geom1CoordinatesProjected = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom1.coordinates ) ) ? $.geo.proj.fromGeodetic(geom1.coordinates) : geom1.coordinates, - geom2CoordinatesProjected = ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom2.coordinates ) ) ? $.geo.proj.fromGeodetic(geom2.coordinates) : geom2.coordinates; - - switch (geom1.type) { - case "Point": - switch (geom2.type) { - case "Point": - return this._distancePointPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "LineString": - return this._distanceLineStringPoint(geom2CoordinatesProjected, geom1CoordinatesProjected); - case "Polygon": - return this._containsPolygonPoint(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "LineString": - switch (geom2.type) { - case "Point": - return this._distanceLineStringPoint(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "LineString": - return this._distanceLineStringLineString(geom1CoordinatesProjected, geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom2CoordinatesProjected, geom1CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom2CoordinatesProjected[0], geom1CoordinatesProjected); - default: - return undefined; - } - break; - - case "Polygon": - switch (geom2.type) { - case "Point": - return this._containsPolygonPoint(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringPoint(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "LineString": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected); - case "Polygon": - return this._containsPolygonLineString(geom1CoordinatesProjected, geom2CoordinatesProjected[0]) ? 0 : this._distanceLineStringLineString(geom1CoordinatesProjected[0], geom2CoordinatesProjected[0]); - default: - return undefined; - } - break; - } - }, - - _distancePointPoint: function (coordinate1, coordinate2) { - var dx = coordinate2[0] - coordinate1[0], - dy = coordinate2[1] - coordinate1[1]; - return Math.sqrt((dx * dx) + (dy * dy)); - }, - - _distanceLineStringPoint: function (lineStringCoordinates, pointCoordinate) { - var minDist = pos_oo; - - if (lineStringCoordinates.length > 0) { - var a = lineStringCoordinates[0], - - apx = pointCoordinate[0] - a[0], - apy = pointCoordinate[1] - a[1]; - - if (lineStringCoordinates.length == 1) { - return Math.sqrt(apx * apx + apy * apy); - } else { - for (var i = 1; i < lineStringCoordinates.length; i++) { - var b = lineStringCoordinates[i], - - abx = b[0] - a[0], - aby = b[1] - a[1], - bpx = pointCoordinate[0] - b[0], - bpy = pointCoordinate[1] - b[1], - - d = this._distanceSegmentPoint(abx, aby, apx, apy, bpx, bpy); - - if (d === 0) { - return 0; - } - - if (d < minDist) { - minDist = d; - } - - a = b; - apx = bpx; - apy = bpy; - } - } - } - - return Math.sqrt(minDist); - }, - - _distanceSegmentPoint: function (abx, aby, apx, apy, bpx, bpy) { - var dot1 = abx * apx + aby * apy; - - if (dot1 <= 0) { - return apx * apx + apy * apy; - } - - var dot2 = abx * abx + aby * aby; - - if (dot1 >= dot2) { - return bpx * bpx + bpy * bpy; - } - - return apx * apx + apy * apy - dot1 * dot1 / dot2; - }, - - _distanceLineStringLineString: function (lineStringCoordinates1, lineStringCoordinates2) { - var minDist = pos_oo; - for (var i = 0; i < lineStringCoordinates2.length; i++) { - minDist = Math.min(minDist, this._distanceLineStringPoint(lineStringCoordinates1, lineStringCoordinates2[i])); - } - return minDist; - }, - - // buffer - - _buffer: function( geom, distance, _ignoreGeo /* Internal Use Only */ ) { - var wasGeodetic = false, - coords = geom.coordinates; - - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( geom.coordinates ) ) { - wasGeodetic = true; - coords = $.geo.proj.fromGeodetic( geom.coordinates ); - } - - if ( geom.type === "Point" ) { - var resultCoords = [], - slices = 180, - i = 0, - a; - - for ( ; i <= slices; i++ ) { - a = ( i * 360 / slices ) * ( Math.PI / 180 ); - resultCoords.push( [ - coords[ 0 ] + Math.cos( a ) * distance, - coords[ 1 ] + Math.sin( a ) * distance - ] ); - } - - return { - type: "Polygon", - coordinates: [ ( wasGeodetic ? $.geo.proj.toGeodetic( resultCoords ) : resultCoords ) ] - }; - } else { - return undefined; - } - }, - - - // - // feature - // - - _flatten: function (geom) { - // return an array of all basic geometries - // not in JTS - var geometries = [], - curGeom = 0; - switch (geom.type) { - case "Feature": - $.merge(geometries, this._flatten(geom.geometry)); - break; - - case "FeatureCollection": - for (; curGeom < geom.features.length; curGeom++) { - $.merge(geometries, this._flatten(geom.features[curGeom].geometry)); - } - break; - - case "GeometryCollection": - for (; curGeom < geom.geometries.length; curGeom++) { - $.merge(geometries, this._flatten(geom.geometries[curGeom])); - } - break; - - default: - geometries[0] = geom; - break; - } - return geometries; - }, - - length: function( geom, _ignoreGeo /* Internal Use Only */ ) { - var sum = 0, - lineStringCoordinates, - i = 1, dx, dy; - - switch ( geom.type ) { - case "Point": - return 0; - - case "LineString": - lineStringCoordinates = geom.coordinates; - break; - - case "Polygon": - lineStringCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( lineStringCoordinates ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( lineStringCoordinates ) ) { - lineStringCoordinates = $.geo.proj.fromGeodetic( lineStringCoordinates ); - } - - for ( ; i < lineStringCoordinates.length; i++ ) { - dx = lineStringCoordinates[ i ][0] - lineStringCoordinates[ i - 1 ][0]; - dy = lineStringCoordinates[ i ][1] - lineStringCoordinates[ i - 1 ][1]; - sum += Math.sqrt((dx * dx) + (dy * dy)); - } - - return sum; - } - - // return undefined; - }, - - area: function( geom, _ignoreGeo /* Internal Use Only */ ) { - var sum = 0, - polygonCoordinates, - i = 1, j; - - switch ( geom.type ) { - case "Point": - case "LineString": - return 0; - - case "Polygon": - polygonCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( polygonCoordinates ) { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( polygonCoordinates ) ) { - polygonCoordinates = $.geo.proj.fromGeodetic( polygonCoordinates ); - } - - for ( ; i <= polygonCoordinates.length; i++) { - j = i % polygonCoordinates.length; - sum += ( polygonCoordinates[ i - 1 ][ 0 ] - polygonCoordinates[ j ][ 0 ] ) * ( polygonCoordinates[ i - 1 ][ 1 ] + polygonCoordinates[ j ][ 1 ] ) / 2; - } - - return Math.abs( sum ); - } - }, - - pointAlong: function( geom, percentage, _ignoreGeo /* Internal Use Only */ ) { - var totalLength = 0, - previousPercentageSum = 0, - percentageSum = 0, - remainderPercentageSum, - len, - lineStringCoordinates, - segmentLengths = [], - i = 1, dx, dy, - c, c0, c1, - wasGeodetic = false; - - switch ( geom.type ) { - case "Point": - return $.extend( { }, geom ); - - case "LineString": - lineStringCoordinates = geom.coordinates; - break; - - case "Polygon": - lineStringCoordinates = geom.coordinates[ 0 ]; - break; - } - - if ( lineStringCoordinates ) { - if ( percentage === 0 ) { - return { - type: "Point", - coordinates: [ lineStringCoordinates[ 0 ][ 0 ], lineStringCoordinates[ 0 ][ 1 ] ] - }; - } else if ( percentage === 1 ) { - i = lineStringCoordinates.length - 1; - return { - type: "Point", - coordinates: [ lineStringCoordinates[ i ][ 0 ], lineStringCoordinates[ i ][ 1 ] ] - }; - } else { - if ( !_ignoreGeo && $.geo.proj && this._isGeodetic( lineStringCoordinates ) ) { - wasGeodetic = true; - lineStringCoordinates = $.geo.proj.fromGeodetic( lineStringCoordinates ); - } - - for ( ; i < lineStringCoordinates.length; i++ ) { - dx = lineStringCoordinates[ i ][ 0 ] - lineStringCoordinates[ i - 1 ][ 0 ]; - dy = lineStringCoordinates[ i ][ 1 ] - lineStringCoordinates[ i - 1 ][ 1 ]; - len = Math.sqrt((dx * dx) + (dy * dy)); - segmentLengths.push( len ); - totalLength += len; - } - - for ( i = 0; i < segmentLengths.length && percentageSum < percentage; i++ ) { - previousPercentageSum = percentageSum; - percentageSum += ( segmentLengths[ i ] / totalLength ); - } - - remainderPercentageSum = percentage - previousPercentageSum; - - c0 = lineStringCoordinates[ i - 1 ]; - c1 = lineStringCoordinates[ i ]; - - c = [ - c0[ 0 ] + ( remainderPercentageSum * ( c1[ 0 ] - c0[ 0 ] ) ), - c0[ 1 ] + ( remainderPercentageSum * ( c1[ 1 ] - c0[ 1 ] ) ) - ]; - - return { - type: "Point", - coordinates: wasGeodetic ? $.geo.proj.toGeodetic(c) : c - }; - } - } - }, - - // - // WKT functions - // - - _WKT: (function () { - function pointToString(value) { - return "POINT " + pointToUntaggedString(value.coordinates); - } - - function pointToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - return "(" + coordinates.join(" ") + ")"; - } - } - - function lineStringToString(value) { - return "LINESTRING " + lineStringToUntaggedString(value.coordinates); - } - - function lineStringToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var points = []; - - for (var i = 0; i < coordinates.length; i++) { - points.push(coordinates[i].join(" ")); - } - - return "(" + points + ")"; - } - } - - function polygonToString(value) { - return "POLYGON " + polygonToUntaggedString(value.coordinates); - } - - function polygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMTPY"; - } else { - var lineStrings = []; - - for (var i = 0; i < coordinates.length; i++) { - lineStrings.push(lineStringToUntaggedString(coordinates[i])); - } - - return "(" + lineStrings + ")"; - } - } - - function multiPointToString(value) { - return "MULTIPOINT " + lineStringToUntaggedString(value.coordinates); - } - - function multiLineStringToString(value) { - return "MULTILINSTRING " + polygonToUntaggedString(value.coordinates); - } - - function multiPolygonToString(value) { - return "MULTIPOLYGON " + multiPolygonToUntaggedString(value.coordinates); - } - - function multiPolygonToUntaggedString(coordinates) { - if (!(coordinates && coordinates.length)) { - return "EMPTY"; - } else { - var polygons = []; - for (var i = 0; i < coordinates.length; i++) { - polygons.push(polygonToUntaggedString(coordinates[i])); - } - return "(" + polygons + ")"; - } - } - - function geometryCollectionToString(value) { - return "GEOMETRYCOLLECTION " + geometryCollectionToUntaggedString(value.geometries); - } - - function geometryCollectionToUntaggedString(geometries) { - if (!(geometries && geometries.length)) { - return "EMPTY"; - } else { - var geometryText = []; - for (var i = 0; i < geometries.length; i++) { - geometryText.push(stringify(geometries[i])); - } - return "(" + geometries + ")"; - } - } - - function stringify(value) { - if (!(value && value.type)) { - return ""; - } else { - switch (value.type) { - case "Point": - return pointToString(value); - - case "LineString": - return lineStringToString(value); - - case "Polygon": - return polygonToString(value); - - case "MultiPoint": - return multiPointToString(value); - - case "MultiLineString": - return multiLineStringToString(value); - - case "MultiPolygon": - return multiPolygonToString(value); - - case "GeometryCollection": - return geometryCollectionToString(value); - - default: - return ""; - } - } - } - - function pointParseUntagged(wkt) { - var pointString = wkt.match( /\(\s*([\d\.\-]+)\s+([\d\.\-]+)\s*\)/ ); - return pointString && pointString.length > 2 ? { - type: "Point", - coordinates: [ - parseFloat(pointString[1]), - parseFloat(pointString[2]) - ] - } : null; - } - - function lineStringParseUntagged(wkt) { - var lineString = wkt.match( /\s*\((.*)\)/ ), - coords = [], - pointStrings, - pointParts, - i = 0; - - if ( lineString && lineString.length > 1 ) { - pointStrings = lineString[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g ); - - for ( ; i < pointStrings.length; i++ ) { - pointParts = pointStrings[ i ].match( /\s*([\d\.\-]+)\s+([\d\.\-]+)\s*/ ); - coords[ i ] = [ parseFloat( pointParts[ 1 ] ), parseFloat( pointParts[ 2 ] ) ]; - } - - return { - type: "LineString", - coordinates: coords - }; - } else { - return null; - } - } - - function polygonParseUntagged(wkt) { - var polygon = wkt.match( /\s*\(\s*\((.*)\)\s*\)/ ), - coords = [], - pointStrings, - pointParts, - i = 0; - - if ( polygon && polygon.length > 1 ) { - pointStrings = polygon[ 1 ].match( /[\d\.\-]+\s+[\d\.\-]+/g ); - - for ( ; i < pointStrings.length; i++ ) { - pointParts = pointStrings[ i ].match( /\s*([\d\.\-]+)\s+([\d\.\-]+)\s*/ ); - coords[ i ] = [ parseFloat( pointParts[ 1 ] ), parseFloat( pointParts[ 2 ] ) ]; - } - - return { - type: "Polygon", - coordinates: [ coords ] - }; - } else { - return null; - } - } - - function multiPointParseUntagged(wkt) { - var multiSomething; - - if ( wkt.indexOf( "((" ) === -1 ) { - multiSomething = lineStringParseUntagged( wkt ); - } else { - multiSomething = multiLineStringParseUntagged( wkt ); - multiSomething.coordinates = $.geo._allCoordinates( multiSomething ); - } - - multiSomething.type = "MultiPoint"; - - return multiSomething; - } - - function multiLineStringParseUntagged(wkt) { - var lineStringsWkt = wkt.substr( 1, wkt.length - 2 ), - lineStrings = lineStringsWkt.split( ")),((" ), - i = 0, - multiLineString = { - type: "MultiLineString", - coordinates: [ ] - }; - - for ( ; i < lineStrings.length; i++ ) { - multiLineString.coordinates.push( lineStringParseUntagged( lineStrings[ i ] ).coordinates ); - } - - return multiLineString; - } - - function multiPolygonParseUntagged(wkt) { - var polygonsWkt = wkt.substr( 1, wkt.length - 2 ), - polygons = polygonsWkt.split( ")),((" ), - i = 0, - multiPolygon = { - type: "MultiPolygon", - coordinates: [ ] - }; - - for ( ; i < polygons.length; i++ ) { - multiPolygon.coordinates.push( polygonParseUntagged( polygons[ i ] ).coordinates ); - } - - return multiPolygon; - } - - function geometryCollectionParseUntagged( wkt ) { - var geometriesWkt = wkt.substr( 1, wkt.length - 2 ), - geometries = geometriesWkt.match( /\),[a-zA-Z]/g ), - geometryCollection = { - type: "GeometryCollection", - geometries: [ ] - }, - curGeom, - i = 0, curStart = 0, curLen; - - if ( geometries && geometries.length > 0 ) { - for ( ; i < geometries.length; i++ ) { - curLen = geometriesWkt.indexOf( geometries[ i ], curStart ) - curStart + 1; - curGeom = parse( geometriesWkt.substr( curStart, curLen ) ); - if ( curGeom ) { - geometryCollection.geometries.push( curGeom ); - } - curStart += curLen + 1; - } - - // one more - curGeom = parse( geometriesWkt.substr( curStart ) ); - if ( curGeom ) { - geometryCollection.geometries.push( curGeom ); - } - - return geometryCollection; - } else { - return null; - } - } - - function parse(wkt) { - wkt = $.trim(wkt); - - var typeIndex = wkt.indexOf( "(" ), - untagged = wkt.substr( typeIndex ); - - switch ($.trim(wkt.substr(0, typeIndex)).toUpperCase()) { - case "POINT": - return pointParseUntagged( untagged ); - - case "LINESTRING": - return lineStringParseUntagged( untagged ); - - case "POLYGON": - return polygonParseUntagged( untagged ); - - case "MULTIPOINT": - return multiPointParseUntagged( untagged ); - - case "MULTILINESTRING": - return multiLineStringParseUntagged( untagged ); - - case "MULTIPOLYGON": - return multiPolygonParseUntagged( untagged ); - - case "GEOMETRYCOLLECTION": - return geometryCollectionParseUntagged( untagged ); - - default: - return null; - } - } - - return { - stringify: stringify, - - parse: parse - }; - }()), - - // - // projection functions - // - - proj: (function () { - var halfPi = 1.5707963267948966192, - quarterPi = 0.7853981633974483096, - radiansPerDegree = 0.0174532925199432958, - degreesPerRadian = 57.295779513082320877, - semiMajorAxis = 6378137; - - return { - fromGeodeticPos: function (coordinate) { - return [ - semiMajorAxis * coordinate[ 0 ] * radiansPerDegree, - semiMajorAxis * Math.log(Math.tan(quarterPi + coordinate[ 1 ] * radiansPerDegree / 2)) - ]; - }, - - fromGeodetic: function ( coordinates ) { - if ( ! $.geo._isGeodetic( coordinates ) ) { - return coordinates; - } - - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - fromGeodeticPos = this.fromGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = fromGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = fromGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ], - i, j, k; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = fromGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - }, - - toGeodeticPos: function (coordinate) { - return [ - (coordinate[ 0 ] / semiMajorAxis) * degreesPerRadian, - (halfPi - 2 * Math.atan(1 / Math.exp(coordinate[ 1 ] / semiMajorAxis))) * degreesPerRadian - ]; - }, - - toGeodetic: function (coordinates) { - if ( $.geo._isGeodetic( coordinates ) ) { - return coordinates; - } - - var isMultiPointOrLineString = $.isArray(coordinates[ 0 ]), - toGeodeticPos = this.toGeodeticPos; - - if (!isMultiPointOrLineString && coordinates.length == 4) { - // bbox - var min = toGeodeticPos([ coordinates[ 0 ], coordinates[ 1 ] ]), - max = toGeodeticPos([ coordinates[ 2 ], coordinates[ 3 ] ]); - return [ min[ 0 ], min[ 1 ], max[ 0 ], max[ 1 ] ]; - } else { - // geometry - var isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray(coordinates[ 0 ][ 0 ]), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray(coordinates[ 0 ][ 0 ][ 0 ]), - result = [ ], - i, j, k; - - if (!isMultiPolygon) { - if (!isMultiLineStringOrPolygon) { - if (!isMultiPointOrLineString) { - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - coordinates = [ coordinates ]; - } - - for ( i = 0; i < coordinates.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < coordinates[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < coordinates[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = toGeodeticPos(coordinates[ i ][ j ][ k ]); - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - } - } - }; - }()), - - // - // service types (defined in other files) - // - - _serviceTypes: {} - }; -}(jQuery, this)); - -(function ($, undefined) { - var _ieVersion = ( function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - do { - div.innerHTML = ""; - } while ( a[0] ); - return v > 6 ? v : !v; - }() ); - - $.widget("geo.geographics", { - _$elem: undefined, - _options: {}, - _trueCanvas: true, - _trueDoubleBuffer: true, - - _width: 0, - _height: 0, - - _$canvas: undefined, - _context: undefined, - - _$canvasSceneFront: undefined, //< if _trueCanvas, where canvas images get written (front buffer) - _$canvasSceneBack: undefined, //< if _trueCanvas, where canvas images get written (back buffer) - _timeoutEnd: null, - _requireFlip: false, - - _blitcanvas: undefined, - _blitcontext: undefined, - - _$labelsContainerFront: undefined, - _$labelsContainerBack: undefined, - _labelsHtml: "", - - options: { - style: { - borderRadius: "8px", - color: "#7f0000", - //fill: undefined, - fillOpacity: 0.2, - height: "8px", - opacity: 1, - //stroke: undefined, - strokeOpacity: 1, - strokeWidth: "2px", - visibility: "visible", - width: "8px" - }, - - doubleBuffer: true - }, - - _create: function () { - this._$elem = this.element; - this._options = this.options; - - this._$elem.css( { - webkitTransform: "translateZ(0)", - display: "inline-block", - overflow: "hidden", - textAlign: "left" - } ); - - if (this._$elem.css("position") == "static") { - this._$elem.css("position", "relative"); - } - - this._$elem.addClass( "geo-graphics" ); - - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width"), 10); - this._height = parseInt(this._$elem.css("height"), 10); - } - - var posCss = 'position:absolute;left:0;top:0;margin:0;padding:0;', - sizeCss = 'width:' + this._width + 'px;height:' + this._height + 'px;', - sizeAttr = 'width="' + this._width + '" height="' + this._height + '"'; - - this._blitcanvas = document.createElement( "canvas" ); - - if ( this._blitcanvas.getContext ) { - //this._$elem.append(''); - //this._$canvas = this._$elem.children(':last'); - this._$canvas = $(''); - - // test _trueDoubleBuffer - this._blitcanvas.width = 1; - this._blitcanvas.height = 1; - this._trueDoubleBuffer = this._blitcanvas.toDataURL().length > 6; - - if ( !(this._options.doubleBuffer && this._trueDoubleBuffer) ) { - this._$elem.append( this._$canvas ); - } - - this._context = this._$canvas[0].getContext("2d"); - - //this._blitcanvas = document.createElement( "canvas" ); - this._blitcanvas.width = this._width; - this._blitcanvas.height = this._height; - this._blitcontext = this._blitcanvas.getContext("2d"); - - // create our front & back buffers - this._$canvasSceneFront = $(''); - this._$canvasSceneBack = $(''); - - } else if (_ieVersion <= 8) { - this._trueCanvas = false; - this._$elem.append( '
                  '); - this._$canvas = this._$elem.children(':last'); - - G_vmlCanvasManager.initElement(this._$canvas[0]); - this._context = this._$canvas[0].getContext("2d"); - this._$canvas.children().css({ backgroundColor: "transparent", width: this._width, height: this._height }); - } - - // create our front & back label containers - this._$labelsContainerFront = $('
                  '); - this._$labelsContainerBack = $('
                  '); - }, - - _setOption: function (key, value) { - if (key == "style") { - value = $.extend({}, this._options.style, value); - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - destroy: function () { - $.Widget.prototype.destroy.apply(this, arguments); - this._$elem.html(""); - this._$elem.removeClass( "geo-graphics" ); - }, - - clear: function () { - this._context.clearRect(0, 0, this._width, this._height); - this._labelsHtml = ""; - - //if ( this._options.doubleBuffer ) console.log("clear:_end " + $.now()); - this._end( ); - }, - - drawArc: function (coordinates, startAngle, sweepAngle, style) { - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0 && style.widthValue > 0 && style.heightValue > 0) { - var r = Math.min(style.widthValue, style.heightValue) / 2; - - startAngle = (startAngle * Math.PI / 180); - sweepAngle = (sweepAngle * Math.PI / 180); - - this._context.save(); - this._context.translate(coordinates[0], coordinates[1]); - if (style.widthValue > style.heightValue) { - this._context.scale(style.widthValue / style.heightValue, 1); - } else { - this._context.scale(1, style.heightValue / style.widthValue); - } - - this._context.beginPath(); - this._context.arc(0, 0, r, startAngle, sweepAngle, false); - - if (this._trueCanvas) { - this._context.restore(); - } - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - - if (!this._trueCanvas) { - this._context.restore(); - } - } - - //if ( this._options.doubleBuffer ) console.log("drawArc:_end " + $.now()); - this._end( ); - }, - - drawPoint: function (coordinates, style) { - style = this._getGraphicStyle(style); - if (style.widthValue == style.heightValue && style.heightValue == style.borderRadiusValue) { - this.drawArc(coordinates, 0, 360, style); - } else if (style.visibility != "hidden" && style.opacity > 0) { - style.borderRadiusValue = Math.min(Math.min(style.widthValue, style.heightValue) / 2, style.borderRadiusValue); - coordinates[0] -= style.widthValue / 2; - coordinates[1] -= style.heightValue / 2; - this._context.beginPath(); - this._context.moveTo(coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.lineTo(coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1]); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1], coordinates[0] + style.widthValue, coordinates[1] + style.borderRadiusValue); - this._context.lineTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0] + style.widthValue, coordinates[1] + style.heightValue, coordinates[0] + style.widthValue - style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.lineTo(coordinates[0] + style.borderRadiusValue, coordinates[1] + style.heightValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1] + style.heightValue, coordinates[0], coordinates[1] + style.heightValue - style.borderRadiusValue); - this._context.lineTo(coordinates[0], coordinates[1] + style.borderRadiusValue); - this._context.quadraticCurveTo(coordinates[0], coordinates[1], coordinates[0] + style.borderRadiusValue, coordinates[1]); - this._context.closePath(); - - if (style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - - this._context.stroke(); - } - - //if ( this._options.doubleBuffer ) console.log("drawPoint:_end " + $.now()); - this._end( ); - } - }, - - drawLineString: function (coordinates, style) { - this._drawLines([coordinates], false, style); - }, - - drawPolygon: function (coordinates, style) { - if ( !this._trueCanvas || coordinates.length == 1 ) { - // either we don't have fancy rendering or there's no need for it (no holes) - this._drawLines( coordinates, true, style ); - } else { - if ( !coordinates || !coordinates.length || coordinates[ 0 ].length < 3 ) { - // this is not a Polygon or it doesn't have a proper outer ring - return; - } - - style = this._getGraphicStyle(style); - - var pixelBbox, i, j; - - if ( style.visibility != "hidden" && style.opacity > 0 ) { - this._blitcontext.clearRect(0, 0, this._width, this._height); - - if ( style.doFill ) { - if ( coordinates.length > 1 ) { - // stencil inner rings - this._blitcontext.globalCompositeOperation = "source-out"; - this._blitcontext.globalAlpha = 1; - - for ( i = 1; i < coordinates.length; i++ ) { - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ i ][ 0 ][ 0 ], coordinates[ i ][ 0 ][ 1 ] ); - for ( j = 1; j < coordinates[ i ].length; j++ ) { - this._blitcontext.lineTo( coordinates[ i ][ j ][ 0 ], coordinates[ i ][ j ][ 1 ] ); - } - this._blitcontext.closePath(); - - this._blitcontext.fill( ); - } - } - } - - // path outer ring - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ 0 ][ 0 ][ 0 ], coordinates[ 0 ][ 0 ][ 1 ] ); - - pixelBbox = [ coordinates[ 0 ][ 0 ][ 0 ] - style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 1 ] - style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 0 ] + style.strokeWidthValue, coordinates[ 0 ][ 0 ][ 1 ] + style.strokeWidthValue ]; - - for ( i = 1; i < coordinates[ 0 ].length - 1; i++ ) { - this._blitcontext.lineTo( coordinates[ 0 ][ i ][ 0 ], coordinates[ 0 ][ i ][ 1 ] ); - - pixelBbox[ 0 ] = Math.min( coordinates[ 0 ][ i ][ 0 ] - style.strokeWidthValue, pixelBbox[ 0 ] ); - pixelBbox[ 1 ] = Math.min( coordinates[ 0 ][ i ][ 1 ] - style.strokeWidthValue, pixelBbox[ 1 ] ); - pixelBbox[ 2 ] = Math.max( coordinates[ 0 ][ i ][ 0 ] + style.strokeWidthValue, pixelBbox[ 2 ] ); - pixelBbox[ 3 ] = Math.max( coordinates[ 0 ][ i ][ 1 ] + style.strokeWidthValue, pixelBbox[ 3 ] ); - } - - this._blitcontext.closePath(); - - this._blitcontext.globalCompositeOperation = "source-out"; - if ( style.doFill ) { - // fill outer ring - this._blitcontext.fillStyle = style.fill; - this._blitcontext.globalAlpha = style.opacity * style.fillOpacity; - this._blitcontext.fill( ); - } - - this._blitcontext.globalCompositeOperation = "source-over"; - if ( style.doStroke ) { - // stroke outer ring - this._blitcontext.lineCap = this._blitcontext.lineJoin = "round"; - this._blitcontext.lineWidth = style.strokeWidthValue; - this._blitcontext.strokeStyle = style.stroke; - - this._blitcontext.globalAlpha = style.opacity * style.strokeOpacity; - this._blitcontext.stroke( ); - - if ( coordinates.length > 1 ) { - // stroke inner rings - for ( i = 1; i < coordinates.length; i++ ) { - this._blitcontext.beginPath(); - this._blitcontext.moveTo( coordinates[ i ][ 0 ][ 0 ], coordinates[ i ][ 0 ][ 1 ] ); - for ( j = 1; j < coordinates[ i ].length; j++ ) { - this._blitcontext.lineTo( coordinates[ i ][ j ][ 0 ], coordinates[ i ][ j ][ 1 ] ); - } - this._blitcontext.closePath(); - - this._blitcontext.stroke( ); - } - } - } - - // blit - pixelBbox[ 0 ] = Math.min( Math.max( pixelBbox[ 0 ], 0), this._width ); - pixelBbox[ 1 ] = Math.min( Math.max( pixelBbox[ 1 ], 0), this._height ); - pixelBbox[ 2 ] = Math.min( Math.max( pixelBbox[ 2 ], 0), this._width ); - pixelBbox[ 3 ] = Math.min( Math.max( pixelBbox[ 3 ], 0), this._height ); - - if ( pixelBbox[ 0 ] !== pixelBbox[ 2 ] && pixelBbox[ 1 ] !== pixelBbox[ 3 ] ) { - this._context.drawImage(this._blitcanvas, pixelBbox[ 0 ], pixelBbox[ 1 ], pixelBbox[ 2 ] - pixelBbox[ 0 ], pixelBbox[ 3 ] - pixelBbox[ 1 ], pixelBbox[ 0 ], pixelBbox[ 1 ], pixelBbox[ 2 ] - pixelBbox[ 0 ], pixelBbox[ 3 ] - pixelBbox[ 1 ] ); - - //if ( this._options.doubleBuffer ) console.log("drawPolygon:_end " + $.now()); - this._end( ); - } - } - } - }, - - drawBbox: function (bbox, style) { - this._drawLines([[ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ]], true, style); - }, - - drawLabel: function( coordinates, label ) { - this._labelsHtml += '
                  ' + label + '
                  '; - }, - - resize: function( ) { - this._width = this._$elem.width(); - this._height = this._$elem.height(); - - if (!(this._width && this._height)) { - this._width = parseInt(this._$elem.css("width"), 10); - this._height = parseInt(this._$elem.css("height"), 10); - } - - if ( this._trueCanvas ) { - this._$canvas[0].width = this._width; - this._$canvas[0].height = this._height; - - this._$canvasSceneFront.css( { - width: this._width, - height: this._height - } ); - - this._$canvasSceneBack.css( { - width: this._width, - height: this._height - } ); - } else { - this._$canvas.css( { - width: this._width, - height: this._height - } ); - } - - this._$labelsContainerFront.css( { - width: this._width, - height: this._height - } ); - - this._$labelsContainerBack.css( { - width: this._width, - height: this._height - } ); - }, - - interactiveTransform: function( origin, scale ) { - if ( this._timeoutEnd ) { - clearTimeout( this._timeoutEnd ); - this._timeoutEnd = null; - } - - // hide labels for now until they are on the interactive div - //this._$labelsContainerFront.html(""); - - if ( this._trueCanvas ) { - if ( this._options.doubleBuffer && this._trueDoubleBuffer ) { - - - if ( this._requireFlip ) { - var geographics = this; - - var oldCanvasScene = geographics._$canvasSceneFront; - - geographics._$canvasSceneFront = geographics._$canvasSceneBack.css( { - left: 0, - top: 0, - width: geographics._width, - height: geographics._height - } ).prop( "src", geographics._$canvas[ 0 ].toDataURL( ) ).prependTo( geographics._$elem ); - - geographics._$canvasSceneBack = oldCanvasScene.detach(); - - geographics._requireFlip = false; - } - - - //console.log("geographics:interactiveTransform " + this._$canvasSceneFront.prop( "id" ) + ": origin: " + origin.toString() + ", scale: " + scale); - // transform a finished scene, can assume no drawing during these calls - this._$canvasSceneFront.css( { - left: Math.round( origin[ 0 ] ), - top: Math.round( origin[ 1 ] ), - width: this._width * scale, - height: this._height * scale - } ); - } else { - this._context.clearRect(0, 0, this._width, this._height); - } - } else { - this._context.clearRect(0, 0, this._width, this._height); - } - - // transform labels - this._$labelsContainerFront.css( { - left: Math.round( origin[ 0 ] ), - top: Math.round( origin[ 1 ] ), - width: this._width * scale, - height: this._height * scale - } ); - }, - - _end: function( ) { - // end/finalize a scene - if ( this._timeoutEnd ) { - clearTimeout( this._timeoutEnd ); - this._timeoutEnd = null; - } - - this._requireFlip = true; - - var geographics = this; - - function endCallback( ) { - if ( !geographics._timeoutEnd ) { - // something has canceled the draw - return; - } - - if ( geographics._trueCanvas && geographics._options.doubleBuffer && geographics._trueDoubleBuffer ) { - //console.log(" endCallback..."); - - //geographics._$canvasSceneFront = - geographics._$canvasSceneBack.prop( "src", "" ).one( "load", function( e ) { - //console.log(" ...flip: show " + geographics._$canvasSceneBack.prop( "id" ) + ", hide " + geographics._$canvasSceneFront.prop("id")); - geographics._requireFlip = false; - var oldCanvasScene = geographics._$canvasSceneFront; - - geographics._$canvasSceneFront = geographics._$canvasSceneBack.css( { - left: 0, - top: 0, - width: geographics._width, - height: geographics._height - } ).prependTo( geographics._$elem ); - - geographics._$canvasSceneBack = oldCanvasScene.detach(); - } ).prop( "src", geographics._$canvas[ 0 ].toDataURL( ) ); - } - - - geographics._$labelsContainerBack.html( geographics._labelsHtml ); - - var oldLabelsContainer = geographics._$labelsContainerFront; - - geographics._$labelsContainerFront = geographics._$labelsContainerBack.css( { - left: 0, - top: 0, - width: geographics._width, - height: geographics._height - } ).prependTo( geographics._$elem ); - - geographics._$labelsContainerBack = oldLabelsContainer.detach(); - - - geographics._timeoutEnd = null; - } - - //if ( this._options.doubleBuffer ) { - this._timeoutEnd = setTimeout( endCallback, 20 ); - //} else { - //geographics._$labelsContainerFront.html( geographics._labelsHtml ); - //} - }, - - _getGraphicStyle: function (style) { - function safeParse(value) { - value = parseInt(value, 10); - return (+value + '') === value ? +value : value; - } - - style = $.extend({}, this._options.style, style); - style.borderRadiusValue = safeParse(style.borderRadius); - style.fill = style.fill || style.color; - style.doFill = style.fill && style.fillOpacity > 0; - style.stroke = style.stroke || style.color; - style.strokeWidthValue = safeParse(style.strokeWidth); - style.doStroke = style.stroke && style.strokeOpacity > 0 && style.strokeWidthValue > 0; - style.widthValue = safeParse(style.width); - style.heightValue = safeParse(style.height); - return style; - }, - - _drawLines: function (coordinates, close, style) { - if (!coordinates || !coordinates.length || coordinates[0].length < 2) { - return; - } - - var i, j; - style = this._getGraphicStyle(style); - - if (style.visibility != "hidden" && style.opacity > 0) { - this._context.beginPath(); - - for (i = 0; i < coordinates.length; i++) { - this._context.moveTo(coordinates[i][0][0], coordinates[i][0][1]); - for (j = 1; j < coordinates[i].length; j++) { - this._context.lineTo(coordinates[i][j][0], coordinates[i][j][1]); - } - } - - if (close) { - this._context.closePath(); - } - - if (close && style.doFill) { - this._context.fillStyle = style.fill; - this._context.globalAlpha = style.opacity * style.fillOpacity; - this._context.fill(); - } - - if (style.doStroke) { - this._context.lineCap = this._context.lineJoin = "round"; - this._context.lineWidth = style.strokeWidthValue; - this._context.strokeStyle = style.stroke; - - this._context.globalAlpha = style.opacity * style.strokeOpacity; - this._context.stroke(); - } - - //if ( this._options.doubleBuffer ) console.log("_drawLines:_end " + $.now()); - this._end( ); - } - } - }); -}(jQuery)); - - -(function ($, undefined) { - var _widgetIdSeed = 0, - _ieVersion = ( function () { - var v = 5, div = document.createElement("div"), a = div.all || []; - do { - div.innerHTML = ""; - } while ( a[0] ); - return v > 6 ? v : !v; - }() ), - - _defaultOptions = { - bbox: [-180, -85, 180, 85], - bboxMax: [-180, -85, 180, 85], - center: [0, 0], - cursors: { - "static": "default", - pan: "url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move", - zoom: "crosshair", - dragBox: "crosshair", - dragCircle: "crosshair", - drawPoint: "crosshair", - drawLineString: "crosshair", - drawPolygon: "crosshair", - measureLength: "crosshair", - measureArea: "crosshair" - }, - measureLabels: { - length: "{{:length.toFixed( 2 )}} m", - area: "{{:area.toFixed( 2 )}} sq m" - }, - drawStyle: {}, - shapeStyle: {}, - mode: "pan", - pannable: true, - scroll: "default", - shift: "default", - services: [ - { - "class": "osm", - type: "tiled", - src: function (view) { - return "http://otile" + ((view.index % 4) + 1) + ".mqcdn.com/tiles/1.0.0/osm/" + view.zoom + "/" + view.tile.column + "/" + view.tile.row + ".png"; - }, - attr: "Tiles Courtesy of MapQuest " - } - ], - tilingScheme: { - tileWidth: 256, - tileHeight: 256, - levels: 18, - basePixelSize: 156543.03392799936, - origin: [-20037508.342787, 20037508.342787] - }, - axisLayout: "map", - zoom: 0, - zoomMin: 0, - zoomMax: Number.POSITIVE_INFINITY, - pixelSize: 0 - }; - - $.widget("geo.geomap", { - // private widget members - _$elem: undefined, //< map div for maps, service div for services - _map: undefined, //< only defined in services - _created: false, - _createdGraphics: false, - _widgetId: 0, - _tmplLengthId: "", - _tmplAreaId: "", - - _contentBounds: {}, - - _$resizeContainer: undefined, //< all elements that should match _contentBounds' size - - _$eventTarget: undefined, - _$contentFrame: undefined, - _$existingChildren: undefined, - _$attrList: undefined, - _$servicesContainer: undefined, - _$shapesContainers: undefined, //< all shapesContainer divs (map only) - - _$panContainer: undefined, //< all non-service elements that move while panning - _$shapesContainer: undefined, //< just "our" shapesContainer div (map & service) - _$drawContainer: undefined, - _$measureContainer: undefined, - _$measureLabel: undefined, - - _dpi: 96, - - _currentServices: [], //< internal copy - - _center: undefined, - _pixelSize: undefined, - _centerMax: undefined, - _pixelSizeMax: undefined, - - _userGeodetic: true, - - _centerInteractive: undefined, - _pixelSizeInteractive: undefined, - _timeoutInteractive: null, - _triggerInteractive: false, - - _timeoutRefreshShapes: null, - - _loadCount: 0, - - _wheelTimeout: null, - _wheelLevel: 0, - - _zoomFactor: 2, //< determines what a zoom level means - - _fullZoomFactor: 2, //< interactiveScale factor needed to zoom a whole level - _partialZoomFactor: 1.18920711500273, //< interactiveScale factor needed to zoom a fraction of a level (the fourth root of 2) - - _mouseDown: undefined, - _inOp: undefined, - _toolPan: undefined, - _shiftDown: undefined, - _anchor: undefined, - _current: undefined, - _downDate: undefined, - _moveDate: undefined, - _clickDate: undefined, - _lastMove: undefined, - _lastDrag: undefined, - - _windowHandler: null, - _resizeTimeout: null, - - _panning: undefined, - _velocity: undefined, - _friction: undefined, - - _supportTouch: undefined, - _softDblClick: undefined, - _isTap: undefined, - _isDbltap: undefined, - - _isMultiTouch: undefined, - _multiTouchAnchor: [], //< TouchList - _multiTouchAnchorBbox: undefined, //< bbox - _multiTouchCurrentBbox: undefined, //< bbox - - _drawTimeout: null, //< used in drawPoint mode so we don't send two shape events on dbltap - _drawPixels: [], //< an array of coordinate arrays for drawing lines & polygons, in pixel coordinates - _drawCoords: [], - - _graphicShapes: [], //< an array of objects containing style object refs & GeoJSON object refs - - _initOptions: {}, - - _options: {}, - - options: $.extend({}, _defaultOptions), - - _createWidget: function (options, element) { - this._$elem = $(element); - - if (this._$elem.is(".geo-service")) { - this._graphicShapes = []; - $.Widget.prototype._createWidget.apply(this, arguments); - return; - } - - this._widgetId = _widgetIdSeed++; - this._tmplLengthId = "geoMeasureLength" + this._widgetId; - this._tmplAreaId = "geoMeasureArea" + this._widgetId; - - this._$elem.addClass("geo-map").css( { - webkitTransform: "translateZ(0)" - } ); - - - this._initOptions = options || {}; - - this._forcePosition(this._$elem); - - this._$elem.css("text-align", "left"); - - var size = this._findMapSize(); - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left"), 10), - y: parseInt(this._$elem.css("padding-top"), 10), - width: size["width"], - height: size["height"] - }; - - this._createChildren(); - - this._center = [ 0, 0 ]; - this._centerMax = [ 0, 0 ]; - this._centerInteractive = [ 0, 0 ]; - - this.options["pixelSize"] = this._pixelSize = this._pixelSizeMax = 156543.03392799936; - - this._mouseDown = - this._inOp = - this._toolPan = - this._shiftDown = - this._panning = - this._isTap = - this._isDbltap = false; - - this._anchor = [ 0, 0 ]; - this._current = [ 0, 0 ]; - this._lastMove = [ 0, 0 ]; - this._lastDrag = [ 0, 0 ]; - this._velocity = [ 0, 0 ]; - - this._friction = [0.8, 0.8]; - - this._downDate = - this._moveDate = - this._clickDate = 0; - - this._drawPixels = []; - this._drawCoords = []; - this._graphicShapes = []; - - - $.Widget.prototype._createWidget.apply(this, arguments); - }, - - _create: function () { - this._options = this.options; - - if (this._$elem.is(".geo-service")) { - this._map = this._$elem.data( "geoMap" ); - this._$elem.data( "geoService", this ); - return; - } - - this._map = this; - - this._supportTouch = "ontouchend" in document; - this._softDblClick = this._supportTouch || _ieVersion == 7; - - var geomap = this, - touchStartEvent = this._supportTouch ? "touchstart" : "mousedown", - touchStopEvent = this._supportTouch ? "touchend touchcancel" : "mouseup", - touchMoveEvent = this._supportTouch ? "touchmove" : "mousemove"; - - $(document).keydown($.proxy(this._document_keydown, this)); - - this._$eventTarget.dblclick($.proxy(this._eventTarget_dblclick, this)); - - this._$eventTarget.bind(touchStartEvent, $.proxy(this._eventTarget_touchstart, this)); - - var dragTarget = (this._$eventTarget[0].setCapture) ? this._$eventTarget : $(document); - dragTarget.bind(touchMoveEvent, $.proxy(this._dragTarget_touchmove, this)); - dragTarget.bind(touchStopEvent, $.proxy(this._dragTarget_touchstop, this)); - - this._$eventTarget.mousewheel($.proxy(this._eventTarget_mousewheel, this)); - - this._windowHandler = function () { - if (geomap._resizeTimeout) { - clearTimeout(geomap._resizeTimeout); - } - geomap._resizeTimeout = setTimeout(function () { - if (geomap._created) { - geomap._$elem.geomap( "resize", true ); - } - }, 500); - }; - - $(window).resize(this._windowHandler); - - this._$drawContainer.geographics({ style: this._initOptions.drawStyle || {}, doubleBuffer: false }); - this._options["drawStyle"] = this._$drawContainer.geographics("option", "style"); - - this._$shapesContainer.geographics( { style: this._initOptions.shapeStyle || { } } ); - this._createdGraphics = true; - - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - - if (this._initOptions) { - // always init tilingScheme right away, even if it's null - if ( this._initOptions.tilingScheme !== undefined ) { - this._setOption("tilingScheme", this._initOptions.tilingScheme || null, false); - } - - if ( this._initOptions.services ) { - // jQuery UI Widget Factory merges user services with our default, we want to clobber the default - this._options[ "services" ] = $.merge( [ ], this._initOptions.services ); - } - if (this._initOptions.bboxMax) { - this._setOption("bboxMax", this._initOptions.bboxMax, false); - this._setOption("bbox", this._initOptions.bboxMax, false); - } - if (this._initOptions.zoomMin !== undefined) { - this._setOption("zoomMin", this._initOptions.zoomMin, false); - } - if (this._initOptions.zoomMax !== undefined) { - this._setOption("zoomMax", this._initOptions.zoomMax, false); - } - if (this._initOptions.bbox) { - this._setOption("bbox", this._initOptions.bbox, false); - } - if (this._initOptions.center) { - this._setOption("center", this._initOptions.center, false); - } - if (this._initOptions.zoom !== undefined) { - this._setOption("zoom", this._initOptions.zoom, false); - } - } - - $.templates( this._tmplLengthId, this._options[ "measureLabels" ].length ); - $.templates( this._tmplAreaId, this._options[ "measureLabels" ].area ); - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._createServices(); - this._refresh(); - - this._created = true; - }, - - _setOption: function (key, value, refresh) { - if ( key == "pixelSize" ) { - return; - } - - refresh = (refresh === undefined || refresh); - - if ( this._$elem.is( ".geo-map" ) ) { - this._panFinalize(); - } - - var center, pixelSize, bbox, zoom; - - switch (key) { - case "bbox": - if ( this._created ) { - this._clearInteractiveTimeout( ); - } - - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2]; - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height); - - // clamp to zoom - zoom = this._getZoom( center, pixelSize ); - - if ( this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - if ( this._created ) { - this._setInteractiveCenterAndSize( center, pixelSize ); - this._setInteractiveTimeout( false ); - } else { - this._setCenterAndSize( center, pixelSize, false, refresh ); - } - - value = this._getBbox( center, pixelSize ); - break; - - case "bboxMax": - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - break; - - case "center": - if ( this._created ) { - this._clearInteractiveTimeout( ); - } - - this._userGeodetic = $.geo.proj && $.geo._isGeodetic( value ); - if ( this._userGeodetic ) { - value = $.geo.proj.fromGeodetic( value ); - } - - if ( this._created ) { - this._setInteractiveCenterAndSize( value, this._pixelSizeInteractive ); - this._interactiveTransform( ); - this._setInteractiveTimeout( false ); - } else { - this._setCenterAndSize( value, this._pixelSize, false, refresh ); - } - break; - - case "measureLabels": - value = $.extend( this._options[ "measureLabels" ], value ); - - - $.templates( this._tmplLengthId, this._options[ "measureLabels" ].length ); - $.templates( this._tmplAreaId, this._options[ "measureLabels" ].area ); - - break; - - case "drawStyle": - if (this._$drawContainer) { - this._$drawContainer.geographics("option", "style", value); - value = this._$drawContainer.geographics("option", "style"); - } - break; - - case "shapeStyle": - if ( this._$elem.is( ".geo-service" ) && !this._createdGraphics ) { - this._createServiceGraphics( ); - } - - if ( this._createdGraphics ) { - this._$shapesContainer.geographics("option", "style", value); - value = this._$shapesContainer.geographics("option", "style"); - } - break; - - case "mode": - this._resetDrawing( ); - this._$eventTarget.css("cursor", this._options["cursors"][value]); - break; - - case "zoom": - if ( this._created ) { - this._setZoom(value, false, refresh); - } else { - value = Math.max( value, 0 ); - this._setCenterAndSize( this._center, this._getPixelSize( value ), false, refresh ); - } - break; - } - - $.Widget.prototype._setOption.apply(this, arguments); - - switch ( key ) { - case "bbox": - case "center": - if ( this._userGeodetic ) { - this._options[ "bbox" ] = $.geo.proj.toGeodetic( this._options[ "bbox" ] ); - this._options[ "center" ] = $.geo.proj.toGeodetic( this._center ); - } - break; - - case "tilingScheme": - if ( value !== null ) { - this._pixelSizeMax = this._getPixelSize( 0 ); - this._centerMax = [ - value.origin[ 0 ] + this._pixelSizeMax * value.tileWidth / 2, - value.origin[ 1 ] + this._pixelSizeMax * value.tileHeight / 2 - ]; - } - break; - - case "bboxMax": - if ( $.geo.proj && $.geo._isGeodetic( value ) ) { - bbox = $.geo.proj.fromGeodetic( value ); - } else { - bbox = value; - } - - this._centerMax = $.geo.center( bbox ); - this._pixelSizeMax = Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - break; - - case "services": - this._createServices(); - if (refresh) { - this._refresh(); - this._refreshAllShapes(); - } - break; - - case "shapeStyle": - if ( refresh && this._createdGraphics ) { - this._$shapesContainer.geographics("clear"); - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - break; - } - }, - - destroy: function () { - if ( this._$elem.is(".geo-service") ) { - if ( this._createdGraphics ) { - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._createdGraphics = false; - } - } else { - clearTimeout( this._timeoutInteractive ); - this._timeoutInteractive = null; - - this._created = false; - - $(window).unbind("resize", this._windowHandler); - - for ( var i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap("destroy"); - $.geo["_serviceTypes"][this._currentServices[i].type].destroy(this, this._$servicesContainer, this._currentServices[i]); - } - - this._$shapesContainer.geographics("destroy"); - this._$shapesContainer = undefined; - this._createdGraphics = false; - - this._$drawContainer.geographics("destroy"); - this._$drawContainer = undefined; - - this._$existingChildren.detach(); - this._$elem.html(""); - this._$elem.append(this._$existingChildren); - this._$elem.removeClass("geo-map"); - } - - $.Widget.prototype.destroy.apply(this, arguments); - }, - - toMap: function (p) { - p = this._toMap(p); - return this._userGeodetic ? $.geo.proj.toGeodetic(p) : p; - }, - - toPixel: function ( p, _center /* Internal Use Only */, _pixelSize /* Internal Use Only */ ) { - return this._toPixel( $.geo.proj ? $.geo.proj.fromGeodetic( p ) : p, _center, _pixelSize ); - }, - - opacity: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "opacity", value, this._$elem ); - } else { - if ( value >= 0 || value <= 1 ) { - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - service.style.opacity = value; - - // update the original service object's style property - service.serviceObject.style = $.extend( { }, service.serviceObject.style, service.style ); - - $.geo[ "_serviceTypes" ][ service.type ].opacity( this, service ); - } - } - } - } - }, - - toggle: function ( value, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "toggle", value, this._$elem ); - } else { - - for ( var i = 0; i < this._currentServices.length; i++ ) { - var service = this._currentServices[ i ]; - - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - if ( value === undefined ) { - // toggle visibility - value = ( service.style.visibility !== "visible" ); - } - - service.style.visibility = ( value ? "visible" : "hidden" ); - - // update the original service object's style property - service.serviceObject.style = $.extend( { }, service.serviceObject.style, service.style ); - - service.serviceContainer.toggle( value ); - - if ( value ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service ); - } - } - } - } - }, - - zoom: function (numberOfLevels) { - if (numberOfLevels !== null) { - this._setZoom(this._options["zoom"] + numberOfLevels, false, true); - } - }, - - refresh: function ( force, _serviceContainer ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._$elem.closest( ".geo-map" ).geomap( "refresh", force, this._$elem ); - } else { - this._refresh( force, _serviceContainer ); - this._refreshAllShapes( ); - } - }, - - resize: function ( _trigger /* Internal Use Only */ ) { - var size = this._findMapSize(), - dx = size["width"]/2 - this._contentBounds.width/2, - dy = size["height"]/2 - this._contentBounds.height/2, - i; - - this._contentBounds = { - x: parseInt(this._$elem.css("padding-left"), 10), - y: parseInt(this._$elem.css("padding-top"), 10), - width: size["width"], - height: size["height"] - }; - - this._$resizeContainer.css( { - width: size["width"], - height: size["height"] - } ); - - for (i = 0; i < this._currentServices.length; i++) { - $.geo["_serviceTypes"][this._currentServices[i].type].resize(this, this._currentServices[i]); - } - - this._$elem.find( ".geo-graphics" ).css( { - width: size["width"], - height: size["height"] - }).geographics( "resize" ); - - for (i = 0; i < this._drawPixels.length; i++) { - this._drawPixels[i][0] += dx; - this._drawPixels[i][1] += dy; - } - - this._setCenterAndSize(this._center, this._pixelSize, _trigger, true); - }, - - append: function ( shape, style, label, refresh ) { - if ( shape && ( $.isPlainObject( shape ) || ( $.isArray( shape ) && shape.length > 0 ) ) ) { - if ( !this._createdGraphics ) { - this._createServiceGraphics( ); - } - - var shapes, arg, i, realStyle, realLabel, realRefresh; - - if ( $.isArray( shape ) ) { - shapes = shape; - } else if ( shape.type == "FeatureCollection" ) { - shapes = shape.features; - } else { - shapes = [ shape ]; - } - - for ( i = 1; i < arguments.length; i++ ) { - arg = arguments[ i ]; - - if ( typeof arg === "object" ) { - realStyle = arg; - } else if ( typeof arg === "number" || typeof arg === "string" ) { - realLabel = arg; - } else if ( typeof arg === "boolean" ) { - realRefresh = arg; - } - } - - for ( i = 0; i < shapes.length; i++ ) { - if ( shapes[ i ].type != "Point" ) { - var bbox = $.geo.bbox( shapes[ i ] ); - if ( $.geo.proj && $.geo._isGeodetic( bbox ) ) { - bbox = $.geo.proj.fromGeodetic( bbox ); - } - $.data( shapes[ i ], "geoBbox", bbox ); - } - - this._graphicShapes.push( { - shape: shapes[ i ], - style: realStyle, - label: realLabel - } ); - } - - if ( realRefresh === undefined || realRefresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - this._refreshAllShapes( ); - } - } - }, - - empty: function ( refresh ) { - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - $.removeData( this._graphicShapes[ i ].shape, "geoBbox" ); - } - - this._graphicShapes = []; - - if ( refresh === undefined || refresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - this._refreshAllShapes( ); - } - }, - - find: function ( selector, pixelTolerance ) { - var isPoint = $.isPlainObject( selector ), - searchPixel = isPoint ? this._map.toPixel( selector.coordinates ) : undefined, - mapTol = this._map._pixelSize * pixelTolerance, - result = [], - graphicShape, - geometries, - curGeom, - i = 0; - - for ( ; i < this._graphicShapes.length; i++ ) { - graphicShape = this._graphicShapes[ i ]; - - if ( isPoint ) { - if ( graphicShape.shape.type == "Point" ) { - if ( $.geo.distance( graphicShape.shape, selector ) <= mapTol ) { - result.push( graphicShape.shape ); - } - } else { - var bbox = $.data( graphicShape.shape, "geoBbox" ), - bboxPolygon = { - type: "Polygon", - coordinates: [ [ - [bbox[0], bbox[1]], - [bbox[0], bbox[3]], - [bbox[2], bbox[3]], - [bbox[2], bbox[1]], - [bbox[0], bbox[1]] - ] ] - }, - projectedPoint = { - type: "Point", - coordinates: $.geo.proj && $.geo._isGeodetic( selector.coordinates ) ? $.geo.proj.fromGeodetic( selector.coordinates ) : selector.coordinates - }; - - if ( $.geo.distance( bboxPolygon, projectedPoint, true ) <= mapTol ) { - geometries = $.geo._flatten( graphicShape.shape ); - for ( curGeom = 0; curGeom < geometries.length; curGeom++ ) { - if ( $.geo.distance( geometries[ curGeom ], selector ) <= mapTol ) { - result.push( graphicShape.shape ); - break; - } - } - } - } - } else { - result.push( graphicShape.shape ); - } - } - - if ( this._$elem.is( ".geo-map" ) ) { - this._$elem.find( ".geo-service" ).each( function( ) { - result = $.merge( result, $( this ).geomap( "find", selector, pixelTolerance ) ); - } ); - } - - return result; - }, - - remove: function ( shape, refresh ) { - if ( shape && ( $.isPlainObject( shape ) || ( $.isArray( shape ) && shape.length > 0 ) ) ) { - var shapes = $.isArray( shape ) ? shape : [ shape ], - rest; - - for ( var i = 0; i < this._graphicShapes.length; i++ ) { - if ( $.inArray( this._graphicShapes[ i ].shape, shapes ) >= 0 ) { - $.removeData( shape, "geoBbox" ); - rest = this._graphicShapes.slice( i + 1 ); - this._graphicShapes.length = i; - this._graphicShapes.push.apply( this._graphicShapes, rest ); - i--; - } - } - - if ( refresh === undefined || refresh ) { - if ( this._$elem.is( ".geo-service" ) ) { - this._refresh( false, this._$elem ); - } else { - this._refresh( ); - } - this._refreshAllShapes( ); - } - } - }, - - _getBbox: function (center, pixelSize) { - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - // calculate the internal bbox - var halfWidth = this._contentBounds[ "width" ] / 2 * pixelSize, - halfHeight = this._contentBounds[ "height" ] / 2 * pixelSize; - return [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - }, - - _setBbox: function (value, trigger, refresh) { - var center = [value[0] + (value[2] - value[0]) / 2, value[1] + (value[3] - value[1]) / 2], - pixelSize = Math.max($.geo.width(value, true) / this._contentBounds.width, $.geo.height(value, true) / this._contentBounds.height), - zoom = this._getZoom( center, pixelSize ); - - // clamp to zoom - if ( this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - this._setInteractiveCenterAndSize( center, pixelSize ); - this._interactiveTransform( ); - }, - - _getBboxMax: function () { - // calculate the internal bboxMax - var halfWidth = this._contentBounds["width"] / 2 * this._pixelSizeMax, - halfHeight = this._contentBounds["height"] / 2 * this._pixelSizeMax; - return [this._centerMax[0] - halfWidth, this._centerMax[1] - halfHeight, this._centerMax[0] + halfWidth, this._centerMax[1] + halfHeight]; - }, - - _getCenter: function () { - return this._center; - }, - - _getContentBounds: function () { - return this._contentBounds; - }, - - _getServicesContainer: function () { - return this._$servicesContainer; - }, - - _getZoom: function ( center, pixelSize ) { - // calculate the internal zoom level, vs. public zoom property - // this does not take zoomMin or zoomMax into account - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var tilingScheme = this._options["tilingScheme"]; - if ( tilingScheme ) { - if ( tilingScheme.pixelSizes ) { - var roundedPixelSize = Math.floor(pixelSize * 1000), - levels = tilingScheme.pixelSizes.length, - i = levels - 1; - - for ( ; i >= 0; i-- ) { - if ( Math.floor( tilingScheme.pixelSizes[ i ] * 1000 ) >= roundedPixelSize ) { - return i; - } - } - - return 0; - } else { - return Math.round( Math.log( tilingScheme.basePixelSize / pixelSize) / Math.log( 2 ) ); - } - } else { - var ratio = this._contentBounds["width"] / this._contentBounds["height"], - bbox = $.geo.reaspect( this._getBbox( center, pixelSize ), ratio, true ), - bboxMax = $.geo.reaspect(this._getBboxMax(), ratio, true); - - return Math.round( Math.log($.geo.width(bboxMax, true) / $.geo.width(bbox, true)) / Math.log(this._zoomFactor) ); - } - }, - - _setZoom: function ( value, trigger, refresh ) { - // set the map widget's zoom, taking zoomMin and zoomMax into account - this._clearInteractiveTimeout( ); - - value = Math.min( Math.max( value, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ); - - this._setInteractiveCenterAndSize( this._centerInteractive, this._getPixelSize( value ) ); - this._interactiveTransform( ); - this._setInteractiveTimeout( trigger ); - }, - - _createChildren: function () { - this._$existingChildren = this._$elem.children(); - - this._forcePosition(this._$existingChildren); - - this._$existingChildren.detach().css( { - mozUserSelect: "none" - } ); - - - var contentSizeCss = "width:" + this._contentBounds["width"] + "px; height:" + this._contentBounds["height"] + "px; margin:0; padding:0;", - contentPosCss = "position:absolute; left:0; top:0;"; - - this._$elem.prepend('
                  '); - this._$eventTarget = this._$contentFrame = this._$elem.children(':first'); - - this._$contentFrame.append('
                  '); - this._$servicesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
                  '); - this._$shapesContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append( '
                    ' ); - this._$attrList = this._$contentFrame.children( ":last" ); - - this._$contentFrame.append('
                    '); - this._$drawContainer = this._$contentFrame.children(':last'); - - this._$contentFrame.append('
                    '); - this._$measureContainer = this._$contentFrame.children(':last'); - this._$measureLabel = this._$measureContainer.children(); - - this._$panContainer = $( [ this._$shapesContainer[ 0 ], this._$drawContainer[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$resizeContainer = $( [ this._$contentFrame[ 0 ], this._$servicesContainer[ 0 ], this._$eventTarget[ 0 ], this._$measureContainer[ 0 ] ] ); - - this._$contentFrame.append(this._$existingChildren); - - if ( ! $("#geo-measure-style").length ) { - $("head").prepend( '' ); - } - }, - - _createServices: function () { - var service, i; - - for ( i = 0; i < this._currentServices.length; i++ ) { - this._currentServices[ i ].serviceContainer.geomap( "destroy" ); - $.geo[ "_serviceTypes" ][ this._currentServices[ i ].type ].destroy( this, this._$servicesContainer, this._currentServices[ i ] ); - } - - this._currentServices = [ ]; - this._$servicesContainer.html( "" ); - this._$attrList.html( "" ); - - for ( i = 0; i < this._options[ "services" ].length; i++ ) { - service = this._currentServices[ i ] = $.extend( { }, this._options[ "services" ][ i ] ); - - // keep a reference to the original - service.serviceObject = this._options[ "services" ][ i ]; - - // default the service style property on our copy - service.style = $.extend( { - visibility: "visible", - opacity: 1 - }, service.style ); - - var idString = service.id ? ' id="' + service.id + '"' : "", - classString = 'class="geo-service ' + ( service["class"] ? service["class"] : '' ) + '"', - scHtml = '
                    ', - servicesContainer; - - this._$servicesContainer.append( scHtml ); - serviceContainer = this._$servicesContainer.children( ":last" ); - service.serviceContainer = serviceContainer; - - $.geo[ "_serviceTypes" ][ service.type ].create( this, serviceContainer, service, i ); - - serviceContainer.data( "geoMap", this ).geomap(); - - if ( service.attr ) { - this._$attrList.append( '
                  • ' + service.attr + '
                  • ' ); - } - } - - // start with our map-level shapesContainer - this._$shapesContainers = this._$shapesContainer; - - this._$attrList.find( "a" ).css( { - position: "relative", - zIndex: 100 - } ); - }, - - _createServiceGraphics: function( ) { - // only called in the context of a service-level geomap - var $contentFrame = this._$elem.closest( ".geo-content-frame" ); - this._$elem.append('
                    '); - this._$shapesContainer = this._$elem.children(':last'); - - this._map._$shapesContainers = this._map._$shapesContainers.add( this._$shapesContainer ); - - this._$shapesContainer.geographics( ); - this._createdGraphics = true; - - this._options["shapeStyle"] = this._$shapesContainer.geographics("option", "style"); - }, - - _refreshDrawing: function ( ) { - this._$drawContainer.geographics("clear"); - - if ( this._drawPixels.length > 0 ) { - var mode = this._options[ "mode" ], - pixels = this._drawPixels, - coords = this._drawCoords, - label, - labelShape, - labelPixel, - widthOver, - heightOver; - - switch ( mode ) { - case "measureLength": - mode = "drawLineString"; - labelShape = { - type: "LineString", - coordinates: coords - }; - label = $.render[ this._tmplLengthId ]( { length: $.geo.length( labelShape, true ) } ); - labelPixel = $.merge( [], pixels[ pixels.length - 1 ] ); - break; - - case "measureArea": - mode = "drawPolygon"; - - labelShape = { - type: "Polygon", - coordinates: [ $.merge( [ ], coords ) ] - }; - labelShape.coordinates[ 0 ].push( coords[ 0 ] ); - - label = $.render[ this._tmplAreaId ]( { area: $.geo.area( labelShape, true ) } ); - labelPixel = this._toPixel( $.geo.centroid( labelShape ).coordinates ); - pixels = [ pixels ]; - break; - - case "drawPolygon": - pixels = [ pixels ]; - break; - } - - this._$drawContainer.geographics( mode, pixels ); - - if ( label ) { - this._$measureLabel.html( label ); - - widthOver = this._contentBounds.width - ( this._$measureLabel.outerWidth( true ) + labelPixel[ 0 ] ); - heightOver = this._contentBounds.height - ( this._$measureLabel.outerHeight( true ) + labelPixel[ 1 ] ); - - if ( widthOver < 0 ) { - labelPixel[ 0 ] += widthOver; - } - - if ( heightOver < 0 ) { - labelPixel[ 1 ] += heightOver; - } - - this._$measureLabel.css( { - left: Math.max( labelPixel[ 0 ], 0 ), - top: Math.max( labelPixel[ 1 ], 0 ) - } ).show(); - } - } - }, - - _resetDrawing: function () { - this._drawPixels = []; - this._drawCoords = []; - this._$drawContainer.geographics("clear"); - this._$measureLabel.hide(); - }, - - _refreshAllShapes: function ( ) { - this._timeoutRefreshShapes = null; - - var service, - geoService, - i = 0; - - for ( ; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - geoService = service.serviceContainer.data( "geoService" ); - - if ( geoService._createdGraphics ) { - geoService._$shapesContainer.geographics( "clear" ); - if ( geoService._graphicShapes.length > 0 ) { - geoService._refreshShapes( geoService._$shapesContainer, geoService._graphicShapes, geoService._graphicShapes, geoService._graphicShapes ); - } - } - } - - if ( this._createdGraphics ) { - this._$shapesContainer.geographics( "clear" ); - if ( this._graphicShapes.length > 0 ) { - this._refreshShapes( this._$shapesContainer, this._graphicShapes, this._graphicShapes, this._graphicShapes ); - } - } - }, - - - _refreshShapes: function (geographics, shapes, styles, labels, center, pixelSize) { - var i, mgi, - shape, - shapeBbox, - style, - label, - hasLabel, - labelPixel, - bbox = this._map._getBbox(center, pixelSize); - - /* - if ( shapes.length > 0 ) { - console.log( "_refreshShapes " + $.now() ); - } - */ - for (i = 0; i < shapes.length; i++) { - shape = shapes[i].shape || shapes[i]; - shape = shape.geometry || shape; - shapeBbox = $.data(shape, "geoBbox"); - - if ( shapeBbox && $.geo._bboxDisjoint( bbox, shapeBbox ) ) { - continue; - } - - style = $.isArray(styles) ? styles[i].style : styles; - label = $.isArray(labels) ? labels[i].label : labels; - hasLabel = ( label !== undefined ); - labelPixel = undefined; - - switch (shape.type) { - case "Point": - labelPixel = this._map.toPixel( shape.coordinates, center, pixelSize ); - this._$shapesContainer.geographics("drawPoint", labelPixel, style); - break; - case "LineString": - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.pointAlong( shape, 0.5 ).coordinates, center, pixelSize ); - } - break; - case "Polygon": - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates, center, pixelSize), style); - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPoint": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPoint", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiLineString": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawLineString", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - case "MultiPolygon": - for (mgi = 0; mgi < shape.coordinates.length; mgi++) { - this._$shapesContainer.geographics("drawPolygon", this._map.toPixel(shape.coordinates[mgi], center, pixelSize), style); - } - if ( hasLabel ) { - labelPixel = this._map.toPixel( $.geo.centroid( shape ).coordinates, center, pixelSize ); - } - break; - - case "GeometryCollection": - this._refreshShapes(geographics, shape.geometries, style, label, center, pixelSize); - break; - } - - if ( hasLabel && labelPixel ) { - this._$shapesContainer.geographics( "drawLabel", labelPixel, label ); - } - } - }, - - _findMapSize: function () { - // really, really attempt to find a size for this thing - // even if it's hidden (look at parents) - var size = { width: 0, height: 0 }, - sizeContainer = this._$elem; - - while (sizeContainer.size() && !(size["width"] > 0 && size["height"] > 0)) { - size = { width: sizeContainer.width(), height: sizeContainer.height() }; - if (size["width"] <= 0 || size["height"] <= 0) { - size = { width: parseInt(sizeContainer.css("width"), 10), height: parseInt(sizeContainer.css("height"), 10) }; - } - sizeContainer = sizeContainer.parent(); - } - return size; - }, - - _forcePosition: function (elem) { - var cssPosition = elem.css("position"); - if (cssPosition != "relative" && cssPosition != "absolute" && cssPosition != "fixed") { - elem.css("position", "relative"); - } - }, - - _getPixelSize: function ( zoom ) { - var tilingScheme = this._options["tilingScheme"]; - if (tilingScheme !== null) { - if (zoom === 0) { - return tilingScheme.pixelSizes ? tilingScheme.pixelSizes[0] : tilingScheme.basePixelSize; - } - - zoom = Math.round(zoom); - zoom = Math.max(zoom, 0); - var levels = tilingScheme.pixelSizes ? tilingScheme.pixelSizes.length : tilingScheme.levels; - zoom = Math.min(zoom, levels - 1); - - if ( tilingScheme.pixelSizes ) { - return tilingScheme.pixelSizes[zoom]; - } else { - return tilingScheme.basePixelSize / Math.pow(2, zoom); - } - } else { - var bbox = $.geo.scaleBy( this._getBboxMax(), 1 / Math.pow( this._zoomFactor, zoom ), true ); - return Math.max( $.geo.width( bbox, true ) / this._contentBounds.width, $.geo.height( bbox, true ) / this._contentBounds.height ); - } - }, - - _getZoomCenterAndSize: function ( anchor, zoomDelta, full ) { - var zoomFactor = ( full ? this._fullZoomFactor : this._partialZoomFactor ), - scale = Math.pow( zoomFactor, -zoomDelta ), - pixelSize = this._pixelSizeInteractive * scale, - zoom = this._getZoom(this._centerInteractive, pixelSize); - - // clamp to zoom - if ( full && this._options[ "tilingScheme" ] ) { - pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoomDelta < 0 && zoom < this._options[ "zoomMin" ] ) { - pixelSize = this._pixelSizeInteractive; - } else if ( zoomDelta > 0 && zoom > this._options[ "zoomMax" ] ) { - pixelSize = this._pixelSizeInteractive; - } - } - - var ratio = pixelSize / this._pixelSizeInteractive, - anchorMapCoord = this._toMap( anchor, this._centerInteractive, this._pixelSizeInteractive ), - centerDelta = [(this._centerInteractive[0] - anchorMapCoord[0]) * ratio, (this._centerInteractive[1] - anchorMapCoord[1]) * ratio], - scaleCenter = [anchorMapCoord[0] + centerDelta[0], anchorMapCoord[1] + centerDelta[1]]; - - return { pixelSize: pixelSize, center: scaleCenter }; - }, - - _mouseWheelFinish: function ( refresh ) { - this._wheelTimeout = null; - - if (this._wheelLevel !== 0) { - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, this._wheelLevel, this._options[ "tilingScheme" ] !== null ); - - this._wheelLevel = 0; - } else if ( refresh ) { - this._refresh(); - this._refreshAllShapes( ); - } - }, - - _panFinalize: function () { - if (this._panning) { - this._velocity = [0, 0]; - - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - image = this._options[ "axisLayout" ] === "image", - dxMap = -dx * this._pixelSize, - dyMap = ( image ? -1 : 1 ) * dy * this._pixelSize; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._inOp = false; - this._anchor = this._current; - this._mouseDown = this._toolPan = this._panning = false; - } - }, - - _panMove: function () { - if ( ! this._options[ "pannable" ] ) { - return; - } - - var dx = this._current[0] - this._lastDrag[0], - dy = this._current[1] - this._lastDrag[1], - i = 0, - service, - translateObj; - - if (this._toolPan || dx > 3 || dx < -3 || dy > 3 || dy < -3) { - if (!this._toolPan) { - this._toolPan = true; - this._$eventTarget.css("cursor", this._options["cursors"]["pan"]); - } - - if (this._mouseDown) { - this._velocity = [dx, dy]; - } - - if (dx !== 0 || dy !== 0) { - this._panning = true; - this._lastDrag = this._current; - - this._centerInteractive[ 0 ] -= ( dx * this._pixelSizeInteractive ); - this._centerInteractive[ 1 ] += ( ( this._options[ "axisLayout" ] === "image" ? -1 : 1 ) * dy * this._pixelSizeInteractive ); - this._setInteractiveCenterAndSize( this._centerInteractive, this._pixelSizeInteractive ); - this._interactiveTransform( ); - } - } - }, - - _clearInteractiveTimeout: function() { - if ( this._timeoutRefreshShapes ) { - clearTimeout( this._timeoutRefreshShapes ); - this._timeoutRefreshShapes = null; - } - - if ( this._timeoutInteractive ) { - clearTimeout( this._timeoutInteractive ); - this._timeoutInteractive = null; - return true; - } else { - this._centerInteractive[ 0 ] = this._center[ 0 ]; - this._centerInteractive[ 1 ] = this._center[ 1 ]; - this._pixelSizeInteractive = this._pixelSize; - return false; - } - }, - - _interactiveTransform: function( ) { - var mapWidth = this._contentBounds[ "width" ], - mapHeight = this._contentBounds[ "height" ], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - bbox = [ this._centerInteractive[ 0 ] - halfWidth, this._centerInteractive[ 1 ] - halfHeight, this._centerInteractive[ 0 ] + halfWidth, this._centerInteractive[ 1 ] + halfHeight ]; - - var scalePixelSize = this._pixelSize, - scaleRatio = scalePixelSize / this._pixelSizeInteractive; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapOrigin = this._toMap( [ 0, 0 ] ), - newPixelPoint = this._toPixel( oldMapOrigin, this._centerInteractive, this._pixelSizeInteractive ); - - - this._$shapesContainers.geographics("interactiveTransform", newPixelPoint, scaleRatio); - - /* - $scaleContainer.css( { - left: Math.round( newPixelPoint[ 0 ] ), - top: Math.round( newPixelPoint[ 1 ] ), - width: mapWidth * scaleRatio, - height: mapHeight * scaleRatio - } ); - */ - - } - - - - - - - - - - - - - - - - - - - - - for ( var i = 0; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - $.geo[ "_serviceTypes" ][ service.type ].interactiveTransform( this, service, this._centerInteractive, this._pixelSizeInteractive ); - } - - if (this._drawCoords.length > 0) { - this._drawPixels = this._toPixel( this._drawCoords, this._centerInteractive, this._pixelSizeInteractive ); - this._refreshDrawing(); - } - }, - - _interactiveTimeout: function( ) { - if ( this._isMultiTouch ) { - this._timeoutInteractive = setTimeout( $.proxy( interactiveTimeout, this ), 128 ); - } else if ( this._created && this._timeoutInteractive ) { - this._setCenterAndSize( this._centerInteractive, this._pixelSizeInteractive, this._triggerInteractive, true ); - this._timeoutInteractive = null; - this._triggerInteractive = false; - - this._timeoutRefreshShapes = setTimeout( $.proxy( this._refreshAllShapes, this ), 128 ); - } - }, - - _setInteractiveTimeout: function( trigger ) { - this._timeoutInteractive = setTimeout( $.proxy( this._interactiveTimeout, this ), 128 ); - this._triggerInteractive |= trigger; - }, - - _refresh: function ( force, _serviceContainer ) { - var service, - i = 0; - - for ( ; i < this._currentServices.length; i++ ) { - service = this._currentServices[ i ]; - if ( !_serviceContainer || service.serviceContainer[ 0 ] == _serviceContainer[ 0 ] ) { - $.geo[ "_serviceTypes" ][ service.type ].refresh( this, service, force ); - } - } - }, - - _setInteractiveCenterAndSize: function ( center, pixelSize ) { - // set the temporary (interactive) center & size - // also, update the public-facing options - // this does not take zoomMin or zoomMax into account - this._centerInteractive[ 0 ] = center[ 0 ]; - this._centerInteractive[ 1 ] = center[ 1 ]; - this._pixelSizeInteractive = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox( center, pixelSize ) ); - this._options["center"] = $.geo.proj.toGeodetic( center ); - } else { - this._options["bbox"] = this._getBbox( center, pixelSize ); - this._options["center"][ 0 ] = center[ 0 ]; - this._options["center"][ 1 ] = center[ 1 ]; - } - - this._options["pixelSize"] = pixelSize; - this._options["zoom"] = this._getZoom( center, pixelSize ); - }, - - _setCenterAndSize: function (center, pixelSize, trigger, refresh) { - if ( ! $.isArray( center ) || center.length != 2 || typeof center[ 0 ] !== "number" || typeof center[ 1 ] !== "number" ) { - return; - } - - // the final call during any extent change - // only called by timeoutInteractive & resize - // clamp to zoom - var zoom = this._getZoom( center, pixelSize ); - - if ( this._options[ "tilingScheme" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( Math.min( Math.max( zoom, this._options[ "zoomMin" ] ), this._options[ "zoomMax" ] ) ); - } else { - if ( zoom < this._options[ "zoomMin" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( this._options[ "zoomMin" ] ); - } else if ( zoom > this._options[ "zoomMax" ] ) { - this._pixelSizeInteractive = pixelSize = this._getPixelSize( this._options[ "zoomMax" ] ); - } - } - - this._center[ 0 ] = center[ 0 ]; - this._center[ 1 ] = center[ 1 ]; - this._options["pixelSize"] = this._pixelSize = pixelSize; - - if ( this._userGeodetic ) { - this._options["bbox"] = $.geo.proj.toGeodetic( this._getBbox() ); - this._options["center"] = $.geo.proj.toGeodetic( this._center ); - } else { - this._options["bbox"] = this._getBbox(); - this._options["center"] = $.merge( [ ], center ); - } - - this._options["zoom"] = zoom; - - if (trigger) { - this._trigger("bboxchange", window.event, { bbox: $.merge( [ ], this._options["bbox"] ) }); - } - - if (refresh) { - this._refresh(); - this._refreshAllShapes( ); - this._refreshDrawing(); - } - }, - - _requestQueued: function ( ) { - if ( this._loadCount === 0 ) { - this._trigger( "loadstart", window.event ); - } - this._loadCount++; - }, - - _requestComplete: function ( ) { - this._loadCount--; - if ( this._loadCount <= 0 ) { - this._loadCount = 0; - this._trigger( "loadend", window.event ); - } - }, - - _toMap: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - xRatio = $.geo.width(bbox, true) / width, - yRatio = $.geo.height(bbox, true) / height, - yOffset, - image = this._options[ "axisLayout" ] === "image", - result = [], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - yOffset = (p[ i ][ j ][ k ][1] * yRatio); - result[ i ][ j ][ k ] = [ - bbox[ 0 ] + ( p[ i ][ j ][ k ][ 0 ] * xRatio ), - image ? bbox[ 1 ] + yOffset : bbox[ 3 ] - yOffset - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _toPixel: function (p, center, pixelSize) { - // ignores $.geo.proj - - center = center || this._center; - pixelSize = pixelSize || this._pixelSize; - - var isMultiPointOrLineString = $.isArray( p[ 0 ] ), - isMultiLineStringOrPolygon = isMultiPointOrLineString && $.isArray( p[ 0 ][ 0 ] ), - isMultiPolygon = isMultiLineStringOrPolygon && $.isArray( p[ 0 ][ 0 ][ 0 ] ), - width = this._contentBounds["width"], - height = this._contentBounds["height"], - halfWidth = width / 2 * pixelSize, - halfHeight = height / 2 * pixelSize, - bbox = [center[0] - halfWidth, center[1] - halfHeight, center[0] + halfWidth, center[1] + halfHeight], - bboxWidth = $.geo.width(bbox, true), - bboxHeight = $.geo.height(bbox, true), - image = this._options[ "axisLayout" ] === "image", - xRatio = width / bboxWidth, - yRatio = height / bboxHeight, - result = [ ], - i, j, k; - - if ( !isMultiPolygon ) { - if ( !isMultiLineStringOrPolygon ) { - if ( !isMultiPointOrLineString ) { - p = [ p ]; - } - p = [ p ]; - } - p = [ p ]; - } - - for ( i = 0; i < p.length; i++ ) { - result[ i ] = [ ]; - for ( j = 0; j < p[ i ].length; j++ ) { - result[ i ][ j ] = [ ]; - for ( k = 0; k < p[ i ][ j ].length; k++ ) { - result[ i ][ j ][ k ] = [ - Math.round( ( p[ i ][ j ][ k ][ 0 ] - bbox[ 0 ] ) * xRatio ), - Math.round( ( image ? p[ i ][ j ][ k ][ 1 ] - bbox[ 1 ] : bbox[ 3 ] - p[ i ][ j ][ k ][ 1 ] ) * yRatio ) - ]; - } - } - } - - return isMultiPolygon ? result : isMultiLineStringOrPolygon ? result[ 0 ] : isMultiPointOrLineString ? result[ 0 ][ 0 ] : result[ 0 ][ 0 ][ 0 ]; - }, - - _document_keydown: function (e) { - var len = this._drawCoords.length; - if (len > 0 && e.which == 27) { - if (len <= 2) { - this._resetDrawing(); - this._inOp = false; - } else { - this._drawCoords[len - 2] = $.merge( [], this._drawCoords[ len - 1 ] ); - this._drawPixels[len - 2] = $.merge( [], this._drawPixels[ len - 1 ] ); - - this._drawCoords.length--; - this._drawPixels.length--; - - this._refreshDrawing(); - } - } - }, - - _eventTarget_dblclick_zoom: function(e) { - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - this._trigger("dblclick", e, { type: "Point", coordinates: this._toMap(this._current, this._centerInteractive, this._pixelSizeInteractive ) }); - - if (!e.isDefaultPrevented()) { - var centerAndSize = this._getZoomCenterAndSize(this._current, 1, true ); - - this._setInteractiveCenterAndSize( centerAndSize.center, centerAndSize.pixelSize ); - this._interactiveTransform( ); - - doInteractiveTimeout = true; - } - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - }, - - _eventTarget_dblclick: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - var offset = $(e.currentTarget).offset(); - - switch (this._options["mode"]) { - case "drawLineString": - case "measureLength": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - this._drawCoords.length--; - this._trigger( "shape", e, { - type: "LineString", - coordinates: this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords - } ); - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - case "drawPolygon": - case "measureArea": - if ( this._drawCoords.length > 1 && ! ( this._drawCoords[0][0] == this._drawCoords[1][0] && - this._drawCoords[0][1] == this._drawCoords[1][1] ) ) { - var endIndex = this._drawCoords.length - 1; - if (endIndex > 2) { - this._drawCoords[endIndex] = $.merge( [], this._drawCoords[0] ); - this._trigger( "shape", e, { - type: "Polygon", - coordinates: [ this._userGeodetic ? $.geo.proj.toGeodetic(this._drawCoords) : this._drawCoords ] - } ); - } - } else { - this._eventTarget_dblclick_zoom(e); - } - this._resetDrawing(); - break; - - default: - this._eventTarget_dblclick_zoom(e); - break; - } - - this._inOp = false; - }, - - _eventTarget_touchstart: function (e) { - var mode = this._options[ "mode" ], - shift = this._options[ "shift" ], - defaultShift = ( mode === "dragBox" ? "dragBox" : "zoom" ); - - if ( mode === "static" ) { - return; - } - - if ( !this._supportTouch && e.which != 1 ) { - return; - } - - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - var offset = $(e.currentTarget).offset(), - touches = e.originalEvent.changedTouches; - - if ( this._supportTouch ) { - this._multiTouchAnchor = $.merge( [ ], touches ); - - this._isMultiTouch = this._multiTouchAnchor.length > 1; - - if ( this._isMultiTouch ) { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - touches[1].pageX - offset.left, - touches[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - this._multiTouchCurrentBbox = [ - touches[0].pageX - offset.left, - touches[0].pageY - offset.top, - NaN, - NaN - ]; - - this._current = [ touches[0].pageX - offset.left, touches[0].pageY - offset.top ]; - } - } else { - this._current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - var downDate = $.now(); - if (downDate - this._downDate < 750) { - if (this._isTap) { - var dx = this._current[0] - this._anchor[0], - dy = this._current[1] - this._anchor[1], - distance = Math.sqrt((dx * dx) + (dy * dy)); - if (distance > 8) { - this._isTap = false; - } else { - this._current = $.merge( [ ], this._anchor ); - } - } - - if (this._isDbltap) { - this._isDbltap = false; - } else { - this._isDbltap = this._isTap; - } - } else { - this._isDbltap = false; - } - this._isTap = true; - this._downDate = downDate; - } - - this._mouseDown = true; - this._anchor = $.merge( [ ], this._current ); - - if (!this._inOp && e.shiftKey && shift !== "off") { - this._shiftDown = true; - this._$eventTarget.css( "cursor", this._options[ "cursors" ][ shift === "default" ? defaultShift : shift ] ); - } else if ( !this._isMultiTouch && ( this._options[ "pannable" ] || mode === "dragBox" || mode === "dragCircle" ) ) { - this._inOp = true; - - if ( mode !== "zoom" && mode !== "dragBox" && mode !== "dragCircle" ) { - this._lastDrag = this._current; - - if (e.currentTarget.setCapture) { - e.currentTarget.setCapture(); - } - } - } - - e.preventDefault(); - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - return false; - }, - - _dragTarget_touchmove: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - var doInteractiveTimeout = false; - if ( this._mouseDown ) { - doInteractiveTimeout = this._clearInteractiveTimeout( ); - } - - var offset = this._$eventTarget.offset(), - drawCoordsLen = this._drawCoords.length, - touches = e.originalEvent.changedTouches, - current, - service, - i = 0; - - if ( this._supportTouch ) { - if ( !this._isMultiTouch && this._mouseDown && this._multiTouchAnchor.length > 0 && touches[ 0 ].identifier !== this._multiTouchAnchor[ 0 ].identifier ) { - // switch to multitouch - this._mouseDown = false; - this._isMultiTouch = true; - this._wheelLevel = 0; - - this._multiTouchAnchor.push( touches[ 0 ] ); - - - - - this._multiTouchCurrentBbox = [ - this._multiTouchCurrentBbox[ 0 ], - this._multiTouchCurrentBbox[ 1 ], - this._multiTouchAnchor[1].pageX - offset.left, - this._multiTouchAnchor[1].pageY - offset.top - ]; - - this._multiTouchAnchorBbox = $.merge( [ ], this._multiTouchCurrentBbox ); - - this._mouseDown = true; - this._anchor = this._current = $.geo.center( this._multiTouchCurrentBbox, true ); - - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - - if ( this._isMultiTouch ) { - - for ( ; i < touches.length; i++ ) { - if ( touches[ i ].identifier === this._multiTouchAnchor[ 0 ].identifier ) { - this._multiTouchCurrentBbox[ 0 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 1 ] = touches[ i ].pageY - offset.top; - } else if ( touches[ i ].identifier === this._multiTouchAnchor[ 1 ].identifier ) { - this._multiTouchCurrentBbox[ 2 ] = touches[ i ].pageX - offset.left; - this._multiTouchCurrentBbox[ 3 ] = touches[ i ].pageY - offset.top; - } - } - - var anchorDistance = $.geo._distancePointPoint( [ this._multiTouchAnchorBbox[ 0 ], this._multiTouchAnchorBbox[ 1 ] ], [ this._multiTouchAnchorBbox[ 2 ], this._multiTouchAnchorBbox[ 3 ] ] ), - currentDistance = $.geo._distancePointPoint( [ this._multiTouchCurrentBbox[ 0 ], this._multiTouchCurrentBbox[ 1 ] ], [ this._multiTouchCurrentBbox[ 2 ], this._multiTouchCurrentBbox[ 3 ] ] ); - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - - var wheelLevel = ( ( currentDistance - anchorDistance ) / anchorDistance ); - - if ( wheelLevel > 0 ) { - wheelLevel *= 5; - } else { - wheelLevel *= 10; - } - - var delta = wheelLevel - this._wheelLevel; - - this._wheelLevel = wheelLevel; - - var pinchCenterAndSize = this._getZoomCenterAndSize( this._anchor, delta, false ); - - this._setInteractiveCenterAndSize( pinchCenterAndSize.center, pinchCenterAndSize.pixelSize ); - this._interactiveTransform( ); - - doInteractiveTimeout = true; - - current = $.geo.center( this._multiTouchCurrentBbox, true ); - } else { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - } - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (current[0] === this._lastMove[0] && current[1] === this._lastMove[1]) { - if ( this._inOp ) { - e.preventDefault(); - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - } - - if ( _ieVersion == 7 ) { - this._isDbltap = this._isTap = false; - } - - if (this._mouseDown) { - this._current = current; - this._moveDate = $.now(); - } - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isDbltap = this._isTap = false; - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return false; - } - - var mode = this._options["mode"], - shift = this._options[ "shift" ], - defaultShift = ( mode === "dragBox" ? "dragBox" : "zoom" ), - dx, dy, circleSize; - - if ( this._shiftDown ) { - mode = ( shift === "default" ? defaultShift : shift ); - } - - switch (mode) { - case "zoom": - case "dragBox": - if ( this._mouseDown ) { - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawBbox", [ - this._anchor[ 0 ], - this._anchor[ 1 ], - current[ 0 ], - current[ 1 ] - ] ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "dragCircle": - if ( this._mouseDown ) { - dx = current[ 0 ] - this._anchor[ 0 ]; - dy = current[ 1 ] - this._anchor[ 1 ]; - circleSize = Math.sqrt( ( dx * dx) + ( dy * dy ) ) * 2; - //circleSize = Math.max( Math.abs( current[ 0 ] - this._anchor[ 0 ] ), Math.abs( current[ 1 ] - this._anchor[ 1 ] ) ) * 2; - - // not part of _refreshDrawing - this._$drawContainer.geographics( "clear" ); - this._$drawContainer.geographics( "drawArc", this._anchor, 0, 360, { - width: circleSize, - height: circleSize - } ); - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (this._mouseDown || this._toolPan) { - this._panMove(); - doInteractiveTimeout = true; - } else { - if (drawCoordsLen > 0) { - this._drawCoords[drawCoordsLen - 1] = this._toMap( current, this._centerInteractive, this._pixelSizeInteractive ); - this._drawPixels[drawCoordsLen - 1] = current; - - this._refreshDrawing(); - } - - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - - default: - if (this._mouseDown || this._toolPan) { - this._panMove(); - doInteractiveTimeout = true; - } else { - this._trigger("move", e, { type: "Point", coordinates: this.toMap(current) }); - } - break; - } - - this._lastMove = current; - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _dragTarget_touchstop: function (e) { - if ( this._options[ "mode" ] === "static" ) { - return; - } - - if ( !this._mouseDown ) { - if ( _ieVersion == 7 ) { - // ie7 doesn't appear to trigger dblclick on this._$eventTarget, - // we fake regular click here to cause soft dblclick - this._eventTarget_touchstart(e); - } else { - // Chrome & Firefox trigger a rogue mouseup event when doing a dblclick maximize in Windows(/Linux?) - // ignore it - return; - } - } - - var doInteractiveTimeout = this._clearInteractiveTimeout( ); - - var mouseWasDown = this._mouseDown, - wasToolPan = this._toolPan, - offset = this._$eventTarget.offset(), - mode = this._options[ "mode" ], - shift = this._options[ "shift" ], - defaultShift = ( mode === "dragBox" ? "dragBox" : "zoom" ), - current, i, clickDate, - dx, dy, - coordBuffer, - triggerShape; - - if ( this._shiftDown ) { - mode = ( shift === "default" ? defaultShift : shift ); - } - - if (this._supportTouch) { - current = [e.originalEvent.changedTouches[0].pageX - offset.left, e.originalEvent.changedTouches[0].pageY - offset.top]; - this._multiTouchAnchor = []; - this._inOp = false; - } else { - current = [e.pageX - offset.left, e.pageY - offset.top]; - } - - if (this._softDblClick) { - if (this._isTap) { - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - if (Math.sqrt((dx * dx) + (dy * dy)) <= 8) { - current = $.merge( [ ], this._anchor ); - } - } - } - - dx = current[0] - this._anchor[0]; - dy = current[1] - this._anchor[1]; - - this._$eventTarget.css("cursor", this._options["cursors"][this._options["mode"]]); - - this._shiftDown = this._mouseDown = this._toolPan = false; - - if ( this._isMultiTouch ) { - e.preventDefault( ); - this._isMultiTouch = false; - - this._wheelLevel = 0; - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - return; - } - - if (document.releaseCapture) { - document.releaseCapture(); - } - - if (mouseWasDown) { - clickDate = $.now(); - this._current = current; - - switch ( mode ) { - case "zoom": - case "dragBox": - if ( dx !== 0 || dy !== 0 ) { - var minSize = this._pixelSize * 6, - bboxCoords = this._toMap( [ [ - Math.min( this._anchor[ 0 ], current[ 0 ] ), - Math.max( this._anchor[ 1 ], current[ 1 ] ) - ], [ - Math.max( this._anchor[ 0 ], current[ 0 ] ), - Math.min( this._anchor[ 1 ], current[ 1 ] ) - ] - ] ), - bbox = [ - bboxCoords[0][0], - bboxCoords[0][1], - bboxCoords[1][0], - bboxCoords[1][1] - ]; - - if ( mode === "zoom" ) { - if ( ( bbox[2] - bbox[0] ) < minSize && ( bbox[3] - bbox[1] ) < minSize ) { - bbox = $.geo.scaleBy( this._getBbox( $.geo.center( bbox, true ) ), 0.5, true ); - } - - this._setBbox(bbox, true, true); - doInteractiveTimeout = true; - } else { - triggerShape = $.geo.polygonize( bbox, true ); - triggerShape.bbox = bbox; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - this._trigger( "shape", e, triggerShape ); - } - } else { - if ( mode === "dragBox" ) { - coordBuffer = this._toMap( current ); - - triggerShape = { - type: "Point", - coordinates: [ coordBuffer[ 0 ], coordBuffer[ 1 ] ], - bbox: [ coordBuffer[ 0 ], coordBuffer[ 1 ], coordBuffer[ 0 ], coordBuffer[ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - } - } - - this._resetDrawing(); - break; - - case "dragCircle": - if ( dx !== 0 || dy !== 0 ) { - var image = this._options[ "axisLayout" ] === "image", - d = Math.sqrt( ( dx * dx) + ( dy * dy ) ), - n = 180, - a; - - this._drawPixels.length = n + 1; - - for ( i = 0; i < n; i++ ) { - a = ( i * 360 / n ) * ( Math.PI / 180 ); - this._drawPixels[ i ] = [ - this._anchor[ 0 ] + Math.cos( a ) * d, - this._anchor[ 1 ] + Math.sin( a ) * d - ]; - } - - this._drawPixels[ n ] = [ - this._drawPixels[ 0 ][ 0 ], - this._drawPixels[ 0 ][ 1 ] - ]; - - // using coordBuffer for bbox coords - coordBuffer = this._toMap( [ - [ this._anchor[ 0 ] - d, this._anchor[ 1 ] + ( image ? -d : d ) ], - [ this._anchor[ 0 ] + d, this._anchor[ 1 ] + ( image ? d : -d ) ] - ] ); - - triggerShape = { - type: "Polygon", - coordinates: [ this._toMap( this._drawPixels ) ], - bbox: [ coordBuffer[ 0 ][ 0 ], coordBuffer[ 0 ][ 1 ], coordBuffer[ 1 ][ 0 ], coordBuffer[ 1 ][ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - - this._resetDrawing(); - } else { - coordBuffer = this._toMap( current ); - - triggerShape = { - type: "Point", - coordinates: [ coordBuffer[ 0 ], coordBuffer[ 1 ] ], - bbox: [ coordBuffer[ 0 ], coordBuffer[ 1 ], coordBuffer[ 0 ], coordBuffer[ 1 ] ] - }; - - if ( this._userGeodetic ) { - triggerShape.coordinates = $.geo.proj.toGeodetic( triggerShape.coordinates ); - triggerShape.bbox = $.geo.proj.toGeodetic( triggerShape.bbox ); - } - - this._trigger( "shape", e, triggerShape ); - } - break; - - case "drawPoint": - if (this._drawTimeout) { - window.clearTimeout(this._drawTimeout); - this._drawTimeout = null; - } - - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - var geomap = this; - this._drawTimeout = setTimeout(function () { - if (geomap._drawTimeout) { - geomap._trigger("shape", e, { type: "Point", coordinates: geomap.toMap(current) }); - geomap._inOp = false; - geomap._drawTimeout = null; - } - }, 250); - } - } - break; - - case "drawLineString": - case "drawPolygon": - case "measureLength": - case "measureArea": - if (wasToolPan) { - this._panFinalize(); - } else { - i = (this._drawCoords.length === 0 ? 0 : this._drawCoords.length - 1); - - this._drawCoords[i] = this._toMap(current); - this._drawPixels[i] = current; - - if (i < 2 || !(this._drawCoords[i][0] == this._drawCoords[i-1][0] && - this._drawCoords[i][1] == this._drawCoords[i-1][1])) { - this._drawCoords[i + 1] = this._toMap( current, this._centerInteractive, this._pixelSizeInteractive ); - this._drawPixels[i + 1] = current; - } - - this._refreshDrawing(); - } - break; - - default: - if (wasToolPan) { - this._panFinalize(); - } else { - if (clickDate - this._clickDate > 100) { - this._trigger("click", e, { type: "Point", coordinates: this.toMap(current) }); - this._inOp = false; - } - } - break; - } - - this._clickDate = clickDate; - - if (this._softDblClick && this._isDbltap) { - this._isDbltap = this._isTap = false; - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - this._$eventTarget.trigger("dblclick", e); - return false; - } - } - - if ( doInteractiveTimeout ) { - this._setInteractiveTimeout( true ); - } - - if ( this._inOp ) { - e.preventDefault(); - return false; - } - }, - - _eventTarget_mousewheel: function (e, delta) { - if ( this._options[ "mode" ] === "static" || this._options[ "scroll" ] === "off" ) { - return; - } - - e.preventDefault(); - - if ( this._mouseDown ) { - return false; - } - - if (delta !== 0) { - this._clearInteractiveTimeout( ); - - if ( delta > 0 ) { - delta = Math.ceil( delta ); - } else { - delta = Math.floor( delta ); - } - - var offset = $(e.currentTarget).offset(); - this._anchor = [e.pageX - offset.left, e.pageY - offset.top]; - - var wheelCenterAndSize = this._getZoomCenterAndSize( this._anchor, delta, this._options[ "tilingScheme" ] !== null ), - service, - i = 0; - - this._setInteractiveCenterAndSize( wheelCenterAndSize.center, wheelCenterAndSize.pixelSize ); - this._interactiveTransform( ); - - this._setInteractiveTimeout( true ); - } - - return false; - } - } - ); -}(jQuery)); - - -(function ($, undefined) { - $.geo._serviceTypes.tiled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0, - reloadTiles: false - }; - - var scHtml = '
                    '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children( ":last" ); - - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactiveTransform: function ( map, service, center, pixelSize ) { - //console.log( "tiled.interactiveTransform( " + center.join( ", " ) + ", " + pixelSize + ")" ); - var serviceState = $.data( service, "geoServiceState" ), - tilingScheme = map.options[ "tilingScheme" ]; - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.data("pixelSize"), - scaleRatio = scalePixelSize / pixelSize; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapCoord = $scaleContainer.data("scaleOrigin"), - newPixelPoint = map._toPixel(oldMapCoord, center, pixelSize); - - $scaleContainer.css( { - left: Math.round(newPixelPoint[0]) + "px", - top: Math.round(newPixelPoint[1]) + "px", - width: tilingScheme.tileWidth * scaleRatio, - height: tilingScheme.tileHeight * scaleRatio - } ); - - /* - if ( $("body")[0].filters !== undefined ) { - $scaleContainer.children().each( function ( i ) { - $( this ).css( "filter", "progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11=" + scaleRatio + ",M22=" + scaleRatio + ",sizingmethod='auto expand')" ); - } ); - } - */ - } - }); - } - }, - - refresh: function (map, service, force) { - //console.log( "tiled.refresh( " + map._center.join( ", " ) + ", " + map._pixelSize + ")" ); - var serviceState = $.data( service, "geoServiceState" ); - - this._cancelUnloaded(map, service); - - if ( serviceState && force ) { - // if hidden atm, we want to make sure we reload this service after it becomes visible - serviceState.reloadTiles = true; - } - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - $serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - image = map.options[ "axisLayout" ] === "image", - ySign = image ? +1 : -1, - - tilingScheme = map.options["tilingScheme"], - tileWidth = tilingScheme.tileWidth, - tileHeight = tilingScheme.tileHeight, - - tileX = Math.floor((bbox[0] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY = Math.max( Math.floor( ( image ? bbox[1] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 3 ] ) / (pixelSize * tileHeight) ), 0 ), - tileX2 = Math.ceil((bbox[2] - tilingScheme.origin[0]) / (pixelSize * tileWidth)), - tileY2 = Math.ceil( ( image ? bbox[3] - tilingScheme.origin[1] : tilingScheme.origin[1] - bbox[ 1 ] ) / (pixelSize * tileHeight) ), - - bboxMax = map._getBboxMax(), - pixelSizeAtZero = map._getPixelSize(0), - ratio = pixelSizeAtZero / pixelSize, - fullXAtScale = Math.floor((bboxMax[0] - tilingScheme.origin[0]) / (pixelSizeAtZero * tileWidth)) * ratio, - fullYAtScale = Math.floor((tilingScheme.origin[1] + ySign * bboxMax[3]) / (pixelSizeAtZero * tileHeight)) * ratio, - - fullXMinX = tilingScheme.origin[0] + (fullXAtScale * tileWidth) * pixelSize, - fullYMinOrMaxY = tilingScheme.origin[1] + ySign * (fullYAtScale * tileHeight) * pixelSize, - - serviceLeft = Math.round((fullXMinX - bbox[0]) / pixelSize), - serviceTop = Math.round( ( image ? fullYMinOrMaxY - bbox[1] : bbox[3] - fullYMinOrMaxY ) / pixelSize), - - scaleContainers = $serviceContainer.children().show(), - scaleContainer = scaleContainers.filter("[data-pixel-size='" + pixelSize + "']").appendTo($serviceContainer), - - opacity = service.style.opacity, - - x, y, - - loadImageDeferredDone = function( url ) { - // when a Deferred call is done, add the image to the map - // a reference to the correct img element is on the Deferred object itself - serviceObj._loadImage( $.data( this, "img" ), url, pixelSize, map, serviceState, opacity ); - }, - - loadImageDeferredFail = function( ) { - $.data( this, "img" ).remove( ); - serviceState.loadCount--; - map._requestComplete(); - }; - - if (serviceState.reloadTiles) { - scaleContainers.find("img").attr("data-dirty", "true"); - } - - if (!scaleContainer.size()) { - $serviceContainer.append("
                    "); - scaleContainer = $serviceContainer.children(":last").data("scaleOrigin", map._toMap( [ (serviceLeft % tileWidth), (serviceTop % tileHeight) ] ) ); - } else { - scaleContainer.css({ - left: (serviceLeft % tileWidth) + "px", - top: (serviceTop % tileHeight) + "px" - }).data("scaleOrigin", map._toMap( [ (serviceLeft % tileWidth), (serviceTop % tileHeight) ] ) ); - - scaleContainer.children().each(function (i) { - var - $img = $(this), - tile = $img.attr("data-tile").split(","); - - $img.css({ - left: Math.round(((parseInt(tile[0], 10) - fullXAtScale) * 100) + (serviceLeft - (serviceLeft % tileWidth)) / tileWidth * 100) + "%", - top: Math.round(((parseInt(tile[1], 10) - fullYAtScale) * 100) + (serviceTop - (serviceTop % tileHeight)) / tileHeight * 100) + "%" - }); - - if (opacity < 1) { - $img.fadeTo(0, opacity); - } - }); - } - - for (x = tileX; x < tileX2; x++) { - for (y = tileY; y < tileY2; y++) { - var tileStr = "" + x + "," + y, - $img = scaleContainer.children("[data-tile='" + tileStr + "']").removeAttr("data-dirty"); - - if ($img.size() === 0 || serviceState.reloadTiles) { - var bottomLeft = [ - tilingScheme.origin[0] + (x * tileWidth) * pixelSize, - tilingScheme.origin[1] + ySign * (y * tileHeight) * pixelSize - ], - - topRight = [ - tilingScheme.origin[0] + ((x + 1) * tileWidth - 1) * pixelSize, - tilingScheme.origin[1] + ySign * ((y + 1) * tileHeight - 1) * pixelSize - ], - - tileBbox = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]], - - urlProp = ( service.hasOwnProperty( "src" ) ? "src" : "getUrl" ), - urlArgs = { - bbox: tileBbox, - width: tileWidth, - height: tileHeight, - zoom: map._getZoom(), - tile: { - row: y, - column: x - }, - index: Math.abs(y + x) - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl; - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.templates( "geoSrc", service[ urlProp ] ); - imageUrl = $.render[ "geoSrc" ]( urlArgs ); - } - - serviceState.loadCount++; - map._requestQueued(); - - if (serviceState.reloadTiles && $img.size() > 0) { - $img.attr("src", imageUrl); - } else { - var imgMarkup = ""; - - scaleContainer.append(imgMarkup); - $img = scaleContainer.children(":last"); - } - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, map, serviceState, opacity ); - } else if ( imageUrl ) { - // assume Deferred - $.data( imageUrl, "img", $img ); - imageUrl.done( loadImageDeferredDone ).fail( loadImageDeferredFail ); - } else { - $img.remove( ); - } - } - } - } - - scaleContainers.find("[data-dirty]").remove(); - serviceState.reloadTiles = false; - } - }, - - resize: function (map, service) { - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.css( "display", service.style.visibility === "visible" ? "block" : "none" ); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data( service, "geoServiceState" ); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - map._requestComplete(); - } - } - }, - - _loadImage: function ( $img, url, pixelSize, map, serviceState, opacity ) { - var serviceContainer = serviceState.serviceContainer; - - $img.load(function (e) { - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).error(function (e) { - $(e.target).remove(); - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - }()); -}(jQuery)); - -(function ($, undefined) { - $.geo._serviceTypes.shingled = (function () { - return { - create: function (map, serviceContainer, service, index) { - var serviceState = $.data(service, "geoServiceState"); - - if ( !serviceState ) { - serviceState = { - loadCount: 0 - }; - - var scHtml = '
                    '; - - serviceContainer.append(scHtml); - - serviceState.serviceContainer = serviceContainer.children(":last"); - $.data(service, "geoServiceState", serviceState); - } - - return serviceState.serviceContainer; - }, - - destroy: function (map, serviceContainer, service) { - var serviceState = $.data(service, "geoServiceState"); - - serviceState.serviceContainer.remove(); - - $.removeData(service, "geoServiceState"); - }, - - interactiveTransform: function ( map, service, center, pixelSize ) { - var serviceState = $.data( service, "geoServiceState" ), - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds[ "width" ], - mapHeight = contentBounds[ "height" ], - - halfWidth = mapWidth / 2, - halfHeight = mapHeight / 2, - - bbox = [ center[ 0 ] - halfWidth, center[ 1 ] - halfHeight, center[ 0 ] + halfWidth, center[ 1 ] + halfHeight ]; - - if ( serviceState ) { - this._cancelUnloaded( map, service ); - - serviceState.serviceContainer.children( ).each( function ( i ) { - var $scaleContainer = $(this), - scalePixelSize = $scaleContainer.data( "pixelSize" ), - scaleRatio = scalePixelSize / pixelSize; - - if ( scalePixelSize > 0 ) { - scaleRatio = Math.round(scaleRatio * 1000) / 1000; - - var oldMapOrigin = $scaleContainer.data( "origin" ), - newPixelPoint = map._toPixel( oldMapOrigin, center, pixelSize ); - - $scaleContainer.css( { - left: Math.round( newPixelPoint[ 0 ] ), - top: Math.round( newPixelPoint[ 1 ] ), - width: mapWidth * scaleRatio, - height: mapHeight * scaleRatio - } ); - } - }); - } - }, - - refresh: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - this._cancelUnloaded(map, service); - - if ( serviceState && service && service.style.visibility === "visible" && !( serviceState.serviceContainer.is( ":hidden" ) ) ) { - - var bbox = map._getBbox(), - pixelSize = map._pixelSize, - - serviceObj = this, - serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - scaleContainer = serviceContainer.children('[data-pixel-size="' + pixelSize + '"]'), - - opacity = service.style.opacity, - - $img; - - if (opacity < 1) { - serviceContainer.find("img").attr("data-keep-alive", "0"); - } - - if ( !scaleContainer.size() ) { - serviceContainer.append('
                    '); - scaleContainer = serviceContainer.children(":last"); - } - - var urlProp = ( service.hasOwnProperty("src") ? "src" : "getUrl" ), - urlArgs = { - bbox: bbox, - width: mapWidth, - height: mapHeight, - zoom: map._getZoom(), - tile: null, - index: 0 - }, - isFunc = $.isFunction( service[ urlProp ] ), - imageUrl, - imagePos = scaleContainer.position( ); - - imagePos.left = - ( imagePos.left ); - imagePos.top = - ( imagePos.top ); - - if ( isFunc ) { - imageUrl = service[ urlProp ]( urlArgs ); - } else { - $.templates( "geoSrc", service[ urlProp ] ); - imageUrl = $.render[ "geoSrc" ]( urlArgs ); - } - - serviceState.loadCount++; - map._requestQueued(); - - scaleContainer.append(''); - $img = scaleContainer.children(":last").data("center", map._center); - - if ( typeof imageUrl === "string" ) { - serviceObj._loadImage( $img, imageUrl, pixelSize, map, serviceState, opacity ); - } else { - // assume Deferred - imageUrl.done( function( url ) { - serviceObj._loadImage( $img, url, pixelSize, map, serviceState, opacity ); - } ).fail( function( ) { - $img.remove( ); - serviceState.loadCount--; - map._requestComplete(); - } ); - } - - } - }, - - resize: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if ( serviceState && service && service.style.visibility === "visible" ) { - this._cancelUnloaded(map, service); - - var serviceContainer = serviceState.serviceContainer, - - contentBounds = map._getContentBounds(), - mapWidth = contentBounds["width"], - mapHeight = contentBounds["height"], - - scaleContainers = serviceContainer.children(); - - scaleContainers.attr("data-pixel-size", "0"); - - scaleContainers.each( function ( i ) { - var $scaleContainer = $(this), - position = $scaleContainer.position( ); - - var oldMapOrigin = $scaleContainer.data( "origin" ), - newPixelPoint = map._toPixel( oldMapOrigin ); - - $scaleContainer.css( { - left: position.left + ( mapWidth - $scaleContainer.width( ) ) / 2, - top: position.top + ( mapHeight - $scaleContainer.height( ) ) / 2 - } ); - - } ); - - - /* - scaleContainer.css({ - left: halfWidth + 'px', - top: halfHeight + 'px' - }); - */ - } - }, - - opacity: function ( map, service ) { - var serviceState = $.data( service, "geoServiceState" ); - serviceState.serviceContainer.find( "img" ).stop( true ).fadeTo( "fast", service.style.opacity ); - }, - - toggle: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - serviceState.serviceContainer.css("display", service.style.visibility === "visible" ? "block" : "none"); - }, - - _cancelUnloaded: function (map, service) { - var serviceState = $.data(service, "geoServiceState"); - - if (serviceState && serviceState.loadCount > 0) { - serviceState.serviceContainer.find("img:hidden").remove(); - while (serviceState.loadCount > 0) { - serviceState.loadCount--; - map._requestComplete(); - } - } - }, - - _loadImage: function ( $img, url, pixelSize, map, serviceState, opacity ) { - var serviceContainer = serviceState.serviceContainer; - - $img.load(function (e) { - if ( !$.contains(document.body, e.target.jquery ? e.target[0] : e.target) ) { - // this image has been canceled and removed from the DOM - return; - } - - if (opacity < 1) { - $(e.target).fadeTo(0, opacity); - } else { - $(e.target).show(); - } - - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - // #newpanzoom - serviceContainer.children(':not([data-pixel-size="' + pixelSize + '"])').remove(); - - serviceContainer.find( "img[data-keep-alive]" ).remove( ); - - serviceState.loadCount = 0; - } - }).error(function (e) { - if ( !$.contains(document.body, e.target.jquery ? e.target[0] : e.target) ) { - // this image has been canceled and removed from the DOM - return; - } - - $(e.target).remove(); - serviceState.loadCount--; - map._requestComplete(); - - if (serviceState.loadCount <= 0) { - serviceContainer.children(":not([data-pixel-size='" + pixelSize + "'])").remove(); - serviceState.loadCount = 0; - } - }).attr("src", url); - } - }; - }()); -}(jQuery)); diff --git a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.min.js b/libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.min.js deleted file mode 100755 index 66925f3..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/jquery.geo-test.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery Geo - vtest - 2012-11-02 - * http://jquerygeo.com - * Copyright (c) 2012 Ryan Westphal/Applied Geographics, Inc.; Licensed MIT, GPL */ -document.createElement("canvas").getContext||function(){function f(){return this.context_||(this.context_=new P(this))}function c(e,t,n){var r=l.call(arguments,2);return function(){return e.apply(t,r.concat(l.call(arguments)))}}function h(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function p(e,t,n){e.namespaces[t]||e.namespaces.add(t,n,"#default#VML")}function d(e){p(e,"g_vml_","urn:schemas-microsoft-com:vml"),p(e,"g_o_","urn:schemas-microsoft-com:office:office");if(!e.styleSheets.ex_canvas_){var t=e.createStyleSheet();t.owningElement.id="ex_canvas_",t.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function m(e){var t=e.srcElement;switch(e.propertyName){case"width":t.getContext().clearRect(),t.style.width=t.attributes.width.nodeValue+"px",t.firstChild.style.width=t.clientWidth+"px";break;case"height":t.getContext().clearRect(),t.style.height=t.attributes.height.nodeValue+"px",t.firstChild.style.height=t.clientHeight+"px"}}function g(e){var t=e.srcElement;t.firstChild&&(t.firstChild.style.width=t.clientWidth+"px",t.firstChild.style.height=t.clientHeight+"px")}function E(){return[[1,0,0],[0,1,0],[0,0,1]]}function S(e,t){var n=E();for(var r=0;r<3;r++)for(var i=0;i<3;i++){var s=0;for(var o=0;o<3;o++)s+=e[r][o]*t[o][i];n[r][i]=s}return n}function x(e,t){t.fillStyle=e.fillStyle,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.strokeStyle=e.strokeStyle,t.globalAlpha=e.globalAlpha,t.font=e.font,t.textAlign=e.textAlign,t.textBaseline=e.textBaseline,t.arcScaleX_=e.arcScaleX_,t.arcScaleY_=e.arcScaleY_,t.lineScale_=e.lineScale_}function T(e){var t=e.indexOf("(",3),n=e.indexOf(")",t+1),r=e.substring(t+1,n).split(",");if(r.length!=4||e.charAt(3)!="a")r[3]=1;return r}function N(e){return parseFloat(e)/100}function C(e,t,n){return Math.min(n,Math.max(t,e))}function k(e){var t,n,r,i,s,o;i=parseFloat(e[0])/360%360,i<0&&i++,s=C(N(e[1]),0,1),o=C(N(e[2]),0,1);if(s==0)t=n=r=o;else{var u=o<.5?o*(1+s):o+s-o*s,a=2*o-u;t=L(a,u,i+1/3),n=L(a,u,i),r=L(a,u,i-1/3)}return"#"+y[Math.floor(t*255)]+y[Math.floor(n*255)]+y[Math.floor(r*255)]}function L(e,t,n){return n<0&&n++,n>1&&n--,6*n<1?e+(t-e)*6*n:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function O(e){if(e in A)return A[e];var t,n=1;e=String(e);if(e.charAt(0)=="#")t=e;else if(/^rgb/.test(e)){var r=T(e),t="#",i;for(var s=0;s<3;s++)r[s].indexOf("%")!=-1?i=Math.floor(N(r[s])*255):i=+r[s],t+=y[C(i,0,255)];n=+r[3]}else if(/^hsl/.test(e)){var r=T(e);t=k(r),n=r[3]}else t=e;return A[e]={color:t,alpha:n}}function D(e){return _[e]||"square"}function P(e){this.m_=E(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle="#000",this.fillStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=o*1,this.globalAlpha=1,this.canvas=e;var t="width:"+e.clientWidth+"px;height:"+e.clientHeight+"px;overflow:hidden;position:absolute",n=e.ownerDocument.createElement("div");n.style.cssText=t,e.appendChild(n);var r=n.cloneNode(!1);r.style.backgroundColor="red",r.style.filter="alpha(opacity=0)",e.appendChild(r),this.element_=n,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1}function B(e,t,n,r){e.currentPath_.push({type:"bezierCurveTo",cp1x:t.x,cp1y:t.y,cp2x:n.x,cp2y:n.y,x:r.x,y:r.y}),e.currentX_=r.x,e.currentY_=r.y}function j(e,t){var n=O(e.strokeStyle),r=n.color,i=n.alpha*e.globalAlpha,s=e.lineScale_*e.lineWidth;s<1&&(i*=s),t.push("')}function F(e,t,n,r){var i=e.fillStyle,s=e.arcScaleX_,o=e.arcScaleY_,u=r.x-n.x,a=r.y-n.y,f=O(e.fillStyle),l=f.color,c=f.alpha*e.globalAlpha;t.push('')}function I(e,t,n){var r=e.m_;return{x:o*(t*r[0][0]+n*r[1][0]+r[2][0])-u,y:o*(t*r[0][1]+n*r[1][1]+r[2][1])-u}}function q(e){return isFinite(e[0][0])&&isFinite(e[0][1])&&isFinite(e[1][0])&&isFinite(e[1][1])&&isFinite(e[2][0])&&isFinite(e[2][1])}function R(e,t,n){if(!q(t))return;e.m_=t;if(n){var r=t[0][0]*t[1][1]-t[0][1]*t[1][0];e.lineScale_=s(i(r))}}function U(e){throw new z(e)}function z(e){this.code=this[e],this.message=e+": DOM Exception "+this.code}var e=Math,t=e.round,n=e.sin,r=e.cos,i=e.abs,s=e.sqrt,o=10,u=o/2,a=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],l=Array.prototype.slice;d(document);var v={init:function(e){var t=e||document;t.createElement("canvas"),t.attachEvent("onreadystatechange",c(this.init_,this,t))},init_:function(e){var t=e.getElementsByTagName("canvas");for(var n=0;nf.x)f.x=c.x;if(a.y==null||c.yf.y)f.y=c.y}}n.push(' ">'),e?F(this,n,a,f):j(this,n),n.push(""),this.element_.insertAdjacentHTML("beforeEnd",n.join(""))},H.fill=function(){this.stroke(!0)},H.closePath=function(){this.currentPath_.push({type:"close"})},H.save=function(){var e={};x(this,e),this.aStack_.push(e),this.mStack_.push(this.m_),this.m_=S(E(),this.m_)},H.restore=function(){this.aStack_.length&&(x(this.aStack_.pop(),this),this.m_=this.mStack_.pop())},H.translate=function(e,t){var n=[[1,0,0],[0,1,0],[e,t,1]];R(this,S(n,this.m_),!1)},H.scale=function(e,t){this.arcScaleX_*=e,this.arcScaleY_*=t;var n=[[e,0,0],[0,t,0],[0,0,1]];R(this,S(n,this.m_),!0)};var W=z.prototype=new Error;W.INDEX_SIZE_ERR=1,W.DOMSTRING_SIZE_ERR=2,W.HIERARCHY_REQUEST_ERR=3,W.WRONG_DOCUMENT_ERR=4,W.INVALID_CHARACTER_ERR=5,W.NO_DATA_ALLOWED_ERR=6,W.NO_MODIFICATION_ALLOWED_ERR=7,W.NOT_FOUND_ERR=8,W.NOT_SUPPORTED_ERR=9,W.INUSE_ATTRIBUTE_ERR=10,W.INVALID_STATE_ERR=11,W.SYNTAX_ERR=12,W.INVALID_MODIFICATION_ERR=13,W.NAMESPACE_ERR=14,W.INVALID_ACCESS_ERR=15,W.VALIDATION_ERR=16,W.TYPE_MISMATCH_ERR=17,G_vmlCanvasManager=v,CanvasRenderingContext2D=P,DOMException=z}(),this.jsviews||this.jQuery&&jQuery.views||function(e,t){function C(e,t){var n="\\"+e.charAt(0),r="\\"+e.charAt(1),o="\\"+t.charAt(0),u="\\"+t.charAt(1);return N.rTag=i=r+"(?:(?:(\\w+(?=[\\/\\s"+o+"]))|(?:(\\w+)?(:)|(>)|(\\*)))"+"\\s*((?:[^"+o+"]|"+o+"(?!"+u+"))*?)"+"(\\/)?|(?:\\/(\\w+)))"+o,i=new RegExp(n+i+u,"g"),s=new RegExp("<.*>|"+e+".*"+t),this}function k(e){var n=this,r=n.tmpl.helpers||{};return e=(n.ctx[e]!==t?n.ctx:r[e]!==t?r:P[e]!==t?P:{})[e],typeof e!="function"?e:function(){return e.apply(n,arguments)}}function L(e,t,n){var r=t.tmpl.converters;return e=r&&r[e]||H[e],e?e.call(t,n):n}function A(e,n,r,i,s){s.props=s.props||{};var u,a=s.props.tmpl,l=n.tmpl.tags,c=n.tmpl.templates,h=arguments,p=l&&l[e]||D[e];return p?(i=i&&n.tmpl.tmpls[i-1],a=a||i||t,s.tmpl=""+a===a?c&&c[a]||_[a]||_(a):a,s.isTag=f,s.converter=r,s.view=n,s.renderContent=B,n.ctx&&o(s.ctx,n.ctx),u=p.apply(s,h.length>5?x.call(h,5):[]),u||(u==t?"":u.toString())):""}function O(e,n,i,s,o,u){var a=i.views,f={tmpl:o,path:n,parent:i,data:s,ctx:e,views:r.isArray(s)?[]:{},hlp:k};return r.isArray(a)?a.splice(f.index=u!==t?u:a.length,0,f):a[f.index="_"+g++]=f,f}function M(e,n,r,i,s){var o,a;if(r&&typeof r=="object"&&!r.nodeType){for(o in r)n(o,r[o]);return e}if(!r||i===t)s&&(i=s(t,i||r));else if(""+r===r)if(i===null)delete n[r];else if(i=s?s(r,i):i)n[r]=i;return(a=u.onStoreItem)&&a(n,r,i,s),i}function _(e,t){return M(this,_,e,t,q)}function D(e,t){return M(this,D,e,t)}function P(e,t){return M(this,P,e,t)}function H(e,t){return M(this,H,e,t)}function B(e,n,i,s,l){var c,h,p,d,v,m,g,y,b,w,E={},S=l===f,x=this,T="";x.isTag?(b=x.tmpl,n=n||x.ctx,i=i||x.view,s=s||x.path,l=l||x.index,E=x.props):b=x.jquery&&x[0]||x,i=i||N.topView,y=i.ctx,w=b.layout,e===i&&(e=i.data,w=f),n=n&&n===y?y:y?(y=o({},y),n)?o(y,n):y:n||{},E.link===a&&(n.link=a),b.fn||(b=_[b]||_(b)),v=n.link&&u.onRenderItem,m=n.link&&u.onRenderItems;if(b){if(r.isArray(e)&&!w){d=S?i:l!==t&&i||O(n,s,i,e,b,l);for(c=0,h=e.length;c-1,a+=(b===":"?w==="html"?(c=f,"e("+S):w?(g=f,'c("'+w+'",view,'+S):(h=f,"((v="+S+')!=u?v:""'):(l=f,'t("'+b+'",view,"'+(w||"")+'",'+(M?k.length:'""')+","+x+(S?",":"")+S))+")+");return a=new Function("data, view, j, b, u",E+(h?"v,":"")+(l?"t=j.tag,":"")+(g?"c=j.convert,":"")+(c?"e=j.converters.html,":"")+"ret; try{\n\n"+(C.debug?"debugger;":"")+(N?"ret=":"return ")+a.slice(0,-1)+";\n\n"+(N?"return ret;":"")+"}catch(e){return j.err(e);}"),t&&(t.fn=a,t.useVw=g||y||l),a}function I(e,t){function u(e,u,l,h,p,d,v,m,g,y,b,w,E,S,x,T){function N(e,n,r,i,s,o,u){if(n){var a=(r?'view.hlp("'+r+'")':i?"view":"data")+(u?(s?"."+s:r?"":i?"":"."+n)+(o||""):(u=r?"":i?s||"":n,""));return t&&g!=="("&&(a="b("+a+',"'+u+'")'),a+(u?"."+u:"")}return e}p=p||"",l=l||u||b,h=h||m,g=g||x||"",p=p||"";if(!d)return o?(o=!w,o?e:'"'):s?(s=!E,s?e:'"'):(l?(i++,l):"")+(T?i?"":n?(n=a,"\b"):",":v?(i&&j(),n=f,"\b"+h+":"):h?h.replace(c,N)+(g?(r[++i]=f,g):p):p?e:S?(r[i--]=a,S)+(g?(r[++i]=f,g):""):y?(r[i]||j(),","):u?"":(o=w,s=E,'"'));j()}var n,r={},i=0,s=a,o=a;return e=(e+" ").replace(h,u),e}function q(e,n,r,i){function p(t){if(""+t===t||t.nodeType>0)return a=t.nodeType>0?t:!s.test(t)&&l&&l(t)[0],a&&a.type&&(t=_[a.getAttribute(w)],t||(e=e||"_"+y++,a.setAttribute(w,e),t=q(e,a.innerHTML,r,i),_[e]=t)),t}var u,a,f,c,h;u=p(n),i=i||(n.markup?n:{}),i.name=e,c=i.templates,!u&&n.markup&&(u=p(n.markup))&&u.fn&&(u.debug!==n.debug||u.allowCode!==n.allowCode)&&(u=u.markup);if(u!==t){e&&!r&&(T[e]=function(){return n.render.apply(n,arguments)}),u.fn||n.fn?u.fn&&(e&&e!==u.name?n=o(o({},u),i):n=u):(n=R(u,i,r,0),F(u,n));for(f in c)h=c[f],h.name!==f&&(c[f]=q(f,h,n));return n}}function R(e,t,n,r){function i(e){n[e]&&(s[e]=o(o({},n[e]),t[e]))}t=t||{};var s={markup:e,tmpls:[],links:[],render:B};return n&&(n.templates&&(s.templates=o(o({},n.templates),t.templates)),s.parent=n,s.name=n.name+"["+r+"]",s.index=r),o(s,t),n&&(i("templates"),i("tags"),i("helpers"),i("converters")),s}function U(e){return b[e]||(b[e]="&#"+e.charCodeAt(0)+";")}var n="v1.0pre",r,i,s,o,u={},a=!1,f=!0,l=e.jQuery,c=/^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g,h=/(\()(?=|\s*\()|(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g,p=/\r?\n/g,d=/\\(['"])/g,v=/\\?(['"])/g,m=/\x08(~)?([^\x08]+)\x08/g,g=0,y=0,b={"&":"&","<":"<",">":">"},w="data-jsv-tmpl",E="var j=j||"+(l?"jQuery.":"js")+"views,",S=/[\x00"&'<>]/g,x=Array.prototype.slice,T={},N={jsviews:n,sub:u,debugMode:f,err:function(e){return N.debugMode?"
                    Error: "+(e.message||e)+". ":'""'},tmplFn:F,render:T,templates:_,tags:D,helpers:P,converters:H,View:O,convert:L,delimiters:C,tag:A};l?(r=l,r.templates=_,r.render=T,r.views=N,r.fn.render=B):(r=e.jsviews=N,r.extend=function(e,t){var n;e=e||{};for(n in t)e[n]=t[n];return e},r.isArray=Array&&Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}),o=r.extend,N.topView={views:{},tmpl:{},hlp:k,ctx:N.helpers},D({"if":function(){var e=this,n=e.view;return n.onElse=function(e,r){var i=0,s=r.length;while(s&&!r[i++])if(i===s)return"";return n.onElse=t,e.path="",e.renderContent(n)},n.onElse(this,arguments)},"else":function(){var e=this.view;return e.onElse?e.onElse(this,arguments):""},"for":function(){var e,t=this,n="",r=arguments,i=r.length;t.props.layout&&(t.tmpl.layout=f);for(e=0;e1&&!e.isArray(t[0]))return t[0]>=-180&&t[0]<=180&&t[1]>=-85&&t[1]<=85;t=t[0]}return!1},center:function(t,n){var r=!1;!n&&e.geo.proj&&this._isGeodetic(t)&&(r=!0,t=e.geo.proj.fromGeodetic(t));var i=[(t[0]+t[2])/2,(t[1]+t[3])/2];return r?e.geo.proj.toGeodetic(i):i},expandBy:function(t,n,r,i){var s=!1;return!i&&e.geo.proj&&this._isGeodetic(t)&&(s=!0,t=e.geo.proj.fromGeodetic(t)),t=[t[0]-n,t[1]-r,t[2]+n,t[3]+r],s?e.geo.proj.toGeodetic(t):t},height:function(t,n){return!n&&e.geo.proj&&this._isGeodetic(t)&&(t=e.geo.proj.fromGeodetic(t)),t[3]-t[1]},_in:function(e,t){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[2]&&e[3]>=t[3]},_bboxDisjoint:function(e,t){return t[0]>e[2]||t[2]e[3]||t[3]0&&(s/o>n?(a=s/2,f=a/n):(f=o/2,a=f*n),t=[u[0]-a,u[1]-f,u[0]+a,u[1]+f]),i?e.geo.proj.toGeodetic(t):t},recenter:function(t,n,r){var i=!1;!r&&e.geo.proj&&(this._isGeodetic(t)&&(i=!0,t=e.geo.proj.fromGeodetic(t)),this._isGeodetic(n)&&(n=e.geo.proj.fromGeodetic(n)));var s=(t[2]-t[0])/2,o=(t[3]-t[1])/2;return t=[n[0]-s,n[1]-o,n[0]+s,n[1]+o],i?e.geo.proj.toGeodetic(t):t},scaleBy:function(t,n,r){var i=!1;!r&&e.geo.proj&&this._isGeodetic(t)&&(i=!0,t=e.geo.proj.fromGeodetic(t));var s=this.center(t,!0),o=(t[2]-t[0])*n/2,u=(t[3]-t[1])*n/2;return t=[s[0]-o,s[1]-u,s[0]+o,s[1]+u],i?e.geo.proj.toGeodetic(t):t},width:function(t,n){return!n&&e.geo.proj&&this._isGeodetic(t)&&(t=e.geo.proj.fromGeodetic(t)),t[2]-t[0]},bbox:function(t,s){var o,u=!1;if(!t)return n;if(t.bbox)o=!s&&e.geo.proj&&this._isGeodetic(t.bbox)?e.geo.proj.fromGeodetic(t.bbox):t.bbox;else{o=[r,r,i,i];var a=this._allCoordinates(t),f=0;if(a.length===0)return n;!s&&e.geo.proj&&this._isGeodetic(a)&&(u=!0,a=e.geo.proj.fromGeodetic(a));for(;f0?(u[0]=Math.min(Math.max(a[0][0],h[0]),h[2]),u[1]=Math.min(Math.max(a[0][1],h[1]),h[3]),{type:"Point",coordinates:p?e.geo.proj.toGeodetic(u):u}):n;return o*=3,u[0]=Math.min(Math.max(u[0]/o,h[0]),h[2]),u[1]=Math.min(Math.max(u[1]/o,h[1]),h[3]),{type:"Point",coordinates:p?e.geo.proj.toGeodetic(u):u}}return n},contains:function(e,t){if(e.type!="Polygon")return!1;switch(t.type){case"Point":return this._containsPolygonPoint(e.coordinates,t.coordinates);case"LineString":return this._containsPolygonLineString(e.coordinates,t.coordinates);case"Polygon":return this._containsPolygonLineString(e.coordinates,t.coordinates[0]);default:return!1}},_containsPolygonPoint:function(e,t){if(e.length===0||e[0].length<4)return!1;var n=0,r=e[0][0],i=1,s,o;for(;it[0]&&n++;r=s}return n%2==1},_containsPolygonLineString:function(e,t){for(var n=0;n0){var i=e[0],s=t[0]-i[0],o=t[1]-i[1];if(e.length==1)return Math.sqrt(s*s+o*o);for(var u=1;u=u?i*i+s*s:n*n+r*r-o*o/u},_distanceLineStringLineString:function(e,t){var n=r;for(var i=0;i2?{type:"Point",coordinates:[parseFloat(t[1]),parseFloat(t[2])]}:null}function v(e){var t=e.match(/\s*\((.*)\)/),n=[],r,i,s=0;if(t&&t.length>1){r=t[1].match(/[\d\.\-]+\s+[\d\.\-]+/g);for(;s1){r=t[1].match(/[\d\.\-]+\s+[\d\.\-]+/g);for(;s0){for(;s
                    ";while(n[0]);return e>6?e:!e}();e.widget("geo.geographics",{_$elem:t,_options:{},_trueCanvas:!0,_trueDoubleBuffer:!0,_width:0,_height:0,_$canvas:t,_context:t,_$canvasSceneFront:t,_$canvasSceneBack:t,_timeoutEnd:null,_requireFlip:!1,_blitcanvas:t,_blitcontext:t,_$labelsContainerFront:t,_$labelsContainerBack:t,_labelsHtml:"",options:{style:{borderRadius:"8px",color:"#7f0000",fillOpacity:.2,height:"8px",opacity:1,strokeOpacity:1,strokeWidth:"2px",visibility:"visible",width:"8px"},doubleBuffer:!0},_create:function(){this._$elem=this.element,this._options=this.options,this._$elem.css({webkitTransform:"translateZ(0)",display:"inline-block",overflow:"hidden",textAlign:"left"}),this._$elem.css("position")=="static"&&this._$elem.css("position","relative"),this._$elem.addClass("geo-graphics"),this._width=this._$elem.width(),this._height=this._$elem.height();if(!this._width||!this._height)this._width=parseInt(this._$elem.css("width"),10),this._height=parseInt(this._$elem.css("height"),10);var t="position:absolute;left:0;top:0;margin:0;padding:0;",r="width:"+this._width+"px;height:"+this._height+"px;",i='width="'+this._width+'" height="'+this._height+'"';this._blitcanvas=document.createElement("canvas"),this._blitcanvas.getContext?(this._$canvas=e("'),this._blitcanvas.width=1,this._blitcanvas.height=1,this._trueDoubleBuffer=this._blitcanvas.toDataURL().length>6,(!this._options.doubleBuffer||!this._trueDoubleBuffer)&&this._$elem.append(this._$canvas),this._context=this._$canvas[0].getContext("2d"),this._blitcanvas.width=this._width,this._blitcanvas.height=this._height,this._blitcontext=this._blitcanvas.getContext("2d"),this._$canvasSceneFront=e(''),this._$canvasSceneBack=e('')):n<=8&&(this._trueCanvas=!1,this._$elem.append("
                    '),this._$canvas=this._$elem.children(":last"),G_vmlCanvasManager.initElement(this._$canvas[0]),this._context=this._$canvas[0].getContext("2d"),this._$canvas.children().css({backgroundColor:"transparent",width:this._width,height:this._height})),this._$labelsContainerFront=e('
                    '),this._$labelsContainerBack=e('
                    ')},_setOption:function(t,n){t=="style"&&(n=e.extend({},this._options.style,n)),e.Widget.prototype._setOption.apply(this,arguments)},destroy:function(){e.Widget.prototype.destroy.apply(this,arguments),this._$elem.html(""),this._$elem.removeClass("geo-graphics")},clear:function(){this._context.clearRect(0,0,this._width,this._height),this._labelsHtml="",this._end()},drawArc:function(e,t,n,r){r=this._getGraphicStyle(r);if(r.visibility!="hidden"&&r.opacity>0&&r.widthValue>0&&r.heightValue>0){var i=Math.min(r.widthValue,r.heightValue)/2;t=t*Math.PI/180,n=n*Math.PI/180,this._context.save(),this._context.translate(e[0],e[1]),r.widthValue>r.heightValue?this._context.scale(r.widthValue/r.heightValue,1):this._context.scale(1,r.heightValue/r.widthValue),this._context.beginPath(),this._context.arc(0,0,i,t,n,!1),this._trueCanvas&&this._context.restore(),r.doFill&&(this._context.fillStyle=r.fill,this._context.globalAlpha=r.opacity*r.fillOpacity,this._context.fill()),r.doStroke&&(this._context.lineJoin="round",this._context.lineWidth=r.strokeWidthValue,this._context.strokeStyle=r.stroke,this._context.globalAlpha=r.opacity*r.strokeOpacity,this._context.stroke()),this._trueCanvas||this._context.restore()}this._end()},drawPoint:function(e,t){t=this._getGraphicStyle(t),t.widthValue==t.heightValue&&t.heightValue==t.borderRadiusValue?this.drawArc(e,0,360,t):t.visibility!="hidden"&&t.opacity>0&&(t.borderRadiusValue=Math.min(Math.min(t.widthValue,t.heightValue)/2,t.borderRadiusValue),e[0]-=t.widthValue/2,e[1]-=t.heightValue/2,this._context.beginPath(),this._context.moveTo(e[0]+t.borderRadiusValue,e[1]),this._context.lineTo(e[0]+t.widthValue-t.borderRadiusValue,e[1]),this._context.quadraticCurveTo(e[0]+t.widthValue,e[1],e[0]+t.widthValue,e[1]+t.borderRadiusValue),this._context.lineTo(e[0]+t.widthValue,e[1]+t.heightValue-t.borderRadiusValue),this._context.quadraticCurveTo(e[0]+t.widthValue,e[1]+t.heightValue,e[0]+t.widthValue-t.borderRadiusValue,e[1]+t.heightValue),this._context.lineTo(e[0]+t.borderRadiusValue,e[1]+t.heightValue),this._context.quadraticCurveTo(e[0],e[1]+t.heightValue,e[0],e[1]+t.heightValue-t.borderRadiusValue),this._context.lineTo(e[0],e[1]+t.borderRadiusValue),this._context.quadraticCurveTo(e[0],e[1],e[0]+t.borderRadiusValue,e[1]),this._context.closePath(),t.doFill&&(this._context.fillStyle=t.fill,this._context.globalAlpha=t.opacity*t.fillOpacity,this._context.fill()),t.doStroke&&(this._context.lineJoin="round",this._context.lineWidth=t.strokeWidthValue,this._context.strokeStyle=t.stroke,this._context.globalAlpha=t.opacity*t.strokeOpacity,this._context.stroke()),this._end())},drawLineString:function(e,t){this._drawLines([e],!1,t)},drawPolygon:function(e,t){if(!this._trueCanvas||e.length==1)this._drawLines(e,!0,t);else{if(!e||!e.length||e[0].length<3)return;t=this._getGraphicStyle(t);var n,r,i;if(t.visibility!="hidden"&&t.opacity>0){this._blitcontext.clearRect(0,0,this._width,this._height);if(t.doFill&&e.length>1){this._blitcontext.globalCompositeOperation="source-out",this._blitcontext.globalAlpha=1;for(r=1;r1)for(r=1;r'+t+""},resize:function(){this._width=this._$elem.width(),this._height=this._$elem.height();if(!this._width||!this._height)this._width=parseInt(this._$elem.css("width"),10),this._height=parseInt(this._$elem.css("height"),10);this._trueCanvas?(this._$canvas[0].width=this._width,this._$canvas[0].height=this._height,this._$canvasSceneFront.css({width:this._width,height:this._height}),this._$canvasSceneBack.css({width:this._width,height:this._height})):this._$canvas.css({width:this._width,height:this._height}),this._$labelsContainerFront.css({width:this._width,height:this._height}),this._$labelsContainerBack.css({width:this._width,height:this._height})},interactiveTransform:function(e,t){this._timeoutEnd&&(clearTimeout(this._timeoutEnd),this._timeoutEnd=null);if(this._trueCanvas)if(this._options.doubleBuffer&&this._trueDoubleBuffer){if(this._requireFlip){var n=this,r=n._$canvasSceneFront;n._$canvasSceneFront=n._$canvasSceneBack.css({left:0,top:0,width:n._width,height:n._height}).prop("src",n._$canvas[0].toDataURL()).prependTo(n._$elem),n._$canvasSceneBack=r.detach(),n._requireFlip=!1}this._$canvasSceneFront.css({left:Math.round(e[0]),top:Math.round(e[1]),width:this._width*t,height:this._height*t})}else this._context.clearRect(0,0,this._width,this._height);else this._context.clearRect(0,0,this._width,this._height);this._$labelsContainerFront.css({left:Math.round(e[0]),top:Math.round(e[1]),width:this._width*t,height:this._height*t})},_end:function(){function t(){if(!e._timeoutEnd)return;e._trueCanvas&&e._options.doubleBuffer&&e._trueDoubleBuffer&&e._$canvasSceneBack.prop("src","").one("load",function(t){e._requireFlip=!1;var n=e._$canvasSceneFront;e._$canvasSceneFront=e._$canvasSceneBack.css({left:0,top:0,width:e._width,height:e._height}).prependTo(e._$elem),e._$canvasSceneBack=n.detach()}).prop("src",e._$canvas[0].toDataURL()),e._$labelsContainerBack.html(e._labelsHtml);var t=e._$labelsContainerFront;e._$labelsContainerFront=e._$labelsContainerBack.css({left:0,top:0,width:e._width,height:e._height}).prependTo(e._$elem),e._$labelsContainerBack=t.detach(),e._timeoutEnd=null}this._timeoutEnd&&(clearTimeout(this._timeoutEnd),this._timeoutEnd=null),this._requireFlip=!0;var e=this;this._timeoutEnd=setTimeout(t,20)},_getGraphicStyle:function(t){function n(e){return e=parseInt(e,10),+e+""===e?+e:e}return t=e.extend({},this._options.style,t),t.borderRadiusValue=n(t.borderRadius),t.fill=t.fill||t.color,t.doFill=t.fill&&t.fillOpacity>0,t.stroke=t.stroke||t.color,t.strokeWidthValue=n(t.strokeWidth),t.doStroke=t.stroke&&t.strokeOpacity>0&&t.strokeWidthValue>0,t.widthValue=n(t.width),t.heightValue=n(t.height),t},_drawLines:function(e,t,n){if(!e||!e.length||e[0].length<2)return;var r,i;n=this._getGraphicStyle(n);if(n.visibility!="hidden"&&n.opacity>0){this._context.beginPath();for(r=0;r
                    ";while(n[0]);return e>6?e:!e}(),i={bbox:[-180,-85,180,85],bboxMax:[-180,-85,180,85],center:[0,0],cursors:{"static":"default",pan:"url(data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAgACAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=), move",zoom:"crosshair",dragBox:"crosshair",dragCircle:"crosshair",drawPoint:"crosshair",drawLineString:"crosshair",drawPolygon:"crosshair",measureLength:"crosshair",measureArea:"crosshair"},measureLabels:{length:"{{:length.toFixed( 2 )}} m",area:"{{:area.toFixed( 2 )}} sq m"},drawStyle:{},shapeStyle:{},mode:"pan",pannable:!0,scroll:"default",shift:"default",services:[{"class":"osm",type:"tiled",src:function(e){return"http://otile"+(e.index%4+1)+".mqcdn.com/tiles/1.0.0/osm/"+e.zoom+"/"+e.tile.column+"/"+e.tile.row+".png"},attr:"Tiles Courtesy of MapQuest "}],tilingScheme:{tileWidth:256,tileHeight:256,levels:18,basePixelSize:156543.03392799935,origin:[-20037508.342787,20037508.342787]},axisLayout:"map",zoom:0,zoomMin:0,zoomMax:Number.POSITIVE_INFINITY,pixelSize:0};e.widget("geo.geomap",{_$elem:t,_map:t,_created:!1,_createdGraphics:!1,_widgetId:0,_tmplLengthId:"",_tmplAreaId:"",_contentBounds:{},_$resizeContainer:t,_$eventTarget:t,_$contentFrame:t,_$existingChildren:t,_$attrList:t,_$servicesContainer:t,_$shapesContainers:t,_$panContainer:t,_$shapesContainer:t,_$drawContainer:t,_$measureContainer:t,_$measureLabel:t,_dpi:96,_currentServices:[],_center:t,_pixelSize:t,_centerMax:t,_pixelSizeMax:t,_userGeodetic:!0,_centerInteractive:t,_pixelSizeInteractive:t,_timeoutInteractive:null,_triggerInteractive:!1,_timeoutRefreshShapes:null,_loadCount:0,_wheelTimeout:null,_wheelLevel:0,_zoomFactor:2,_fullZoomFactor:2,_partialZoomFactor:1.18920711500273,_mouseDown:t,_inOp:t,_toolPan:t,_shiftDown:t,_anchor:t,_current:t,_downDate:t,_moveDate:t,_clickDate:t,_lastMove:t,_lastDrag:t,_windowHandler:null,_resizeTimeout:null,_panning:t,_velocity:t,_friction:t,_supportTouch:t,_softDblClick:t,_isTap:t,_isDbltap:t,_isMultiTouch:t,_multiTouchAnchor:[],_multiTouchAnchorBbox:t,_multiTouchCurrentBbox:t,_drawTimeout:null,_drawPixels:[],_drawCoords:[],_graphicShapes:[],_initOptions:{},_options:{},options:e.extend({},i),_createWidget:function(t,r){this._$elem=e(r);if(this._$elem.is(".geo-service")){this._graphicShapes=[],e.Widget.prototype._createWidget.apply(this,arguments);return}this._widgetId=n++,this._tmplLengthId="geoMeasureLength"+this._widgetId,this._tmplAreaId="geoMeasureArea"+this._widgetId,this._$elem.addClass("geo-map").css({webkitTransform:"translateZ(0)"}),this._initOptions=t||{},this._forcePosition(this._$elem),this._$elem.css("text-align","left");var i=this._findMapSize();this._contentBounds={x:parseInt(this._$elem.css("padding-left"),10),y:parseInt(this._$elem.css("padding-top"),10),width:i.width,height:i.height},this._createChildren(),this._center=[0,0],this._centerMax=[0,0],this._centerInteractive=[0,0],this.options.pixelSize=this._pixelSize=this._pixelSizeMax=156543.03392799935,this._mouseDown=this._inOp=this._toolPan=this._shiftDown=this._panning=this._isTap=this._isDbltap=!1,this._anchor=[0,0],this._current=[0,0],this._lastMove=[0,0],this._lastDrag=[0,0],this._velocity=[0,0],this._friction=[.8,.8],this._downDate=this._moveDate=this._clickDate=0,this._drawPixels=[],this._drawCoords=[],this._graphicShapes=[],e.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){this._options=this.options;if(this._$elem.is(".geo-service")){this._map=this._$elem.data("geoMap"),this._$elem.data("geoService",this);return}this._map=this,this._supportTouch="ontouchend"in document,this._softDblClick=this._supportTouch||r==7;var n=this,i=this._supportTouch?"touchstart":"mousedown",s=this._supportTouch?"touchend touchcancel":"mouseup",o=this._supportTouch?"touchmove":"mousemove";e(document).keydown(e.proxy(this._document_keydown,this)),this._$eventTarget.dblclick(e.proxy(this._eventTarget_dblclick,this)),this._$eventTarget.bind(i,e.proxy(this._eventTarget_touchstart,this));var u=this._$eventTarget[0].setCapture?this._$eventTarget:e(document);u.bind(o,e.proxy(this._dragTarget_touchmove,this)),u.bind(s,e.proxy(this._dragTarget_touchstop,this)),this._$eventTarget.mousewheel(e.proxy(this._eventTarget_mousewheel,this)),this._windowHandler=function(){n._resizeTimeout&&clearTimeout(n._resizeTimeout),n._resizeTimeout=setTimeout(function(){n._created&&n._$elem.geomap("resize",!0)},500)},e(window).resize(this._windowHandler),this._$drawContainer.geographics({style:this._initOptions.drawStyle||{},doubleBuffer:!1}),this._options.drawStyle=this._$drawContainer.geographics("option","style"),this._$shapesContainer.geographics({style:this._initOptions.shapeStyle||{}}),this._createdGraphics=!0,this._options.shapeStyle=this._$shapesContainer.geographics("option","style"),this._initOptions&&(this._initOptions.tilingScheme!==t&&this._setOption("tilingScheme",this._initOptions.tilingScheme||null,!1),this._initOptions.services&&(this._options.services=e.merge([],this._initOptions.services)),this._initOptions.bboxMax&&(this._setOption("bboxMax",this._initOptions.bboxMax,!1),this._setOption("bbox",this._initOptions.bboxMax,!1)),this._initOptions.zoomMin!==t&&this._setOption("zoomMin",this._initOptions.zoomMin,!1),this._initOptions.zoomMax!==t&&this._setOption("zoomMax",this._initOptions.zoomMax,!1),this._initOptions.bbox&&this._setOption("bbox",this._initOptions.bbox,!1),this._initOptions.center&&this._setOption("center",this._initOptions.center,!1),this._initOptions.zoom!==t&&this._setOption("zoom",this._initOptions.zoom,!1)),e.templates(this._tmplLengthId,this._options.measureLabels.length),e.templates(this._tmplAreaId,this._options.measureLabels.area),this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._createServices(),this._refresh(),this._created=!0},_setOption:function(n,r,i){if(n=="pixelSize")return;i=i===t||i,this._$elem.is(".geo-map")&&this._panFinalize();var s,o,u,a;switch(n){case"bbox":this._created&&this._clearInteractiveTimeout(),this._userGeodetic=e.geo.proj&&e.geo._isGeodetic(r),this._userGeodetic&&(r=e.geo.proj.fromGeodetic(r)),s=[r[0]+(r[2]-r[0])/2,r[1]+(r[3]-r[1])/2],o=Math.max(e.geo.width(r,!0)/this._contentBounds.width,e.geo.height(r,!0)/this._contentBounds.height),a=this._getZoom(s,o),this._options.tilingScheme?o=this._getPixelSize(Math.min(Math.max(a,this._options.zoomMin),this._options.zoomMax)):athis._options.zoomMax&&(o=this._getPixelSize(this._options.zoomMax)),this._created?(this._setInteractiveCenterAndSize(s,o),this._setInteractiveTimeout(!1)):this._setCenterAndSize(s,o,!1,i),r=this._getBbox(s,o);break;case"bboxMax":this._userGeodetic=e.geo.proj&&e.geo._isGeodetic(r);break;case"center":this._created&&this._clearInteractiveTimeout(),this._userGeodetic=e.geo.proj&&e.geo._isGeodetic(r),this._userGeodetic&&(r=e.geo.proj.fromGeodetic(r)),this._created?(this._setInteractiveCenterAndSize(r,this._pixelSizeInteractive),this._interactiveTransform(),this._setInteractiveTimeout(!1)):this._setCenterAndSize(r,this._pixelSize,!1,i);break;case"measureLabels":r=e.extend(this._options.measureLabels,r),e.templates(this._tmplLengthId,this._options.measureLabels.length),e.templates(this._tmplAreaId,this._options.measureLabels.area);break;case"drawStyle":this._$drawContainer&&(this._$drawContainer.geographics("option","style",r),r=this._$drawContainer.geographics("option","style"));break;case"shapeStyle":this._$elem.is(".geo-service")&&!this._createdGraphics&&this._createServiceGraphics(),this._createdGraphics&&(this._$shapesContainer.geographics("option","style",r),r=this._$shapesContainer.geographics("option","style"));break;case"mode":this._resetDrawing(),this._$eventTarget.css("cursor",this._options.cursors[r]);break;case"zoom":this._created?this._setZoom(r,!1,i):(r=Math.max(r,0),this._setCenterAndSize(this._center,this._getPixelSize(r),!1,i))}e.Widget.prototype._setOption.apply(this,arguments);switch(n){case"bbox":case"center":this._userGeodetic&&(this._options.bbox=e.geo.proj.toGeodetic(this._options.bbox),this._options.center=e.geo.proj.toGeodetic(this._center));break;case"tilingScheme":r!==null&&(this._pixelSizeMax=this._getPixelSize(0),this._centerMax=[r.origin[0]+this._pixelSizeMax*r.tileWidth/2,r.origin[1]+this._pixelSizeMax*r.tileHeight/2]);break;case"bboxMax":e.geo.proj&&e.geo._isGeodetic(r)?u=e.geo.proj.fromGeodetic(r):u=r,this._centerMax=e.geo.center(u),this._pixelSizeMax=Math.max(e.geo.width(u,!0)/this._contentBounds.width,e.geo.height(u,!0)/this._contentBounds.height);break;case"services":this._createServices(),i&&(this._refresh(),this._refreshAllShapes());break;case"shapeStyle":i&&this._createdGraphics&&(this._$shapesContainer.geographics("clear"),this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,this._graphicShapes))}},destroy:function(){if(this._$elem.is(".geo-service"))this._createdGraphics&&(this._$shapesContainer.geographics("destroy"),this._$shapesContainer=t,this._createdGraphics=!1);else{clearTimeout(this._timeoutInteractive),this._timeoutInteractive=null,this._created=!1,e(window).unbind("resize",this._windowHandler);for(var n=0;n=0||t<=1)for(var r=0;r0)){this._createdGraphics||this._createServiceGraphics();var o,u,a,f,l,c;e.isArray(n)?o=n:n.type=="FeatureCollection"?o=n.features:o=[n];for(a=1;a0)){var i=e.isArray(n)?n:[n],s;for(var o=0;o=0&&(e.removeData(n,"geoBbox"),s=this._graphicShapes.slice(o+1),this._graphicShapes.length=o,this._graphicShapes.push.apply(this._graphicShapes,s),o--);if(r===t||r)this._$elem.is(".geo-service")?this._refresh(!1,this._$elem):this._refresh(),this._refreshAllShapes()}},_getBbox:function(e,t){e=e||this._center,t=t||this._pixelSize;var n=this._contentBounds.width/2*t,r=this._contentBounds.height/2*t;return[e[0]-n,e[1]-r,e[0]+n,e[1]+r]},_setBbox:function(t,n,r){var i=[t[0]+(t[2]-t[0])/2,t[1]+(t[3]-t[1])/2],s=Math.max(e.geo.width(t,!0)/this._contentBounds.width,e.geo.height(t,!0)/this._contentBounds.height),o=this._getZoom(i,s);this._options.tilingScheme?s=this._getPixelSize(Math.min(Math.max(o,this._options.zoomMin),this._options.zoomMax)):othis._options.zoomMax&&(s=this._getPixelSize(this._options.zoomMax)),this._setInteractiveCenterAndSize(i,s),this._interactiveTransform()},_getBboxMax:function(){var e=this._contentBounds.width/2*this._pixelSizeMax,t=this._contentBounds.height/2*this._pixelSizeMax;return[this._centerMax[0]-e,this._centerMax[1]-t,this._centerMax[0]+e,this._centerMax[1]+t]},_getCenter:function(){return this._center},_getContentBounds:function(){return this._contentBounds},_getServicesContainer:function(){return this._$servicesContainer},_getZoom:function(t,n){t=t||this._center,n=n||this._pixelSize;var r=this._options.tilingScheme;if(r){if(r.pixelSizes){var i=Math.floor(n*1e3),s=r.pixelSizes.length,o=s-1;for(;o>=0;o--)if(Math.floor(r.pixelSizes[o]*1e3)>=i)return o;return 0}return Math.round(Math.log(r.basePixelSize/n)/Math.log(2))}var u=this._contentBounds.width/this._contentBounds.height,a=e.geo.reaspect(this._getBbox(t,n),u,!0),f=e.geo.reaspect(this._getBboxMax(),u,!0);return Math.round(Math.log(e.geo.width(f,!0)/e.geo.width(a,!0))/Math.log(this._zoomFactor))},_setZoom:function(e,t,n){this._clearInteractiveTimeout(),e=Math.min(Math.max(e,this._options.zoomMin),this._options.zoomMax),this._setInteractiveCenterAndSize(this._centerInteractive,this._getPixelSize(e)),this._interactiveTransform(),this._setInteractiveTimeout(t)},_createChildren:function(){this._$existingChildren=this._$elem.children(),this._forcePosition(this._$existingChildren),this._$existingChildren.detach().css({mozUserSelect:"none"});var t="width:"+this._contentBounds.width+"px; height:"+this._contentBounds.height+"px; margin:0; padding:0;",n="position:absolute; left:0; top:0;";this._$elem.prepend('
                    '),this._$eventTarget=this._$contentFrame=this._$elem.children(":first"),this._$contentFrame.append('
                    '),this._$servicesContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
                    '),this._$shapesContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
                      '),this._$attrList=this._$contentFrame.children(":last"),this._$contentFrame.append('
                      '),this._$drawContainer=this._$contentFrame.children(":last"),this._$contentFrame.append('
                      '),this._$measureContainer=this._$contentFrame.children(":last"),this._$measureLabel=this._$measureContainer.children(),this._$panContainer=e([this._$shapesContainer[0],this._$drawContainer[0],this._$measureContainer[0]]),this._$resizeContainer=e([this._$contentFrame[0],this._$servicesContainer[0],this._$eventTarget[0],this._$measureContainer[0]]),this._$contentFrame.append(this._$existingChildren),e("#geo-measure-style").length||e("head").prepend('")},_createServices:function(){var t,n;for(n=0;n',o;this._$servicesContainer.append(s),serviceContainer=this._$servicesContainer.children(":last"),t.serviceContainer=serviceContainer,e.geo._serviceTypes[t.type].create(this,serviceContainer,t,n),serviceContainer.data("geoMap",this).geomap(),t.attr&&this._$attrList.append("
                    • "+t.attr+"
                    • ")}this._$shapesContainers=this._$shapesContainer,this._$attrList.find("a").css({position:"relative",zIndex:100})},_createServiceGraphics:function(){var e=this._$elem.closest(".geo-content-frame");this._$elem.append('
                      '),this._$shapesContainer=this._$elem.children(":last"),this._map._$shapesContainers=this._map._$shapesContainers.add(this._$shapesContainer),this._$shapesContainer.geographics(),this._createdGraphics=!0,this._options.shapeStyle=this._$shapesContainer.geographics("option","style")},_refreshDrawing:function(){this._$drawContainer.geographics("clear");if(this._drawPixels.length>0){var t=this._options.mode,n=this._drawPixels,r=this._drawCoords,i,s,o,u,a;switch(t){case"measureLength":t="drawLineString",s={type:"LineString",coordinates:r},i=e.render[this._tmplLengthId]({length:e.geo.length(s,!0)}),o=e.merge([],n[n.length-1]);break;case"measureArea":t="drawPolygon",s={type:"Polygon",coordinates:[e.merge([],r)]},s.coordinates[0].push(r[0]),i=e.render[this._tmplAreaId]({area:e.geo.area(s,!0)}),o=this._toPixel(e.geo.centroid(s).coordinates),n=[n];break;case"drawPolygon":n=[n]}this._$drawContainer.geographics(t,n),i&&(this._$measureLabel.html(i),u=this._contentBounds.width-(this._$measureLabel.outerWidth(!0)+o[0]),a=this._contentBounds.height-(this._$measureLabel.outerHeight(!0)+o[1]),u<0&&(o[0]+=u),a<0&&(o[1]+=a),this._$measureLabel.css({left:Math.max(o[0],0),top:Math.max(o[1],0)}).show())}},_resetDrawing:function(){this._drawPixels=[],this._drawCoords=[],this._$drawContainer.geographics("clear"),this._$measureLabel.hide()},_refreshAllShapes:function(){this._timeoutRefreshShapes=null;var e,t,n=0;for(;n0&&t._refreshShapes(t._$shapesContainer,t._graphicShapes,t._graphicShapes,t._graphicShapes));this._createdGraphics&&(this._$shapesContainer.geographics("clear"),this._graphicShapes.length>0&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,this._graphicShapes))},_refreshShapes:function(n,r,i,s,o,u){var a,f,l,c,h,p,d,v,m=this._map._getBbox(o,u);for(a=0;a0&&e.height>0)){e={width:t.width(),height:t.height()};if(e.width<=0||e.height<=0)e={width:parseInt(t.css("width"),10),height:parseInt(t.css("height"),10)};t=t.parent()}return e},_forcePosition:function(e){var t=e.css("position");t!="relative"&&t!="absolute"&&t!="fixed"&&e.css("position","relative")},_getPixelSize:function(t){var n=this._options.tilingScheme;if(n!==null){if(t===0)return n.pixelSizes?n.pixelSizes[0]:n.basePixelSize;t=Math.round(t),t=Math.max(t,0);var r=n.pixelSizes?n.pixelSizes.length:n.levels;return t=Math.min(t,r-1),n.pixelSizes?n.pixelSizes[t]:n.basePixelSize/Math.pow(2,t)}var i=e.geo.scaleBy(this._getBboxMax(),1/Math.pow(this._zoomFactor,t),!0);return Math.max(e.geo.width(i,!0)/this._contentBounds.width,e.geo.height(i,!0)/this._contentBounds.height)},_getZoomCenterAndSize:function(e,t,n){var r=n?this._fullZoomFactor:this._partialZoomFactor,i=Math.pow(r,-t),s=this._pixelSizeInteractive*i,o=this._getZoom(this._centerInteractive,s);n&&this._options.tilingScheme?s=this._getPixelSize(Math.min(Math.max(o,this._options.zoomMin),this._options.zoomMax)):t<0&&o0&&o>this._options.zoomMax&&(s=this._pixelSizeInteractive);var u=s/this._pixelSizeInteractive,a=this._toMap(e,this._centerInteractive,this._pixelSizeInteractive),f=[(this._centerInteractive[0]-a[0])*u,(this._centerInteractive[1]-a[1])*u],l=[a[0]+f[0],a[1]+f[1]];return{pixelSize:s,center:l}},_mouseWheelFinish:function(e){this._wheelTimeout=null;if(this._wheelLevel!==0){var t=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._options.tilingScheme!==null);this._wheelLevel=0}else e&&(this._refresh(),this._refreshAllShapes())},_panFinalize:function(){if(this._panning){this._velocity=[0,0];var e=this._current[0]-this._anchor[0],t=this._current[1]-this._anchor[1],n=this._options.axisLayout==="image",r=-e*this._pixelSize,i=(n?-1:1)*t*this._pixelSize;this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._inOp=!1,this._anchor=this._current,this._mouseDown=this._toolPan=this._panning=!1}},_panMove:function(){if(!this._options.pannable)return;var e=this._current[0]-this._lastDrag[0],t=this._current[1]-this._lastDrag[1],n=0,r,i;if(this._toolPan||e>3||e<-3||t>3||t<-3){this._toolPan||(this._toolPan=!0,this._$eventTarget.css("cursor",this._options.cursors.pan)),this._mouseDown&&(this._velocity=[e,t]);if(e!==0||t!==0)this._panning=!0,this._lastDrag=this._current,this._centerInteractive[0]-=e*this._pixelSizeInteractive,this._centerInteractive[1]+=(this._options.axisLayout==="image"?-1:1)*t*this._pixelSizeInteractive,this._setInteractiveCenterAndSize(this._centerInteractive,this._pixelSizeInteractive),this._interactiveTransform()}},_clearInteractiveTimeout:function(){return this._timeoutRefreshShapes&&(clearTimeout(this._timeoutRefreshShapes),this._timeoutRefreshShapes=null),this._timeoutInteractive?(clearTimeout(this._timeoutInteractive),this._timeoutInteractive=null,!0):(this._centerInteractive[0]=this._center[0],this._centerInteractive[1]=this._center[1],this._pixelSizeInteractive=this._pixelSize,!1)},_interactiveTransform:function(){var t=this._contentBounds.width,n=this._contentBounds.height,r=t/2,i=n/2,s=[this._centerInteractive[0]-r,this._centerInteractive[1]-i,this._centerInteractive[0]+r,this._centerInteractive[1]+i],o=this._pixelSize,u=o/this._pixelSizeInteractive;if(o>0){u=Math.round(u*1e3)/1e3;var a=this._toMap([0,0]),f=this._toPixel(a,this._centerInteractive,this._pixelSizeInteractive);this._$shapesContainers.geographics("interactiveTransform",f,u)}for(var l=0;l0&&(this._drawPixels=this._toPixel(this._drawCoords,this._centerInteractive,this._pixelSizeInteractive),this._refreshDrawing())},_interactiveTimeout:function(){this._isMultiTouch?this._timeoutInteractive=setTimeout(e.proxy(interactiveTimeout,this),128):this._created&&this._timeoutInteractive&&(this._setCenterAndSize(this._centerInteractive,this._pixelSizeInteractive,this._triggerInteractive,!0),this._timeoutInteractive=null,this._triggerInteractive=!1,this._timeoutRefreshShapes=setTimeout(e.proxy(this._refreshAllShapes,this),128))},_setInteractiveTimeout:function(t){this._timeoutInteractive=setTimeout(e.proxy(this._interactiveTimeout,this),128),this._triggerInteractive|=t},_refresh:function(t,n){var r,i=0;for(;ithis._options.zoomMax&&(this._pixelSizeInteractive=n=this._getPixelSize(this._options.zoomMax)),this._center[0]=t[0],this._center[1]=t[1],this._options.pixelSize=this._pixelSize=n,this._userGeodetic?(this._options.bbox=e.geo.proj.toGeodetic(this._getBbox()),this._options.center=e.geo.proj.toGeodetic(this._center)):(this._options.bbox=this._getBbox(),this._options.center=e.merge([],t)),this._options.zoom=s,r&&this._trigger("bboxchange",window.event,{bbox:e.merge([],this._options.bbox)}),i&&(this._refresh(),this._refreshAllShapes(),this._refreshDrawing())},_requestQueued:function(){this._loadCount===0&&this._trigger("loadstart",window.event),this._loadCount++},_requestComplete:function(){this._loadCount--,this._loadCount<=0&&(this._loadCount=0,this._trigger("loadend",window.event))},_toMap:function(t,n,r){n=n||this._center,r=r||this._pixelSize;var i=e.isArray(t[0]),s=i&&e.isArray(t[0][0]),o=s&&e.isArray(t[0][0][0]),u=this._contentBounds.width,a=this._contentBounds.height,f=u/2*r,l=a/2*r,c=[n[0]-f,n[1]-l,n[0]+f,n[1]+l],h=e.geo.width(c,!0)/u,p=e.geo.height(c,!0)/a,d,v=this._options.axisLayout==="image",m=[],g,y,b;o||(s||(i||(t=[t]),t=[t]),t=[t]);for(g=0;g0&&t.which==27&&(n<=2?(this._resetDrawing(),this._inOp=!1):(this._drawCoords[n-2]=e.merge([],this._drawCoords[n-1]),this._drawPixels[n-2]=e.merge([],this._drawPixels[n-1]),this._drawCoords.length--,this._drawPixels.length--,this._refreshDrawing()))},_eventTarget_dblclick_zoom:function(e){var t=this._clearInteractiveTimeout();this._trigger("dblclick",e,{type:"Point",coordinates:this._toMap(this._current,this._centerInteractive,this._pixelSizeInteractive)});if(!e.isDefaultPrevented()){var n=this._getZoomCenterAndSize(this._current,1,!0);this._setInteractiveCenterAndSize(n.center,n.pixelSize),this._interactiveTransform(),t=!0}t&&this._setInteractiveTimeout(!0)},_eventTarget_dblclick:function(t){if(this._options.mode==="static")return;this._drawTimeout&&(window.clearTimeout(this._drawTimeout),this._drawTimeout=null);var n=e(t.currentTarget).offset();switch(this._options.mode){case"drawLineString":case"measureLength":this._drawCoords.length>1&&(this._drawCoords[0][0]!=this._drawCoords[1][0]||this._drawCoords[0][1]!=this._drawCoords[1][1])?(this._drawCoords.length--,this._trigger("shape",t,{type:"LineString",coordinates:this._userGeodetic?e.geo.proj.toGeodetic(this._drawCoords):this._drawCoords})):this._eventTarget_dblclick_zoom(t),this._resetDrawing();break;case"drawPolygon":case"measureArea":if(this._drawCoords.length>1&&(this._drawCoords[0][0]!=this._drawCoords[1][0]||this._drawCoords[0][1]!=this._drawCoords[1][1])){var r=this._drawCoords.length-1;r>2&&(this._drawCoords[r]=e.merge([],this._drawCoords[0]),this._trigger("shape",t,{type:"Polygon",coordinates:[this._userGeodetic?e.geo.proj.toGeodetic(this._drawCoords):this._drawCoords]}))}else this._eventTarget_dblclick_zoom(t);this._resetDrawing();break;default:this._eventTarget_dblclick_zoom(t)}this._inOp=!1},_eventTarget_touchstart:function(t){var n=this._options.mode,r=this._options.shift,i=n==="dragBox"?"dragBox":"zoom";if(n==="static")return;if(!this._supportTouch&&t.which!=1)return;var s=this._clearInteractiveTimeout(),o=e(t.currentTarget).offset(),u=t.originalEvent.changedTouches;this._supportTouch?(this._multiTouchAnchor=e.merge([],u),this._isMultiTouch=this._multiTouchAnchor.length>1,this._isMultiTouch?(this._multiTouchCurrentBbox=[u[0].pageX-o.left,u[0].pageY-o.top,u[1].pageX-o.left,u[1].pageY-o.top],this._multiTouchAnchorBbox=e.merge([],this._multiTouchCurrentBbox),this._current=e.geo.center(this._multiTouchCurrentBbox,!0)):(this._multiTouchCurrentBbox=[u[0].pageX-o.left,u[0].pageY-o.top,NaN,NaN],this._current=[u[0].pageX-o.left,u[0].pageY-o.top])):this._current=[t.pageX-o.left,t.pageY-o.top];if(this._softDblClick){var a=e.now();if(a-this._downDate<750){if(this._isTap){var f=this._current[0]-this._anchor[0],l=this._current[1]-this._anchor[1],c=Math.sqrt(f*f+l*l);c>8?this._isTap=!1:this._current=e.merge([],this._anchor)}this._isDbltap?this._isDbltap=!1:this._isDbltap=this._isTap}else this._isDbltap=!1;this._isTap=!0,this._downDate=a}return this._mouseDown=!0,this._anchor=e.merge([],this._current),!this._inOp&&t.shiftKey&&r!=="off"?(this._shiftDown=!0,this._$eventTarget.css("cursor",this._options.cursors[r==="default"?i:r])):!this._isMultiTouch&&(this._options.pannable||n==="dragBox"||n==="dragCircle")&&(this._inOp=!0,n!=="zoom"&&n!=="dragBox"&&n!=="dragCircle"&&(this._lastDrag=this._current,t.currentTarget.setCapture&&t.currentTarget.setCapture())),t.preventDefault(),s&&this._setInteractiveTimeout(!0),!1},_dragTarget_touchmove:function(t){if(this._options.mode==="static")return;var n=!1;this._mouseDown&&(n=this._clearInteractiveTimeout());var i=this._$eventTarget.offset(),s=this._drawCoords.length,o=t.originalEvent.changedTouches,u,a,f=0;if(this._supportTouch){if(!this._isMultiTouch&&this._mouseDown&&this._multiTouchAnchor.length>0&&o[0].identifier!==this._multiTouchAnchor[0].identifier)return this._mouseDown=!1,this._isMultiTouch=!0,this._wheelLevel=0,this._multiTouchAnchor.push(o[0]),this._multiTouchCurrentBbox=[this._multiTouchCurrentBbox[0],this._multiTouchCurrentBbox[1],this._multiTouchAnchor[1].pageX-i.left,this._multiTouchAnchor[1].pageY-i.top],this._multiTouchAnchorBbox=e.merge([],this._multiTouchCurrentBbox),this._mouseDown=!0,this._anchor=this._current=e.geo.center(this._multiTouchCurrentBbox,!0),n&&this._setInteractiveTimeout(!0),!1;if(this._isMultiTouch){for(;f0?h*=5:h*=10;var p=h-this._wheelLevel;this._wheelLevel=h;var d=this._getZoomCenterAndSize(this._anchor,p,!1);this._setInteractiveCenterAndSize(d.center,d.pixelSize),this._interactiveTransform(),n=!0,u=e.geo.center(this._multiTouchCurrentBbox,!0)}else u=[t.originalEvent.changedTouches[0].pageX-i.left,t.originalEvent.changedTouches[0].pageY-i.top]}else u=[t.pageX-i.left,t.pageY-i.top];if(u[0]===this._lastMove[0]&&u[1]===this._lastMove[1]&&this._inOp)return t.preventDefault(),n&&this._setInteractiveTimeout(!0),!1;r==7&&(this._isDbltap=this._isTap=!1),this._mouseDown&&(this._current=u,this._moveDate=e.now());if(this._isMultiTouch)return t.preventDefault(),this._isDbltap=this._isTap=!1,n&&this._setInteractiveTimeout(!0),!1;var v=this._options.mode,m=this._options.shift,g=v==="dragBox"?"dragBox":"zoom",y,b,w;this._shiftDown&&(v=m==="default"?g:m);switch(v){case"zoom":case"dragBox":this._mouseDown?(this._$drawContainer.geographics("clear"),this._$drawContainer.geographics("drawBbox",[this._anchor[0],this._anchor[1],u[0],u[1]])):this._trigger("move",t,{type:"Point",coordinates:this.toMap(u)});break;case"dragCircle":this._mouseDown?(y=u[0]-this._anchor[0],b=u[1]-this._anchor[1],w=Math.sqrt(y*y+b*b)*2,this._$drawContainer.geographics("clear"),this._$drawContainer.geographics("drawArc",this._anchor,0,360,{width:w,height:w})):this._trigger("move",t,{type:"Point",coordinates:this.toMap(u)});break;case"drawLineString":case"drawPolygon":case"measureLength":case"measureArea":this._mouseDown||this._toolPan?(this._panMove(),n=!0):(s>0&&(this._drawCoords[s-1]=this._toMap(u,this._centerInteractive,this._pixelSizeInteractive),this._drawPixels[s-1]=u,this._refreshDrawing()),this._trigger("move",t,{type:"Point",coordinates:this.toMap(u)}));break;default:this._mouseDown||this._toolPan?(this._panMove(),n=!0):this._trigger("move",t,{type:"Point",coordinates:this.toMap(u)})}this._lastMove=u,n&&this._setInteractiveTimeout(!0);if(this._inOp)return t.preventDefault(),!1},_dragTarget_touchstop:function(t){if(this._options.mode==="static")return;if(!this._mouseDown){if(r!=7)return;this._eventTarget_touchstart(t)}var n=this._clearInteractiveTimeout(),i=this._mouseDown,s=this._toolPan,o=this._$eventTarget.offset(),u=this._options.mode,a=this._options.shift,f=u==="dragBox"?"dragBox":"zoom",l,c,h,p,d,v,m;this._shiftDown&&(u=a==="default"?f:a),this._supportTouch?(l=[t.originalEvent.changedTouches[0].pageX-o.left,t.originalEvent.changedTouches[0].pageY-o.top],this._multiTouchAnchor=[],this._inOp=!1):l=[t.pageX-o.left,t.pageY-o.top],this._softDblClick&&this._isTap&&(p=l[0]-this._anchor[0],d=l[1]-this._anchor[1],Math.sqrt(p*p+d*d)<=8&&(l=e.merge([],this._anchor))),p=l[0]-this._anchor[0],d=l[1]-this._anchor[1],this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]),this._shiftDown=this._mouseDown=this._toolPan=!1;if(this._isMultiTouch){t.preventDefault(),this._isMultiTouch=!1,this._wheelLevel=0,n&&this._setInteractiveTimeout(!0);return}document.releaseCapture&&document.releaseCapture();if(i){h=e.now(),this._current=l;switch(u){case"zoom":case"dragBox":if(p!==0||d!==0){var g=this._pixelSize*6,y=this._toMap([[Math.min(this._anchor[0],l[0]),Math.max(this._anchor[1],l[1])],[Math.max(this._anchor[0],l[0]),Math.min(this._anchor[1],l[1])]]),b=[y[0][0],y[0][1],y[1][0],y[1][1]];u==="zoom"?(b[2]-b[0]100){var T=this;this._drawTimeout=setTimeout(function(){T._drawTimeout&&(T._trigger("shape",t,{type:"Point",coordinates:T.toMap(l)}),T._inOp=!1,T._drawTimeout=null)},250)}break;case"drawLineString":case"drawPolygon":case"measureLength":case"measureArea":if(s)this._panFinalize();else{c=this._drawCoords.length===0?0:this._drawCoords.length-1,this._drawCoords[c]=this._toMap(l),this._drawPixels[c]=l;if(c<2||this._drawCoords[c][0]!=this._drawCoords[c-1][0]||this._drawCoords[c][1]!=this._drawCoords[c-1][1])this._drawCoords[c+1]=this._toMap(l,this._centerInteractive,this._pixelSizeInteractive),this._drawPixels[c+1]=l;this._refreshDrawing()}break;default:s?this._panFinalize():h-this._clickDate>100&&(this._trigger("click",t,{type:"Point",coordinates:this.toMap(l)}),this._inOp=!1)}this._clickDate=h;if(this._softDblClick&&this._isDbltap)return this._isDbltap=this._isTap=!1,n&&this._setInteractiveTimeout(!0),this._$eventTarget.trigger("dblclick",t),!1}n&&this._setInteractiveTimeout(!0);if(this._inOp)return t.preventDefault(),!1},_eventTarget_mousewheel:function(t,n){if(this._options.mode==="static"||this._options.scroll==="off")return;t.preventDefault();if(this._mouseDown)return!1;if(n!==0){this._clearInteractiveTimeout(),n>0?n=Math.ceil(n):n=Math.floor(n);var r=e(t.currentTarget).offset();this._anchor=[t.pageX-r.left,t.pageY-r.top];var i=this._getZoomCenterAndSize(this._anchor,n,this._options.tilingScheme!==null),s,o=0;this._setInteractiveCenterAndSize(i.center,i.pixelSize),this._interactiveTransform(),this._setInteractiveTimeout(!0)}return!1}})}(jQuery),function(e,t){e.geo._serviceTypes.tiled=function(){return{create:function(t,n,r,i){var s=e.data(r,"geoServiceState");if(!s){s={loadCount:0,reloadTiles:!1};var o='
                      ';n.append(o),s.serviceContainer=n.children(":last"),e.data(r,"geoServiceState",s)}return s.serviceContainer},destroy:function(t,n,r){var i=e.data(r,"geoServiceState");i.serviceContainer.remove(),e.removeData(r,"geoServiceState")},interactiveTransform:function(t,n,r,i){var s=e.data(n,"geoServiceState"),o=t.options.tilingScheme;s&&(this._cancelUnloaded(t,n),s.serviceContainer.children().each(function(n){var s=e(this),u=s.data("pixelSize"),a=u/i;if(u>0){a=Math.round(a*1e3)/1e3;var f=s.data("scaleOrigin"),l=t._toPixel(f,r,i);s.css({left:Math.round(l[0])+"px",top:Math.round(l[1])+"px",width:o.tileWidth*a,height:o.tileHeight*a})}}))},refresh:function(t,n,r){var i=e.data(n,"geoServiceState");this._cancelUnloaded(t,n),i&&r&&(i.reloadTiles=!0);if(i&&n&&n.style.visibility==="visible"&&!i.serviceContainer.is(":hidden")){var s=t._getBbox(),o=t._pixelSize,u=this,a=i.serviceContainer,f=t._getContentBounds(),l=f.width,c=f.height,h=t.options.axisLayout==="image",p=h?1:-1,d=t.options.tilingScheme,v=d.tileWidth,m=d.tileHeight,g=Math.floor((s[0]-d.origin[0])/(o*v)),y=Math.max(Math.floor((h?s[1]-d.origin[1]:d.origin[1]-s[3])/(o*m)),0),b=Math.ceil((s[2]-d.origin[0])/(o*v)),w=Math.ceil((h?s[3]-d.origin[1]:d.origin[1]-s[1])/(o*m)),E=t._getBboxMax(),S=t._getPixelSize(0),x=S/o,T=Math.floor((E[0]-d.origin[0])/(S*v))*x,N=Math.floor((d.origin[1]+p*E[3])/(S*m))*x,C=d.origin[0]+T*v*o,k=d.origin[1]+p*N*m*o,L=Math.round((C-s[0])/o),A=Math.round((h?k-s[1]:s[3]-k)/o),O=a.children().show(),M=O.filter("[data-pixel-size='"+o+"']").appendTo(a),_=n.style.opacity,D,P,H=function(n){u._loadImage(e.data(this,"img"),n,o,t,i,_)},B=function(){e.data(this,"img").remove(),i.loadCount--,t._requestComplete()};i.reloadTiles&&O.find("img").attr("data-dirty","true"),M.size()?(M.css({left:L%v+"px",top:A%m+"px"}).data("scaleOrigin",t._toMap([L%v,A%m])),M.children().each(function(t){var n=e(this),r=n.attr("data-tile").split(",");n.css({left:Math.round((parseInt(r[0],10)-T)*100+(L-L%v)/v*100)+"%",top:Math.round((parseInt(r[1],10)-N)*100+(A-A%m)/m*100)+"%"}),_<1&&n.fadeTo(0,_)})):(a.append("
                      "),M=a.children(":last").data("scaleOrigin",t._toMap([L%v,A%m])));for(D=g;D0)F.attr("src",X);else{var V="",M.append(V),F=M.children(":last")}typeof X=="string"?u._loadImage(F,X,o,t,i,_):X?(e.data(X,"img",F),X.done(H).fail(B)):F.remove()}}O.find("[data-dirty]").remove(),i.reloadTiles=!1}},resize:function(e,t){},opacity:function(t,n){var r=e.data(n,"geoServiceState");r.serviceContainer.find("img").stop(!0).fadeTo("fast",n.style.opacity)},toggle:function(t,n){var r=e.data(n,"geoServiceState");r.serviceContainer.css("display",n.style.visibility==="visible"?"block":"none")},_cancelUnloaded:function(t,n){var r=e.data(n,"geoServiceState");if(r&&r.loadCount>0){r.serviceContainer.find("img:hidden").remove();while(r.loadCount>0)r.loadCount--,t._requestComplete()}},_loadImage:function(t,n,r,i,s,o){var u=s.serviceContainer;t.load(function(t){o<1?e(t.target).fadeTo(0,o):e(t.target).show(),s.loadCount--,i._requestComplete(),s.loadCount<=0&&(u.children(":not([data-pixel-size='"+r+"'])").remove(),s.loadCount=0)}).error(function(t){e(t.target).remove(),s.loadCount--,i._requestComplete(),s.loadCount<=0&&(u.children(":not([data-pixel-size='"+r+"'])").remove(),s.loadCount=0)}).attr("src",n)}}}()}(jQuery),function(e,t){e.geo._serviceTypes.shingled=function(){return{create:function(t,n,r,i){var s=e.data(r,"geoServiceState");if(!s){s={loadCount:0};var o='
                      ';n.append(o),s.serviceContainer=n.children(":last"),e.data(r,"geoServiceState",s)}return s.serviceContainer},destroy:function(t,n,r){var i=e.data(r,"geoServiceState");i.serviceContainer.remove(),e.removeData(r,"geoServiceState")},interactiveTransform:function(t,n,r,i){var s=e.data(n,"geoServiceState"),o=t._getContentBounds(),u=o.width,a=o.height,f=u/2,l=a/2,c=[r[0]-f,r[1]-l,r[0]+f,r[1]+l];s&&(this._cancelUnloaded(t,n),s.serviceContainer.children().each(function(n){var s=e(this),o=s.data("pixelSize"),f=o/i;if(o>0){f=Math.round(f*1e3)/1e3;var l=s.data("origin"),c=t._toPixel(l,r,i);s.css({left:Math.round(c[0]),top:Math.round(c[1]),width:u*f,height:a*f})}}))},refresh:function(t,n){var r=e.data(n,"geoServiceState");this._cancelUnloaded(t,n);if(r&&n&&n.style.visibility==="visible"&&!r.serviceContainer.is(":hidden")){var i=t._getBbox(),s=t._pixelSize,o=this,u=r.serviceContainer,a=t._getContentBounds(),f=a.width,l=a.height,c=u.children('[data-pixel-size="'+s+'"]'),h=n.style.opacity,p;h<1&&u.find("img").attr("data-keep-alive","0"),c.size()||(u.append('
                      '),c=u.children(":last"));var d=n.hasOwnProperty("src")?"src":"getUrl",v={bbox:i,width:f,height:l,zoom:t._getZoom(),tile:null,index:0},m=e.isFunction(n[d]),g,y=c.position();y.left=-y.left,y.top=-y.top,m?g=n[d](v):(e.templates("geoSrc",n[d]),g=e.render.geoSrc(v)),r.loadCount++,t._requestQueued(),c.append(''),p=c.children(":last").data("center",t._center),typeof g=="string"?o._loadImage(p,g,s,t,r,h):g.done(function(e){o._loadImage(p,e,s,t,r,h)}).fail(function(){p.remove(),r.loadCount--,t._requestComplete()})}},resize:function(t,n){var r=e.data(n,"geoServiceState");if(r&&n&&n.style.visibility==="visible"){this._cancelUnloaded(t,n);var i=r.serviceContainer,s=t._getContentBounds(),o=s.width,u=s.height,a=i.children();a.attr("data-pixel-size","0"),a.each(function(n){var r=e(this),i=r.position(),s=r.data("origin"),a=t._toPixel(s);r.css({left:i.left+(o-r.width())/2,top:i.top+(u-r.height())/2})})}},opacity:function(t,n){var r=e.data(n,"geoServiceState");r.serviceContainer.find("img").stop(!0).fadeTo("fast",n.style.opacity)},toggle:function(t,n){var r=e.data(n,"geoServiceState");r.serviceContainer.css("display",n.style.visibility==="visible"?"block":"none")},_cancelUnloaded:function(t,n){var r=e.data(n,"geoServiceState");if(r&&r.loadCount>0){r.serviceContainer.find("img:hidden").remove();while(r.loadCount>0)r.loadCount--,t._requestComplete()}},_loadImage:function(t,n,r,i,s,o){var u=s.serviceContainer;t.load(function(t){if(!e.contains(document.body,t.target.jquery?t.target[0]:t.target))return;o<1?e(t.target).fadeTo(0,o):e(t.target).show(),s.loadCount--,i._requestComplete(),s.loadCount<=0&&(u.children(':not([data-pixel-size="'+r+'"])').remove(),u.find("img[data-keep-alive]").remove(),s.loadCount=0)}).error(function(t){if(!e.contains(document.body,t.target.jquery?t.target[0]:t.target))return;e(t.target).remove(),s.loadCount--,i._requestComplete(),s.loadCount<=0&&(u.children(":not([data-pixel-size='"+r+"'])").remove(),s.loadCount=0)}).attr("src",n)}}}()}(jQuery); \ No newline at end of file diff --git a/libs/js/jquery-geo-1.0b2/docs/js/plugins.js b/libs/js/jquery-geo-1.0b2/docs/js/plugins.js deleted file mode 100755 index c1ba19f..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/js/plugins.js +++ /dev/null @@ -1,34 +0,0 @@ - -(function($){ - - - - - - - - - - - -})(this.jQuery); - - - - -window.log = function(){ - log.history = log.history || []; - log.history.push(arguments); - if(this.console){ - console.log( Array.prototype.slice.call(arguments) ); - } -}; -(function(doc){ - var write = doc.write; - doc.write = function(q){ - log('document.write(): ',arguments); - if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments); - }; -})(document); - - diff --git a/libs/js/jquery-geo-1.0b2/docs/js/rainbow-custom.min.js b/libs/js/jquery-geo-1.0b2/docs/js/rainbow-custom.min.js deleted file mode 100755 index 2837315..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/js/rainbow-custom.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/* Rainbow v1.0 rainbowco.de | included languages: generic, javascript, html */ -window.Rainbow=function(){function q(b){var d=b.getAttribute&&b.getAttribute("data-language")||null;if(!d){var b=b.attributes.length,c;for(c=0;c=g[f][c])delete g[f][c],delete i[f][c];if(b>=c&&bc&&d'+d+"
                      "} -function D(b,d){var c=0,e;for(e=1;e0?k():setTimeout(k,0)};if(C(j,u))m();else{var n=v(d.matches),l=function(c,b,e){if(c>=b.length)e(h);else{var f=function(){l(++c,b,e)},g=k[b[c]];if(g){var j=d.matches[b[c]],i=j.language;if(i)w(g,i,function(c){h=h.replace(g,c);f()});else if(typeof j=== -"object")x(g,j.length?j:[j],function(c){h=h.replace(g,c);f()});else{h=y(D(k,b[c]),g,r(j,g),h);f()}}else f()}};l(0,n,function(c){d.name&&(c=r(d.name,c));if(!i[f]){i[f]={};g[f]={}}i[f][j]={replace:k[0],"with":c};g[f][j]=u;m()})}}else e()}function E(b){var d=n[b]||[],c=n[z]||[];return A[b]?d:d.concat(c)}function y(b,d,c,e){return e.substr(0,b)+e.substr(b).replace(d,c)}function v(b){var d=[],c;for(c in b)b.hasOwnProperty(c)&&d.push(c);return d.sort(function(c,b){return b-c})}function x(b,d,c){function e(d, -h){h>>0;c--;)e[c]=d[c];for(c=0;c - - - - - - quickstart | jQuery Geo - - - - - - - - - - - -
                      -
                      -

                      quickstart

                      -
                      - -
                      -

                      The jQuery Geo plugin has one widget, geomap, that you can instantiate on any div with a computable width and height.

                      -

                      html

                      -
                      <div id="map" style="width: 640px; height: 480px;"></div>
                      -<script src="//code.jquery.com/jquery-1.7.2.min.js"></script>
                      -<script src="//code.jquerygeo.com/jquery.geo-1.0b1.min.js"></script>
                      -

                      javascript

                      -
                      $("#map").geomap();
                      -

                      By default, this one line of code will create a fully functional map on your page showing the whole world and using OpenStreetMap data via the mapquest open tile set.

                      -

                      The default units are longitude & latitude degrees which is the most common format for GPS and other online spatial data. You can set the center and zoom of the map at the same time you initialize it by passing a JavaScript object of options.

                      -
                      $("#map").geomap({
                      -  center: [ -71.037598, 42.363281 ],
                      -  zoom: 10
                      -});
                      -

                      Please note that longitude is the first value, x, even though it is commonly spoken second. This plugin does not distinguish between lon/lat and any other x/y coordinate system.

                      -

                      The above example will show the City of Boston. The value passed to the center property is a GeoJSON position, which is an array with an x value followed by a y value.

                      -

                      If you need help determining the center point values the events example can help. Pan and zoom the map to an area and click the location you want. Then copy the coordinates value displayed under the geo argument heading of the click event and paste it into you code.

                      -
                      -
                      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/docs/what/index.html b/libs/js/jquery-geo-1.0b2/docs/what/index.html deleted file mode 100755 index 6515e96..0000000 --- a/libs/js/jquery-geo-1.0b2/docs/what/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - what? | jQuery Geo - - - - - - - - - - - -
                      -
                      -

                      what?

                      -
                      - -
                      -

                      open-source

                      -

                      jQuery Geo is a jQuery plugin, which means it is 100% JavaScript and ties into the popular jQuery library. It helps make interacting with various web mapping servers and tile sets such as Open Street Map, MapBox, WMS, and Esri ArcGIS Server as simple as possible.

                      -

                      Internally, Applied Geographics, Inc. has been developing a JavaScript mapping component over the last five years or so and are proud to give our reasearch to the open-source community.

                      -

                      Our intention is to be a simple & fast approach to a decent percentage of the spatial web's needs.

                      - -

                      geomap widget

                      -

                      The primary component of our geospatial plugin is a single user interface widget that pulls in tiled or dynamic map images from map servers. By default, this component targets Open Street Map data as tiles rendered by mapquest open but can be easilly configured to use other cached tile sets and/or dynamic services.

                      - -
                      - -

                      The map widget includes only what is required to show mapping data and handle direct user interaction with the map. The rest can be handled programmatically by the web developer and any other UI framework they choose, e.g., showing and hiding services, changing the widget's mode, hooking into an external zoom bar, etc.

                      - -

                      geo namespace

                      -

                      Apart from the widget, jQuery Geo has useful geospatial functions in the $.geo namespace. These functions help you calculate bounding boxes, measure the distance between geometries, determine if one geometry contains another, and other functions you might find in the well-known Java Topology Suite. They are all implemented in JavaScript and are included with the rest of jQuery Geo.

                      -
                      -
                      - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/favicon.ico b/libs/js/jquery-geo-1.0b2/favicon.ico deleted file mode 100755 index 5717d042925832b56265211ed57baadef97d1e8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26694 zcmeHQ2V7Lg*58}8VDGUcCK|gY3Pz1BwrGq|V-kCB(b#+J%OW6(h0fBefPknJMFEj! z1VM_TfQkb4E*3;A%=bTY_b#x2AuoA(@ArM*;OuQPXU?5F<(&UHGsj%48Y6q-#9ak;(K&$Yd>Ah|hP{lF2&$AYJRo z5^Bg~hbGHp4Uv!NFRCV!t)C@b>&O;Wm&vZplgT<$nTT@`DIE{riHH9?zsfeKO>>z{ zktvfY**_ZWe)k*>RY)Hd>5AGnP~od-=kTxis(}vD$z2l5|n7Uig<}nU0p-= z%P%|Go;`d1(YSiGDH}S}xYRf2ZJ_V_-+=ReN90}cWY(-*%)-LrKN?r9+QUBl&_Mkj zygg92t|aL1C*D8$$dH+sSTP$LoBxVvZf?!K{BpbW4%8PbXiLgD>Uu9UFtB0v_V)j1 zRH+=8xw##)u(W4(b`Isrwzjqd|5E>>{!lv5`zW3e|1)M-FlT4ye=IsVIWyz!u57{t zTh_bJZq|Q*8F)~!y?fot@vv!=ZK?jCEY*&bQ;7FZJ~3wQ?(TnUbaC-y+qb*3rAt+8 zr|CZC=H^+3{x(Ao*0JLrR;SJm*0ZM<>)O?oRjX!*_prjZD4Uje`}W&C>UYrJQSt@E zc0Xy774!1)`rD$jvp4J8PsId5924bo12$-|9ou1gkS$*9%*Orb&RVtF!)n#q&I}E6 znZG|{etyMl$&ysO!!|Z&juYFr&$|pin>Ra3{UEi3e{sCrxznBb`uhGY(bd(T_0Y9q zjT`S_qemYDzbUA@5Z0ib%l^r@%o+q*XiDxN@{2w`TgjFSmgoLmI2ZGsNv%_rq zbZ0hmrVGZ905)}+8~S1CIaA4&FF%L&@Q%NOkI!2+cWwf!RojHsM!Nd-jabvBCj4FN z)!WGi4h+CJ@5AKsZA@3!k~zBsRme|e{2xDloK+Qv7<*Egkx?F7v?!UU@7}|bZQc^VcI`gMJUm0$u3d-OccbiC_wHsGgDlX- zFn+rnsgxIqwp9Dl^@$TFSXJWcHGcT!rflNGD2&th*zVnTc)PAyvuxcHT^f7p*4+si zz#K=6kzZP4ehMj9&e5Y0%*W>_^YuH%!ouFqhs3Wo|IyLWtSYg4cbd<=nUm8CP1|;L zeTi}0S=}#1zWepJV@}RtY|q{h_Uo_vn59)H_^w(R@8hE~{!g7c#i|lpePqf83^NTtrD%Ol&77hGX4`15?EE@s8KGgb!%H@YGXBq=Jkw zxtwH4Nl8_rQ@X4pM^7_DqagISp!ojY5W zX)_Xyl`8`)%tLgNlQY=YgPb(-=La7cunrw9(a%lQv_$!B>eN`xI3~$Kef#>cVZ)q2 z<6=4bQrX($e{OCr(~i+G7g)=dyI6}BmTdg^lY9=Pd7j#8%T~KtN=jC_JVfJcau(~= z+wKqKPjRj;U;mGJ{m+@}$1*ds%h9il|C={&GVQo-T?ntMl`GS^Tub%i=JpcUKp<<= z)(maoYPmc_!`eEg3i7AOKgs%o2OnaqR;6p&e~T8oAUmIC*RS6wN53-u@7}%3wBy*Z zo}7Po_d?A#rZ!5ljE;^m#`#O-@(_&`D*|~wNv@RIwzm9PtCkVd)l;z=7{hASDj9#w z%wt&I^;;Fvu8jYO4<9n^xM;D+hmp~B-nWPkFR#~p%x{JElbLzFTpprfx+{wFUy=M- zr;Z8J?P<$)?}=s?FN*n-&R)g%dy2WZCa^14ZdFKA;;l0N^YinWb__jsk=3ieo$IA* z*IvXtn+Lrvp37siW(A;}$K~=6jo(jaLq6TXDw02k40U0*Zat_lpLY2bU025cix)4L zcFfOz#=aTu#^>Am^-Ve7)OSaH?}<4wuUvX5e_GlNR1=&Ca=P@Qhp1|-^=8oy!6hG9zA<+J}LkEjuIc* zrD7mUlUz$!vmYTE5`X{8$_yj0FV(RFuE z;e0f1yccv2^FA!VFrd11O;~*VjWX#oGVeoYv*Y*{(Uzi!|G2ZsQ~WW;7M96F7r=kib``1p zh`4SJc$Pv=&J)(4p$S{CAW1`)=sP+-2md?SvSmk@HvjW~3FO$0sp)M^9>UV5Oo_o9 zvV$ci-jvAmV^-D!;0^Yb;BPK$+Oz}g>C;zb^3a8ZHA~#%I*Pu@v16AtX&*c&0DkAf zS_KD76u>{SXEx1;TQbkZFQ7>`>c2c<>_1w%~QzyZ3(1M_uTM zGiM$w*OnTFSy55>en@$#o~T`I-V%X+@5?4n z_GhN3_bb_tv`O>pAwyi%{3};U+>1vMgQh;H9STsd^sS#hqj{z5_tZ{H*Kd&K8PYy_ z^pby*;^MOHtfD+rS5KZ4^8TvbW~B7y=BK5)CtC~bjHQFJv(&Fk_X8>KfBKk-u}b0( zyu;p7Q6QTyZ%0r5o8BQl{yOwmD|OwIt>t||9E<2Zs4bQ55C8Nxps{A-#&D^}_~| zh%d=cH2xEj+ggTH#^oR1r}t1Ape~}s`0suP8V9K??(^^$`2OQJ`)^1gwqcnJjf4Lb z({Zp&_KJ?5%4GR;Y#@{6(y^xcD3{5i=~_ApGMNEg{~tO=)B8&Ak7F)fqkedONk`P% zTe^>W+z>`)R4WcVo&_E+Cga^cf}B#|VQaS)c3`WQQXgG|4b^p|g{G zO|mQbjWooOY;+%gY=m>t|4q5PPxd6j^~ior`U}|(TDG);UBQOqVq}vidzhY{k;bop zWHFMZI&`q)xCUXG-Md?H*^p#J(pAU?M7CqHzmok~PtTIeSA_ZZ?yZ7d--gS)gd-5P zNqQ3LeP4Xxfpq)04*Fw!yJG)yKrpd`|llLOS6W2 zWevNaGxP-)?sK$i)h_OLFlVkax7U;Z1KHn6e6HAIq^NvayohK{k8BzX(@cv*rS~9g`oGk&!jMx5srrw#%67E1h&p# z>b z8^6GDI>JzsfmaiTc<$VJV2au7(xpq#H?MP?iEuKKu?dqPTr4BwI>#7Ezb74(^f=NL zNantF?GeYT2|FbmnQ%VBV+nh_efudRJcuwT(g7X;4-xUbLXM}AuJ`g~5yz)qL+>Uz znq+5;1Qh?3Ae0Ys1b$aMmZ4fcb;%vM@BuE6Rg;6BeKN-IJz?xnN~6v|rH{=nnme z5x@KnZtVK*(>9}aJK_2#o&lH{IU#aqR)0SMO;;=fmg?1Ywku3ti#I zg`d%tr5-B3_ue0;Hq$wkmZp%8bH>e|i6KG0%cWd!?%rg9;+IC?RagMaVOqDrPLxKZ zZ{gzNjz9XPK);LSn^Mw}7gkrNPyKwbGu@YCf)eC#pDGhv97om`eh1ZUR6rw~8Ppob zQxJW*pib`t8HER#*U%k5}PsHg9o?>wK^mO~aQTtY4 z0`J;cKTgrA;|eoZvyrX4e{Uxyq4$-`)#=Z9dM
                      *>>+Ye8PSX>C28%)`}9ox)Qf z{)Ka5@H}_!i~fmeX-QqdbuT;X#VXt>c}8cPKBZ3=$r47eLSZ=iuBVjOON&Btrjk9Rm&kAx5Pg@Ic8-I<0oCFi}Wu` z!5%$9UcG~Zbd5BZ&o9-fRlT;=MSf4LA3Dv(-}#=@WoMkHD=}nWzPP;BAOror&FuLN z@%zGLNa5mo9aK!?F!Abgs7>gV%fU+;_e)AkOK76(_V@mQD9X`j05A z6ZG+^rhIgTU-`;6C!>8Z1us`sd& zqod>Vh~F0JW9ZD!UoGHMr7UcAgJ0QFX{lRk>3ZMDzvO@DCcl}VFVcTW;bg6D263C4 zF3aav8I4*g&^|{z=2w~@kv>cSuU@_UR$ixRtqD2&;?;E>d99|kdc}xWnqQIrt2eLS zynfRO-?nisoxghX#t(HXOn6SGuix ze?7T&-(OnFSMoHG&Fc&rP_55xexafNqEDCPwA6*Q1K#5PQJsY;Y4P1S{TDNv(D#y<8lPWwM1>aaB>+)Ev)4s#jOO9WcO{tzW+jy4v2qB`OrVp$9|XuS0fO zMI7q4U3m`lJsLDn7Oz;b_pQ0P74$RfzcpG~T0tK*2d-d9Jj9f$2eeB4`FQW*rAsY} z9UL5>m;SYAZ%=D89N3mEwoIX~g1%cqZ__60qM9`g=zAE+WE0WSH#P!4$-R1+!avm& zwo|u1747Za+19NN&?!BjM~Zn#$L`(R92kW?unk)_beJW4+uS)_XJ=P7X3SpHfqpjH z)yIgRqx=VJ*E%q7Z|^EcFE4M{Z9G^fU@GKm_0dOWY|2zu;1ssNWcHwZAFj`m{j_su zXZRU8LAMp@6MrbP0A=?ia{%vj2>QG? z$C^I)K*@cfsSL8ScI@cHv94;>3~=sYbLV*?y)Q5)clbOLhGh#p z#v6A3&@%M3%a4qVWEDkkpHPmMk*}n+^&>WJTsZd^p!~IK8{ylU!Cr68zWU0RnVAJ@ zXhcMuK)oGDeTKsxSe~|a`EhY^@GUJL9UYGXWAo%~iR{@XCO0`QICQ8TFd+E6hee~D z6D%w|23Se?{1wrpd)nonIdcZsN%^>ceI;zj*N?aHNt*zO!NBiNH<8^-JW}KXIZbaHTZvb1S7yOG}5} zc?$d|&%;;s0*i@FMteI5%+-PY_FE>$1KYK;MgKTiCZBfsSFT(EMpY91{o`5JZkFgz z;@sD)*-jP`l2j(m`SY3Z$KHps%z*i-*mvK#0Mj)?UC|oOM2?}6Z^hWLVHkf7z<2MG zCck$1d3kwEis9ksfGzLkW6R2w=P}MWvytDq!CxsylO`+cDjPG_gRd(fKRYUeFl{wm zV8j7@Tq3MbPtOx;HzHV0POc`ucKLVi++kAOyg8I()3lC=#uma;zy8_@INc3Rnxv%5 zSR1m3?bvaXr?Izxih2;&Y7y4nrmZ<}auvtNr%v?)2ABgp@3tntcKOh1f$xdY&i*vd zXKwxgYw}*ONt2>rr{51;@PQ^xX4VbNEmj=!CH&IZ_y)#2JGOFFFiTEBS$FQUqoL^- z4>H-kdnNg#GPKKo{`@(U;;q~80fPTVn>H%$*VMbW6V`cLfsOu|Ce6Kjk5MPi+}DDz z_>P_I;ZGk4e6l2sM6aTwcKJm`Metb=V?jY7<}`8L8Tq+;dZuWeNog{(?t(uv&G$Aj zi3S#0s7VK18~hfqXU_{bJ}Tvtj@sozv*Fk&`74}=ysGhGYtX=i#huFI&!jZ@`7gPh zn0#T04%tX<-Fm7?Lo`BxK`&i;1U~Me>~wtD{6t5)d{JLv=pPSRuU?L9&>&hDb{zH= z3+4lioAOY2348J{3xd!moOu7}+SQE>8S19-n;{>SAo#9)`l%)4jN@3F5`=L`#Zppl zYiJN1?eYmfrf>*$>yaZv_!=&1`?NN3+OzIv7-&2^XU1WJ@+s^+k$V=e}sH$ z$oFmH#3)X~+xrdor86;!(eOy+VD5hd9%$}`45BEIe5nEhGuiOrftvCcE6z<=JBg&fJ!)E)V7tyy~<^R5&7@y8RaM-O+lc3oH*+F`Ig zbn0ZoeW%FJo4zMu|I#-+d-f*E*MElcd&*>M>!AFoUcKzmyHA_|`cn z7rLGl^p#X6!~@mC-yI4H#5zM?eTR2Ztvi7R>bHELx`m?MAQvb@G>`{G!QkH%iGD63Z0Yu?-fGK3{xV@me(u3gPw!`{W(erAPn$BNs`+qYM-E?uoK z&RAj1m zgB=iEK*JOFJk_>yZ;X%rNOuS}^MkN!Z-+mp3C1>aoLjTuBdmZOIKqDJ0vXJejUMX= zJGV1m`@3k-Uf7w)tc59fZ#6DOWz^XGfOR_+Dc_&&&D0ib`7 z&Hp6`Ht!(JPeFKg6k}l!?B}6)7REMgjDYTc0&-I{_obaN;}o}(FIbSs<)x)d)4*ps zm+MG&B;8`ehD+f0GWgBLxVeYpE@oy{ICsRk1II!vE#1`EgbUa8O-#sc?hiflFve>? zr15}V*&TLlcgWj5(2x9K%l1XugUrAH>!s;u_7YtP{BX+!pq88nf)} z6H#6Y=Dpux(@upgI~j6d4Av$`LmxVYn27Nxjn5x`u$u=2TtwL!TxJN5ILGHYn!my$ zviaH-(xFM`BOhh*?Ij(Q*1I`4Jmc$mJw0D(?B!9>SzHHANOz0d)6>)QU~|8N zc{-1sKYy3cZ5bK&xmC*zNO(^7Z4$Z5Dg=9}J;^RKefi#a{1fWP*HQ8sxz>k2raZef{#AlR*;BO9g!v>BM zo$qushn=uUQ~59_lTq13uWL&kK|V8j zb=%={zUkU+Hr=KCqIuY+$ELXH)r1;dx(y~B;9agXi_yw62o_t|&iQMgw4OZyJD;%*kDcPHIyR@4tLe*5%8T zA6^+@AFkZcd(zFjcP~xqyKzQsxiCH^x{nvGDgV8DkF0y0PT26%&3li|eH@(-+gYgg zVf%JJUAlMg9v%y@L>_7%6}MvH<0nt9>#g~Hb4RO;M`tcR#^n>dzr3)p;QlA=`{-UM zC@gsVQ?uTk7vrQ5Z4-g=!yZ`JP^j*Ud>dT(*irqwtre&v}Aew>8bu8gytg; zExt8w+RP3iD1J%r6@7kr2kTmg=~H{aWOxVJg>lb{^L;#X$Xxa|)Z^F-;_K=@zdPV( z0s4?o(-&4uwK1(&IzqgJVX+?d5JB*LMpxS5`N8_Ug9$>-AxCb#h45QC+&=yz%-doQ z#Y^H}*+4B%>c5p3qxfTz75>w5N(*oTfedm=8_tvLJyN8YfaJKX(;#~p{A+RREaYn_ z($fCrxbc+^9SkvNZ!aYK!k>wwN7I@qZVP~%tNgYsb){~N8u~@EXYYPPzG{CZE?Ke% z>sJgQ^DBpoWsuIHNS`^={GFqtBj)Kp7p-j^q1W3$ez3)SE9PCk+!E`9NM0uyS2?70 z>+P6h2{V0vba(e;lP23j{xXA{;Q^e`4KkTI_v`!d#|Sohj17G2L>jufv_5X@B$Tsk z;CVJe(=TnVVoV8fd~U9Urmx<$>)-AT*BpOy|uTuAEz^UvJGq^iml+^VCqzR z$Q{9DBH{8rK7o)0d|+GghcBiTaA*VWOXurb%>6E*JMlGKvu2&<`!tOG!2xoGNQY<= zZHhBzI&;53@(q-t7yJhGdOGoZBo`wckA&$HhB0D<6YM8P_ix z^ykiXSNraf|DG7vuJz?u2E99B3Qd}r0HfT;4g^F(PC5?%zLK<3p3+C6DbZiBzzaBR zVwq@c90VEN6W{PEm#tN*<7J+gP9GE;1KBRF%yXhC(OHNM zl>1(melDG-rJZAom-zGYX6fi@tB^T3IA7b4c=vJd`$B! zBO?p`rw6&8>&A^iklP(O?m=tR$WLfYm%CYM)V>}sQwnU3)O7wsG?Fi(!`#gT}g$-XLNbR{# zA0J@EH#E=4UzqS;seN|uVT11z247u&*ryJ%bLVq3X^Eypf77Pp9P1?cP@x~r*Lab? z?>yjIPoF;3JX^Lb7+93pK1qLh@+4pLjPjO_L{p-#P@I5#`I<*#<0!h%b;rB+o@(xs zOxmxXh$jyo>59v{J$l&jHGQo=*~_spx=(WL za_CHL+p75bJ!cmY_rc7H@g^0%)NZgRxs+KSNHit-3PmK5;eNejV;~%E*s#Ma;zTyT z9~E_tV{Y_K2*2O7=>)(3B)^b-)z_V`6?AfX4qxnjn)RXv22nIdV|-97BE60RVTNS) zBKm^{1@N_ZbU!vW7j@&$@jcqBX{(x_r&w>;r;i)=#JvRV8xZ?UdsvlZoIBeKHj7j^jZ%huc z!$ZG*PEN4NYqJGl_RZ3{OF@SG%ub3 zZD2{21!Y$?7HEKUer;p99a$aLz)}mcYvcY$Bbyt9@;N~>{BVM7T7qN$sI)i)fE| z!vfI;>8&AKH~|~7XMMhM<7>qSVSMb{*A;!q4OkJat3bXU`#^sm`o9mJx#PY+pW6vT zA2jG7Fd|pTc_t+DVJ(CSn>~9E&dJtb1ANC0Sid71@vRg40dxOk$TqWQTfk1?0F1{4 z^Y31aJ65obLVj9h%jKQn=%Yi2dZSNy1OM@Y&4aEF1OM@0<0p6ltM&m-L} zkc|%F-a(`fwfcLBoA!b?91lO4}?4rjAtR3>q0T!1YzzuiZLq~Z9N3XFz^|HbF8`8d;+*qB<~CQ z`X|9tH28_bJDx^)30Tu{mhT<6Y?+8J(Y}1^*JpxW7V>3-&Na|MG>B5K!Ek~M>BMEw zZHAtrY-Mo(wvAw5O2>d1ML{l%!rF)krm_pedWa(!+eCTL$48XgNG9|0K8i8&7?)!L zAkUEOCdo!d#?ip2qCq>B<3^5-XE9$U18Yh}x>$_yr}&t5?D%EAZkWbyE2~Eue5dr< z2(qP+O@+pF8k0$uih_MYlATD#Nl7_}>m00m5ao^w7qVdcyrh;XuCds-T*xE2EGH+A zUA=mf&+Rmq6E;KR@x6P`Fpr8j&66iDFyD&vD6PvUtVUY%KwdxxQd@C`hh+}s@Znzff7 zKK^C3T3eV}D+rZ?~=id3lzCurbfm==hX_dEvc|8T^)aLGMV=*z7zj zL0FpSwe5KCLwTor9#d|}%jgsm`2AH%-{5NUgwgA>^Ky2KnUt27cVNuesJy(-@nO93 zaxUendHBgdA@jf*1s${^X68C1FlO4K7i(m2f=bpP0u; zv2R11Nq9oVb`PYWplpLkGEP?(U zlJ<0={bHo_QeBnao09y_BoY1C$xcUs))vxwKjMi3?QKKr18L4KQtJU?enk{Lr}dI{NEE9Yr1X@RVJ09nx#ve+*8e3$_z!am#M+%OJU zuxZn6;fHApInn`k%tP=)^@p752bs+a{nsCI+d-rc;(i`u#suT}F<@>-K_?hAk3en> zMw+9%ebZis6DFL1oEeF-X#K7SD*y=^n*Nk9CpMoj5`r1I}YWZf?Sz|^~2GS z7h@n>p6B*P(r4GM&A|ODYMJmVd}u6STND4^0BdU}X7At(`O5`zp)()LcI@!LwHIt~ zA!wt=ptFTSJ`9K5F9b4OIP7py=!g3um-zyt3j#(K%*UX}$SACVje#(nEIX@(C`1i@M)lT~Xlc&IuI zX$TWeqi=Z_HvF4rAC71$2;cogq5EfbYY!SQ@<&0KFk!;apEs{HvrC@VXS8I6v9TbS^cmE_ zWLp0g28(-jTfIXNHh=YXN0aG&+izR?Ww*6TLC`Z;q`zbP@+~`dtXi{UGUP(t-%Qkt SkT>2?3=IQu_|L', - meta: { - banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %>\n' + - '<%= pkg.homepage ? " * " + pkg.homepage + "\n" : "" %>' + - ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>/<%= pkg.author.company %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' - }, - concat: { - dist: { - src: [ - '', - 'js/excanvas.js', - 'js/jsrender.js', - 'js/jquery.mousewheel.js', - 'js/jquery.ui.widget.js', - 'js/jquery.geo.core.js', - 'js/jquery.geo.geographics.js', - 'js/jquery.geo.geomap.js', - 'js/jquery.geo.tiled.js', - 'js/jquery.geo.shingled.js' - ], - dest: 'docs/<%= pkg.name %>-<%= pkg.version %>.js' - } - }, - min: { - excanvas: { - src: ['js/excanvas.js'], - dest: 'js/excanvas.min.js' - }, - jsrender: { - src: ['js/jsrender.js'], - dest: 'js/jsrender.min.js' - }, - widget: { - src: ['js/jquery.ui.widget.js'], - dest: 'js/jquery.ui.widget.min.js' - }, - dist: { - src: ['', ''], - dest: 'docs/<%= pkg.name %>-<%= pkg.version %>.min.js' - } - }, - qunit: { - files: ['test/**/*.html'] - }, - lint: { - files: ['js/jquery.geo.core.js', 'js/jquery.geo.geographics.js', 'js/jquery.geo.geomap.js', 'js/jquery.geo.shingled.js', 'js/jquery.geo.tiled.js'] - }, - watch: { - files: '', - tasks: 'lint qunit' - }, - jshint: { - options: { - curly: true, - eqeqeq: false, - immed: true, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: false, - boss: true, - eqnull: false, - browser: true - }, - globals: { - jQuery: true - } - }, - uglify: {} - }); - - grunt.registerTask('default', 'lint concat:dist min:dist'); -}; diff --git a/libs/js/jquery-geo-1.0b2/index-full.html b/libs/js/jquery-geo-1.0b2/index-full.html deleted file mode 100755 index aa6442d..0000000 --- a/libs/js/jquery-geo-1.0b2/index-full.html +++ /dev/null @@ -1,511 +0,0 @@ - - - - - jQuery Geo - - - - - - - -
                      -
                      - -

                      jQuery Geowrite less, map more

                      -
                      -
                      -
                      -
                      - - -

                      jQuery Geo - an interactive mapping plugin

                      - -

                      jQuery Geo, an open-source geospatial mapping project from Applied Geographics, provides a streamlined JavaScript API for a large percentage of your online mapping needs. Whether you just want to display a map on a wep page as quickly as possible or you are a more advanced GIS user, jQuery Geo can help!

                      - -

                      You can check back here or follow @jQueryGeo on Twitter for release announcements. Also, head over to the lead developer's Twitter account, @ryanttb, for development info, links, or to ask questions.

                      - -

                      Download

                      - -

                      Using jQuery Geo requires adding one element, including one script (apart from jQuery itself) and calling one function. The following copy-and-paste snippet will help you get started.

                      -
                      <div id="map" style="height: 320px;"></div>
                      -<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
                      -<script src="http://code.jquerygeo.com/jquery.geo-1.0b1.min.js"></script>
                      -<script>$(function() { $( "#map" ).geomap( ); });</script>
                      - -

                      code.jquerygeo.com is on the CloudFlare Content Delivery Network (CDN) so our minified, gzipped library will get to your client as fast as possible!

                      - -

                      Beta 1 released!

                      - - -

                      Over 120 commits and five months after the release of alpha 4, jQuery Geo is now feature complete with what we planned for version 1.0!

                      - -

                      New interaction engine

                      - -

                      User interaction is a big part of an interactive map widget, obviously!, and in beta 1 we have optimized panning, zooming, and how they work together. Your maps should feel more responsive overall.

                      - -

                      Wicked fast mobile

                      - -

                      Using CSS3 features on modern mobile devices brings tremendous speed improvements to iOS and Android.

                      - -

                      New default map

                      - -

                      Probably the most noticable change, jQuery Geo is still using OpenStreetMap data by default but in the form of tiles rendered by mapquest open. It's your same open data but the servers are faster and the cartography is nicer.

                      - -

                      New build environment

                      - -

                      jQuery Geo now builds with grunt from Ben Alman making it 100% lint free, smaller, and supporting the next generation of the jQuery Plugins website.

                      - -

                      Drag modes

                      - -

                      There is a whole new mode style called drag. Previously, draw modes such as drawPoint and drawPolygon, allow the user to perform individual clicks or taps to create shapes. New modes have been added that trigger shape events on a single motion: dragBox and dragCircle. They disable map panning and allow quick digitization of rectangles and circles, great for spatial queries and selecting! They both send GeoJSON Polygon objects as the geo argument to your shape event handler.

                      - -

                      Load events

                      - -

                      Two new events, loadstart and loadend, allow you to display indicators or give feedback to users while map tiles or other images are downloading.

                      - -

                      Forcing refresh

                      - -

                      Sometimes you have time-dependent, continuously updated data and images coming from a map server. New arguments to refresh allow you to get updated images even if the map's viewport (and thus, image URLs) hasn't changed. You can also refresh only specific services that you know will have changed, leaving other more static images in place.

                      - -

                      Zoom level constraints

                      - -

                      Whether you have a tiled or non-tiled (all shingled) map, you can now limit how far in and/or out a user can zoom with the new zoomMax and zoomMin options.

                      - -

                      Breaking

                      - -

                      There is one, small breaking change in how all template strings are processed. This is due to a change (and finalization in the API) to jsRender, which jQuery Geo uses for a service's src template strings and measureLabels template strings. In short, use {{:variable}} where you used to use {{=variable}}. You can read more about this change on Boris Moore's blog post: http://www.borismoore.com/2012/03/approaching-beta-whats-changing-in_06.html.

                      - -

                      Enjoy!

                      - -

                      Thanks for checking out jQuery Geo! We hope you find it useful and will keep you updated as we press on to a 1.0 release!

                      - -

                      Here's the full changelog:

                      - -
                      * geographics - use canvas compositing for Polygons with holes
                      -* geographics - [bug] on polygons with holes, stroke draws a line from exterior ring to interior one
                      -* docs - geomap - trigger a shape event when a user finishes measuring
                      -* geomap - trigger a shape event when a user finishes measuring
                      -* geomap - [bug] elements inside the map div lose their position setting
                      -* geomap - trigger bboxchange when we update the map size after the window resizes
                      -* geomap - [bug] multiple map widgets share the same compiled measureLabels template names and overwrite each other
                      -* examples - inset map/multiple maps example
                      -* geomap - [bug] in zoom mode, dragging from bottom-right to top-left draws box but doesn't zoom
                      -* geomap - [bug] any mouse down triggers refresh, even without pan
                      -* cdn - fix caching
                      -** Cache-Control header max-age set to 5 years
                      -** remove Expires header
                      -* geomap - upgrade to jsrender 1.0pre
                      -* deploy - build releases using grunt
                      -* deploy - make a package for new jQuery plugin directory
                      -** https://github.com/jquery/plugins.jquery.com/blob/master/docs/package.md
                      -* deploy - lint JavaScript files
                      -* docs - geomap - dragBbox mode
                      -* docs - geo - polygonize function for bbox
                      -* geo - polygonize function for bbox
                      -* geomap - dragBbox mode
                      -* docs - geomap - shift option (default, zoom, dragBbox, off)
                      -* geomap - shift option (default, zoom, dragBbox, off)
                      -* docs - geomap - loadstart, loadend events
                      -* docs - geomap - allow append to take an array of shapes
                      -* docs - geomap - allow remove to take an array of shapes
                      -* docs - geomap - improve services option documentation
                      -* geomap - clamp measure labels to [0, 0]
                      -* geo - clamp centroid to bbox
                      -* geomap - measure label for polygon should be in centroid
                      -* geomap - merge interactive pan and zoom into one, faster system (pan/zoom rewrite)
                      -* geomap - [bug] iOS - panning is visually jumpy but settles on the correct bbox in the end
                      -* geomap - pinch-zoom doesn't follow user's fingers close enough when scaling
                      -* geomap - [bug] pinch zoom on iPad 2 (iOS 5) doesn't refresh tiles when zooming out
                      -* geomap - request new image in shingled service during interactive pan
                      -* geomap - [bug] zoom in more than once with zoom method moves tiles to the wrong spot
                      -* geomap - [bug] only services that have finished refreshing move when the user pans
                      -* geomap - [bug] map panning is jumpy, appears to be related to shapes and/or drawing context
                      -* geomap - [bug] pan sometimes lags on first drag
                      -* geomap - tiled data-scaleOrigin should be stored as an array
                      -* geomap - android - [bug] cannot always pan map after appending shapes
                      -* geomap - android - browser stops pan/zoom after 7 logos on logo demo
                      -* geomap - [bug] mouse wheel on bad or missing tile doesn't zoom out on first rotate
                      -* geomap - increase mobile performance by 9000
                      -* docs - geomap - add argument to refresh to force reload of images for dynamic data
                      -* docs - geomap - allow service-level refresh
                      -* docs - geomap - zoomMax option (tiled & shingled)
                      -* docs - geo - include method for bbox
                      -* geomap - bboxMax should reset center & pixelSize
                      -* geomap - [bug] initializing center, zoom, & bbox doesn't set all properties
                      -* geo - [bug] polygonize doesn't return valid polygon when using geodetic coordinates
                      -* geomap - [bug] dragBbox doesn't include the bbox property in the shape
                      -* geomap - dragBbox should send a Point (with bbox) for single clicks
                      -* docs - geomap - dragCircle mode
                      -* geo - include method for bbox
                      -* geomap - dragCircle mode
                      -* geomap - [regression] refresh & toggle methods no longer keep original service objects in sync
                      -* geomap - [bug] when a singled image hasn't loaded after pan and you double click on empty space, the zoomed bbox seems wrong
                      -* geomap - allow service-level refresh
                      -* geographics - remove the blit canvas from the DOM, i.e., don't attach
                      -* geomap - don't initialze service-level geographics until they're used
                      -* geomap - add argument to refresh to force reload of images (in case of dynamic data)
                      -* geomap - loadstart, loadend events
                      -* geomap - allow append to take an array of shapes
                      -* geomap - allow remove to take an array of shapes
                      -* geomap - zoomMax option
                      -* geomap - [bug] cannot interact with other elements on the page on iOS after panning the map (#71)
                      -* geomap - iOS - [bug] after one finger is removed, stop processing as if multitouch is still on
                      -* geomap - dumb high-precision mice down on tiled maps
                      -** otherwise, the high precision rounds down to zero change in zoom
                      -* geomap - use linear distance for pinch zoom calculation
                      -* docs - geomap - zoomMin option
                      -* geomap - zoomMin option
                      -* docs - geomap - use MapQuest Open by default; can't deny that it looks much nicer
                      -* geomap - use MapQuest Open by default; can't deny that it looks much nicer
                      -* docs - geomap - rename dragBbox to dragBox
                      -* geomap - rename dragBbox to dragBox
                      -* geomap - [bug] error using tiled deferred services
                      - -

                      Alpha 4 released!

                      - - -

                      It's been a long three months but we're very happy to announce the release of jQuery Geo 1.0a4! Here are some highlights and details:

                      - -

                      At the service level

                      - -

                      In alpha 3, you could append and interact with shapes on the map. In alpha 4, this is extended to services! Service-level shapes have their own shapeStyle apart from the map's and hide when their service is hidden.

                      - -

                      More modes!

                      - -

                      There are new modes to let you measure distance & area, and a static mode for when you want to display a map but not let users interact with it. Apart from the three new built-in modes, you can also create custom modes to help organize your app.

                      - -

                      What's that? CSS labels!

                      - -

                      You can now give any shape a label when you append it. You can style the label from your regular style sheet using the .geo-label class which opens labeling up to all the design power of CSS3. There's even more potential if you put a class or id on your map service because you can target labels on different services using CSS rules. Also, labels can be any HTML which opens them up to new features in HTML5!

                      - -

                      More service src options

                      - -

                      The old getUrl property has been renamed to src (see Breaking below) and you can now set it to a string template. jQuery Geo will stick your tile row, column, zoom, or image bbox in for you. Services defined as a string are a little easier on the eyes than a function and can be stored as JSON data.

                      - -

                      You can still use a function and the function can now return a jQuery Promise to delay loading of the map image or tile. Want to calculate a Mandlebrot image in a JavaScript web worker without blocking user interaction? Return a new jQuery.Deferred() and call resolve when you're done!

                      - -

                      Mobile

                      - -

                      This version has better mobile support including pinch zoom on iOS and Android 3+ as well as other bug fixes for mobile devices.

                      - -

                      Don't worry about $.geo.proj so much

                      - -

                      You can now send either geodetic (lon, lat) or projected (x, y) coordinates to any library function and it will return accordingly if you stay on the default web mercator projection. You should still set it to null or implement the (to|from)GeodeticPos functions if you need to change projections.

                      - -

                      Breaking

                      - -

                      There is one deprecation (a service object property will be renamed in beta) and one minor breaking change.

                      - -

                      To align this API with HTML itself, the getUrl property on service objects will be renamed to src. Using either src or getUrl will work for this alpha release but getUrl will be removed for beta. Please update any map services to use the new src property when you're defining them.

                      - -

                      Also on service objects, the initial opacity and visibility are in a property of the service object itself named style. Your old services will still function but ones you may expect to be hidden initially will be visible until you update the service object.

                      - -

                      To exemplify both of these changes, instead of:

                      {
                      -  type: "tiled",
                      -  getUrl: function( view ) { return ""; },
                      -  visibility: "hidden"
                      -}
                      you should write:
                      {
                      -  type: "tiled",
                      -  src: function( view ) { return ""; },
                      -  style: { visibility: "hidden" }
                      -}

                      - -

                      Everything else

                      - -

                      With over 60 commits, there are more features and bug fixes to write about. If you dare to click the link below (or read the README file on the project's GitHub page) you can get a better idea of what went into this build. This is the last alpha release (!) and the path to beta will add unit testing, a better build process, and smaller, more refined source code. Thanks for all your support!

                      - -
                      * geomap - [bug] changing the tilingScheme doesn't update pixelSize, maxPixelSize, center or centerMax
                      -* geomap - [bug] shingled services throw exception during resize
                      -* docs - geomap - axisLayout option
                      -* geomap - axisLayout option
                      -* docs - upgrade to jQuery Mobile rc3
                      -* docs - allow page refreshing
                      -* docs - geomap - more modes: measureDistance, measureArea, static
                      -* docs - geomap - append label argument
                      -* docs - geomap - toPixel/toMap should take all coordinate dimensions like the proj functions
                      -* geomap - toPixel/toMap should take all coordinate dimensions like the proj functions
                      -* geomap - move the drawing container instead of individual points during pan
                      -* geomap - [bug] drawStyle resets after window resize
                      -* geomap - append label argument
                      -* docs - geomap - measureLabels option
                      -* geomap - measureLabels option
                      -* geomap - measureDistance mode
                      -* geomap - measureArea mode
                      -* docs - geomap - service-level shapeStyle
                      -* docs - geomap - getUrl string option
                      -* geomap - [bug] create doesn't clear drawing shapes
                      -* docs - geomap - service-level shapes
                      -* docs - geo - detect geodetic coordinates and call $.geo.proj automatically, don't require devs to set $.geo.proj to null
                      -* docs - geomap - add projection section explaining how bbox & center affect map unit type
                      -* docs - geomap - rename getUrl to src
                      -* docs - geomap - scroll option
                      -* docs - geomap - pannable option
                      -* geomap - src string option
                      -* examples - string service src
                      -* geomap - [bug] map tracks mouse when not panning if click on other elements
                      -* geomap - pannable option
                      -* geomap - scroll option
                      -* geomap - [bug] shapesContainer is being cleared twice during mouse wheel zoom
                      -* geomap - support pinch zoom on iOS
                      -* docs - geo - add recenter function for bbox
                      -* geomap - static mode
                      -* docs - geomap - allow Deferred or Promise as return value from src function
                      -* geomap - [bug] widget factory merges first service with default sometimes causing exceptions with shingled services
                      -* geomap - allow Deferred or Promise as return value from src function
                      -* geomap - [bug] resize event triggered too many times during resize
                      -* geomap - service-level shapes
                      -* geomap - service-level find
                      -* geographics - add a resize method, call from geomap.resize
                      -* geo - add recenter function for bbox
                      -* geomap - [bug] errors creating second un-tiled map after destroying a first on same element
                      -* geomap - refresh shouldn't request new images if the map element is hidden
                      -* geomap - [bug] delayed multitouch isn't nearly as smooth as true multitouch
                      -* geomap - [bug] tiled pinch zoom isn't smooth
                      -* geo - detect geodetic coordinates and call $.geo.proj automatically, don't require devs to set $.geo.proj to null
                      -* geomap - [bug] mouse wheel doesn't work with jQuery 1.7
                      -** upgrade to latest jquery.mousewheel plugin
                      -* geomap - service object visibility and opacity options should be moved to a style property
                      -* geomap - use _currentServices in all functions unless we actually need to update the public options services object
                      -* geomap - don't change user's service objects in opacity/toggle
                      -* geomap - show attr text
                      -* docs - geomap - selector argument to find method
                      -* geomap - selector argument to find method
                      -* geomap - pan mode should use a hand cursor by default
                      -* geomap - [bug] only services that have finished refreshing move when the user pans
                      -** for a4: hide unfinished services
                      -* geomap - [bug] a user can mess with the center option, e.g., convert numbers to strings, and it can wreck havoc with map state
                      -* geomap - [bug] zoom option doesn't return proper values for shingled services
                      -* geomap - [bug] non-tiled maps can zoom out past zoom 0
                      -* geomap - don't request tiles that are -y index
                      -* geomap - [bug] initializing tiled map by non-geodetic bbox always causes zoom level 0
                      -* docs - geomap - empty string needed for label element
                      -* geomap - [bug] double tap to end shapes adds two points before ending the shape, in different places
                      -* geomap - [bug] lifting fingers after pinch zoom in drawLineString or drawPolygon modes sometimes adds fake visual coordinate on touch point last lifted
                      -* docs - upgrade to jQuery 1.7.2
                      -* geomap - [bug] scroll=off doesn't zoom map but also doesn't allow document scroll
                      -* geomap - [bug] changing mode does not reset measure drawing
                      -* geomap - [bug] jQuery UI Widget Factory no longer passes pageX & pageY event properties during _trigger when using jQuery 1.7
                      -** upgrade to Widget Factory 1.8.17
                      -* examples - all demo (shingled)
                      -* docs - geomap - custom modes
                      -* examples - all demo (tiled)
                      - -

                      Alpha 3 released!

                      - - -

                      jQuery Geo 1.0 Alpha 3 is mostly about sketching!

                      -
                        -
                      • new modes: drawPoint, drawLineString, and drawPolygon allow users to draw on your map
                      • -
                      • new event: shape triggers anytime a user draws a feature
                      • -
                      • new style option: drawStyle lets you change how the shapes look while being drawn
                      • -
                      -

                      It's also about geometry functions!

                      -
                        -
                      • $.geo's center, height/width, expandBy, scaleBy & reaspect functions operate on bounding boxes
                      • -
                      • $.geo's bbox, distance, contains & centroid functions operate on geometries
                      • -
                      -

                      Many examples have more class and now link to jsFiddles to further explain what's going on!

                      -

                      And a tiny bit about size

                      -

                      jQuery Geo is now hosted on a CDN with gzip enabled bringing the entire library to your neighborhood at under 18k.

                      -

                      Breaking

                      -

                      There are some minor breaking changes to make the API more consistent.

                      -
                        -
                      • The getPixelSize function is now a read-only option named pixelSize:
                        $( "#map" ).geomap( "option", "pixelSize" );
                      • -
                      • The shapeStyle function is also now an option, e.g.:
                        $( "#map" ).geomap( "option", "shapeStyle", { color: "red" } );
                      • -
                      • - The boolean visible property on service objects is now the visibility property found in CSS and geomap styles and can be "visible" or "hidden": -
                        $( "#map" ).geomap( { services: [ { id: "roads", visibility: "hidden", ... } ] } );
                        -
                      • -
                      - -

                      Edge

                      -

                      The links above will always point to the latest stable release. However, you can test the most recently committed docs, code & demos by heading over to the test release.

                      - Test docs & demos - -

                      Thanks!

                      - -
                        -
                      • - - -
                      • - -
                      • - - -
                      • - -
                      • - - -
                      • - -
                      • - - -
                      • - -
                      • - - -
                      • -
                      - - -
                      -
                      - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/index.html b/libs/js/jquery-geo-1.0b2/index.html deleted file mode 100755 index 6556490..0000000 --- a/libs/js/jquery-geo-1.0b2/index.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - jQuery Geo - JavaScript mapping API - - - - - - - -
                      -
                      - -

                      jQuery Geowrite less, map more

                      -
                      -
                      -
                      -
                      - - - - - - - -

                      jQuery Geo - a JavaScript mapping API

                      - -

                      jQuery Geo, an open-source geospatial mapping project from Applied Geographics, provides a streamlined JavaScript API for a large percentage of your online mapping needs. Whether you just want to display a map on a wep page as quickly as possible or you are a more advanced GIS user, jQuery Geo can help!

                      - -

                      You can check back here or follow @jQueryGeo on Twitter for release announcements. Also, head over to the lead developer's Twitter account, @ryanttb, for development info, links, or to ask questions.

                      - -

                      Download

                      - -

                      Using jQuery Geo requires adding one element, including one script (apart from jQuery itself) and calling one function. The following copy-and-paste snippet will help you get started.

                      -
                      <div id="map" style="height: 320px;"></div>
                      -<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
                      -<script src="http://code.jquerygeo.com/jquery.geo-1.0b1.min.js"></script>
                      -<script>$(function() { $( "#map" ).geomap( ); });</script>
                      - -

                      code.jquerygeo.com is on the CloudFlare Content Delivery Network (CDN) so our minified, gzipped library will get to your client as fast as possible!

                      - -

                      Beta 1 released!

                      - - -

                      Over 120 commits and five months after the release of alpha 4, jQuery Geo is now feature complete with what we planned for version 1.0!

                      - -

                      The highlights are mentioned here and you can follow the link at the end to read more details.

                      - -

                      New interaction engine

                      - -

                      User interaction is a big part of an interactive map widget, obviously!, and in beta 1 we have optimized panning, zooming, and how they work together. Your maps should feel more responsive overall.

                      - -

                      Wicked fast mobile

                      - -

                      Using CSS3 features on modern mobile devices brings tremendous speed improvements to iOS and Android.

                      - -

                      New default map

                      - -

                      Probably the most noticable change, jQuery Geo is still using OpenStreetMap data by default but in the form of tiles rendered by mapquest open. It's your same open data but the servers are faster and the cartography is nicer.

                      - -

                      New build environment

                      - -

                      jQuery Geo now builds with grunt from Ben Alman making it 100% lint free, smaller, and supporting the next generation of the jQuery Plugins website.

                      - -

                      Drag modes

                      - -

                      There is a whole new mode style called drag. Previously, draw modes such as drawPoint and drawPolygon, allow the user to perform individual clicks or taps to create shapes. New modes have been added that trigger shape events on a single motion: dragBox and dragCircle. They disable map panning and allow quick digitization of rectangles and circles, great for spatial queries and selecting! They both send GeoJSON Polygon objects as the geo argument to your shape event handler.

                      - -

                      Load events

                      - -

                      Two new events, loadstart and loadend, allow you to display indicators or give feedback to users while map tiles or other images are downloading.

                      - -

                      Forcing refresh

                      - -

                      Sometimes you have time-dependent, continuously updated data and images coming from a map server. New arguments to refresh allow you to get updated images even if the map's viewport (and thus, image URLs) hasn't changed. You can also refresh only specific services that you know will have changed, leaving other more static images in place.

                      - -

                      Zoom level constraints

                      - -

                      Whether you have a tiled or non-tiled (all shingled) map, you can now limit how far in and/or out a user can zoom with the new zoomMax and zoomMin options.

                      - -

                      Breaking

                      - -

                      There is one, small breaking change in how all template strings are processed. This is due to a change (and finalization in the API) to jsRender, which jQuery Geo uses for a service's src template strings and measureLabels template strings. In short, use {{:variable}} where you used to use {{=variable}}. You can read more about this change on Boris Moore's blog post: http://www.borismoore.com/2012/03/approaching-beta-whats-changing-in_06.html.

                      - -

                      Enjoy!

                      - -

                      Thanks for checking out jQuery Geo! We hope you find it useful and will keep you updated as we press on to a 1.0 release!

                      - -

                      Click here to checkout the full changelog

                      - -

                      Edge

                      -

                      The links above will always point to the latest stable release. However, you can test the most recently committed docs, code & demos by heading over to the test release.

                      - Test docs & demos - -

                      Thanks!

                      - -
                        -
                      • - - -
                      • - -
                      • - - -
                      • - -
                      • - - -
                      • - -
                      • - - -
                      • - -
                      • - - -
                      • -
                      - - -
                      -
                      - - - - - - - - - - - - diff --git a/libs/js/jquery-geo-1.0b2/js/excanvas.js b/libs/js/jquery-geo-1.0b2/js/excanvas.js deleted file mode 100755 index f40af96..0000000 --- a/libs/js/jquery-geo-1.0b2/js/excanvas.js +++ /dev/null @@ -1,1417 +0,0 @@ -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// Known Issues: -// -// * Patterns only support repeat. -// * Radial gradient are not implemented. The VML version of these look very -// different from the canvas one. -// * Clipping paths are not implemented. -// * Coordsize. The width and height attribute have higher priority than the -// width and height style values which isn't correct. -// * Painting mode isn't implemented. -// * Canvas width/height should is using content-box by default. IE in -// Quirks mode will draw the canvas using border-box. Either change your -// doctype to HTML5 -// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) -// or use Box Sizing Behavior from WebFX -// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) -// * Non uniform scaling does not correctly scale strokes. -// * Optimize. There is always room for speed improvements. - -// Only add this code if we do not already have a canvas implementation -if (!document.createElement('canvas').getContext) { - - (function () { - - // alias some functions to make (compiled) code shorter - var m = Math; - var mr = m.round; - var ms = m.sin; - var mc = m.cos; - var abs = m.abs; - var sqrt = m.sqrt; - - // this is used for sub pixel precision - var Z = 10; - var Z2 = Z / 2; - - var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1]; - - /** - * This funtion is assigned to the elements as element.getContext(). - * @this {HTMLElement} - * @return {CanvasRenderingContext2D_} - */ - function getContext() { - return this.context_ || - (this.context_ = new CanvasRenderingContext2D_(this)); - } - - var slice = Array.prototype.slice; - - /** - * Binds a function to an object. The returned function will always use the - * passed in {@code obj} as {@code this}. - * - * Example: - * - * g = bind(f, obj, a, b) - * g(c, d) // will do f.call(obj, a, b, c, d) - * - * @param {Function} f The function to bind the object to - * @param {Object} obj The object that should act as this when the function - * is called - * @param {*} var_args Rest arguments that will be used as the initial - * arguments when the function is called - * @return {Function} A new function that has bound this - */ - function bind(f, obj, var_args) { - var a = slice.call(arguments, 2); - return function () { - return f.apply(obj, a.concat(slice.call(arguments))); - }; - } - - function encodeHtmlAttribute(s) { - return String(s).replace(/&/g, '&').replace(/"/g, '"'); - } - - function addNamespace(doc, prefix, urn) { - if (!doc.namespaces[prefix]) { - doc.namespaces.add(prefix, urn, '#default#VML'); - } - } - - function addNamespacesAndStylesheet(doc) { - addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml'); - addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office'); - - // Setup default CSS. Only add one style sheet per document - if (!doc.styleSheets['ex_canvas_']) { - var ss = doc.createStyleSheet(); - ss.owningElement.id = 'ex_canvas_'; - ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + - // default size is 300x150 in Gecko and Opera - 'text-align:left;width:300px;height:150px}'; - } - } - - // Add namespaces and stylesheet at startup. - addNamespacesAndStylesheet(document); - - var G_vmlCanvasManager_ = { - init: function (opt_doc) { - var doc = opt_doc || document; - // Create a dummy element so that IE will allow canvas elements to be - // recognized. - doc.createElement('canvas'); - doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); - }, - - init_: function (doc) { - // find all canvas elements - var els = doc.getElementsByTagName('canvas'); - for (var i = 0; i < els.length; i++) { - this.initElement(els[i]); - } - }, - - /** - * Public initializes a canvas element so that it can be used as canvas - * element from now on. This is called automatically before the page is - * loaded but if you are creating elements using createElement you need to - * make sure this is called on the element. - * @param {HTMLElement} el The canvas element to initialize. - * @return {HTMLElement} the element that was created. - */ - initElement: function (el) { - if (!el.getContext) { - el.getContext = getContext; - - // Add namespaces and stylesheet to document of the element. - addNamespacesAndStylesheet(el.ownerDocument); - - // Remove fallback content. There is no way to hide text nodes so we - // just remove all childNodes. We could hide all elements and remove - // text nodes but who really cares about the fallback content. - el.innerHTML = ''; - - // do not use inline function because that will leak memory - el.attachEvent('onpropertychange', onPropertyChange); - el.attachEvent('onresize', onResize); - - var attrs = el.attributes; - if (attrs.width && attrs.width.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setWidth_(attrs.width.nodeValue); - el.style.width = attrs.width.nodeValue + 'px'; - } else { - el.width = el.clientWidth; - } - if (attrs.height && attrs.height.specified) { - // TODO: use runtimeStyle and coordsize - // el.getContext().setHeight_(attrs.height.nodeValue); - el.style.height = attrs.height.nodeValue + 'px'; - } else { - el.height = el.clientHeight; - } - //el.getContext().setCoordsize_() - } - return el; - } - }; - - function onPropertyChange(e) { - var el = e.srcElement; - - switch (e.propertyName) { - case 'width': - el.getContext().clearRect(); - el.style.width = el.attributes.width.nodeValue + 'px'; - // In IE8 this does not trigger onresize. - el.firstChild.style.width = el.clientWidth + 'px'; - break; - case 'height': - el.getContext().clearRect(); - el.style.height = el.attributes.height.nodeValue + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - break; - } - } - - function onResize(e) { - var el = e.srcElement; - if (el.firstChild) { - el.firstChild.style.width = el.clientWidth + 'px'; - el.firstChild.style.height = el.clientHeight + 'px'; - } - } - - G_vmlCanvasManager_.init(); - - // precompute "00" to "FF" - var decToHex = []; - for (var i = 0; i < 16; i++) { - for (var j = 0; j < 16; j++) { - decToHex[i * 16 + j] = i.toString(16) + j.toString(16); - } - } - - function createMatrixIdentity() { - return [ - [1, 0, 0], - [0, 1, 0], - [0, 0, 1] - ]; - } - - function matrixMultiply(m1, m2) { - var result = createMatrixIdentity(); - - for (var x = 0; x < 3; x++) { - for (var y = 0; y < 3; y++) { - var sum = 0; - - for (var z = 0; z < 3; z++) { - sum += m1[x][z] * m2[z][y]; - } - - result[x][y] = sum; - } - } - return result; - } - - function copyState(o1, o2) { - o2.fillStyle = o1.fillStyle; - o2.lineCap = o1.lineCap; - o2.lineJoin = o1.lineJoin; - o2.lineWidth = o1.lineWidth; - o2.miterLimit = o1.miterLimit; - o2.shadowBlur = o1.shadowBlur; - o2.shadowColor = o1.shadowColor; - o2.shadowOffsetX = o1.shadowOffsetX; - o2.shadowOffsetY = o1.shadowOffsetY; - o2.strokeStyle = o1.strokeStyle; - o2.globalAlpha = o1.globalAlpha; - o2.font = o1.font; - o2.textAlign = o1.textAlign; - o2.textBaseline = o1.textBaseline; - o2.arcScaleX_ = o1.arcScaleX_; - o2.arcScaleY_ = o1.arcScaleY_; - o2.lineScale_ = o1.lineScale_; - } - - // var colorData = { - // aliceblue: '#F0F8FF', - // antiquewhite: '#FAEBD7', - // aquamarine: '#7FFFD4', - // azure: '#F0FFFF', - // beige: '#F5F5DC', - // bisque: '#FFE4C4', - // black: '#000000', - // blanchedalmond: '#FFEBCD', - // blueviolet: '#8A2BE2', - // brown: '#A52A2A', - // burlywood: '#DEB887', - // cadetblue: '#5F9EA0', - // chartreuse: '#7FFF00', - // chocolate: '#D2691E', - // coral: '#FF7F50', - // cornflowerblue: '#6495ED', - // cornsilk: '#FFF8DC', - // crimson: '#DC143C', - // cyan: '#00FFFF', - // darkblue: '#00008B', - // darkcyan: '#008B8B', - // darkgoldenrod: '#B8860B', - // darkgray: '#A9A9A9', - // darkgreen: '#006400', - // darkgrey: '#A9A9A9', - // darkkhaki: '#BDB76B', - // darkmagenta: '#8B008B', - // darkolivegreen: '#556B2F', - // darkorange: '#FF8C00', - // darkorchid: '#9932CC', - // darkred: '#8B0000', - // darksalmon: '#E9967A', - // darkseagreen: '#8FBC8F', - // darkslateblue: '#483D8B', - // darkslategray: '#2F4F4F', - // darkslategrey: '#2F4F4F', - // darkturquoise: '#00CED1', - // darkviolet: '#9400D3', - // deeppink: '#FF1493', - // deepskyblue: '#00BFFF', - // dimgray: '#696969', - // dimgrey: '#696969', - // dodgerblue: '#1E90FF', - // firebrick: '#B22222', - // floralwhite: '#FFFAF0', - // forestgreen: '#228B22', - // gainsboro: '#DCDCDC', - // ghostwhite: '#F8F8FF', - // gold: '#FFD700', - // goldenrod: '#DAA520', - // grey: '#808080', - // greenyellow: '#ADFF2F', - // honeydew: '#F0FFF0', - // hotpink: '#FF69B4', - // indianred: '#CD5C5C', - // indigo: '#4B0082', - // ivory: '#FFFFF0', - // khaki: '#F0E68C', - // lavender: '#E6E6FA', - // lavenderblush: '#FFF0F5', - // lawngreen: '#7CFC00', - // lemonchiffon: '#FFFACD', - // lightblue: '#ADD8E6', - // lightcoral: '#F08080', - // lightcyan: '#E0FFFF', - // lightgoldenrodyellow: '#FAFAD2', - // lightgreen: '#90EE90', - // lightgrey: '#D3D3D3', - // lightpink: '#FFB6C1', - // lightsalmon: '#FFA07A', - // lightseagreen: '#20B2AA', - // lightskyblue: '#87CEFA', - // lightslategray: '#778899', - // lightslategrey: '#778899', - // lightsteelblue: '#B0C4DE', - // lightyellow: '#FFFFE0', - // limegreen: '#32CD32', - // linen: '#FAF0E6', - // magenta: '#FF00FF', - // mediumaquamarine: '#66CDAA', - // mediumblue: '#0000CD', - // mediumorchid: '#BA55D3', - // mediumpurple: '#9370DB', - // mediumseagreen: '#3CB371', - // mediumslateblue: '#7B68EE', - // mediumspringgreen: '#00FA9A', - // mediumturquoise: '#48D1CC', - // mediumvioletred: '#C71585', - // midnightblue: '#191970', - // mintcream: '#F5FFFA', - // mistyrose: '#FFE4E1', - // moccasin: '#FFE4B5', - // navajowhite: '#FFDEAD', - // oldlace: '#FDF5E6', - // olivedrab: '#6B8E23', - // orange: '#FFA500', - // orangered: '#FF4500', - // orchid: '#DA70D6', - // palegoldenrod: '#EEE8AA', - // palegreen: '#98FB98', - // paleturquoise: '#AFEEEE', - // palevioletred: '#DB7093', - // papayawhip: '#FFEFD5', - // peachpuff: '#FFDAB9', - // peru: '#CD853F', - // pink: '#FFC0CB', - // plum: '#DDA0DD', - // powderblue: '#B0E0E6', - // rosybrown: '#BC8F8F', - // royalblue: '#4169E1', - // saddlebrown: '#8B4513', - // salmon: '#FA8072', - // sandybrown: '#F4A460', - // seagreen: '#2E8B57', - // seashell: '#FFF5EE', - // sienna: '#A0522D', - // skyblue: '#87CEEB', - // slateblue: '#6A5ACD', - // slategray: '#708090', - // slategrey: '#708090', - // snow: '#FFFAFA', - // springgreen: '#00FF7F', - // steelblue: '#4682B4', - // tan: '#D2B48C', - // thistle: '#D8BFD8', - // tomato: '#FF6347', - // turquoise: '#40E0D0', - // violet: '#EE82EE', - // wheat: '#F5DEB3', - // whitesmoke: '#F5F5F5', - // yellowgreen: '#9ACD32' - // }; - - - function getRgbHslContent(styleString) { - var start = styleString.indexOf('(', 3); - var end = styleString.indexOf(')', start + 1); - var parts = styleString.substring(start + 1, end).split(','); - // add alpha if needed - if (parts.length != 4 || styleString.charAt(3) != 'a') { - parts[3] = 1; - } - return parts; - } - - function percent(s) { - return parseFloat(s) / 100; - } - - function clamp(v, min, max) { - return Math.min(max, Math.max(min, v)); - } - - function hslToRgb(parts) { - var r, g, b, h, s, l; - h = parseFloat(parts[0]) / 360 % 360; - if (h < 0) - h++; - s = clamp(percent(parts[1]), 0, 1); - l = clamp(percent(parts[2]), 0, 1); - if (s == 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hueToRgb(p, q, h + 1 / 3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1 / 3); - } - - return '#' + decToHex[Math.floor(r * 255)] + - decToHex[Math.floor(g * 255)] + - decToHex[Math.floor(b * 255)]; - } - - function hueToRgb(m1, m2, h) { - if (h < 0) - h++; - if (h > 1) - h--; - - if (6 * h < 1) - return m1 + (m2 - m1) * 6 * h; - else if (2 * h < 1) - return m2; - else if (3 * h < 2) - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - else - return m1; - } - - var processStyleCache = {}; - - function processStyle(styleString) { - if (styleString in processStyleCache) { - return processStyleCache[styleString]; - } - - var str, alpha = 1; - - styleString = String(styleString); - if (styleString.charAt(0) == '#') { - str = styleString; - } else if (/^rgb/.test(styleString)) { - var parts = getRgbHslContent(styleString); - var str = '#', n; - for (var i = 0; i < 3; i++) { - if (parts[i].indexOf('%') != -1) { - n = Math.floor(percent(parts[i]) * 255); - } else { - n = +parts[i]; - } - str += decToHex[clamp(n, 0, 255)]; - } - alpha = +parts[3]; - } else if (/^hsl/.test(styleString)) { - var parts = getRgbHslContent(styleString); - str = hslToRgb(parts); - alpha = parts[3]; - } else { - str = /*colorData[styleString] ||*/styleString; - } - return processStyleCache[styleString] = { color: str, alpha: alpha }; - } - - var DEFAULT_STYLE = { - style: 'normal', - variant: 'normal', - weight: 'normal', - size: 10, - family: 'sans-serif' - }; - - // Internal text style cache - // var fontStyleCache = {}; - - // function processFontStyle(styleString) { - // if (fontStyleCache[styleString]) { - // return fontStyleCache[styleString]; - // } - - // var el = document.createElement('div'); - // var style = el.style; - // try { - // style.font = styleString; - // } catch (ex) { - // // Ignore failures to set to invalid font. - // } - - // return fontStyleCache[styleString] = { - // style: style.fontStyle || DEFAULT_STYLE.style, - // variant: style.fontVariant || DEFAULT_STYLE.variant, - // weight: style.fontWeight || DEFAULT_STYLE.weight, - // size: style.fontSize || DEFAULT_STYLE.size, - // family: style.fontFamily || DEFAULT_STYLE.family - // }; - // } - - // function getComputedStyle(style, element) { - // var computedStyle = {}; - - // for (var p in style) { - // computedStyle[p] = style[p]; - // } - - // // Compute the size - // var canvasFontSize = parseFloat(element.currentStyle.fontSize), - // fontSize = parseFloat(style.size); - - // if (typeof style.size == 'number') { - // computedStyle.size = style.size; - // } else if (style.size.indexOf('px') != -1) { - // computedStyle.size = fontSize; - // } else if (style.size.indexOf('em') != -1) { - // computedStyle.size = canvasFontSize * fontSize; - // } else if(style.size.indexOf('%') != -1) { - // computedStyle.size = (canvasFontSize / 100) * fontSize; - // } else if (style.size.indexOf('pt') != -1) { - // computedStyle.size = fontSize / .75; - // } else { - // computedStyle.size = canvasFontSize; - // } - - // // Different scaling between normal text and VML text. This was found using - // // trial and error to get the same size as non VML text. - // computedStyle.size *= 0.981; - - // return computedStyle; - // } - - // function buildStyle(style) { - // return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + - // style.size + 'px ' + style.family; - // } - - var lineCapMap = { - 'butt': 'flat', - 'round': 'round' - }; - - function processLineCap(lineCap) { - return lineCapMap[lineCap] || 'square'; - } - - /** - * This class implements CanvasRenderingContext2D interface as described by - * the WHATWG. - * @param {HTMLElement} canvasElement The element that the 2D context should - * be associated with - */ - function CanvasRenderingContext2D_(canvasElement) { - this.m_ = createMatrixIdentity(); - - this.mStack_ = []; - this.aStack_ = []; - this.currentPath_ = []; - - // Canvas context properties - this.strokeStyle = '#000'; - this.fillStyle = '#000'; - - this.lineWidth = 1; - this.lineJoin = 'miter'; - this.lineCap = 'butt'; - this.miterLimit = Z * 1; - this.globalAlpha = 1; - //this.font = '10px sans-serif'; - //this.textAlign = 'left'; - //this.textBaseline = 'alphabetic'; - this.canvas = canvasElement; - - var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' + - canvasElement.clientHeight + 'px;overflow:hidden;position:absolute'; - var el = canvasElement.ownerDocument.createElement('div'); - el.style.cssText = cssText; - canvasElement.appendChild(el); - - var overlayEl = el.cloneNode(false); - // Use a non transparent background. - overlayEl.style.backgroundColor = 'red'; - overlayEl.style.filter = 'alpha(opacity=0)'; - canvasElement.appendChild(overlayEl); - - this.element_ = el; - this.arcScaleX_ = 1; - this.arcScaleY_ = 1; - this.lineScale_ = 1; - } - - var contextPrototype = CanvasRenderingContext2D_.prototype; - contextPrototype.clearRect = function () { - if (this.textMeasureEl_) { - this.textMeasureEl_.removeNode(true); - this.textMeasureEl_ = null; - } - this.element_.innerHTML = ''; - }; - - contextPrototype.beginPath = function () { - // TODO: Branch current matrix so that save/restore has no effect - // as per safari docs. - this.currentPath_ = []; - }; - - contextPrototype.moveTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'moveTo', x: p.x, y: p.y }); - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.lineTo = function (aX, aY) { - var p = getCoords(this, aX, aY); - this.currentPath_.push({ type: 'lineTo', x: p.x, y: p.y }); - - this.currentX_ = p.x; - this.currentY_ = p.y; - }; - - contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, - aCP2x, aCP2y, - aX, aY) { - var p = getCoords(this, aX, aY); - var cp1 = getCoords(this, aCP1x, aCP1y); - var cp2 = getCoords(this, aCP2x, aCP2y); - bezierCurveTo(this, cp1, cp2, p); - }; - - // Helper function that takes the already fixed cordinates. - function bezierCurveTo(self, cp1, cp2, p) { - self.currentPath_.push({ - type: 'bezierCurveTo', - cp1x: cp1.x, - cp1y: cp1.y, - cp2x: cp2.x, - cp2y: cp2.y, - x: p.x, - y: p.y - }); - self.currentX_ = p.x; - self.currentY_ = p.y; - } - - contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { - // the following is lifted almost directly from - // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes - - var cp = getCoords(this, aCPx, aCPy); - var p = getCoords(this, aX, aY); - - var cp1 = { - x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), - y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) - }; - var cp2 = { - x: cp1.x + (p.x - this.currentX_) / 3.0, - y: cp1.y + (p.y - this.currentY_) / 3.0 - }; - - bezierCurveTo(this, cp1, cp2, p); - }; - - contextPrototype.arc = function (aX, aY, aRadius, - aStartAngle, aEndAngle, aClockwise) { - aRadius *= Z; - var arcType = aClockwise ? 'at' : 'wa'; - - var xStart = aX + mc(aStartAngle) * aRadius - Z2; - var yStart = aY + ms(aStartAngle) * aRadius - Z2; - - var xEnd = aX + mc(aEndAngle) * aRadius - Z2; - var yEnd = aY + ms(aEndAngle) * aRadius - Z2; - - // IE won't render arches drawn counter clockwise if xStart == xEnd. - if (xStart == xEnd && !aClockwise) { - xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something - // that can be represented in binary - } - - var p = getCoords(this, aX, aY); - var pStart = getCoords(this, xStart, yStart); - var pEnd = getCoords(this, xEnd, yEnd); - - this.currentPath_.push({ type: arcType, - x: p.x, - y: p.y, - radius: aRadius, - xStart: pStart.x, - yStart: pStart.y, - xEnd: pEnd.x, - yEnd: pEnd.y - }); - - }; - - // contextPrototype.rect = function(aX, aY, aWidth, aHeight) { - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // }; - - // contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.stroke(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { - // var oldPath = this.currentPath_; - // this.beginPath(); - - // this.moveTo(aX, aY); - // this.lineTo(aX + aWidth, aY); - // this.lineTo(aX + aWidth, aY + aHeight); - // this.lineTo(aX, aY + aHeight); - // this.closePath(); - // this.fill(); - - // this.currentPath_ = oldPath; - // }; - - // contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { - // var gradient = new CanvasGradient_('gradient'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // return gradient; - // }; - - // contextPrototype.createRadialGradient = function(aX0, aY0, aR0, - // aX1, aY1, aR1) { - // var gradient = new CanvasGradient_('gradientradial'); - // gradient.x0_ = aX0; - // gradient.y0_ = aY0; - // gradient.r0_ = aR0; - // gradient.x1_ = aX1; - // gradient.y1_ = aY1; - // gradient.r1_ = aR1; - // return gradient; - // }; - - // contextPrototype.drawImage = function(image, var_args) { - // var dx, dy, dw, dh, sx, sy, sw, sh; - - // // to find the original width we overide the width and height - // var oldRuntimeWidth = image.runtimeStyle.width; - // var oldRuntimeHeight = image.runtimeStyle.height; - // image.runtimeStyle.width = 'auto'; - // image.runtimeStyle.height = 'auto'; - - // // get the original size - // var w = image.width; - // var h = image.height; - - // // and remove overides - // image.runtimeStyle.width = oldRuntimeWidth; - // image.runtimeStyle.height = oldRuntimeHeight; - - // if (arguments.length == 3) { - // dx = arguments[1]; - // dy = arguments[2]; - // sx = sy = 0; - // sw = dw = w; - // sh = dh = h; - // } else if (arguments.length == 5) { - // dx = arguments[1]; - // dy = arguments[2]; - // dw = arguments[3]; - // dh = arguments[4]; - // sx = sy = 0; - // sw = w; - // sh = h; - // } else if (arguments.length == 9) { - // sx = arguments[1]; - // sy = arguments[2]; - // sw = arguments[3]; - // sh = arguments[4]; - // dx = arguments[5]; - // dy = arguments[6]; - // dw = arguments[7]; - // dh = arguments[8]; - // } else { - // throw Error('Invalid number of arguments'); - // } - - // var d = getCoords(this, dx, dy); - - // var w2 = sw / 2; - // var h2 = sh / 2; - - // var vmlStr = []; - - // var W = 10; - // var H = 10; - - // // For some reason that I've now forgotten, using divs didn't work - // vmlStr.push(' ' , - // '', - // ''); - - // this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join('')); - // }; - - contextPrototype.stroke = function (aFill) { - var lineStr = []; - var lineOpen = false; - - var W = 10; - var H = 10; - - lineStr.push(''); - - if (!aFill) { - appendStroke(this, lineStr); - } else { - appendFill(this, lineStr, min, max); - } - - lineStr.push(''); - - this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - }; - - function appendStroke(ctx, lineStr) { - var a = processStyle(ctx.strokeStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - var lineWidth = ctx.lineScale_ * ctx.lineWidth; - - // VML cannot correctly render a line if the width is less than 1px. - // In that case, we dilute the color to make the line look thinner. - if (lineWidth < 1) { - opacity *= lineWidth; - } - - lineStr.push( - '' - ); - } - - function appendFill(ctx, lineStr, min, max) { - var fillStyle = ctx.fillStyle; - var arcScaleX = ctx.arcScaleX_; - var arcScaleY = ctx.arcScaleY_; - var width = max.x - min.x; - var height = max.y - min.y; - // if (fillStyle instanceof CanvasGradient_) { - // // TODO: Gradients transformed with the transformation matrix. - // var angle = 0; - // var focus = {x: 0, y: 0}; - - // // additional offset - // var shift = 0; - // // scale factor for offset - // var expansion = 1; - - // if (fillStyle.type_ == 'gradient') { - // var x0 = fillStyle.x0_ / arcScaleX; - // var y0 = fillStyle.y0_ / arcScaleY; - // var x1 = fillStyle.x1_ / arcScaleX; - // var y1 = fillStyle.y1_ / arcScaleY; - // var p0 = getCoords(ctx, x0, y0); - // var p1 = getCoords(ctx, x1, y1); - // var dx = p1.x - p0.x; - // var dy = p1.y - p0.y; - // angle = Math.atan2(dx, dy) * 180 / Math.PI; - - // // The angle should be a non-negative number. - // if (angle < 0) { - // angle += 360; - // } - - // // Very small angles produce an unexpected result because they are - // // converted to a scientific notation string. - // if (angle < 1e-6) { - // angle = 0; - // } - // } else { - // var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_); - // focus = { - // x: (p0.x - min.x) / width, - // y: (p0.y - min.y) / height - // }; - - // width /= arcScaleX * Z; - // height /= arcScaleY * Z; - // var dimension = m.max(width, height); - // shift = 2 * fillStyle.r0_ / dimension; - // expansion = 2 * fillStyle.r1_ / dimension - shift; - // } - - // // We need to sort the color stops in ascending order by offset, - // // otherwise IE won't interpret it correctly. - // var stops = fillStyle.colors_; - // stops.sort(function(cs1, cs2) { - // return cs1.offset - cs2.offset; - // }); - - // var length = stops.length; - // var color1 = stops[0].color; - // var color2 = stops[length - 1].color; - // var opacity1 = stops[0].alpha * ctx.globalAlpha; - // var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; - - // var colors = []; - // for (var i = 0; i < length; i++) { - // var stop = stops[i]; - // colors.push(stop.offset * expansion + shift + ' ' + stop.color); - // } - - // // When colors attribute is used, the meanings of opacity and o:opacity2 - // // are reversed. - // lineStr.push(''); - // } else if (fillStyle instanceof CanvasPattern_) { - // if (width && height) { - // var deltaLeft = -min.x; - // var deltaTop = -min.y; - // lineStr.push(''); - // } - // } else { - var a = processStyle(ctx.fillStyle); - var color = a.color; - var opacity = a.alpha * ctx.globalAlpha; - lineStr.push(''); - // } - } - - contextPrototype.fill = function () { - this.stroke(true); - }; - - contextPrototype.closePath = function () { - this.currentPath_.push({ type: 'close' }); - }; - - function getCoords(ctx, aX, aY) { - var m = ctx.m_; - return { - x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, - y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 - }; - }; - - contextPrototype.save = function () { - var o = {}; - copyState(this, o); - this.aStack_.push(o); - this.mStack_.push(this.m_); - this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); - }; - - contextPrototype.restore = function () { - if (this.aStack_.length) { - copyState(this.aStack_.pop(), this); - this.m_ = this.mStack_.pop(); - } - }; - - function matrixIsFinite(m) { - return isFinite(m[0][0]) && isFinite(m[0][1]) && - isFinite(m[1][0]) && isFinite(m[1][1]) && - isFinite(m[2][0]) && isFinite(m[2][1]); - } - - function setM(ctx, m, updateLineScale) { - if (!matrixIsFinite(m)) { - return; - } - ctx.m_ = m; - - if (updateLineScale) { - // Get the line scale. - // Determinant of this.m_ means how much the area is enlarged by the - // transformation. So its square root can be used as a scale factor - // for width. - var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; - ctx.lineScale_ = sqrt(abs(det)); - } - } - - contextPrototype.translate = function (aX, aY) { - var m1 = [ - [1, 0, 0], - [0, 1, 0], - [aX, aY, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), false); - }; - - // contextPrototype.rotate = function(aRot) { - // var c = mc(aRot); - // var s = ms(aRot); - - // var m1 = [ - // [c, s, 0], - // [-s, c, 0], - // [0, 0, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), false); - // }; - - contextPrototype.scale = function (aX, aY) { - this.arcScaleX_ *= aX; - this.arcScaleY_ *= aY; - var m1 = [ - [aX, 0, 0], - [0, aY, 0], - [0, 0, 1] - ]; - - setM(this, matrixMultiply(m1, this.m_), true); - }; - - // contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { - // var m1 = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, matrixMultiply(m1, this.m_), true); - // }; - - // contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { - // var m = [ - // [m11, m12, 0], - // [m21, m22, 0], - // [dx, dy, 1] - // ]; - - // setM(this, m, true); - // }; - - /** - * The text drawing function. - * The maxWidth argument isn't taken in account, since no browser supports - * it yet. - */ - // contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { - // var m = this.m_, - // delta = 1000, - // left = 0, - // right = delta, - // offset = {x: 0, y: 0}, - // lineStr = []; - - // var fontStyle = getComputedStyle(processFontStyle(this.font), - // this.element_); - - // var fontStyleString = buildStyle(fontStyle); - - // var elementStyle = this.element_.currentStyle; - // var textAlign = this.textAlign.toLowerCase(); - // switch (textAlign) { - // case 'left': - // case 'center': - // case 'right': - // break; - // case 'end': - // textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; - // break; - // case 'start': - // textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; - // break; - // default: - // textAlign = 'left'; - // } - - // // 1.75 is an arbitrary number, as there is no info about the text baseline - // switch (this.textBaseline) { - // case 'hanging': - // case 'top': - // offset.y = fontStyle.size / 1.75; - // break; - // case 'middle': - // break; - // default: - // case null: - // case 'alphabetic': - // case 'ideographic': - // case 'bottom': - // offset.y = -fontStyle.size / 2.25; - // break; - // } - - // switch(textAlign) { - // case 'right': - // left = delta; - // right = 0.05; - // break; - // case 'center': - // left = right = delta / 2; - // break; - // } - - // var d = getCoords(this, x + offset.x, y + offset.y); - - // lineStr.push(''); - - // if (stroke) { - // appendStroke(this, lineStr); - // } else { - // // TODO: Fix the min and max params. - // appendFill(this, lineStr, {x: -left, y: 0}, - // {x: right, y: fontStyle.size}); - // } - - // var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + - // m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; - - // var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); - - // lineStr.push('', - // '', - // ''); - - // this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); - // }; - - // contextPrototype.fillText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, false); - // }; - - // contextPrototype.strokeText = function(text, x, y, maxWidth) { - // this.drawText_(text, x, y, maxWidth, true); - // }; - - // contextPrototype.measureText = function(text) { - // if (!this.textMeasureEl_) { - // var s = ''; - // this.element_.insertAdjacentHTML('beforeEnd', s); - // this.textMeasureEl_ = this.element_.lastChild; - // } - // var doc = this.element_.ownerDocument; - // this.textMeasureEl_.innerHTML = ''; - // this.textMeasureEl_.style.font = this.font; - // // Don't use innerHTML or innerText because they allow markup/whitespace. - // this.textMeasureEl_.appendChild(doc.createTextNode(text)); - // return {width: this.textMeasureEl_.offsetWidth}; - // }; - - /******** STUBS ********/ - // contextPrototype.clip = function() { - // // TODO: Implement - // }; - - // contextPrototype.arcTo = function() { - // // TODO: Implement - // }; - - // contextPrototype.createPattern = function(image, repetition) { - // return new CanvasPattern_(image, repetition); - // }; - - // // Gradient / Pattern Stubs - // function CanvasGradient_(aType) { - // this.type_ = aType; - // this.x0_ = 0; - // this.y0_ = 0; - // this.r0_ = 0; - // this.x1_ = 0; - // this.y1_ = 0; - // this.r1_ = 0; - // this.colors_ = []; - // } - - // CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { - // aColor = processStyle(aColor); - // this.colors_.push({offset: aOffset, - // color: aColor.color, - // alpha: aColor.alpha}); - // }; - - // function CanvasPattern_(image, repetition) { - // assertImageIsValid(image); - // switch (repetition) { - // case 'repeat': - // case null: - // case '': - // this.repetition_ = 'repeat'; - // break - // case 'repeat-x': - // case 'repeat-y': - // case 'no-repeat': - // this.repetition_ = repetition; - // break; - // default: - // throwException('SYNTAX_ERR'); - // } - - // this.src_ = image.src; - // this.width_ = image.width; - // this.height_ = image.height; - // } - - function throwException(s) { - throw new DOMException_(s); - } - - // function assertImageIsValid(img) { - // if (!img || img.nodeType != 1 || img.tagName != 'IMG') { - // throwException('TYPE_MISMATCH_ERR'); - // } - // if (img.readyState != 'complete') { - // throwException('INVALID_STATE_ERR'); - // } - // } - - function DOMException_(s) { - this.code = this[s]; - this.message = s + ': DOM Exception ' + this.code; - } - var p = DOMException_.prototype = new Error; - p.INDEX_SIZE_ERR = 1; - p.DOMSTRING_SIZE_ERR = 2; - p.HIERARCHY_REQUEST_ERR = 3; - p.WRONG_DOCUMENT_ERR = 4; - p.INVALID_CHARACTER_ERR = 5; - p.NO_DATA_ALLOWED_ERR = 6; - p.NO_MODIFICATION_ALLOWED_ERR = 7; - p.NOT_FOUND_ERR = 8; - p.NOT_SUPPORTED_ERR = 9; - p.INUSE_ATTRIBUTE_ERR = 10; - p.INVALID_STATE_ERR = 11; - p.SYNTAX_ERR = 12; - p.INVALID_MODIFICATION_ERR = 13; - p.NAMESPACE_ERR = 14; - p.INVALID_ACCESS_ERR = 15; - p.VALIDATION_ERR = 16; - p.TYPE_MISMATCH_ERR = 17; - - // set up externs - G_vmlCanvasManager = G_vmlCanvasManager_; - CanvasRenderingContext2D = CanvasRenderingContext2D_; - //CanvasGradient = CanvasGradient_; - //CanvasPattern = CanvasPattern_; - DOMException = DOMException_; - })(); - -} // if diff --git a/libs/js/jquery-geo-1.0b2/js/excanvas.min.js b/libs/js/jquery-geo-1.0b2/js/excanvas.min.js deleted file mode 100755 index f90001c..0000000 --- a/libs/js/jquery-geo-1.0b2/js/excanvas.min.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -document.createElement("canvas").getContext||function(){function j(){return this.context_||(this.context_=new I(this))}function l(a,b,c){var d=k.call(arguments,2);return function(){return a.apply(b,d.concat(k.call(arguments)))}}function m(a){return String(a).replace(/&/g,"&").replace(/"/g,""")}function n(a,b,c){a.namespaces[b]||a.namespaces.add(b,c,"#default#VML")}function o(a){n(a,"g_vml_","urn:schemas-microsoft-com:vml"),n(a,"g_o_","urn:schemas-microsoft-com:office:office");if(!a.styleSheets.ex_canvas_){var b=a.createStyleSheet();b.owningElement.id="ex_canvas_",b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function q(a){var b=a.srcElement;switch(a.propertyName){case"width":b.getContext().clearRect(),b.style.width=b.attributes.width.nodeValue+"px",b.firstChild.style.width=b.clientWidth+"px";break;case"height":b.getContext().clearRect(),b.style.height=b.attributes.height.nodeValue+"px",b.firstChild.style.height=b.clientHeight+"px"}}function r(a){var b=a.srcElement;b.firstChild&&(b.firstChild.style.width=b.clientWidth+"px",b.firstChild.style.height=b.clientHeight+"px")}function v(){return[[1,0,0],[0,1,0],[0,0,1]]}function w(a,b){var c=v();for(var d=0;d<3;d++)for(var e=0;e<3;e++){var f=0;for(var g=0;g<3;g++)f+=a[d][g]*b[g][e];c[d][e]=f}return c}function x(a,b){b.fillStyle=a.fillStyle,b.lineCap=a.lineCap,b.lineJoin=a.lineJoin,b.lineWidth=a.lineWidth,b.miterLimit=a.miterLimit,b.shadowBlur=a.shadowBlur,b.shadowColor=a.shadowColor,b.shadowOffsetX=a.shadowOffsetX,b.shadowOffsetY=a.shadowOffsetY,b.strokeStyle=a.strokeStyle,b.globalAlpha=a.globalAlpha,b.font=a.font,b.textAlign=a.textAlign,b.textBaseline=a.textBaseline,b.arcScaleX_=a.arcScaleX_,b.arcScaleY_=a.arcScaleY_,b.lineScale_=a.lineScale_}function y(a){var b=a.indexOf("(",3),c=a.indexOf(")",b+1),d=a.substring(b+1,c).split(",");if(d.length!=4||a.charAt(3)!="a")d[3]=1;return d}function z(a){return parseFloat(a)/100}function A(a,b,c){return Math.min(c,Math.max(b,a))}function B(a){var b,c,d,e,f,g;e=parseFloat(a[0])/360%360,e<0&&e++,f=A(z(a[1]),0,1),g=A(z(a[2]),0,1);if(f==0)b=c=d=g;else{var h=g<.5?g*(1+f):g+f-g*f,i=2*g-h;b=C(i,h,e+1/3),c=C(i,h,e),d=C(i,h,e-1/3)}return"#"+s[Math.floor(b*255)]+s[Math.floor(c*255)]+s[Math.floor(d*255)]}function C(a,b,c){return c<0&&c++,c>1&&c--,6*c<1?a+(b-a)*6*c:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}function E(a){if(a in D)return D[a];var b,c=1;a=String(a);if(a.charAt(0)=="#")b=a;else if(/^rgb/.test(a)){var d=y(a),b="#",e;for(var f=0;f<3;f++)d[f].indexOf("%")!=-1?e=Math.floor(z(d[f])*255):e=+d[f],b+=s[A(e,0,255)];c=+d[3]}else if(/^hsl/.test(a)){var d=y(a);b=B(d),c=d[3]}else b=a;return D[a]={color:b,alpha:c}}function H(a){return G[a]||"square"}function I(a){this.m_=v(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle="#000",this.fillStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=g*1,this.globalAlpha=1,this.canvas=a;var b="width:"+a.clientWidth+"px;height:"+a.clientHeight+"px;overflow:hidden;position:absolute",c=a.ownerDocument.createElement("div");c.style.cssText=b,a.appendChild(c);var d=c.cloneNode(!1);d.style.backgroundColor="red",d.style.filter="alpha(opacity=0)",a.appendChild(d),this.element_=c,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1}function K(a,b,c,d){a.currentPath_.push({type:"bezierCurveTo",cp1x:b.x,cp1y:b.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y}),a.currentX_=d.x,a.currentY_=d.y}function L(a,b){var c=E(a.strokeStyle),d=c.color,e=c.alpha*a.globalAlpha,f=a.lineScale_*a.lineWidth;f<1&&(e*=f),b.push("')}function M(a,b,c,d){var e=a.fillStyle,f=a.arcScaleX_,g=a.arcScaleY_,h=d.x-c.x,i=d.y-c.y,j=E(a.fillStyle),k=j.color,l=j.alpha*a.globalAlpha;b.push('')}function N(a,b,c){var d=a.m_;return{x:g*(b*d[0][0]+c*d[1][0]+d[2][0])-h,y:g*(b*d[0][1]+c*d[1][1]+d[2][1])-h}}function O(a){return isFinite(a[0][0])&&isFinite(a[0][1])&&isFinite(a[1][0])&&isFinite(a[1][1])&&isFinite(a[2][0])&&isFinite(a[2][1])}function P(a,b,c){if(!O(b))return;a.m_=b;if(c){var d=b[0][0]*b[1][1]-b[0][1]*b[1][0];a.lineScale_=f(e(d))}}function Q(a){throw new R(a)}function R(a){this.code=this[a],this.message=a+": DOM Exception "+this.code}var a=Math,b=a.round,c=a.sin,d=a.cos,e=a.abs,f=a.sqrt,g=10,h=g/2,i=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],k=Array.prototype.slice;o(document);var p={init:function(a){var b=a||document;b.createElement("canvas"),b.attachEvent("onreadystatechange",l(this.init_,this,b))},init_:function(a){var b=a.getElementsByTagName("canvas");for(var c=0;cj.x)j.x=l.x;if(i.y==null||l.yj.y)j.y=l.y}}c.push(' ">'),a?M(this,c,i,j):L(this,c),c.push(""),this.element_.insertAdjacentHTML("beforeEnd",c.join(""))},J.fill=function(){this.stroke(!0)},J.closePath=function(){this.currentPath_.push({type:"close"})},J.save=function(){var a={};x(this,a),this.aStack_.push(a),this.mStack_.push(this.m_),this.m_=w(v(),this.m_)},J.restore=function(){this.aStack_.length&&(x(this.aStack_.pop(),this),this.m_=this.mStack_.pop())},J.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];P(this,w(c,this.m_),!1)},J.scale=function(a,b){this.arcScaleX_*=a,this.arcScaleY_*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];P(this,w(c,this.m_),!0)};var S=R.prototype=new Error;S.INDEX_SIZE_ERR=1,S.DOMSTRING_SIZE_ERR=2,S.HIERARCHY_REQUEST_ERR=3,S.WRONG_DOCUMENT_ERR=4,S.INVALID_CHARACTER_ERR=5,S.NO_DATA_ALLOWED_ERR=6,S.NO_MODIFICATION_ALLOWED_ERR=7,S.NOT_FOUND_ERR=8,S.NOT_SUPPORTED_ERR=9,S.INUSE_ATTRIBUTE_ERR=10,S.INVALID_STATE_ERR=11,S.SYNTAX_ERR=12,S.INVALID_MODIFICATION_ERR=13,S.NAMESPACE_ERR=14,S.INVALID_ACCESS_ERR=15,S.VALIDATION_ERR=16,S.TYPE_MISMATCH_ERR=17,G_vmlCanvasManager=p,CanvasRenderingContext2D=I,DOMException=R}() diff --git a/libs/js/jquery-geo-1.0b2/js/jquery-1.7.2.js b/libs/js/jquery-geo-1.0b2/js/jquery-1.7.2.js deleted file mode 100755 index 3774ff9..0000000 --- a/libs/js/jquery-geo-1.0b2/js/jquery-1.7.2.js +++ /dev/null @@ -1,9404 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Wed Mar 21 12:46:34 2012 -0700 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - fired = true; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
                      a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
                      " + - "" + - "
                      "; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
                      t
                      "; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
                      "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

                      "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
                      "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
                      ", "
                      " ], - thead: [ 1, "", "
                      " ], - tr: [ 2, "", "
                      " ], - td: [ 3, "", "
                      " ], - col: [ 2, "", "
                      " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - - - - - -

                      jQuery Geo Test Suite

                      -

                      -
                      -

                      -
                        -
                        - lame test markup - normal test markup - awesome test markup -
                        - - diff --git a/libs/js/jquery-geo-1.0b2/test/jquery.geo_test.js b/libs/js/jquery-geo-1.0b2/test/jquery.geo_test.js deleted file mode 100755 index a679d73..0000000 --- a/libs/js/jquery-geo-1.0b2/test/jquery.geo_test.js +++ /dev/null @@ -1,38 +0,0 @@ -/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ -/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/ -/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/ -(function($) { - - module('jQuery#awesome', { - setup: function() { - this.elems = $('#qunit-fixture').children(); - } - }); - - test('is chainable', 1, function() { - // Not a bad test to run on collection methods. - strictEqual(this.elems.awesome(), this.elems, 'should be chaninable'); - }); - - test('is awesome', 1, function() { - strictEqual(this.elems.awesome().text(), 'awesomeawesomeawesome', 'should be thoroughly awesome'); - }); - - module('jQuery.awesome'); - - test('is awesome', 1, function() { - strictEqual($.awesome(), 'awesome', 'should be thoroughly awesome'); - }); - - module(':awesome selector', { - setup: function() { - this.elems = $('#qunit-fixture').children(); - } - }); - - test('is awesome', 1, function() { - // Use deepEqual & .get() when comparing jQuery objects. - deepEqual(this.elems.filter(':awesome').get(), this.elems.last().get(), 'knows awesome when it sees it'); - }); - -}(jQuery)); -- 2.7.4
                        -
                        -
                        - - - - - - - -
                        -

                        Atlas Utah!

                        -
                        -
                        -
                        -
                        - UTM NAD83 coords: (453709,4333922) -
                        -
                        - - -
                        -
                        -
                        -
                        -
                        - -