Skip to content

Commit 8b0c10f

Browse files
committed
Merge branch 'fix-geo-bounds-collection' of https://github.com/natevw/d3 into 3.0.1
2 parents cd1b2d0 + 1aa5046 commit 8b0c10f

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

d3.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5348,10 +5348,6 @@
53485348
FeatureCollection: function(object, listener) {
53495349
var features = object.features, i = -1, n = features.length;
53505350
while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
5351-
},
5352-
GeometryCollection: function(object, listener) {
5353-
var geometries = object.geometries, i = -1, n = geometries.length;
5354-
while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
53555351
}
53565352
};
53575353
var d3_geo_streamGeometryType = {
@@ -5379,6 +5375,10 @@
53795375
MultiPolygon: function(object, listener) {
53805376
var coordinates = object.coordinates, i = -1, n = coordinates.length;
53815377
while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
5378+
},
5379+
GeometryCollection: function(object, listener) {
5380+
var geometries = object.geometries, i = -1, n = geometries.length;
5381+
while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
53825382
}
53835383
};
53845384
function d3_geo_streamLine(coordinates, listener, closed) {

d3.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geo/stream.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ var d3_geo_streamObjectType = {
1919
FeatureCollection: function(object, listener) {
2020
var features = object.features, i = -1, n = features.length;
2121
while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
22-
},
23-
GeometryCollection: function(object, listener) {
24-
var geometries = object.geometries, i = -1, n = geometries.length;
25-
while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
2622
}
2723
};
2824

@@ -51,6 +47,10 @@ var d3_geo_streamGeometryType = {
5147
MultiPolygon: function(object, listener) {
5248
var coordinates = object.coordinates, i = -1, n = coordinates.length;
5349
while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
50+
},
51+
GeometryCollection: function(object, listener) {
52+
var geometries = object.geometries, i = -1, n = geometries.length;
53+
while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
5454
}
5555
};
5656

test/geo/bounds-test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,29 @@ suite.addBatch({
9090
type: "Polygon",
9191
coordinates: [[[-123, 39], [-122, 39], [-122, 38], [-123, 39]], [[10, 20], [20, 20], [20, 10], [10, 10], [10, 20]]]
9292
}), [[-123, 38], [-122, 39]])
93+
},
94+
"NestedCollection": function (bounds) {
95+
assert.deepEqual(bounds({
96+
type: "FeatureCollection",
97+
features: [
98+
{
99+
type: "Feature",
100+
geometry: {
101+
type: "GeometryCollection",
102+
geometries: [
103+
{
104+
type: "Point",
105+
coordinates: [-120,47]
106+
},
107+
{
108+
type: "Point",
109+
coordinates: [-119,46]
110+
}
111+
]
112+
}
113+
}
114+
]
115+
}), [[-120,46], [-119,47]])
93116
}
94117
}
95118
});

0 commit comments

Comments
 (0)