leaflet-ruby 0.3.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/LICENSE +21 -0
- data/README.rdoc +55 -0
- data/Rakefile +15 -0
- data/leaflet-ruby.gemspec +24 -0
- data/lib/leaflet-ruby.rb +18 -0
- data/lib/leaflet/CHANGELOG.md +181 -0
- data/lib/leaflet/Jakefile.js +65 -0
- data/lib/leaflet/LICENSE +22 -0
- data/lib/leaflet/README.md +32 -0
- data/lib/leaflet/build/build.html +243 -0
- data/lib/leaflet/build/build.js +79 -0
- data/lib/leaflet/build/deps.js +231 -0
- data/lib/leaflet/build/hint.js +30 -0
- data/lib/leaflet/build/hintrc.js +44 -0
- data/lib/leaflet/debug/control/control-layers.html +47 -0
- data/lib/leaflet/debug/control/map-control.html +29 -0
- data/lib/leaflet/debug/css/mobile.css +6 -0
- data/lib/leaflet/debug/css/screen.css +5 -0
- data/lib/leaflet/debug/geojson/geojson-sample.js +53 -0
- data/lib/leaflet/debug/geojson/geojson.html +56 -0
- data/lib/leaflet/debug/leaflet-include.js +120 -0
- data/lib/leaflet/debug/map/canvas.html +46 -0
- data/lib/leaflet/debug/map/map-mobile.html +42 -0
- data/lib/leaflet/debug/map/map.html +54 -0
- data/lib/leaflet/debug/map/max-bounds.html +36 -0
- data/lib/leaflet/debug/map/scroll.html +35 -0
- data/lib/leaflet/debug/map/wms-marble.html +30 -0
- data/lib/leaflet/debug/map/wms.html +37 -0
- data/lib/leaflet/debug/vector/editable.html +43 -0
- data/lib/leaflet/debug/vector/route.js +1 -0
- data/lib/leaflet/debug/vector/vector-bounds.html +69 -0
- data/lib/leaflet/debug/vector/vector-canvas.html +92 -0
- data/lib/leaflet/debug/vector/vector-mobile.html +38 -0
- data/lib/leaflet/debug/vector/vector-simple.html +63 -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-shadow.png +0 -0
- data/lib/leaflet/dist/images/marker.png +0 -0
- data/lib/leaflet/dist/images/popup-close.png +0 -0
- data/lib/leaflet/dist/images/zoom-in.png +0 -0
- data/lib/leaflet/dist/images/zoom-out.png +0 -0
- data/lib/leaflet/dist/leaflet-src.js +5537 -0
- data/lib/leaflet/dist/leaflet.css +323 -0
- data/lib/leaflet/dist/leaflet.ie.css +48 -0
- data/lib/leaflet/dist/leaflet.js +6 -0
- data/lib/leaflet/lib/jasmine/jasmine-html.js +182 -0
- data/lib/leaflet/lib/jasmine/jasmine.css +166 -0
- data/lib/leaflet/lib/jasmine/jasmine.js +2421 -0
- data/lib/leaflet/spec/runner.html +57 -0
- data/lib/leaflet/spec/suites/LeafletSpec.js +15 -0
- data/lib/leaflet/spec/suites/SpecHelper.js +28 -0
- data/lib/leaflet/spec/suites/core/ClassSpec.js +153 -0
- data/lib/leaflet/spec/suites/core/EventsSpec.js +110 -0
- data/lib/leaflet/spec/suites/core/UtilSpec.js +63 -0
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +59 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +1 -0
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +76 -0
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +42 -0
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +53 -0
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +45 -0
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +19 -0
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +1 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
- data/lib/leaflet/spec/suites/map/MapSpec.js +1 -0
- data/lib/leaflet/src/Leaflet.js +33 -0
- data/lib/leaflet/src/control/Control.Attribution.js +66 -0
- data/lib/leaflet/src/control/Control.Layers.js +167 -0
- data/lib/leaflet/src/control/Control.Zoom.js +36 -0
- data/lib/leaflet/src/control/Control.js +9 -0
- data/lib/leaflet/src/core/Browser.js +53 -0
- data/lib/leaflet/src/core/Class.js +66 -0
- data/lib/leaflet/src/core/Events.js +62 -0
- data/lib/leaflet/src/core/Handler.js +29 -0
- data/lib/leaflet/src/core/Util.js +108 -0
- data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +43 -0
- data/lib/leaflet/src/dom/DomEvent.js +154 -0
- data/lib/leaflet/src/dom/DomUtil.js +155 -0
- data/lib/leaflet/src/dom/Draggable.js +147 -0
- data/lib/leaflet/src/dom/transition/Transition.Native.js +102 -0
- data/lib/leaflet/src/dom/transition/Transition.Timer.js +126 -0
- data/lib/leaflet/src/dom/transition/Transition.js +28 -0
- data/lib/leaflet/src/geo/LatLng.js +44 -0
- data/lib/leaflet/src/geo/LatLngBounds.js +86 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +13 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +17 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG4326.js +7 -0
- data/lib/leaflet/src/geo/crs/CRS.js +17 -0
- data/lib/leaflet/src/geo/projection/Projection.LonLat.js +10 -0
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +51 -0
- data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +23 -0
- data/lib/leaflet/src/geo/projection/Projection.js +5 -0
- data/lib/leaflet/src/geometry/Bounds.js +50 -0
- data/lib/leaflet/src/geometry/LineUtil.js +194 -0
- data/lib/leaflet/src/geometry/Point.js +66 -0
- data/lib/leaflet/src/geometry/PolyUtil.js +59 -0
- data/lib/leaflet/src/geometry/Transformation.js +31 -0
- data/lib/leaflet/src/layer/FeatureGroup.js +40 -0
- data/lib/leaflet/src/layer/GeoJSON.js +104 -0
- data/lib/leaflet/src/layer/ImageOverlay.js +58 -0
- data/lib/leaflet/src/layer/LayerGroup.js +74 -0
- data/lib/leaflet/src/layer/Popup.js +179 -0
- data/lib/leaflet/src/layer/marker/Icon.js +58 -0
- data/lib/leaflet/src/layer/marker/Marker.Drag.js +57 -0
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +42 -0
- data/lib/leaflet/src/layer/marker/Marker.js +142 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +41 -0
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +47 -0
- data/lib/leaflet/src/layer/tile/TileLayer.js +310 -0
- data/lib/leaflet/src/layer/vector/Circle.js +68 -0
- data/lib/leaflet/src/layer/vector/CircleMarker.js +25 -0
- data/lib/leaflet/src/layer/vector/MultiPoly.js +34 -0
- data/lib/leaflet/src/layer/vector/Path.Popup.js +24 -0
- data/lib/leaflet/src/layer/vector/Path.SVG.js +138 -0
- data/lib/leaflet/src/layer/vector/Path.VML.js +93 -0
- data/lib/leaflet/src/layer/vector/Path.js +88 -0
- data/lib/leaflet/src/layer/vector/Polygon.js +64 -0
- data/lib/leaflet/src/layer/vector/Polyline.js +146 -0
- data/lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js +18 -0
- data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +146 -0
- data/lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js +34 -0
- data/lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js +27 -0
- data/lib/leaflet/src/map/Map.js +613 -0
- data/lib/leaflet/src/map/anim/Map.PanAnimation.js +70 -0
- data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +133 -0
- data/lib/leaflet/src/map/ext/Map.Control.js +50 -0
- data/lib/leaflet/src/map/ext/Map.Geolocation.js +86 -0
- data/lib/leaflet/src/map/ext/Map.Popup.js +20 -0
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +73 -0
- data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +18 -0
- data/lib/leaflet/src/map/handler/Map.Drag.js +81 -0
- data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +55 -0
- data/lib/leaflet/src/map/handler/Map.TouchZoom.js +93 -0
- data/lib/zerista/CRS.Cartesian.js +20 -0
- data/lib/zerista/Projection.Identity.js +11 -0
- data/lib/zerista/zerista_layer.js +97 -0
- data/vendor/assets/javascripts/leaflet.js +139 -0
- data/vendor/assets/stylesheets/leaflet.css +1 -0
- data/vendor/assets/stylesheets/leaflet.ie.css +1 -0
- metadata +185 -0
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
* L.Handler.MapDrag is used internally by L.Map to make the map draggable.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Map.Drag = L.Handler.extend({
|
6
|
+
addHooks: function () {
|
7
|
+
if (!this._draggable) {
|
8
|
+
this._draggable = new L.Draggable(this._map._mapPane, this._map._container);
|
9
|
+
|
10
|
+
this._draggable
|
11
|
+
.on('dragstart', this._onDragStart, this)
|
12
|
+
.on('drag', this._onDrag, this)
|
13
|
+
.on('dragend', this._onDragEnd, this);
|
14
|
+
|
15
|
+
var options = this._map.options;
|
16
|
+
|
17
|
+
if (options.worldCopyJump && !options.continuousWorld) {
|
18
|
+
this._draggable.on('predrag', this._onPreDrag, this);
|
19
|
+
this._map.on('viewreset', this._onViewReset, this);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
this._draggable.enable();
|
23
|
+
},
|
24
|
+
|
25
|
+
removeHooks: function () {
|
26
|
+
this._draggable.disable();
|
27
|
+
},
|
28
|
+
|
29
|
+
moved: function () {
|
30
|
+
return this._draggable && this._draggable._moved;
|
31
|
+
},
|
32
|
+
|
33
|
+
_onDragStart: function () {
|
34
|
+
this._map
|
35
|
+
.fire('movestart')
|
36
|
+
.fire('dragstart');
|
37
|
+
},
|
38
|
+
|
39
|
+
_onDrag: function () {
|
40
|
+
this._map
|
41
|
+
.fire('move')
|
42
|
+
.fire('drag');
|
43
|
+
},
|
44
|
+
|
45
|
+
_onViewReset: function () {
|
46
|
+
var pxCenter = this._map.getSize().divideBy(2),
|
47
|
+
pxWorldCenter = this._map.latLngToLayerPoint(new L.LatLng(0, 0));
|
48
|
+
|
49
|
+
this._initialWorldOffset = pxWorldCenter.subtract(pxCenter);
|
50
|
+
},
|
51
|
+
|
52
|
+
_onPreDrag: function () {
|
53
|
+
var map = this._map,
|
54
|
+
worldWidth = map.options.scale(map.getZoom()),
|
55
|
+
halfWidth = Math.round(worldWidth / 2),
|
56
|
+
dx = this._initialWorldOffset.x,
|
57
|
+
x = this._draggable._newPos.x,
|
58
|
+
newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx,
|
59
|
+
newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
|
60
|
+
newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
|
61
|
+
|
62
|
+
this._draggable._newPos.x = newX;
|
63
|
+
},
|
64
|
+
|
65
|
+
_onDragEnd: function () {
|
66
|
+
var map = this._map;
|
67
|
+
|
68
|
+
map
|
69
|
+
.fire('moveend')
|
70
|
+
.fire('dragend');
|
71
|
+
|
72
|
+
if (map.options.maxBounds) {
|
73
|
+
// TODO predrag validation instead of animation
|
74
|
+
L.Util.requestAnimFrame(this._panInsideMaxBounds, map, true, map._container);
|
75
|
+
}
|
76
|
+
},
|
77
|
+
|
78
|
+
_panInsideMaxBounds: function () {
|
79
|
+
this.panInsideBounds(this.options.maxBounds);
|
80
|
+
}
|
81
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/*
|
2
|
+
* L.Handler.ScrollWheelZoom is used internally by L.Map to enable mouse scroll wheel zooming on the map.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Map.ScrollWheelZoom = L.Handler.extend({
|
6
|
+
addHooks: function () {
|
7
|
+
L.DomEvent.addListener(this._map._container, 'mousewheel', this._onWheelScroll, this);
|
8
|
+
this._delta = 0;
|
9
|
+
},
|
10
|
+
|
11
|
+
removeHooks: function () {
|
12
|
+
L.DomEvent.removeListener(this._map._container, 'mousewheel', this._onWheelScroll);
|
13
|
+
},
|
14
|
+
|
15
|
+
_onWheelScroll: function (e) {
|
16
|
+
var delta = L.DomEvent.getWheelDelta(e);
|
17
|
+
this._delta += delta;
|
18
|
+
this._lastMousePos = this._map.mouseEventToContainerPoint(e);
|
19
|
+
|
20
|
+
clearTimeout(this._timer);
|
21
|
+
this._timer = setTimeout(L.Util.bind(this._performZoom, this), 50);
|
22
|
+
|
23
|
+
L.DomEvent.preventDefault(e);
|
24
|
+
},
|
25
|
+
|
26
|
+
_performZoom: function () {
|
27
|
+
var map = this._map,
|
28
|
+
delta = Math.round(this._delta),
|
29
|
+
zoom = map.getZoom();
|
30
|
+
|
31
|
+
delta = Math.max(Math.min(delta, 4), -4);
|
32
|
+
delta = map._limitZoom(zoom + delta) - zoom;
|
33
|
+
|
34
|
+
this._delta = 0;
|
35
|
+
|
36
|
+
if (!delta) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
var newCenter = this._getCenterForScrollWheelZoom(this._lastMousePos, delta),
|
41
|
+
newZoom = zoom + delta;
|
42
|
+
|
43
|
+
map.setView(newCenter, newZoom);
|
44
|
+
},
|
45
|
+
|
46
|
+
_getCenterForScrollWheelZoom: function (mousePos, delta) {
|
47
|
+
var map = this._map,
|
48
|
+
centerPoint = map.getPixelBounds().getCenter(),
|
49
|
+
viewHalf = map.getSize().divideBy(2),
|
50
|
+
centerOffset = mousePos.subtract(viewHalf).multiplyBy(1 - Math.pow(2, -delta)),
|
51
|
+
newCenterPoint = centerPoint.add(centerOffset);
|
52
|
+
|
53
|
+
return map.unproject(newCenterPoint, map._zoom, true);
|
54
|
+
}
|
55
|
+
});
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/*
|
2
|
+
* L.Handler.TouchZoom is used internally by L.Map to add touch-zooming on Webkit-powered mobile browsers.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Map.TouchZoom = L.Handler.extend({
|
6
|
+
addHooks: function () {
|
7
|
+
L.DomEvent.addListener(this._map._container, 'touchstart', this._onTouchStart, this);
|
8
|
+
},
|
9
|
+
|
10
|
+
removeHooks: function () {
|
11
|
+
L.DomEvent.removeListener(this._map._container, 'touchstart', this._onTouchStart, this);
|
12
|
+
},
|
13
|
+
|
14
|
+
_onTouchStart: function (e) {
|
15
|
+
if (!e.touches || e.touches.length !== 2 || this._map._animatingZoom) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
19
|
+
var p1 = this._map.mouseEventToLayerPoint(e.touches[0]),
|
20
|
+
p2 = this._map.mouseEventToLayerPoint(e.touches[1]),
|
21
|
+
viewCenter = this._map.containerPointToLayerPoint(this._map.getSize().divideBy(2));
|
22
|
+
|
23
|
+
this._startCenter = p1.add(p2).divideBy(2, true);
|
24
|
+
this._startDist = p1.distanceTo(p2);
|
25
|
+
//this._startTransform = this._map._mapPane.style.webkitTransform;
|
26
|
+
|
27
|
+
this._moved = false;
|
28
|
+
this._zooming = true;
|
29
|
+
|
30
|
+
this._centerOffset = viewCenter.subtract(this._startCenter);
|
31
|
+
|
32
|
+
L.DomEvent.addListener(document, 'touchmove', this._onTouchMove, this);
|
33
|
+
L.DomEvent.addListener(document, 'touchend', this._onTouchEnd, this);
|
34
|
+
|
35
|
+
L.DomEvent.preventDefault(e);
|
36
|
+
},
|
37
|
+
|
38
|
+
_onTouchMove: function (e) {
|
39
|
+
if (!e.touches || e.touches.length !== 2) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
|
43
|
+
if (!this._moved) {
|
44
|
+
this._map._mapPane.className += ' leaflet-zoom-anim';
|
45
|
+
|
46
|
+
this._map
|
47
|
+
.fire('zoomstart')
|
48
|
+
.fire('movestart')
|
49
|
+
._prepareTileBg();
|
50
|
+
|
51
|
+
this._moved = true;
|
52
|
+
}
|
53
|
+
|
54
|
+
var p1 = this._map.mouseEventToLayerPoint(e.touches[0]),
|
55
|
+
p2 = this._map.mouseEventToLayerPoint(e.touches[1]);
|
56
|
+
|
57
|
+
this._scale = p1.distanceTo(p2) / this._startDist;
|
58
|
+
this._delta = p1.add(p2).divideBy(2, true).subtract(this._startCenter);
|
59
|
+
|
60
|
+
// Used 2 translates instead of transform-origin because of a very strange bug -
|
61
|
+
// it didn't count the origin on the first touch-zoom but worked correctly afterwards
|
62
|
+
|
63
|
+
this._map._tileBg.style.webkitTransform = [
|
64
|
+
L.DomUtil.getTranslateString(this._delta),
|
65
|
+
L.DomUtil.getScaleString(this._scale, this._startCenter)
|
66
|
+
].join(" ");
|
67
|
+
|
68
|
+
L.DomEvent.preventDefault(e);
|
69
|
+
},
|
70
|
+
|
71
|
+
_onTouchEnd: function (e) {
|
72
|
+
if (!this._moved || !this._zooming) {
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
this._zooming = false;
|
76
|
+
|
77
|
+
var oldZoom = this._map.getZoom(),
|
78
|
+
floatZoomDelta = Math.log(this._scale) / Math.LN2,
|
79
|
+
roundZoomDelta = (floatZoomDelta > 0 ? Math.ceil(floatZoomDelta) : Math.floor(floatZoomDelta)),
|
80
|
+
zoom = this._map._limitZoom(oldZoom + roundZoomDelta),
|
81
|
+
zoomDelta = zoom - oldZoom,
|
82
|
+
centerOffset = this._centerOffset.subtract(this._delta).divideBy(this._scale),
|
83
|
+
centerPoint = this._map.getPixelOrigin().add(this._startCenter).add(centerOffset),
|
84
|
+
center = this._map.unproject(centerPoint);
|
85
|
+
|
86
|
+
L.DomEvent.removeListener(document, 'touchmove', this._onTouchMove);
|
87
|
+
L.DomEvent.removeListener(document, 'touchend', this._onTouchEnd);
|
88
|
+
|
89
|
+
var finalScale = Math.pow(2, zoomDelta);
|
90
|
+
|
91
|
+
this._map._runAnimation(center, zoom, finalScale / this._scale, this._startCenter.add(centerOffset));
|
92
|
+
}
|
93
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* CRS.Cartesian is used for infinite coordinate systems that are not related to the Earth. Examples
|
3
|
+
* include indoor maps, gaming maps, etc. We assume 0,0 is in the bottom right corner.
|
4
|
+
*/
|
5
|
+
|
6
|
+
L.CRS.Cartesian = L.Class.extend({
|
7
|
+
includes: L.CRS,
|
8
|
+
|
9
|
+
initialize: function (bounds)
|
10
|
+
{
|
11
|
+
this._bounds = bounds;
|
12
|
+
// TODO - add this to bounds class
|
13
|
+
this._bounds.width = bounds.max.x - bounds.min.x
|
14
|
+
this._bounds.height = bounds.max.y - bounds.min.y
|
15
|
+
|
16
|
+
this.projection = L.Projection.Identity
|
17
|
+
this.transformation = new L.Transformation(1.0/this._bounds.width, 0,
|
18
|
+
-1.0/this._bounds.height, 1)
|
19
|
+
}
|
20
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
L.Projection.Identity = {
|
3
|
+
project: function(latlng) {
|
4
|
+
return new L.Point(latlng.lng, latlng.lat);
|
5
|
+
},
|
6
|
+
|
7
|
+
unproject: function(point, unbounded) {
|
8
|
+
/* Turn on no wrap by passing true as 3rd parameter */
|
9
|
+
return new L.LatLng(point.y, point.x, true);
|
10
|
+
}
|
11
|
+
};
|
@@ -0,0 +1,97 @@
|
|
1
|
+
|
2
|
+
L.Zerista = L.GeoJSON.extend({
|
3
|
+
includes: L.Mixin.Events,
|
4
|
+
|
5
|
+
initialize: function(uri, options) {
|
6
|
+
L.Util.setOptions(this, options);
|
7
|
+
this._uri = uri;
|
8
|
+
this._layers = {};
|
9
|
+
this._options = options;
|
10
|
+
|
11
|
+
if (uri) {
|
12
|
+
// this.addFeatures(this);
|
13
|
+
}
|
14
|
+
},
|
15
|
+
|
16
|
+
addFeatures: function($this) {
|
17
|
+
$this.on('featureparse', function(e) {
|
18
|
+
var popupText = e.properties.display_value;
|
19
|
+
e.layer.bindPopup(popupText);
|
20
|
+
});
|
21
|
+
},
|
22
|
+
|
23
|
+
onAdd: function(map) {
|
24
|
+
this._map = map;
|
25
|
+
this._iterateLayers(map.addLayer, map);
|
26
|
+
this._update();
|
27
|
+
},
|
28
|
+
|
29
|
+
_update: function() {
|
30
|
+
var self = this
|
31
|
+
$.getJSON(self._uri, function(data)
|
32
|
+
{
|
33
|
+
self.addGeoJSONWithIcon(data);
|
34
|
+
});
|
35
|
+
},
|
36
|
+
|
37
|
+
addGeoJSONWithIcon: function(geojson) {
|
38
|
+
if (geojson.features) {
|
39
|
+
for (var i = 0, len = geojson.features.length; i < len; i++) {
|
40
|
+
this.addGeoJSONWithIcon(geojson.features[i]);
|
41
|
+
}
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
var popupText = "<div class='popup_title'>";
|
45
|
+
var icon = geojson.properties.icon
|
46
|
+
|
47
|
+
if (icon) {
|
48
|
+
popupText += "<img src='/icons_user/" + icon.versions['medium-64'] + "' class='popup_image'>";
|
49
|
+
var iconUrl = '/icons_user/' + icon.versions['small-32'];
|
50
|
+
var MyIcon = L.Icon.extend({iconUrl: iconUrl,
|
51
|
+
iconSize: new L.Point(32, 32),
|
52
|
+
shadowSize: new L.Point(0, 0),
|
53
|
+
shadowUrl: ''});
|
54
|
+
|
55
|
+
var layer = this.geometryToLayer(geojson.geometry, function(latLng) {
|
56
|
+
return new L.Marker(latLng, {icon: new MyIcon()})
|
57
|
+
});
|
58
|
+
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
var layer = this.geometryToLayer(geojson.geometry)
|
62
|
+
}
|
63
|
+
|
64
|
+
popupText += "<h3 class='ui-li-heading'>" + (geojson.link ? geojson.link : geojson.properties.display_value) + "</h3>" + (geojson.by ? ("<p class='ui-li-desc'> By " + geojson.by + "</p>") : '') + "</div>";
|
65
|
+
|
66
|
+
if(geojson.properties.article != null )
|
67
|
+
popupText += "<div class='popup_article'><p class='ui-li-desc'>" + geojson.properties.article['content'] + "</p></div>";
|
68
|
+
|
69
|
+
layer.bindPopup(popupText,{maxWidth: ($(window).width() - 50 )});
|
70
|
+
|
71
|
+
if(geojson.properties.id == this._options.active_id && geojson.geometry.type != 'Point'){
|
72
|
+
layer.setStyle({color: this._options.active_color})
|
73
|
+
}
|
74
|
+
|
75
|
+
this.fire('featureparse', {
|
76
|
+
layer: layer,
|
77
|
+
properties: geojson.properties,
|
78
|
+
geometryType: geojson.geometry.type,
|
79
|
+
bbox: geojson.bbox,
|
80
|
+
id: geojson.id
|
81
|
+
});
|
82
|
+
|
83
|
+
this.addLayer(layer);
|
84
|
+
},
|
85
|
+
|
86
|
+
coordsToLatLng: function(/*Array*/ coords, /*Boolean*/ reverse)/*: LatLng*/ {
|
87
|
+
var lat = parseFloat(coords[reverse ? 0 : 1]),
|
88
|
+
lng = parseFloat(coords[reverse ? 1 : 0]);
|
89
|
+
var noWrap = true;
|
90
|
+
return new L.LatLng(lat, lng, noWrap);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
|
94
|
+
L.Util.extend(L.Zerista.prototype, {
|
95
|
+
geometryToLayer: L.GeoJSON["geometryToLayer"],
|
96
|
+
coordsToLatLngs: L.GeoJSON["coordsToLatLngs"]
|
97
|
+
})
|
@@ -0,0 +1,139 @@
|
|
1
|
+
// The core of the library, including OOP, events, DOM facilities, basic units,
|
2
|
+
// projections (EPSG:3857 and EPSG:4326) and the base Map class.
|
3
|
+
//=require ../../../lib/leaflet/src/Leaflet.js
|
4
|
+
//=require ../../../lib/leaflet/src/core/Util.js
|
5
|
+
//=require ../../../lib/leaflet/src/core/Class.js
|
6
|
+
//=require ../../../lib/leaflet/src/core/Events.js
|
7
|
+
//=require ../../../lib/leaflet/src/core/Browser.js
|
8
|
+
//=require ../../../lib/leaflet/src/geometry/Point.js
|
9
|
+
//=require ../../../lib/leaflet/src/geometry/Bounds.js
|
10
|
+
//=require ../../../lib/leaflet/src/geometry/Transformation.js
|
11
|
+
//=require ../../../lib/leaflet/src/dom/DomUtil.js
|
12
|
+
//=require ../../../lib/leaflet/src/geo/LatLng.js
|
13
|
+
//=require ../../../lib/leaflet/src/geo/LatLngBounds.js
|
14
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.js
|
15
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.SphericalMercator.js
|
16
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.LonLat.js
|
17
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.js
|
18
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.EPSG3857.js
|
19
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.EPSG4326.js
|
20
|
+
//=require ../../../lib/leaflet/src/map/Map.js
|
21
|
+
|
22
|
+
// EPSG3395
|
23
|
+
//=require ../../../lib/leaflet/src/geo/projection/Projection.Mercator.js
|
24
|
+
//=require ../../../lib/leaflet/src/geo/crs/CRS.EPSG3395.js
|
25
|
+
|
26
|
+
// TileLayer
|
27
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.js
|
28
|
+
|
29
|
+
// TileLayerWMS
|
30
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.WMS.js
|
31
|
+
|
32
|
+
// TileLayerCanvas
|
33
|
+
//=require ../../../lib/leaflet/src/layer/tile/TileLayer.Canvas.js
|
34
|
+
|
35
|
+
// ImageOverlay
|
36
|
+
//=require ../../../lib/leaflet/src/layer/ImageOverlay.js
|
37
|
+
|
38
|
+
// Marker
|
39
|
+
//=require ../../../lib/leaflet/src/layer/marker/Icon.js
|
40
|
+
//=require ../../../lib/leaflet/src/layer/marker/Marker.js
|
41
|
+
|
42
|
+
// Popup
|
43
|
+
//=require ../../../lib/leaflet/src/layer/Popup.js
|
44
|
+
//=require ../../../lib/leaflet/src/layer/marker/Marker.Popup.js
|
45
|
+
//=require ../../../lib/leaflet/src/map/ext/Map.Popup.js
|
46
|
+
|
47
|
+
// LayerGroup:
|
48
|
+
//=require ../../../lib/leaflet/src/layer/LayerGroup.js
|
49
|
+
|
50
|
+
// FeatureGroup
|
51
|
+
//=require ../../../lib/leaflet/src/layer/FeatureGroup.js
|
52
|
+
|
53
|
+
// Path
|
54
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.js
|
55
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.SVG.js
|
56
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.Popup.js
|
57
|
+
|
58
|
+
// PathVML
|
59
|
+
//=require ../../../lib/leaflet/src/layer/vector/Path.VML.js
|
60
|
+
|
61
|
+
// Polyline
|
62
|
+
//=require ../../../lib/leaflet/src/geometry/LineUtil.js
|
63
|
+
//=require ../../../lib/leaflet/src/layer/vector/Polyline.js
|
64
|
+
|
65
|
+
// Polygon
|
66
|
+
//=require ../../../lib/leaflet/src/geometry/PolyUtil.js
|
67
|
+
//=require ../../../lib/leaflet/src/layer/vector/Polygon.js
|
68
|
+
|
69
|
+
// MultiPoly
|
70
|
+
//=require ../../../lib/leaflet/src/layer/vector/MultiPoly.js
|
71
|
+
|
72
|
+
// Circle
|
73
|
+
//=require ../../../lib/leaflet/src/layer/vector/Circle.js
|
74
|
+
|
75
|
+
// CircleMarker
|
76
|
+
//=require ../../../lib/leaflet/src/layer/vector/CircleMarker.js
|
77
|
+
|
78
|
+
// PathCanvas
|
79
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Path.Canvas.js
|
80
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js
|
81
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js
|
82
|
+
//=require ../../../lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js
|
83
|
+
|
84
|
+
// GeoJSON
|
85
|
+
//=require ../../../lib/leaflet/src/layer/GeoJSON.js
|
86
|
+
|
87
|
+
// MapDrag
|
88
|
+
//=require ../../../lib/leaflet/src/dom/DomEvent.js
|
89
|
+
//=require ../../../lib/leaflet/src/dom/Draggable.js
|
90
|
+
//=require ../../../lib/leaflet/src/core/Handler.js
|
91
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.Drag.js
|
92
|
+
|
93
|
+
// MouseZoom
|
94
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
|
95
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js
|
96
|
+
|
97
|
+
|
98
|
+
// TouchZoom
|
99
|
+
//=require ../../../lib/leaflet/src/dom/DomEvent.DoubleTap.js
|
100
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.TouchZoom.js
|
101
|
+
|
102
|
+
// BoxZoom
|
103
|
+
//=require ../../../lib/leaflet/src/map/handler/Map.BoxZoom.js
|
104
|
+
|
105
|
+
// MarkerDrag
|
106
|
+
//=require ../../../lib/leaflet/src/layer/marker/Marker.Drag.js
|
107
|
+
|
108
|
+
// ControlZoom
|
109
|
+
//=require ../../../lib/leaflet/src/control/Control.js
|
110
|
+
//=require ../../../lib/leaflet/src/map/ext/Map.Control.js
|
111
|
+
//=require ../../../lib/leaflet/src/control/Control.Zoom.js
|
112
|
+
|
113
|
+
// ControlAttrib
|
114
|
+
//=require ../../../lib/leaflet/src/control/Control.Attribution.js
|
115
|
+
|
116
|
+
// ControlLayers
|
117
|
+
//=require ../../../lib/leaflet/src/control/Control.Layers.js
|
118
|
+
|
119
|
+
|
120
|
+
// AnimationNative
|
121
|
+
//=require ../../../lib/leaflet/src/dom/transition/Transition.js
|
122
|
+
//=require ../../../lib/leaflet/src/dom/transition/Transition.Native.js
|
123
|
+
|
124
|
+
// AnimationTimer
|
125
|
+
//=require ../../../lib/leaflet/src/dom/transition/Transition.Timer.js
|
126
|
+
|
127
|
+
// AnimationPan
|
128
|
+
//=require ../../../lib/leaflet/src/map/anim/Map.PanAnimation.js
|
129
|
+
|
130
|
+
// AnimationZoom: {
|
131
|
+
//=require ../../../lib/leaflet/src/map/anim/Map.ZoomAnimation.js
|
132
|
+
|
133
|
+
// Geolocation
|
134
|
+
//=require ../../../lib/leaflet/src/map/ext/Map.Geolocation.js
|
135
|
+
|
136
|
+
// Zerista additions
|
137
|
+
//=require ../../../lib/zerista/CRS.Cartesian.js
|
138
|
+
//=require ../../../lib/zerista/Projection.Identity.js
|
139
|
+
//=require ../../../lib/zerista/zerista_layer.js
|