Change getInteriorPoint type to XYM with intersection length as M

This commit is contained in:
Andreas Hocevar
2017-09-27 18:06:05 +02:00
parent c75040e7d8
commit 7a3e11b9e4
5 changed files with 37 additions and 8 deletions

View File

@@ -195,4 +195,18 @@ describe('ol.geom.MultiPolygon', function() {
});
describe('#getInteriorPoints', function() {
it('returns XYM multipoint with intersection width as M', function() {
var geom = new ol.geom.MultiPolygon([
[[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]],
[[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]]
]);
var interiorPoints = geom.getInteriorPoints();
expect(interiorPoints.getType()).to.be('MultiPoint');
expect(interiorPoints.layout).to.be('XYM');
expect(interiorPoints.getCoordinates()).to.eql([[0.5, 0.5, 1], [1.5, 1.5, 1]]);
});
});
});

View File

@@ -541,6 +541,17 @@ describe('ol.geom.Polygon', function() {
});
describe('#getInteriorPoint', function() {
it('returns XYM point with intersection width as M', function() {
var geom = new ol.geom.Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
var interiorPoint = geom.getInteriorPoint();
expect(interiorPoint.getType()).to.be('Point');
expect(interiorPoint.layout).to.be('XYM');
expect(interiorPoint.getCoordinates()).to.eql([0.5, 0.5, 1]);
});
});
describe('ol.geom.Polygon.fromExtent', function() {
it('creates the correct polygon', function() {
var extent = [1, 2, 3, 5];