diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js index 3b1cb59981..0da2285d5e 100644 --- a/src/ol/geom/polygon.js +++ b/src/ol/geom/polygon.js @@ -192,8 +192,6 @@ ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) { var ends = ol.geom.flat.deflateCoordinatess( this.flatCoordinates, 0, coordinates, this.stride, this.ends_); this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1]; - ol.geom.flat.orientLinearRings( - this.flatCoordinates, 0, this.ends_, this.stride); this.dispatchChangeEvent(); } }; diff --git a/test/spec/ol/geom/polygon.test.js b/test/spec/ol/geom/polygon.test.js index b547565ec3..a35f473816 100644 --- a/test/spec/ol/geom/polygon.test.js +++ b/test/spec/ol/geom/polygon.test.js @@ -73,19 +73,13 @@ describe('ol.geom.Polygon', function() { expect(polygon.getStride()).to.be(2); }); - it('reverses the outer ring if necessary', function() { - polygon = new ol.geom.Polygon([outerRing.reverse(), innerRing]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses inner rings if necessary', function() { - polygon = new ol.geom.Polygon([outerRing, innerRing.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses all rings if necessary', function() { - polygon = new ol.geom.Polygon([outerRing.reverse(), innerRing.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); + it('does not reverse any rings', function() { + outerRing.reverse(); + innerRing.reverse(); + polygon = new ol.geom.Polygon([outerRing, innerRing]); + var coordinates = polygon.getCoordinates(); + expect(coordinates[0]).to.eql(outerRing); + expect(coordinates[1]).to.eql(innerRing); }); it('does not contain outside coordinates', function() { @@ -136,21 +130,6 @@ describe('ol.geom.Polygon', function() { expect(polygon.getStride()).to.be(3); }); - it('reverses the outer ring if necessary', function() { - polygon = new ol.geom.Polygon([outerRing.reverse(), innerRing]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses inner rings if necessary', function() { - polygon = new ol.geom.Polygon([outerRing, innerRing.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses all rings if necessary', function() { - polygon = new ol.geom.Polygon([outerRing.reverse(), innerRing.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - it('does not contain outside coordinates', function() { expect(polygon.containsCoordinate(outsideOuter)).to.be(false); }); @@ -200,21 +179,6 @@ describe('ol.geom.Polygon', function() { expect(polygon.getStride()).to.be(3); }); - it('reverses the outer ring if necessary', function() { - polygon = new ol.geom.Polygon([outerRing.reverse(), innerRing]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses inner rings if necessary', function() { - polygon = new ol.geom.Polygon([outerRing, innerRing.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses all rings if necessary', function() { - polygon = new ol.geom.Polygon([outerRing.reverse(), innerRing.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - it('does not contain outside coordinates', function() { expect(polygon.containsCoordinate(outsideOuter)).to.be(false); }); @@ -271,24 +235,6 @@ describe('ol.geom.Polygon', function() { expect(polygon.getStride()).to.be(4); }); - it('reverses the outer ring if necessary', function() { - polygon = new ol.geom.Polygon( - [outerRing.reverse(), innerRing1, innerRing2]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses inner rings if necessary', function() { - polygon = new ol.geom.Polygon( - [outerRing, innerRing1.reverse(), innerRing2.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - - it('reverses all rings if necessary', function() { - polygon = new ol.geom.Polygon( - [outerRing.reverse(), innerRing1.reverse(), innerRing2.reverse()]); - expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); - }); - it('does not contain outside coordinates', function() { expect(polygon.containsCoordinate(outsideOuter)).to.be(false); }); diff --git a/test/spec/ol/interaction/drawinteraction.test.js b/test/spec/ol/interaction/drawinteraction.test.js index b2a67c52d0..4efdd2a50e 100644 --- a/test/spec/ol/interaction/drawinteraction.test.js +++ b/test/spec/ol/interaction/drawinteraction.test.js @@ -314,9 +314,8 @@ describe('ol.interaction.Draw', function() { var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.Polygon); - // note that order is forced clockwise (despite drawing counter-clockwise) expect(geometry.getCoordinates()).to.eql([ - [[10, -20], [30, -10], [30, -20], [10, -20]] + [[10, -20], [30, -20], [30, -10], [10, -20]] ]); });