leaflet-ruby 0.3.beta1 → 0.3.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -1
- data/leaflet-ruby.gemspec +1 -1
- data/lib/leaflet-ruby.rb +0 -4
- data/vendor/assets/javascripts/leaflet.js +0 -1
- metadata +2 -3
- data/lib/zerista/zerista_layer.js +0 -97
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= leaflet-ruby Changelog
|
2
2
|
|
3
|
-
=== 0.3.
|
3
|
+
=== 0.3.beta3
|
4
|
+
* Remove zerista_layer.js to remove depedency on jQuery.
|
5
|
+
|
6
|
+
=== 0.3.beta2
|
7
|
+
* Withdrawn
|
4
8
|
|
9
|
+
=== 0.3.beta1
|
5
10
|
* First release, wraps the current master version of Leaflet 0.3 which is not yet released.
|
data/leaflet-ruby.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = 'leaflet-ruby'
|
4
|
-
spec.version = '0.3.
|
4
|
+
spec.version = '0.3.beta3'
|
5
5
|
spec.homepage = 'https://github.com/cfis/leaflet-ruby'
|
6
6
|
spec.summary = <<-EOS
|
7
7
|
Wraps the Leaflet Javascript Mapping Library in a Rails asset gem. For more information
|
data/lib/leaflet-ruby.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
module Leaflet
|
2
2
|
class Engine < Rails::Engine
|
3
3
|
initializer :append_assets_path do |app|
|
4
|
-
puts 1111111111111
|
5
|
-
puts config.root
|
6
|
-
puts File.join(config.root, 'lib')
|
7
|
-
|
8
4
|
# For javascripts
|
9
5
|
app.config.assets.paths << File.join(config.root, 'lib', 'leaflet', 'src')
|
10
6
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leaflet-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.beta3
|
5
5
|
prerelease: 4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -25,7 +25,6 @@ files:
|
|
25
25
|
- lib/leaflet-ruby.rb
|
26
26
|
- lib/zerista/CRS.Cartesian.js
|
27
27
|
- lib/zerista/Projection.Identity.js
|
28
|
-
- lib/zerista/zerista_layer.js
|
29
28
|
- lib/leaflet/build/build.html
|
30
29
|
- lib/leaflet/build/build.js
|
31
30
|
- lib/leaflet/build/deps.js
|
@@ -1,97 +0,0 @@
|
|
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
|
-
})
|