Add ol.geom.{de,in}flateCoordinatess

This commit is contained in:
Tom Payne
2013-11-09 16:30:42 +01:00
parent a89bf0c329
commit 7740929036
2 changed files with 72 additions and 0 deletions

View File

@@ -19,6 +19,21 @@ describe('ol.geom', function() {
});
describe('ol.geom.deflateCoordinatess', function() {
var flatCoordinates;
beforeEach(function() {
flatCoordinates = [];
});
it('flattens arrays of coordinates', function() {
var ends = ol.geom.deflateCoordinatess(flatCoordinates, 0,
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], 2);
expect(ends).to.eql([4, 8]);
expect(flatCoordinates).to.eql([1, 2, 3, 4, 5, 6, 7, 8]);
});
});
describe('ol.geom.inflateCoordinates', function() {
it('inflates coordinates', function() {
@@ -28,4 +43,13 @@ describe('ol.geom', function() {
});
describe('ol.geom.inflateCoordinatess', function() {
it('inflates arrays of coordinates', function() {
var coordinatess = ol.geom.inflateCoordinatess([1, 2, 3, 4, 5, 6, 7, 8],
0, [4, 8], 2);
expect(coordinatess).to.eql([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
});
});
});