Merge pull request #7543 from ahocevar/interiorpoint-donut

Donut polygon labels do not get a chance to get rendered
This commit is contained in:
Andreas Hocevar
2017-12-06 21:28:12 +01:00
parent 50053c1b3f
commit 2bce90470e
2 changed files with 24 additions and 11 deletions

View File

@@ -550,6 +550,17 @@ describe('ol.geom.Polygon', function() {
expect(interiorPoint.layout).to.be('XYM');
expect(interiorPoint.getCoordinates()).to.eql([0.5, 0.5, 1]);
});
it('returns XYM point for donut polygons', function() {
var geom = new ol.geom.Polygon([
[[0.5, 0.5], [0.5, 2.5], [2.5, 2.5], [2.5, 0.5], [0.5, 0.5]],
[[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]
]);
var interiorPoint = geom.getInteriorPoint();
expect(interiorPoint.getType()).to.be('Point');
expect(interiorPoint.layout).to.be('XYM');
expect(interiorPoint.getCoordinates()).to.eql([0.75, 1.5, 0.5]);
});
});
describe('ol.geom.Polygon.fromExtent', function() {