More robust handling of polygons with empty ring(s).

This is a valid situation but won't usually happen at the moment since
we don't return empty rings when clipping.
This commit is contained in:
Jason Davies 2012-12-12 12:00:29 +00:00
Родитель 913173ea7f
Коммит b1d078db1a
4 изменённых файлов: 4 добавлений и 3 удалений

2
d3.js поставляемый
Просмотреть файл

@ -6144,7 +6144,7 @@
var n = coordinates.length, i = -1, m, j, ring, point; var n = coordinates.length, i = -1, m, j, ring, point;
while (++i < n) { while (++i < n) {
ring = coordinates[i]; ring = coordinates[i];
if (!(m = ring.length - 1)) continue; if ((m = ring.length - 1) < 1) continue;
point = ring[0]; point = ring[0];
context.moveTo(point[0], point[1]); context.moveTo(point[0], point[1]);
for (j = 0; ++j < m; ) { for (j = 0; ++j < m; ) {

2
d3.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -40,7 +40,7 @@ d3.geo.path = function() {
point; point;
while (++i < n) { while (++i < n) {
ring = coordinates[i]; ring = coordinates[i];
if (!(m = ring.length - 1)) continue; if ((m = ring.length - 1) < 1) continue;
point = ring[0]; point = ring[0];
context.moveTo(point[0], point[1]); context.moveTo(point[0], point[1]);
for (j = 0; ++j < m;) { for (j = 0; ++j < m;) {

Просмотреть файл

@ -93,6 +93,7 @@ suite.addBatch({
assert.isNull(path(undefined)); assert.isNull(path(undefined));
assert.isNull(path()); assert.isNull(path());
}, },
"bogus type name": function(path) { "bogus type name": function(path) {
assert.isNull(path({ assert.isNull(path({
type: "Feature", type: "Feature",