Add new ol.geom.LineString#getCoordinateAt function

This commit is contained in:
Frederic Junod
2015-12-10 16:13:21 +01:00
parent 4ba443e829
commit e336947e8d
2 changed files with 51 additions and 3 deletions

View File

@@ -89,6 +89,22 @@ describe('ol.geom.LineString', function() {
});
describe('#getCoordinateAt', function() {
it('return the first point when fraction is 0', function() {
expect(lineString.getCoordinateAt(0)).to.eql([1, 2]);
});
it('return the last point when fraction is 1', function() {
expect(lineString.getCoordinateAt(1)).to.eql([3, 4]);
});
it('return the mid point when fraction is 0.5', function() {
expect(lineString.getCoordinateAt(0.5)).to.eql([2, 3]);
});
});
});
describe('construct with 3D coordinates', function() {
@@ -320,6 +336,23 @@ describe('ol.geom.LineString', function() {
});
describe('#getCoordinateAt', function() {
it('return the first point when fraction is 0', function() {
expect(lineString.getCoordinateAt(0)).to.eql([0, 0]);
});
it('return the last point when fraction is 1', function() {
expect(lineString.getCoordinateAt(1)).to.eql([7, 5]);
});
it('return the mid point when fraction is 0.5', function() {
var midpoint = lineString.getFlatMidpoint();
expect(lineString.getCoordinateAt(0.5)).to.eql(midpoint);
});
});
});
describe('with a simple XYM coordinates', function() {