|
5586 | 5586 | var d3_geo_typeDefaults = { |
5587 | 5587 | Feature: function(o) { |
5588 | 5588 | var g = this.geometry(o.geometry); |
5589 | | - return g && (o = Object.create(o), o.geometry = g); |
| 5589 | + return g && (o = Object.create(o), o.geometry = g, o); |
5590 | 5590 | }, |
5591 | 5591 | FeatureCollection: function foo(o) { |
5592 | 5592 | var a, f, features = o.features, i = -1, n = features.length; |
5593 | 5593 | while (++i < n) if (f = this.Feature(features[i])) a ? a.push(f) : a = [ f ]; |
5594 | | - return a && (o = Object.create(o), o.features = a); |
| 5594 | + return a && (o = Object.create(o), o.features = a, o); |
5595 | 5595 | }, |
5596 | 5596 | GeometryCollection: function(o) { |
5597 | 5597 | var a, g, geometries = o.geometries, i = -1, n = geometries.length; |
5598 | 5598 | while (++i < n) if (g = this.geometry(geometries[i])) a ? a.push(g) : a = [ g ]; |
5599 | | - return a && (o = Object.create(o), o.geometries = a); |
| 5599 | + return a && (o = Object.create(o), o.geometries = a, o); |
5600 | 5600 | }, |
5601 | 5601 | LineString: function(o) { |
5602 | 5602 | var c = this.line(o.coordinates); |
5603 | | - return c && (o = Object.create(o), o.coordinates = c); |
| 5603 | + return c && (o = Object.create(o), o.coordinates = c, o); |
5604 | 5604 | }, |
5605 | 5605 | MultiLineString: function(o) { |
5606 | 5606 | var a, c, coordinates = o.coordinates, i = -1, n = coordinates.length; |
5607 | 5607 | while (++i < n) if (c = this.line(coordinates[i])) a ? a.push(c) : a = [ c ]; |
5608 | | - return a && (o = Object.create(o), o.coordinates = a); |
| 5608 | + return a && (o = Object.create(o), o.coordinates = a, o); |
5609 | 5609 | }, |
5610 | 5610 | MultiPoint: function(o) { |
5611 | 5611 | var a, c, coordinates = o.coordinates, i = -1, n = coordinates.length; |
5612 | 5612 | while (++i < n) if (c = this.point(coordinates[i])) a ? a.push(c) : a = [ c ]; |
5613 | | - return a && (o = Object.create(o), o.coordinates = a); |
| 5613 | + return a && (o = Object.create(o), o.coordinates = a, o); |
5614 | 5614 | }, |
5615 | 5615 | MultiPolygon: function(o) { |
5616 | 5616 | var a, c, coordinates = o.coordinates, i = -1, n = coordinates.length; |
5617 | 5617 | while (++i < n) if (c = this.polygon(coordinates[i])) a ? a.push(c) : a = [ c ]; |
5618 | | - return a && (o = Object.create(o), o.coordinates = a); |
| 5618 | + return a && (o = Object.create(o), o.coordinates = a, o); |
5619 | 5619 | }, |
5620 | 5620 | Point: function(o) { |
5621 | 5621 | var c = this.point(o.coordinates); |
5622 | | - return c && (o = Object.create(o), o.coordinates = c); |
| 5622 | + return c && (o = Object.create(o), o.coordinates = c, o); |
5623 | 5623 | }, |
5624 | 5624 | Polygon: function(o) { |
5625 | 5625 | var c = this.polygon(o.coordinates); |
5626 | | - return c && (o = Object.create(o), o.coordinates = c); |
| 5626 | + return c && (o = Object.create(o), o.coordinates = c, o); |
5627 | 5627 | }, |
5628 | 5628 | Sphere: d3_noop, |
5629 | | - object: function(object) { |
5630 | | - return d3_geo_typeObjects.hasOwnProperty(object.type) ? this[object.type](object) : this.geometry(object); |
| 5629 | + object: function(o) { |
| 5630 | + return d3_geo_typeObjects.hasOwnProperty(o.type) ? this[o.type](o) : this.geometry(o); |
5631 | 5631 | }, |
5632 | | - geometry: function(geometry) { |
5633 | | - return d3_geo_typeGeometries.hasOwnProperty(geometry.type) ? this[geometry.type](geometry) : null; |
| 5632 | + geometry: function(o) { |
| 5633 | + return d3_geo_typeGeometries.hasOwnProperty(o.type) ? this[o.type](o) : null; |
5634 | 5634 | }, |
5635 | 5635 | point: d3_noop, |
5636 | 5636 | line: function(coordinates) { |
|
6478 | 6478 | return reset(); |
6479 | 6479 | }; |
6480 | 6480 | } |
| 6481 | + d3.geo.rotation = function(δλ, δφ, δγ) { |
| 6482 | + var rotate = d3_geo_rotation(δλ * d3_radians, δφ * d3_radians, δγ * d3_radians); |
| 6483 | + var type = d3_geo_type({ |
| 6484 | + point: function(coordinates) { |
| 6485 | + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); |
| 6486 | + coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees; |
| 6487 | + return coordinates; |
| 6488 | + } |
| 6489 | + }); |
| 6490 | + return function(o) { |
| 6491 | + return type.object(o); |
| 6492 | + }; |
| 6493 | + }; |
6481 | 6494 | function d3_geo_rotation(δλ, δφ, δγ) { |
6482 | 6495 | return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; |
6483 | 6496 | } |
|
0 commit comments