topojson-rails 0.0.15 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/topojson-rails/version.rb +1 -1
- data/vendor/assets/javascripts/topojson.js +15 -11
- metadata +3 -3
@@ -119,8 +119,10 @@ topojson = (function() {
|
|
119
119
|
}
|
120
120
|
|
121
121
|
function geometry(o) {
|
122
|
-
|
123
|
-
|
122
|
+
if (o.type in geometryType) {
|
123
|
+
geom = o;
|
124
|
+
geometryType[o.type](o.arcs);
|
125
|
+
}
|
124
126
|
}
|
125
127
|
|
126
128
|
var geometryType = {
|
@@ -168,6 +170,7 @@ topojson = (function() {
|
|
168
170
|
function line(arcs) {
|
169
171
|
var points = [];
|
170
172
|
for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);
|
173
|
+
if (points.length < 2) points.push(points[0]);
|
171
174
|
return points;
|
172
175
|
}
|
173
176
|
|
@@ -182,9 +185,12 @@ topojson = (function() {
|
|
182
185
|
}
|
183
186
|
|
184
187
|
function geometry(o) {
|
185
|
-
o =
|
186
|
-
|
187
|
-
|
188
|
+
var t = o.type, g = t === "GeometryCollection" ? {type: t, geometries: o.geometries.map(geometry)}
|
189
|
+
: t in geometryType ? {type: t, coordinates: geometryType[t](o)}
|
190
|
+
: {type: null};
|
191
|
+
if ("id" in o) g.id = o.id;
|
192
|
+
if ("properties" in o) g.properties = o.properties;
|
193
|
+
return g;
|
188
194
|
}
|
189
195
|
|
190
196
|
var geometryType = {
|
@@ -196,9 +202,7 @@ topojson = (function() {
|
|
196
202
|
MultiPolygon: function(o) { return o.arcs.map(polygon); }
|
197
203
|
};
|
198
204
|
|
199
|
-
return o
|
200
|
-
? (o = Object.create(o), o.geometries = o.geometries.map(geometry), o)
|
201
|
-
: geometry(o);
|
205
|
+
return geometry(o);
|
202
206
|
}
|
203
207
|
|
204
208
|
function reverse(array, n) {
|
@@ -215,7 +219,7 @@ topojson = (function() {
|
|
215
219
|
return lo;
|
216
220
|
}
|
217
221
|
|
218
|
-
function neighbors(
|
222
|
+
function neighbors(objects) {
|
219
223
|
var objectsByArc = [],
|
220
224
|
neighbors = objects.map(function() { return []; });
|
221
225
|
|
@@ -236,7 +240,7 @@ topojson = (function() {
|
|
236
240
|
}
|
237
241
|
|
238
242
|
function geometry(o, i) {
|
239
|
-
geometryType[o.type](o.arcs, i);
|
243
|
+
if (o.type in geometryType) geometryType[o.type](o.arcs, i);
|
240
244
|
}
|
241
245
|
|
242
246
|
var geometryType = {
|
@@ -251,7 +255,7 @@ topojson = (function() {
|
|
251
255
|
}
|
252
256
|
|
253
257
|
return {
|
254
|
-
version: "0.0.
|
258
|
+
version: "0.0.21",
|
255
259
|
mesh: mesh,
|
256
260
|
object: object,
|
257
261
|
neighbors: neighbors
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: topojson-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
prerelease:
|
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: 2013-02-
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
version: '0'
|
70
70
|
requirements: []
|
71
71
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.8.
|
72
|
+
rubygems_version: 1.8.25
|
73
73
|
signing_key:
|
74
74
|
specification_version: 3
|
75
75
|
summary: Gemified topojson.js asset for Rails
|