leaflet-js 0.6.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.rdoc +32 -0
- data/LICENSE +21 -0
- data/README.rdoc +54 -0
- data/Rakefile +15 -0
- data/leaflet-js.gemspec +28 -0
- data/lib/leaflet-js.rb +10 -0
- data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
- data/lib/leaflet.draw/CHANGELOG.md +73 -0
- data/lib/leaflet.draw/Jakefile.js +26 -0
- data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.draw/README.md +364 -0
- data/lib/leaflet.draw/TODO.md +62 -0
- data/lib/leaflet.draw/build/build.html +243 -0
- data/lib/leaflet.draw/build/build.js +189 -0
- data/lib/leaflet.draw/build/deps.js +75 -0
- data/lib/leaflet.draw/build/hintrc.js +47 -0
- data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
- data/lib/leaflet.draw/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +2429 -0
- data/lib/leaflet.draw/dist/leaflet.draw.css +212 -0
- data/lib/leaflet.draw/dist/leaflet.draw.ie.css +44 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
- data/lib/leaflet.draw/examples/basic.html +106 -0
- data/lib/leaflet.draw/examples/edithandlers.html +67 -0
- data/lib/leaflet.draw/examples/libs/images/layers.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-shadow.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +8587 -0
- data/lib/leaflet.draw/examples/libs/leaflet.css +459 -0
- data/lib/leaflet.draw/examples/libs/leaflet.ie.css +51 -0
- data/lib/leaflet.draw/package.json +37 -0
- data/lib/leaflet.draw/spec/after.js +2 -0
- data/lib/leaflet.draw/spec/before.js +3 -0
- data/lib/leaflet.draw/spec/expect.js +1253 -0
- data/lib/leaflet.draw/spec/happen.js +93 -0
- data/lib/leaflet.draw/spec/index.html +36 -0
- data/lib/leaflet.draw/spec/karma.conf.js +69 -0
- data/lib/leaflet.draw/spec/sinon.js +4223 -0
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +15 -0
- data/lib/leaflet.draw/spec/suites/SpecHelper.js +26 -0
- data/lib/leaflet.draw/src/Control.Draw.js +101 -0
- data/lib/leaflet.draw/src/Leaflet.draw.js +5 -0
- data/lib/leaflet.draw/src/Toolbar.js +187 -0
- data/lib/leaflet.draw/src/Tooltip.js +52 -0
- data/lib/leaflet.draw/src/copyright.js +8 -0
- data/lib/leaflet.draw/src/draw/DrawToolbar.js +107 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Circle.js +59 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Feature.js +74 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Marker.js +97 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Polygon.js +79 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Polyline.js +360 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js +41 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js +67 -0
- data/lib/leaflet.draw/src/edit/EditToolbar.js +93 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Circle.js +63 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Poly.js +267 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Rectangle.js +117 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js +138 -0
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js +109 -0
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js +233 -0
- data/lib/leaflet.draw/src/ext/LatLngUtil.js +18 -0
- data/lib/leaflet.draw/src/ext/LineUtil.Intersect.js +15 -0
- data/lib/leaflet.draw/src/ext/Polygon.Intersect.js +27 -0
- data/lib/leaflet.draw/src/ext/Polyline.Intersect.js +85 -0
- data/lib/leaflet.label/CHANGELOG.md +35 -0
- data/lib/leaflet.label/Jakefile.js +21 -0
- data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.label/README.md +86 -0
- data/lib/leaflet.label/build/build.js +155 -0
- data/lib/leaflet.label/build/deps.js +24 -0
- data/lib/leaflet.label/build/hint.js +30 -0
- data/lib/leaflet.label/build/hintrc.js +47 -0
- data/lib/leaflet.label/dist/images/death.png +0 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +359 -0
- data/lib/leaflet.label/dist/leaflet.label.css +33 -0
- data/lib/leaflet.label/dist/leaflet.label.js +9 -0
- data/lib/leaflet.label/example/label.html +82 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
- data/lib/leaflet.label/libs/leaflet/leaflet-src.js +8587 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.css +459 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.ie.css +51 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.js +8 -0
- data/lib/leaflet.label/src/FeatureGroup.Label.js +20 -0
- data/lib/leaflet.label/src/Label.js +123 -0
- data/lib/leaflet.label/src/Leaflet.label.js +5 -0
- data/lib/leaflet.label/src/Map.Label.js +7 -0
- data/lib/leaflet.label/src/Marker.Label.js +160 -0
- data/lib/leaflet.label/src/Path.Label.js +55 -0
- data/lib/leaflet.label/src/copyright.js +8 -0
- data/lib/leaflet/CHANGELOG.md +637 -0
- data/lib/leaflet/CONTRIBUTING.md +155 -0
- data/lib/leaflet/Jakefile.js +26 -0
- data/lib/leaflet/LICENSE +23 -0
- data/lib/leaflet/README.md +30 -0
- data/lib/leaflet/build/build.html +243 -0
- data/lib/leaflet/build/build.js +193 -0
- data/lib/leaflet/build/deps.js +256 -0
- data/lib/leaflet/build/hintrc.js +37 -0
- data/lib/leaflet/debug/css/mobile.css +6 -0
- data/lib/leaflet/debug/css/screen.css +5 -0
- data/lib/leaflet/debug/hacks/jitter.html +43 -0
- data/lib/leaflet/debug/leaflet-include.js +59 -0
- data/lib/leaflet/debug/map/canvas.html +47 -0
- data/lib/leaflet/debug/map/controls.html +50 -0
- data/lib/leaflet/debug/map/geolocation.html +35 -0
- data/lib/leaflet/debug/map/image-overlay.html +44 -0
- data/lib/leaflet/debug/map/map-mobile.html +35 -0
- data/lib/leaflet/debug/map/map.html +60 -0
- data/lib/leaflet/debug/map/max-bounds.html +37 -0
- data/lib/leaflet/debug/map/scroll.html +36 -0
- data/lib/leaflet/debug/map/simple-proj.html +45 -0
- data/lib/leaflet/debug/map/wms-marble.html +31 -0
- data/lib/leaflet/debug/map/wms.html +41 -0
- data/lib/leaflet/debug/map/zoomlevels.html +46 -0
- data/lib/leaflet/debug/tests/add_remove_layers.html +88 -0
- data/lib/leaflet/debug/tests/bringtoback.html +38 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +59 -0
- data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
- data/lib/leaflet/debug/tests/opacity.html +57 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +29 -0
- data/lib/leaflet/debug/tests/removetilewhilepan.html +42 -0
- data/lib/leaflet/debug/tests/reuse_popups.html +41 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +55 -0
- data/lib/leaflet/debug/vector/bounds-extend.html +89 -0
- data/lib/leaflet/debug/vector/feature-group-bounds.html +91 -0
- data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
- data/lib/leaflet/debug/vector/geojson.html +174 -0
- data/lib/leaflet/debug/vector/rectangle.html +54 -0
- data/lib/leaflet/debug/vector/route.js +1 -0
- data/lib/leaflet/debug/vector/touchzoomemu.html +195 -0
- data/lib/leaflet/debug/vector/us-states.js +54 -0
- data/lib/leaflet/debug/vector/vector-bounds.html +70 -0
- data/lib/leaflet/debug/vector/vector-canvas.html +93 -0
- data/lib/leaflet/debug/vector/vector-mobile.html +39 -0
- data/lib/leaflet/debug/vector/vector-simple.html +49 -0
- data/lib/leaflet/debug/vector/vector.html +38 -0
- data/lib/leaflet/dist/images/layers.png +0 -0
- data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
- data/lib/leaflet/dist/images/marker-icon.png +0 -0
- data/lib/leaflet/dist/images/marker-shadow.png +0 -0
- data/lib/leaflet/dist/leaflet-src.js +8579 -0
- data/lib/leaflet/dist/leaflet.css +459 -0
- data/lib/leaflet/dist/leaflet.ie.css +51 -0
- data/lib/leaflet/dist/leaflet.js +8 -0
- data/lib/leaflet/package.json +22 -0
- data/lib/leaflet/spec/after.js +2 -0
- data/lib/leaflet/spec/before.js +3 -0
- data/lib/leaflet/spec/expect.js +1253 -0
- data/lib/leaflet/spec/happen.js +93 -0
- data/lib/leaflet/spec/index.html +78 -0
- data/lib/leaflet/spec/karma.conf.js +64 -0
- data/lib/leaflet/spec/sinon.js +4223 -0
- data/lib/leaflet/spec/suites/LeafletSpec.js +13 -0
- data/lib/leaflet/spec/suites/SpecHelper.js +26 -0
- data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
- data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
- data/lib/leaflet/spec/suites/core/ClassSpec.js +156 -0
- data/lib/leaflet/spec/suites/core/EventsSpec.js +336 -0
- data/lib/leaflet/spec/suites/core/UtilSpec.js +212 -0
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +89 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +136 -0
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +118 -0
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +47 -0
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
- data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
- data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +36 -0
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +86 -0
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +58 -0
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +59 -0
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +87 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +17 -0
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +55 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
- data/lib/leaflet/spec/suites/map/MapSpec.js +244 -0
- data/lib/leaflet/src/Leaflet.js +23 -0
- data/lib/leaflet/src/control/Control.Attribution.js +115 -0
- data/lib/leaflet/src/control/Control.Layers.js +243 -0
- data/lib/leaflet/src/control/Control.Scale.js +112 -0
- data/lib/leaflet/src/control/Control.Zoom.js +86 -0
- data/lib/leaflet/src/control/Control.js +107 -0
- data/lib/leaflet/src/copyright.js +4 -0
- data/lib/leaflet/src/core/Browser.js +96 -0
- data/lib/leaflet/src/core/Class.js +106 -0
- data/lib/leaflet/src/core/Events.js +174 -0
- data/lib/leaflet/src/core/Handler.js +28 -0
- data/lib/leaflet/src/core/Util.js +182 -0
- data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +103 -0
- data/lib/leaflet/src/dom/DomEvent.MsTouch.js +146 -0
- data/lib/leaflet/src/dom/DomEvent.js +211 -0
- data/lib/leaflet/src/dom/DomUtil.js +239 -0
- data/lib/leaflet/src/dom/Draggable.js +198 -0
- data/lib/leaflet/src/dom/PosAnimation.Timer.js +67 -0
- data/lib/leaflet/src/dom/PosAnimation.js +83 -0
- data/lib/leaflet/src/geo/LatLng.js +88 -0
- data/lib/leaflet/src/geo/LatLngBounds.js +153 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +14 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +21 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG4326.js +10 -0
- data/lib/leaflet/src/geo/crs/CRS.Simple.js +12 -0
- data/lib/leaflet/src/geo/crs/CRS.js +27 -0
- data/lib/leaflet/src/geo/projection/Projection.LonLat.js +13 -0
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +56 -0
- data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +27 -0
- data/lib/leaflet/src/geo/projection/Projection.js +5 -0
- data/lib/leaflet/src/geometry/Bounds.js +95 -0
- data/lib/leaflet/src/geometry/LineUtil.js +202 -0
- data/lib/leaflet/src/geometry/Point.js +119 -0
- data/lib/leaflet/src/geometry/PolyUtil.js +55 -0
- data/lib/leaflet/src/geometry/Transformation.js +31 -0
- data/lib/leaflet/src/images/marker.svg +1 -0
- data/lib/leaflet/src/layer/FeatureGroup.js +81 -0
- data/lib/leaflet/src/layer/GeoJSON.js +245 -0
- data/lib/leaflet/src/layer/ImageOverlay.js +132 -0
- data/lib/leaflet/src/layer/LayerGroup.js +110 -0
- data/lib/leaflet/src/layer/Popup.js +316 -0
- data/lib/leaflet/src/layer/marker/DivIcon.js +43 -0
- data/lib/leaflet/src/layer/marker/Icon.Default.js +51 -0
- data/lib/leaflet/src/layer/marker/Icon.js +101 -0
- data/lib/leaflet/src/layer/marker/Marker.Drag.js +66 -0
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +72 -0
- data/lib/leaflet/src/layer/marker/Marker.js +275 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Anim.js +117 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +60 -0
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +83 -0
- data/lib/leaflet/src/layer/tile/TileLayer.js +578 -0
- data/lib/leaflet/src/layer/vector/Circle.js +98 -0
- data/lib/leaflet/src/layer/vector/CircleMarker.js +33 -0
- data/lib/leaflet/src/layer/vector/MultiPoly.js +47 -0
- data/lib/leaflet/src/layer/vector/Path.Popup.js +65 -0
- data/lib/leaflet/src/layer/vector/Path.SVG.js +219 -0
- data/lib/leaflet/src/layer/vector/Path.VML.js +125 -0
- data/lib/leaflet/src/layer/vector/Path.js +115 -0
- data/lib/leaflet/src/layer/vector/Polygon.js +81 -0
- data/lib/leaflet/src/layer/vector/Polyline.js +164 -0
- data/lib/leaflet/src/layer/vector/Rectangle.js +27 -0
- data/lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js +18 -0
- data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +196 -0
- data/lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js +37 -0
- data/lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js +30 -0
- data/lib/leaflet/src/map/Map.js +743 -0
- data/lib/leaflet/src/map/anim/Map.PanAnimation.js +88 -0
- data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +90 -0
- data/lib/leaflet/src/map/ext/Map.Geolocation.js +91 -0
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +104 -0
- data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +23 -0
- data/lib/leaflet/src/map/handler/Map.Drag.js +146 -0
- data/lib/leaflet/src/map/handler/Map.Keyboard.js +147 -0
- data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +56 -0
- data/lib/leaflet/src/map/handler/Map.TouchZoom.js +121 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/images/spritesheet.png +0 -0
- data/vendor/assets/javascripts/leaflet.draw.js +39 -0
- data/vendor/assets/javascripts/leaflet.js +145 -0
- data/vendor/assets/javascripts/leaflet.label.js +9 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +459 -0
- data/vendor/assets/stylesheets/leaflet.draw.css.erb +212 -0
- data/vendor/assets/stylesheets/leaflet.draw.ie.css +44 -0
- data/vendor/assets/stylesheets/leaflet.ie.css +51 -0
- data/vendor/assets/stylesheets/leaflet.label.css +33 -0
- metadata +317 -0
@@ -0,0 +1,193 @@
|
|
1
|
+
var fs = require('fs'),
|
2
|
+
jshint = require('jshint'),
|
3
|
+
UglifyJS = require('uglify-js'),
|
4
|
+
|
5
|
+
deps = require('./deps.js').deps,
|
6
|
+
hintrc = require('./hintrc.js').config;
|
7
|
+
|
8
|
+
function lintFiles(files) {
|
9
|
+
|
10
|
+
var errorsFound = 0,
|
11
|
+
i, j, len, len2, src, errors, e;
|
12
|
+
|
13
|
+
for (i = 0, len = files.length; i < len; i++) {
|
14
|
+
|
15
|
+
jshint.JSHINT(fs.readFileSync(files[i], 'utf8'), hintrc, i ? {L: true} : null);
|
16
|
+
errors = jshint.JSHINT.errors;
|
17
|
+
|
18
|
+
for (j = 0, len2 = errors.length; j < len2; j++) {
|
19
|
+
e = errors[j];
|
20
|
+
console.log(files[i] + '\tline ' + e.line + '\tcol ' + e.character + '\t ' + e.reason);
|
21
|
+
}
|
22
|
+
|
23
|
+
errorsFound += len2;
|
24
|
+
}
|
25
|
+
|
26
|
+
return errorsFound;
|
27
|
+
}
|
28
|
+
|
29
|
+
function getFiles(compsBase32) {
|
30
|
+
var memo = {},
|
31
|
+
comps;
|
32
|
+
|
33
|
+
if (compsBase32) {
|
34
|
+
comps = parseInt(compsBase32, 32).toString(2).split('');
|
35
|
+
console.log('Managing dependencies...');
|
36
|
+
}
|
37
|
+
|
38
|
+
function addFiles(srcs) {
|
39
|
+
for (var j = 0, len = srcs.length; j < len; j++) {
|
40
|
+
memo[srcs[j]] = true;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
for (var i in deps) {
|
45
|
+
if (comps) {
|
46
|
+
if (parseInt(comps.pop(), 2) === 1) {
|
47
|
+
console.log('\t* ' + i);
|
48
|
+
addFiles(deps[i].src);
|
49
|
+
} else {
|
50
|
+
console.log('\t ' + i);
|
51
|
+
}
|
52
|
+
} else {
|
53
|
+
addFiles(deps[i].src);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
var files = [];
|
58
|
+
|
59
|
+
for (var src in memo) {
|
60
|
+
files.push('src/' + src);
|
61
|
+
}
|
62
|
+
|
63
|
+
return files;
|
64
|
+
}
|
65
|
+
|
66
|
+
exports.getFiles = getFiles;
|
67
|
+
|
68
|
+
exports.lint = function () {
|
69
|
+
|
70
|
+
var files = getFiles();
|
71
|
+
|
72
|
+
console.log('Checking for JS errors...');
|
73
|
+
|
74
|
+
var errorsFound = lintFiles(files);
|
75
|
+
|
76
|
+
if (errorsFound > 0) {
|
77
|
+
console.log(errorsFound + ' error(s) found.\n');
|
78
|
+
fail();
|
79
|
+
} else {
|
80
|
+
console.log('\tCheck passed');
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
|
85
|
+
function getSizeDelta(newContent, oldContent) {
|
86
|
+
if (!oldContent) {
|
87
|
+
return 'new';
|
88
|
+
}
|
89
|
+
var newLen = newContent.replace(/\r\n?/g, '\n').length,
|
90
|
+
oldLen = oldContent.replace(/\r\n?/g, '\n').length,
|
91
|
+
delta = newLen - oldLen;
|
92
|
+
|
93
|
+
return (delta >= 0 ? '+' : '') + delta;
|
94
|
+
}
|
95
|
+
|
96
|
+
function loadSilently(path) {
|
97
|
+
try {
|
98
|
+
return fs.readFileSync(path, 'utf8');
|
99
|
+
} catch (e) {
|
100
|
+
return null;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
function combineFiles(files) {
|
105
|
+
var content = '';
|
106
|
+
for (var i = 0, len = files.length; i < len; i++) {
|
107
|
+
content += fs.readFileSync(files[i], 'utf8') + '\n\n';
|
108
|
+
}
|
109
|
+
return content;
|
110
|
+
}
|
111
|
+
|
112
|
+
exports.build = function (compsBase32, buildName) {
|
113
|
+
|
114
|
+
var files = getFiles(compsBase32);
|
115
|
+
|
116
|
+
console.log('Concatenating ' + files.length + ' files...');
|
117
|
+
|
118
|
+
var copy = fs.readFileSync('src/copyright.js', 'utf8'),
|
119
|
+
intro = '(function (window, document, undefined) {',
|
120
|
+
outro = '}(window, document));',
|
121
|
+
newSrc = copy + intro + combineFiles(files) + outro,
|
122
|
+
|
123
|
+
pathPart = 'dist/leaflet' + (buildName ? '-' + buildName : ''),
|
124
|
+
srcPath = pathPart + '-src.js',
|
125
|
+
|
126
|
+
oldSrc = loadSilently(srcPath),
|
127
|
+
srcDelta = getSizeDelta(newSrc, oldSrc);
|
128
|
+
|
129
|
+
console.log('\tUncompressed size: ' + newSrc.length + ' bytes (' + srcDelta + ')');
|
130
|
+
|
131
|
+
if (newSrc === oldSrc) {
|
132
|
+
console.log('\tNo changes');
|
133
|
+
} else {
|
134
|
+
fs.writeFileSync(srcPath, newSrc);
|
135
|
+
console.log('\tSaved to ' + srcPath);
|
136
|
+
}
|
137
|
+
|
138
|
+
console.log('Compressing...');
|
139
|
+
|
140
|
+
var path = pathPart + '.js',
|
141
|
+
oldCompressed = loadSilently(path),
|
142
|
+
newCompressed = copy + UglifyJS.minify(newSrc, {
|
143
|
+
warnings: true,
|
144
|
+
fromString: true
|
145
|
+
}).code,
|
146
|
+
delta = getSizeDelta(newCompressed, oldCompressed);
|
147
|
+
|
148
|
+
console.log('\tCompressed size: ' + newCompressed.length + ' bytes (' + delta + ')');
|
149
|
+
|
150
|
+
if (newCompressed === oldCompressed) {
|
151
|
+
console.log('\tNo changes');
|
152
|
+
} else {
|
153
|
+
fs.writeFileSync(path, newCompressed);
|
154
|
+
console.log('\tSaved to ' + path);
|
155
|
+
}
|
156
|
+
};
|
157
|
+
|
158
|
+
exports.test = function() {
|
159
|
+
var karma = require('karma'),
|
160
|
+
testConfig = {configFile : __dirname + '/../spec/karma.conf.js'};
|
161
|
+
|
162
|
+
testConfig.browsers = ['PhantomJS'];
|
163
|
+
|
164
|
+
if (isArgv('--chrome')) {
|
165
|
+
testConfig.browsers.push('Chrome');
|
166
|
+
}
|
167
|
+
if (isArgv('--safari')) {
|
168
|
+
testConfig.browsers.push('Safari');
|
169
|
+
}
|
170
|
+
if (isArgv('--ff')) {
|
171
|
+
testConfig.browsers.push('Firefox');
|
172
|
+
}
|
173
|
+
if (isArgv('--ie')) {
|
174
|
+
testConfig.browsers.push('IE');
|
175
|
+
}
|
176
|
+
|
177
|
+
if (isArgv('--cov')) {
|
178
|
+
testConfig.preprocessors = {
|
179
|
+
'../src/**/*.js': 'coverage'
|
180
|
+
};
|
181
|
+
testConfig.coverageReporter = {
|
182
|
+
type : 'html',
|
183
|
+
dir : 'coverage/'
|
184
|
+
};
|
185
|
+
testConfig.reporters = ['coverage'];
|
186
|
+
}
|
187
|
+
|
188
|
+
karma.server.start(testConfig);
|
189
|
+
|
190
|
+
function isArgv(optName) {
|
191
|
+
return process.argv.indexOf(optName) !== -1;
|
192
|
+
}
|
193
|
+
};
|
@@ -0,0 +1,256 @@
|
|
1
|
+
var deps = {
|
2
|
+
Core: {
|
3
|
+
src: ['Leaflet.js',
|
4
|
+
'core/Util.js',
|
5
|
+
'core/Class.js',
|
6
|
+
'core/Events.js',
|
7
|
+
'core/Browser.js',
|
8
|
+
'geometry/Point.js',
|
9
|
+
'geometry/Bounds.js',
|
10
|
+
'geometry/Transformation.js',
|
11
|
+
'dom/DomUtil.js',
|
12
|
+
'geo/LatLng.js',
|
13
|
+
'geo/LatLngBounds.js',
|
14
|
+
'geo/projection/Projection.js',
|
15
|
+
'geo/projection/Projection.SphericalMercator.js',
|
16
|
+
'geo/projection/Projection.LonLat.js',
|
17
|
+
'geo/crs/CRS.js',
|
18
|
+
'geo/crs/CRS.Simple.js',
|
19
|
+
'geo/crs/CRS.EPSG3857.js',
|
20
|
+
'geo/crs/CRS.EPSG4326.js',
|
21
|
+
'map/Map.js'],
|
22
|
+
desc: 'The core of the library, including OOP, events, DOM facilities, basic units, projections (EPSG:3857 and EPSG:4326) and the base Map class.'
|
23
|
+
},
|
24
|
+
|
25
|
+
EPSG3395: {
|
26
|
+
src: ['geo/projection/Projection.Mercator.js',
|
27
|
+
'geo/crs/CRS.EPSG3395.js'],
|
28
|
+
desc: 'EPSG:3395 projection (used by some map providers).',
|
29
|
+
heading: 'Additional projections'
|
30
|
+
},
|
31
|
+
|
32
|
+
TileLayer: {
|
33
|
+
src: ['layer/tile/TileLayer.js'],
|
34
|
+
desc: 'The base class for displaying tile layers on the map.',
|
35
|
+
heading: 'Layers'
|
36
|
+
},
|
37
|
+
|
38
|
+
TileLayerWMS: {
|
39
|
+
src: ['layer/tile/TileLayer.WMS.js'],
|
40
|
+
desc: 'WMS tile layer.',
|
41
|
+
deps: ['TileLayer']
|
42
|
+
},
|
43
|
+
|
44
|
+
TileLayerCanvas: {
|
45
|
+
src: ['layer/tile/TileLayer.Canvas.js'],
|
46
|
+
desc: 'Tile layer made from canvases (for custom drawing purposes).',
|
47
|
+
deps: ['TileLayer']
|
48
|
+
},
|
49
|
+
|
50
|
+
ImageOverlay: {
|
51
|
+
src: ['layer/ImageOverlay.js'],
|
52
|
+
desc: 'Used to display an image over a particular rectangular area of the map.'
|
53
|
+
},
|
54
|
+
|
55
|
+
Marker: {
|
56
|
+
src: ['layer/marker/Icon.js',
|
57
|
+
'layer/marker/Icon.Default.js',
|
58
|
+
'layer/marker/Marker.js'],
|
59
|
+
desc: 'Markers to put on the map.'
|
60
|
+
},
|
61
|
+
|
62
|
+
DivIcon: {
|
63
|
+
src: ['layer/marker/DivIcon.js'],
|
64
|
+
deps: ['Marker'],
|
65
|
+
desc: 'Lightweight div-based icon for markers.'
|
66
|
+
},
|
67
|
+
|
68
|
+
Popup: {
|
69
|
+
src: ['layer/Popup.js',
|
70
|
+
'layer/marker/Marker.Popup.js'],
|
71
|
+
deps: ['Marker'],
|
72
|
+
desc: 'Used to display the map popup (used mostly for binding HTML data to markers and paths on click).'
|
73
|
+
},
|
74
|
+
|
75
|
+
LayerGroup: {
|
76
|
+
src: ['layer/LayerGroup.js'],
|
77
|
+
desc: 'Allows grouping several layers to handle them as one.'
|
78
|
+
},
|
79
|
+
|
80
|
+
FeatureGroup: {
|
81
|
+
src: ['layer/FeatureGroup.js'],
|
82
|
+
deps: ['LayerGroup', 'Popup'],
|
83
|
+
desc: 'Extends LayerGroup with mouse events and bindPopup method shared between layers.'
|
84
|
+
},
|
85
|
+
|
86
|
+
Path: {
|
87
|
+
src: ['layer/vector/Path.js',
|
88
|
+
'layer/vector/Path.SVG.js',
|
89
|
+
'layer/vector/Path.Popup.js'],
|
90
|
+
desc: 'Vector rendering core (SVG-powered), enables overlaying the map with SVG paths.',
|
91
|
+
heading: 'Vector layers'
|
92
|
+
},
|
93
|
+
|
94
|
+
PathVML: {
|
95
|
+
src: ['layer/vector/Path.VML.js'],
|
96
|
+
desc: 'VML fallback for vector rendering core (IE 6-8).'
|
97
|
+
},
|
98
|
+
|
99
|
+
PathCanvas: {
|
100
|
+
src: ['layer/vector/canvas/Path.Canvas.js'],
|
101
|
+
deps: ['Path', 'Polyline', 'Polygon', 'Circle'],
|
102
|
+
desc: 'Canvas fallback for vector rendering core (makes it work on Android 2+).'
|
103
|
+
},
|
104
|
+
|
105
|
+
Polyline: {
|
106
|
+
src: ['geometry/LineUtil.js',
|
107
|
+
'layer/vector/Polyline.js'],
|
108
|
+
deps: ['Path'],
|
109
|
+
desc: 'Polyline overlays.'
|
110
|
+
},
|
111
|
+
|
112
|
+
Polygon: {
|
113
|
+
src: ['geometry/PolyUtil.js',
|
114
|
+
'layer/vector/Polygon.js'],
|
115
|
+
deps: ['Polyline'],
|
116
|
+
desc: 'Polygon overlays.'
|
117
|
+
},
|
118
|
+
|
119
|
+
MultiPoly: {
|
120
|
+
src: ['layer/vector/MultiPoly.js'],
|
121
|
+
deps: ['FeatureGroup', 'Polyline', 'Polygon'],
|
122
|
+
desc: 'MultiPolygon and MultyPolyline layers.'
|
123
|
+
},
|
124
|
+
|
125
|
+
Rectangle: {
|
126
|
+
src: ['layer/vector/Rectangle.js'],
|
127
|
+
deps: ['Polygon'],
|
128
|
+
desc: ['Rectangle overlays.']
|
129
|
+
},
|
130
|
+
|
131
|
+
Circle: {
|
132
|
+
src: ['layer/vector/Circle.js'],
|
133
|
+
deps: ['Path'],
|
134
|
+
desc: 'Circle overlays (with radius in meters).'
|
135
|
+
},
|
136
|
+
|
137
|
+
CircleMarker: {
|
138
|
+
src: ['layer/vector/CircleMarker.js'],
|
139
|
+
deps: ['Circle'],
|
140
|
+
desc: 'Circle overlays with a constant pixel radius.'
|
141
|
+
},
|
142
|
+
|
143
|
+
VectorsCanvas: {
|
144
|
+
src: ['layer/vector/canvas/Polyline.Canvas.js',
|
145
|
+
'layer/vector/canvas/Polygon.Canvas.js',
|
146
|
+
'layer/vector/canvas/Circle.Canvas.js'],
|
147
|
+
deps: ['PathCanvas', 'Polyline', 'Polygon', 'Circle'],
|
148
|
+
desc: 'Canvas fallback for vector layers (polygons, polylines, circles)'
|
149
|
+
},
|
150
|
+
|
151
|
+
GeoJSON: {
|
152
|
+
src: ['layer/GeoJSON.js'],
|
153
|
+
deps: ['Marker', 'MultiPoly', 'FeatureGroup'],
|
154
|
+
desc: 'GeoJSON layer, parses the data and adds corresponding layers above.'
|
155
|
+
},
|
156
|
+
|
157
|
+
|
158
|
+
MapDrag: {
|
159
|
+
src: ['dom/DomEvent.js',
|
160
|
+
'dom/Draggable.js',
|
161
|
+
'core/Handler.js',
|
162
|
+
'map/handler/Map.Drag.js'],
|
163
|
+
desc: 'Makes the map draggable (by mouse or touch).',
|
164
|
+
heading: 'Interaction'
|
165
|
+
},
|
166
|
+
|
167
|
+
MouseZoom: {
|
168
|
+
src: ['dom/DomEvent.js',
|
169
|
+
'core/Handler.js',
|
170
|
+
'map/handler/Map.DoubleClickZoom.js',
|
171
|
+
'map/handler/Map.ScrollWheelZoom.js'],
|
172
|
+
desc: 'Scroll wheel zoom and double click zoom on the map.'
|
173
|
+
},
|
174
|
+
|
175
|
+
TouchZoom: {
|
176
|
+
src: ['dom/DomEvent.js',
|
177
|
+
'dom/DomEvent.DoubleTap.js',
|
178
|
+
'dom/DomEvent.MsTouch.js',
|
179
|
+
'core/Handler.js',
|
180
|
+
'map/handler/Map.TouchZoom.js'],
|
181
|
+
deps: ['AnimationZoom'],
|
182
|
+
desc: 'Enables smooth touch zooming on iOS and IE10 and double tap on iOS/IE10/Android.'
|
183
|
+
},
|
184
|
+
|
185
|
+
BoxZoom: {
|
186
|
+
src: ['map/handler/Map.BoxZoom.js'],
|
187
|
+
desc: 'Enables zooming to bounding box by shift-dragging the map.'
|
188
|
+
},
|
189
|
+
|
190
|
+
Keyboard: {
|
191
|
+
src: ['map/handler/Map.Keyboard.js'],
|
192
|
+
desc: 'Enables keyboard pan/zoom when the map is focused.'
|
193
|
+
},
|
194
|
+
|
195
|
+
MarkerDrag: {
|
196
|
+
src: ['layer/marker/Marker.Drag.js'],
|
197
|
+
deps: ['Marker'],
|
198
|
+
desc: 'Makes markers draggable (by mouse or touch).'
|
199
|
+
},
|
200
|
+
|
201
|
+
ControlZoom: {
|
202
|
+
src: ['control/Control.js',
|
203
|
+
'control/Control.Zoom.js'],
|
204
|
+
heading: 'Controls',
|
205
|
+
desc: 'Basic zoom control with two buttons (zoom in / zoom out).'
|
206
|
+
},
|
207
|
+
|
208
|
+
ControlAttrib: {
|
209
|
+
src: ['control/Control.js',
|
210
|
+
'control/Control.Attribution.js'],
|
211
|
+
desc: 'Attribution control.'
|
212
|
+
},
|
213
|
+
|
214
|
+
ControlScale: {
|
215
|
+
src: ['control/Control.js',
|
216
|
+
'control/Control.Scale.js'],
|
217
|
+
desc: 'Scale control.'
|
218
|
+
},
|
219
|
+
|
220
|
+
ControlLayers: {
|
221
|
+
src: ['control/Control.js',
|
222
|
+
'control/Control.Layers.js'],
|
223
|
+
desc: 'Layer Switcher control.'
|
224
|
+
},
|
225
|
+
|
226
|
+
AnimationPan: {
|
227
|
+
src: [
|
228
|
+
'dom/DomEvent.js',
|
229
|
+
'dom/PosAnimation.js',
|
230
|
+
'map/anim/Map.PanAnimation.js'
|
231
|
+
],
|
232
|
+
desc: 'Core panning animation support.'
|
233
|
+
},
|
234
|
+
|
235
|
+
AnimationTimer: {
|
236
|
+
src: ['dom/PosAnimation.Timer.js'],
|
237
|
+
deps: ['AnimationPan'],
|
238
|
+
desc: 'Timer-based pan animation fallback for browsers that don\'t support CSS3 transitions.'
|
239
|
+
},
|
240
|
+
|
241
|
+
AnimationZoom: {
|
242
|
+
src: ['map/anim/Map.ZoomAnimation.js', 'layer/tile/TileLayer.Anim.js'],
|
243
|
+
deps: ['AnimationPan'],
|
244
|
+
desc: 'Smooth zooming animation. Works only on browsers that support CSS3 Transitions.'
|
245
|
+
},
|
246
|
+
|
247
|
+
Geolocation: {
|
248
|
+
src: ['map/ext/Map.Geolocation.js'],
|
249
|
+
desc: 'Adds Map#locate method and related events to make geolocation easier.',
|
250
|
+
heading: 'Misc'
|
251
|
+
}
|
252
|
+
};
|
253
|
+
|
254
|
+
if (typeof exports !== 'undefined') {
|
255
|
+
exports.deps = deps;
|
256
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
exports.config = {
|
2
|
+
|
3
|
+
// environment
|
4
|
+
"browser": true,
|
5
|
+
"node": true,
|
6
|
+
"predef": ['define'],
|
7
|
+
"strict": false,
|
8
|
+
|
9
|
+
// code style
|
10
|
+
"bitwise": true,
|
11
|
+
"camelcase": true,
|
12
|
+
"curly": true,
|
13
|
+
"eqeqeq": true,
|
14
|
+
"forin": false,
|
15
|
+
"immed": true,
|
16
|
+
"latedef": true,
|
17
|
+
"newcap": true,
|
18
|
+
"noarg": true,
|
19
|
+
"noempty": true,
|
20
|
+
"nonew": true,
|
21
|
+
"undef": true,
|
22
|
+
"unused": true,
|
23
|
+
"quotmark": "single",
|
24
|
+
|
25
|
+
// whitespace
|
26
|
+
"indent": 4,
|
27
|
+
"trailing": true,
|
28
|
+
"white": true,
|
29
|
+
"smarttabs": true,
|
30
|
+
"maxlen": 120
|
31
|
+
|
32
|
+
// code simplicity - not enforced but nice to check from time to time
|
33
|
+
// "maxstatements": 20,
|
34
|
+
// "maxcomplexity": 5
|
35
|
+
// "maxparams": 4,
|
36
|
+
// "maxdepth": 4
|
37
|
+
};
|