Merge pull request #4809 from fperucic/multpolygon-clone

Fix multipolygon clone.
This commit is contained in:
Tim Schaub
2016-02-27 09:00:17 -07:00
committed by Andreas Hocevar
parent b4c4a81afb
commit e8cd5e322f
2 changed files with 10 additions and 1 deletions

View File

@@ -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(

View File

@@ -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]];