Permalink
Browse files

Merge branch 'fix-geo-bounds-collection' of https://github.com/natevw/d3

 into 3.0.1
  • Loading branch information...
2 parents cd1b2d0 + 1aa5046 commit 8b0c10f8e555a5a94f77550de7945bcdd2d229ba @mbostock mbostock committed Dec 28, 2012
Showing with 32 additions and 9 deletions.
  1. +4 −4 d3.js
  2. +1 −1 d3.min.js
  3. +4 −4 src/geo/stream.js
  4. +23 −0 test/geo/bounds-test.js
View
8 d3.js
@@ -5348,10 +5348,6 @@
FeatureCollection: function(object, listener) {
var features = object.features, i = -1, n = features.length;
while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
- },
- GeometryCollection: function(object, listener) {
- var geometries = object.geometries, i = -1, n = geometries.length;
- while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
}
};
var d3_geo_streamGeometryType = {
@@ -5379,6 +5375,10 @@
MultiPolygon: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
+ },
+ GeometryCollection: function(object, listener) {
+ var geometries = object.geometries, i = -1, n = geometries.length;
+ while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
}
};
function d3_geo_streamLine(coordinates, listener, closed) {
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -19,10 +19,6 @@ var d3_geo_streamObjectType = {
FeatureCollection: function(object, listener) {
var features = object.features, i = -1, n = features.length;
while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
- },
- GeometryCollection: function(object, listener) {
- var geometries = object.geometries, i = -1, n = geometries.length;
- while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
}
};
@@ -51,6 +47,10 @@ var d3_geo_streamGeometryType = {
MultiPolygon: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
+ },
+ GeometryCollection: function(object, listener) {
+ var geometries = object.geometries, i = -1, n = geometries.length;
+ while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
}
};
View
@@ -90,6 +90,29 @@ suite.addBatch({
type: "Polygon",
coordinates: [[[-123, 39], [-122, 39], [-122, 38], [-123, 39]], [[10, 20], [20, 20], [20, 10], [10, 10], [10, 20]]]
}), [[-123, 38], [-122, 39]])
+ },
+ "NestedCollection": function (bounds) {
+ assert.deepEqual(bounds({
+ type: "FeatureCollection",
+ features: [
+ {
+ type: "Feature",
+ geometry: {
+ type: "GeometryCollection",
+ geometries: [
+ {
+ type: "Point",
+ coordinates: [-120,47]
+ },
+ {
+ type: "Point",
+ coordinates: [-119,46]
+ }
+ ]
+ }
+ }
+ ]
+ }), [[-120,46], [-119,47]])
}
}
});

0 comments on commit 8b0c10f

Please sign in to comment.