From b46cc5a2413b916cf2c67e88ec1ebc7b021d4162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Peru=C4=8Di=C4=87?= Date: Wed, 10 Feb 2016 15:06:00 +0100 Subject: [PATCH 1/2] fix multipolygon clone --- src/ol/geom/multipolygon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js index c06abed26f..41e047c692 100644 --- a/src/ol/geom/multipolygon.js +++ b/src/ol/geom/multipolygon.js @@ -122,7 +122,7 @@ ol.geom.MultiPolygon.prototype.clone = function() { var len = this.endss_.length; var newEndss = new Array(len); for (var i = 0; i < len; ++i) { - newEndss[i] = this.endss_.slice(); + newEndss[i] = this.endss_[i].slice(); } multiPolygon.setFlatCoordinates( From a51e7804b8f935f061ee65d264c4953a588a2405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Peru=C4=8Di=C4=87?= Date: Sat, 27 Feb 2016 13:03:19 +0100 Subject: [PATCH 2/2] added a test --- test/spec/ol/geom/multipolygon.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/spec/ol/geom/multipolygon.test.js b/test/spec/ol/geom/multipolygon.test.js index 606b411c45..aa91d56db8 100644 --- a/test/spec/ol/geom/multipolygon.test.js +++ b/test/spec/ol/geom/multipolygon.test.js @@ -88,6 +88,15 @@ describe('ol.geom.MultiPolygon', function() { [[[3, 0], [4, 1], [5, 2], [5, 0]]]); }); + describe('#clone()', function() { + + it('has the expected endss_', function() { + var clone = multiPolygon.clone(); + expect(multiPolygon.endss_).to.eql(clone.endss_); + }); + + }); + describe('#getCoordinates()', function() { var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];