Add ol.geom.MultiPolygon#appendPolygon

This commit is contained in:
Tom Payne
2014-03-10 16:53:12 +01:00
parent c8bbeca06e
commit b77f0e7d3a
3 changed files with 48 additions and 0 deletions

View File

@@ -10,6 +10,28 @@ describe('ol.geom.MultiPolygon', function() {
}).not.to.throwException();
});
describe('with an empty MultiPolygon', function() {
var multiPolygon;
beforeEach(function() {
multiPolygon = new ol.geom.MultiPolygon(null);
});
it('can append polygons', function() {
multiPolygon.appendPolygon(
new ol.geom.Polygon([[[0, 0], [0, 2], [1, 1], [2, 0]]]));
expect(multiPolygon.getCoordinates()).to.eql(
[[[[0, 0], [0, 2], [1, 1], [2, 0]]]]);
multiPolygon.appendPolygon(
new ol.geom.Polygon([[[3, 0], [4, 1], [5, 2], [5, 0]]]));
expect(multiPolygon.getCoordinates()).to.eql([
[[[0, 0], [0, 2], [1, 1], [2, 0]]],
[[[3, 0], [4, 1], [5, 2], [5, 0]]]
]);
});
});
describe('with a simple MultiPolygon', function() {
var multiPolygon;