leaflet-ruby 0.3.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/CHANGELOG.rdoc +5 -0
  2. data/LICENSE +21 -0
  3. data/README.rdoc +55 -0
  4. data/Rakefile +15 -0
  5. data/leaflet-ruby.gemspec +24 -0
  6. data/lib/leaflet-ruby.rb +18 -0
  7. data/lib/leaflet/CHANGELOG.md +181 -0
  8. data/lib/leaflet/Jakefile.js +65 -0
  9. data/lib/leaflet/LICENSE +22 -0
  10. data/lib/leaflet/README.md +32 -0
  11. data/lib/leaflet/build/build.html +243 -0
  12. data/lib/leaflet/build/build.js +79 -0
  13. data/lib/leaflet/build/deps.js +231 -0
  14. data/lib/leaflet/build/hint.js +30 -0
  15. data/lib/leaflet/build/hintrc.js +44 -0
  16. data/lib/leaflet/debug/control/control-layers.html +47 -0
  17. data/lib/leaflet/debug/control/map-control.html +29 -0
  18. data/lib/leaflet/debug/css/mobile.css +6 -0
  19. data/lib/leaflet/debug/css/screen.css +5 -0
  20. data/lib/leaflet/debug/geojson/geojson-sample.js +53 -0
  21. data/lib/leaflet/debug/geojson/geojson.html +56 -0
  22. data/lib/leaflet/debug/leaflet-include.js +120 -0
  23. data/lib/leaflet/debug/map/canvas.html +46 -0
  24. data/lib/leaflet/debug/map/map-mobile.html +42 -0
  25. data/lib/leaflet/debug/map/map.html +54 -0
  26. data/lib/leaflet/debug/map/max-bounds.html +36 -0
  27. data/lib/leaflet/debug/map/scroll.html +35 -0
  28. data/lib/leaflet/debug/map/wms-marble.html +30 -0
  29. data/lib/leaflet/debug/map/wms.html +37 -0
  30. data/lib/leaflet/debug/vector/editable.html +43 -0
  31. data/lib/leaflet/debug/vector/route.js +1 -0
  32. data/lib/leaflet/debug/vector/vector-bounds.html +69 -0
  33. data/lib/leaflet/debug/vector/vector-canvas.html +92 -0
  34. data/lib/leaflet/debug/vector/vector-mobile.html +38 -0
  35. data/lib/leaflet/debug/vector/vector-simple.html +63 -0
  36. data/lib/leaflet/debug/vector/vector.html +38 -0
  37. data/lib/leaflet/dist/images/layers.png +0 -0
  38. data/lib/leaflet/dist/images/marker-shadow.png +0 -0
  39. data/lib/leaflet/dist/images/marker.png +0 -0
  40. data/lib/leaflet/dist/images/popup-close.png +0 -0
  41. data/lib/leaflet/dist/images/zoom-in.png +0 -0
  42. data/lib/leaflet/dist/images/zoom-out.png +0 -0
  43. data/lib/leaflet/dist/leaflet-src.js +5537 -0
  44. data/lib/leaflet/dist/leaflet.css +323 -0
  45. data/lib/leaflet/dist/leaflet.ie.css +48 -0
  46. data/lib/leaflet/dist/leaflet.js +6 -0
  47. data/lib/leaflet/lib/jasmine/jasmine-html.js +182 -0
  48. data/lib/leaflet/lib/jasmine/jasmine.css +166 -0
  49. data/lib/leaflet/lib/jasmine/jasmine.js +2421 -0
  50. data/lib/leaflet/spec/runner.html +57 -0
  51. data/lib/leaflet/spec/suites/LeafletSpec.js +15 -0
  52. data/lib/leaflet/spec/suites/SpecHelper.js +28 -0
  53. data/lib/leaflet/spec/suites/core/ClassSpec.js +153 -0
  54. data/lib/leaflet/spec/suites/core/EventsSpec.js +110 -0
  55. data/lib/leaflet/spec/suites/core/UtilSpec.js +63 -0
  56. data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
  57. data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +59 -0
  58. data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +1 -0
  59. data/lib/leaflet/spec/suites/geo/LatLngSpec.js +76 -0
  60. data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +42 -0
  61. data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +53 -0
  62. data/lib/leaflet/spec/suites/geometry/PointSpec.js +45 -0
  63. data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +19 -0
  64. data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +1 -0
  65. data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
  66. data/lib/leaflet/spec/suites/map/MapSpec.js +1 -0
  67. data/lib/leaflet/src/Leaflet.js +33 -0
  68. data/lib/leaflet/src/control/Control.Attribution.js +66 -0
  69. data/lib/leaflet/src/control/Control.Layers.js +167 -0
  70. data/lib/leaflet/src/control/Control.Zoom.js +36 -0
  71. data/lib/leaflet/src/control/Control.js +9 -0
  72. data/lib/leaflet/src/core/Browser.js +53 -0
  73. data/lib/leaflet/src/core/Class.js +66 -0
  74. data/lib/leaflet/src/core/Events.js +62 -0
  75. data/lib/leaflet/src/core/Handler.js +29 -0
  76. data/lib/leaflet/src/core/Util.js +108 -0
  77. data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +43 -0
  78. data/lib/leaflet/src/dom/DomEvent.js +154 -0
  79. data/lib/leaflet/src/dom/DomUtil.js +155 -0
  80. data/lib/leaflet/src/dom/Draggable.js +147 -0
  81. data/lib/leaflet/src/dom/transition/Transition.Native.js +102 -0
  82. data/lib/leaflet/src/dom/transition/Transition.Timer.js +126 -0
  83. data/lib/leaflet/src/dom/transition/Transition.js +28 -0
  84. data/lib/leaflet/src/geo/LatLng.js +44 -0
  85. data/lib/leaflet/src/geo/LatLngBounds.js +86 -0
  86. data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +13 -0
  87. data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +17 -0
  88. data/lib/leaflet/src/geo/crs/CRS.EPSG4326.js +7 -0
  89. data/lib/leaflet/src/geo/crs/CRS.js +17 -0
  90. data/lib/leaflet/src/geo/projection/Projection.LonLat.js +10 -0
  91. data/lib/leaflet/src/geo/projection/Projection.Mercator.js +51 -0
  92. data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +23 -0
  93. data/lib/leaflet/src/geo/projection/Projection.js +5 -0
  94. data/lib/leaflet/src/geometry/Bounds.js +50 -0
  95. data/lib/leaflet/src/geometry/LineUtil.js +194 -0
  96. data/lib/leaflet/src/geometry/Point.js +66 -0
  97. data/lib/leaflet/src/geometry/PolyUtil.js +59 -0
  98. data/lib/leaflet/src/geometry/Transformation.js +31 -0
  99. data/lib/leaflet/src/layer/FeatureGroup.js +40 -0
  100. data/lib/leaflet/src/layer/GeoJSON.js +104 -0
  101. data/lib/leaflet/src/layer/ImageOverlay.js +58 -0
  102. data/lib/leaflet/src/layer/LayerGroup.js +74 -0
  103. data/lib/leaflet/src/layer/Popup.js +179 -0
  104. data/lib/leaflet/src/layer/marker/Icon.js +58 -0
  105. data/lib/leaflet/src/layer/marker/Marker.Drag.js +57 -0
  106. data/lib/leaflet/src/layer/marker/Marker.Popup.js +42 -0
  107. data/lib/leaflet/src/layer/marker/Marker.js +142 -0
  108. data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +41 -0
  109. data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +47 -0
  110. data/lib/leaflet/src/layer/tile/TileLayer.js +310 -0
  111. data/lib/leaflet/src/layer/vector/Circle.js +68 -0
  112. data/lib/leaflet/src/layer/vector/CircleMarker.js +25 -0
  113. data/lib/leaflet/src/layer/vector/MultiPoly.js +34 -0
  114. data/lib/leaflet/src/layer/vector/Path.Popup.js +24 -0
  115. data/lib/leaflet/src/layer/vector/Path.SVG.js +138 -0
  116. data/lib/leaflet/src/layer/vector/Path.VML.js +93 -0
  117. data/lib/leaflet/src/layer/vector/Path.js +88 -0
  118. data/lib/leaflet/src/layer/vector/Polygon.js +64 -0
  119. data/lib/leaflet/src/layer/vector/Polyline.js +146 -0
  120. data/lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js +18 -0
  121. data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +146 -0
  122. data/lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js +34 -0
  123. data/lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js +27 -0
  124. data/lib/leaflet/src/map/Map.js +613 -0
  125. data/lib/leaflet/src/map/anim/Map.PanAnimation.js +70 -0
  126. data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +133 -0
  127. data/lib/leaflet/src/map/ext/Map.Control.js +50 -0
  128. data/lib/leaflet/src/map/ext/Map.Geolocation.js +86 -0
  129. data/lib/leaflet/src/map/ext/Map.Popup.js +20 -0
  130. data/lib/leaflet/src/map/handler/Map.BoxZoom.js +73 -0
  131. data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +18 -0
  132. data/lib/leaflet/src/map/handler/Map.Drag.js +81 -0
  133. data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +55 -0
  134. data/lib/leaflet/src/map/handler/Map.TouchZoom.js +93 -0
  135. data/lib/zerista/CRS.Cartesian.js +20 -0
  136. data/lib/zerista/Projection.Identity.js +11 -0
  137. data/lib/zerista/zerista_layer.js +97 -0
  138. data/vendor/assets/javascripts/leaflet.js +139 -0
  139. data/vendor/assets/stylesheets/leaflet.css +1 -0
  140. data/vendor/assets/stylesheets/leaflet.ie.css +1 -0
  141. metadata +185 -0
@@ -0,0 +1,30 @@
1
+ var jshint = require('jshint').JSHINT,
2
+ fs = require('fs'),
3
+ config = require('./hintrc.js').config;
4
+
5
+ function jshintSrc(path, src) {
6
+ jshint(src, config);
7
+
8
+ var errors = jshint.errors,
9
+ i, len, e, line;
10
+
11
+ for (i = 0, len = errors.length; i < len; i++) {
12
+ e = errors[i];
13
+ //console.log(e.evidence);
14
+ console.log(path + '\tline ' + e.line + '\tcol ' + e.character + '\t ' + e.reason);
15
+ }
16
+
17
+ return len;
18
+ }
19
+
20
+ exports.jshint = function (files) {
21
+ var errorsFound = 0;
22
+
23
+ for (var i = 0, len = files.length; i < len; i++) {
24
+ var src = fs.readFileSync(files[i], 'utf8');
25
+
26
+ errorsFound += jshintSrc(files[i], src);
27
+ }
28
+
29
+ return errorsFound;
30
+ };
@@ -0,0 +1,44 @@
1
+ exports.config = {
2
+ "browser": true,
3
+ "predef": ["L"],
4
+
5
+ "debug": false,
6
+ "devel": false,
7
+
8
+ "es5": false,
9
+ "strict": false,
10
+ "globalstrict": false,
11
+
12
+ "asi": false,
13
+ "laxbreak": false,
14
+ "bitwise": true,
15
+ "boss": false,
16
+ "curly": true,
17
+ "eqnull": false,
18
+ "evil": false,
19
+ "expr": false,
20
+ "forin": false,
21
+ "immed": true,
22
+ "latedef": true,
23
+ "loopfunc": false,
24
+ "noarg": true,
25
+ "regexp": true,
26
+ "regexdash": false,
27
+ "scripturl": false,
28
+ "shadow": false,
29
+ "supernew": false,
30
+ "undef": true,
31
+
32
+ "newcap": true,
33
+ "noempty": true,
34
+ "nonew": true,
35
+ "nomen": false,
36
+ "onevar": false,
37
+ "plusplus": false,
38
+ "sub": false,
39
+ "indent": 4,
40
+
41
+ "eqeqeq": true,
42
+ "trailing": true,
43
+ "white": true
44
+ };
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Leaflet debug page</title>
5
+
6
+ <link rel="stylesheet" href="../../dist/leaflet.css" />
7
+ <!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
8
+
9
+ <link rel="stylesheet" href="../css/screen.css" />
10
+
11
+ <script src="../leaflet-include.js"></script>
12
+ </head>
13
+ <body>
14
+
15
+ <div id="map"></div>
16
+
17
+ <script type="text/javascript">
18
+
19
+ function getCloudMadeUrl(styleId) {
20
+ return 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/' + styleId + '/256/{z}/{x}/{y}.png';
21
+ }
22
+
23
+ var cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
24
+ cloudmade = new L.TileLayer(getCloudMadeUrl(997), {attribution: cloudmadeAttribution}),
25
+ cloudmade2 = new L.TileLayer(getCloudMadeUrl(998), {attribution: cloudmadeAttribution});
26
+
27
+ var map = new L.Map('map').addLayer(cloudmade).setView(new L.LatLng(50.5, 30.51), 15);
28
+
29
+ var marker = new L.Marker(new L.LatLng(50.5, 30.505));
30
+ map.addLayer(marker);
31
+
32
+ var marker2 = new L.Marker(new L.LatLng(50.502, 30.515));
33
+ map.addLayer(marker2);
34
+
35
+ var layersControl = new L.Control.Layers({
36
+ 'CloudMade Fresh': cloudmade,
37
+ 'CloudMade Pale Dawn': cloudmade2
38
+ }, {
39
+ 'Some marker': marker,
40
+ 'Another marker': marker2
41
+ });
42
+
43
+ map.addControl(layersControl);
44
+
45
+ </script>
46
+ </body>
47
+ </html>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Leaflet debug page</title>
5
+
6
+ <link rel="stylesheet" href="../../dist/leaflet.css" />
7
+ <!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
8
+
9
+ <link rel="stylesheet" href="../css/screen.css" />
10
+
11
+ <script src="../leaflet-include.js"></script>
12
+ </head>
13
+ <body>
14
+
15
+ <div id="map"></div>
16
+
17
+ <script type="text/javascript">
18
+
19
+ var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
20
+ cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
21
+ latlng = new L.LatLng(50.5, 30.51);
22
+
23
+ var map = new L.Map('map').addLayer(cloudmade).setView(latlng, 15);
24
+
25
+ var zoomControl = new L.Control.Zoom();
26
+ map.addControl(zoomControl);
27
+ </script>
28
+ </body>
29
+ </html>
@@ -0,0 +1,6 @@
1
+ html, body, #map {
2
+ margin: 0;
3
+ padding: 0;
4
+ width: 100%;
5
+ height: 100%;
6
+ }
@@ -0,0 +1,5 @@
1
+ #map {
2
+ width: 800px;
3
+ height: 600px;
4
+ border: 1px solid #ccc;
5
+ }
@@ -0,0 +1,53 @@
1
+ var geojsonSample = {
2
+ "type": "FeatureCollection",
3
+ "features": [
4
+ {
5
+ "type": "Feature",
6
+ "geometry": {
7
+ "type": "Point",
8
+ "coordinates": [102.0, 0.5]
9
+ },
10
+ "properties": {
11
+ "prop0": "value0",
12
+ "color": "blue"
13
+ }
14
+ },
15
+
16
+ {
17
+ "type": "Feature",
18
+ "geometry": {
19
+ "type": "LineString",
20
+ "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]
21
+ },
22
+ "properties": {
23
+ "color": "red",
24
+ "prop1": 0.0
25
+ }
26
+ },
27
+
28
+ {
29
+ "type": "Feature",
30
+ "geometry": {
31
+ "type": "Polygon",
32
+ "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]
33
+ },
34
+ "properties": {
35
+ "color": "green",
36
+ "prop1": {
37
+ "this": "that"
38
+ }
39
+ }
40
+ },
41
+
42
+ {
43
+ "type": "Feature",
44
+ "geometry": {
45
+ "type": "MultiPolygon",
46
+ "coordinates": [[[[100.0, 1.5], [100.5, 1.5], [100.5, 2.0], [100.0, 2.0], [100.0, 1.5]]], [[[100.5, 2.0], [100.5, 2.5], [101.0, 2.5], [101.0, 2.0], [100.5, 2.0]]]]
47
+ },
48
+ "properties": {
49
+ "color": "purple"
50
+ }
51
+ }
52
+ ]
53
+ };
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Leaflet debug page</title>
5
+
6
+ <link rel="stylesheet" href="../../dist/leaflet.css" />
7
+ <!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
8
+
9
+ <link rel="stylesheet" href="../css/screen.css" />
10
+
11
+ <script src="../leaflet-include.js"></script>
12
+ </head>
13
+ <body>
14
+
15
+ <div id="map" style="width: 600px; height: 600px; border: 1px solid #ccc"></div>
16
+ <button id="populate">Populate with 10 markers</button>
17
+
18
+ <script type="text/javascript" src="geojson-sample.js"></script>
19
+ <script type="text/javascript">
20
+
21
+ var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
22
+ cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
23
+ cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
24
+
25
+ var map = new L.Map('map', {
26
+ center: new L.LatLng(0.78, 102.37),
27
+ zoom: 7,
28
+ layers: [cloudmade]
29
+ });
30
+
31
+ var geojson = new L.GeoJSON();
32
+
33
+ /* points are rendered as markers by default, but you can change this:
34
+
35
+ var geojson = new L.GeoJSON(null, {
36
+ pointToLayer: function(latlng) { return new L.CircleMarker(latlng); }
37
+ });
38
+ */
39
+
40
+ geojson.on('featureparse', function(e) {
41
+ // you can style features depending on their properties, etc.
42
+ var popupText = 'geometry type: ' + e.geometryType;
43
+
44
+ if (e.layer.setStyle && e.properties && e.properties.color) {
45
+ e.layer.setStyle({color: e.properties.color});
46
+ popupText += '<br/>color: ' + e.properties.color;
47
+ }
48
+ e.layer.bindPopup(popupText);
49
+ });
50
+
51
+ geojson.addGeoJSON(geojsonSample);
52
+
53
+ map.addLayer(geojson);
54
+ </script>
55
+ </body>
56
+ </html>
@@ -0,0 +1,120 @@
1
+ (function() {
2
+ //TODO replace script list with the one from ../buid/deps.js
3
+ var scripts = [
4
+ 'Leaflet.js',
5
+
6
+ 'core/Util.js',
7
+ 'core/Class.js',
8
+ 'core/Events.js',
9
+ 'core/Browser.js',
10
+
11
+ 'geometry/Point.js',
12
+ 'geometry/Bounds.js',
13
+ 'geometry/Transformation.js',
14
+ 'geometry/LineUtil.js',
15
+ 'geometry/PolyUtil.js',
16
+
17
+ 'dom/DomEvent.js',
18
+ 'dom/DomEvent.DoubleTap.js',
19
+ 'dom/DomUtil.js',
20
+ 'dom/Draggable.js',
21
+
22
+ 'dom/transition/Transition.js',
23
+ 'dom/transition/Transition.Native.js',
24
+ 'dom/transition/Transition.Timer.js',
25
+
26
+ 'geo/LatLng.js',
27
+ 'geo/LatLngBounds.js',
28
+
29
+ 'geo/projection/Projection.js',
30
+ 'geo/projection/Projection.SphericalMercator.js',
31
+ 'geo/projection/Projection.LonLat.js',
32
+ 'geo/projection/Projection.Mercator.js',
33
+
34
+ 'geo/crs/CRS.js',
35
+ 'geo/crs/CRS.EPSG3857.js',
36
+ 'geo/crs/CRS.EPSG4326.js',
37
+ 'geo/crs/CRS.EPSG3395.js',
38
+
39
+ 'map/Map.js',
40
+
41
+ 'map/ext/Map.Geolocation.js',
42
+ 'map/ext/Map.Popup.js',
43
+ 'map/ext/Map.Control.js',
44
+
45
+ 'map/anim/Map.PanAnimation.js',
46
+ 'map/anim/Map.ZoomAnimation.js',
47
+
48
+ 'core/Handler.js',
49
+ 'map/handler/Map.Drag.js',
50
+ 'map/handler/Map.TouchZoom.js',
51
+ 'map/handler/Map.DoubleClickZoom.js',
52
+ 'map/handler/Map.ScrollWheelZoom.js',
53
+ 'map/handler/Map.BoxZoom.js',
54
+
55
+ 'layer/LayerGroup.js',
56
+ 'layer/FeatureGroup.js',
57
+
58
+ 'layer/tile/TileLayer.js',
59
+ 'layer/tile/TileLayer.WMS.js',
60
+ 'layer/tile/TileLayer.Canvas.js',
61
+ 'layer/ImageOverlay.js',
62
+ 'layer/Popup.js',
63
+
64
+ 'layer/marker/Icon.js',
65
+ 'layer/marker/Marker.js',
66
+ 'layer/marker/Marker.Popup.js',
67
+ 'layer/marker/Marker.Drag.js',
68
+
69
+ 'layer/vector/Path.js',
70
+ 'layer/vector/Path.Popup.js',
71
+ 'layer/vector/Path.SVG.js',
72
+ 'layer/vector/Path.VML.js',
73
+ 'layer/vector/canvas/Path.Canvas.js',
74
+ 'layer/vector/Polyline.js',
75
+ 'layer/vector/canvas/Polyline.Canvas.js',
76
+ 'layer/vector/Polygon.js',
77
+ 'layer/vector/canvas/Polygon.Canvas.js',
78
+ 'layer/vector/MultiPoly.js',
79
+ 'layer/vector/Circle.js',
80
+ 'layer/vector/canvas/Circle.Canvas.js',
81
+ 'layer/vector/CircleMarker.js',
82
+
83
+ 'layer/GeoJSON.js',
84
+
85
+ 'control/Control.js',
86
+ 'control/Control.Zoom.js',
87
+ 'control/Control.Attribution.js',
88
+ 'control/Control.Layers.js',
89
+ ];
90
+
91
+ function getSrcUrl() {
92
+ var scripts = document.getElementsByTagName('script');
93
+ for (var i = 0; i < scripts.length; i++) {
94
+ var src = scripts[i].src;
95
+ if (src) {
96
+ var res = src.match(/^(.*)leaflet-include\.js$/);
97
+ if (res) {
98
+ return res[1] + '../src/';
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ var path = getSrcUrl();
105
+ for (var i = 0; i < scripts.length; i++) {
106
+ document.writeln("<script type='text/javascript' src='" + path + "../src/" + scripts[i] + "'></script>");
107
+ }
108
+ })();
109
+
110
+ function getRandomLatLng(map) {
111
+ var bounds = map.getBounds(),
112
+ southWest = bounds.getSouthWest(),
113
+ northEast = bounds.getNorthEast(),
114
+ lngSpan = northEast.lng - southWest.lng,
115
+ latSpan = northEast.lat - southWest.lat;
116
+
117
+ return new L.LatLng(
118
+ southWest.lat + latSpan * Math.random(),
119
+ southWest.lng + lngSpan * Math.random());
120
+ }
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Leaflet debug page</title>
5
+
6
+ <link rel="stylesheet" href="../../dist/leaflet.css" />
7
+ <!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
8
+
9
+ <link rel="stylesheet" href="../css/screen.css" />
10
+
11
+ <script src="../leaflet-include.js"></script>
12
+ </head>
13
+ <body>
14
+
15
+ <div id="map" style="width: 600px; height: 600px; border: 1px solid #ccc"></div>
16
+
17
+ <script type="text/javascript">
18
+
19
+ var tiles = new L.TileLayer.Canvas();
20
+
21
+ tiles.drawTile = function(canvas, tile, zoom) {
22
+ var ctx = canvas.getContext('2d');
23
+
24
+ ctx.fillStyle = 'white';
25
+ ctx.fillRect(0, 0, 255, 255);
26
+
27
+
28
+ ctx.fillStyle = 'black';
29
+ ctx.fillText('x: ' + tile.x + ', y: ' + tile.y + ', zoom:' + zoom, 20, 20);
30
+
31
+
32
+ ctx.strokeStyle = 'red';
33
+ ctx.beginPath();
34
+ ctx.moveTo(0, 0);
35
+ ctx.lineTo(255, 0);
36
+ ctx.lineTo(255, 255);
37
+ ctx.lineTo(0, 255);
38
+ ctx.closePath();
39
+ ctx.stroke();
40
+ }
41
+
42
+ var map = new L.Map('map', {center: new L.LatLng(50.5, 30.51), zoom: 15, layers: [tiles]});
43
+
44
+ </script>
45
+ </body>
46
+ </html>