topojson-rails 1.3.0 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5f156ff2241c767b01dde4aa993ce33432bc156
4
- data.tar.gz: e9df9b46d28f924c49c06de3aedd4b7fdf392dca
3
+ metadata.gz: a795dc2e5d01d77f078d0b9a13d53992960dab8a
4
+ data.tar.gz: 596c535dd0758a0dcdbe24e104846191459b23f4
5
5
  SHA512:
6
- metadata.gz: aea24cceeee16640b66898109d681bea1126f74b65a79010878a4dadd969cca8d21b85cc2a28a77eb5786c5217aaab2be2ad8de2a39a2d381fbf81741554dc18
7
- data.tar.gz: 5f4bf9e50a878d9282c86187ed019add381a33600d7150e2657d0c0242c1f3c9ee6771c3fd7a9ddc54e5b05a656cb31b09bc59b7b0cd98eb5ff2872861483f49
6
+ metadata.gz: 725b6a823c859d16e184507171bd6a64044956ffb6392c2c037c66d174659b13d0f4f426f437f5b3080c099970241c094d9ca7561e3076f2854ed55db6fb2f22
7
+ data.tar.gz: e54aa26bbd6e40efd5422a318a9b9c5de9af231721d94d587ae08dc8e07ff8b2f55e778600255a848c0fe8ddc0a3dae6a41f37267caf6510c3d2e8aae80de55e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  module Topojson
2
2
  module Rails
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.5"
4
4
  end
5
5
  end
@@ -157,27 +157,21 @@ topojson = (function() {
157
157
  }
158
158
 
159
159
  function object(topology, o) {
160
- var tf = topology.transform,
161
- kx = tf.scale[0],
162
- ky = tf.scale[1],
163
- dx = tf.translate[0],
164
- dy = tf.translate[1],
160
+ var absolute = transformAbsolute(topology.transform),
165
161
  arcs = topology.arcs;
166
162
 
167
163
  function arc(i, points) {
168
164
  if (points.length) points.pop();
169
- for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, x = 0, y = 0, p; k < n; ++k) {
165
+ for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {
170
166
  points.push(p = a[k].slice());
171
- p[0] = (x += p[0]) * kx + dx;
172
- p[1] = (y += p[1]) * ky + dy;
167
+ absolute(p, k);
173
168
  }
174
169
  if (i < 0) reverse(points, n);
175
170
  }
176
171
 
177
172
  function point(p) {
178
173
  p = p.slice();
179
- p[0] = p[0] * kx + dx;
180
- p[1] = p[1] * ky + dy;
174
+ absolute(p, 0);
181
175
  return p;
182
176
  }
183
177
 
@@ -276,7 +270,9 @@ topojson = (function() {
276
270
  }
277
271
 
278
272
  function presimplify(topology, triangleArea) {
279
- var heap = minHeap(compareArea),
273
+ var absolute = transformAbsolute(topology.transform),
274
+ relative = transformRelative(topology.transform),
275
+ heap = minHeap(compareArea),
280
276
  maxArea = 0,
281
277
  triangle;
282
278
 
@@ -285,7 +281,7 @@ topojson = (function() {
285
281
  topology.arcs.forEach(function(arc) {
286
282
  var triangles = [];
287
283
 
288
- arc.forEach(transformAbsolute(topology.transform));
284
+ arc.forEach(absolute);
289
285
 
290
286
  for (var i = 1, n = arc.length - 1; i < n; ++i) {
291
287
  triangle = arc.slice(i - 1, i + 2);
@@ -329,7 +325,7 @@ topojson = (function() {
329
325
  }
330
326
 
331
327
  topology.arcs.forEach(function(arc) {
332
- arc.forEach(transformRelative(topology.transform));
328
+ arc.forEach(relative);
333
329
  });
334
330
 
335
331
  function update(triangle) {
@@ -414,26 +410,30 @@ topojson = (function() {
414
410
  }
415
411
 
416
412
  function transformAbsolute(transform) {
417
- var x0 = 0,
418
- y0 = 0,
413
+ if (!transform) return noop;
414
+ var x0,
415
+ y0,
419
416
  kx = transform.scale[0],
420
417
  ky = transform.scale[1],
421
418
  dx = transform.translate[0],
422
419
  dy = transform.translate[1];
423
- return function(point) {
420
+ return function(point, i) {
421
+ if (!i) x0 = y0 = 0;
424
422
  point[0] = (x0 += point[0]) * kx + dx;
425
423
  point[1] = (y0 += point[1]) * ky + dy;
426
424
  };
427
425
  }
428
426
 
429
427
  function transformRelative(transform) {
430
- var x0 = 0,
431
- y0 = 0,
428
+ if (!transform) return noop;
429
+ var x0,
430
+ y0,
432
431
  kx = transform.scale[0],
433
432
  ky = transform.scale[1],
434
433
  dx = transform.translate[0],
435
434
  dy = transform.translate[1];
436
- return function(point) {
435
+ return function(point, i) {
436
+ if (!i) x0 = y0 = 0;
437
437
  var x1 = (point[0] - dx) / kx | 0,
438
438
  y1 = (point[1] - dy) / ky | 0;
439
439
  point[0] = x1 - x0;
@@ -443,8 +443,10 @@ topojson = (function() {
443
443
  };
444
444
  }
445
445
 
446
+ function noop() {}
447
+
446
448
  return {
447
- version: "1.3.0",
449
+ version: "1.4.5",
448
450
  mesh: mesh,
449
451
  feature: featureOrCollection,
450
452
  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: 1.3.0
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Gorodetsky
@@ -29,26 +29,26 @@ cert_chain:
29
29
  JCf887eMZl/8mEIeCLb+gH5sh5yJJpti2HTLnR4Q1QKWR/0T9tASoQPF3kL62n9+
30
30
  m1B90+fEzJsBDQIAsnLPqxjivWbIIfZ7GeGZyA==
31
31
  -----END CERTIFICATE-----
32
- date: 2013-09-02 00:00:00.000000000 Z
32
+ date: 2013-12-17 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: railties
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
- - - <
41
+ - - "<"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '5.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '3.0'
51
- - - <
51
+ - - "<"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '5.0'
54
54
  description: An extension of GeoJSON that encodes topology.
@@ -58,7 +58,7 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
- - .gitignore
61
+ - ".gitignore"
62
62
  - Gemfile
63
63
  - LICENSE
64
64
  - README.md
@@ -78,17 +78,17 @@ require_paths:
78
78
  - lib
79
79
  required_ruby_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.0.3
91
+ rubygems_version: 2.1.11
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Gemified topojson.js asset for Rails
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ��|�_�=H<�k��N;�€�^�����V|��L�/� �h���P2Fм;���*7�� �@��� �TANҹ�}su^MݷpnѸ��ia�;9զm�"Y"1���噖&r�*{�N�F^ptk& �JU�-��o۔R�K���U /�$Z�Ŏ,���/�]�]VZ)�d�<�Y2�>ɖoos˜��dl�?�#
1
+ Obdb�h <�Sz;��051�2s0�W$N�M�i�+�b�.m�q��UJ�V���Y����p��"F��LQڐ%ү���}��ywg�`���$���0V�d�=~�
2
+ �w=0���+��֙ò�r7�w>��_�9y���50�� �����M&��*�9/ �����S���*���g�iNk]͊�Bʇ���g֭���7��,_W�Hq�cY���rq5F���1����p��KԿOg�i����φi��o�]R�W@