Functions to get key from coord and coord from key

This commit is contained in:
Tim Schaub
2017-10-08 08:50:19 -06:00
parent b0f291973b
commit c679e3042e
2 changed files with 37 additions and 2 deletions

View File

@@ -1,5 +1,3 @@
goog.require('ol.tilecoord');
goog.require('ol.tilegrid.TileGrid');
@@ -23,6 +21,23 @@ describe('ol.TileCoord', function() {
});
});
describe('getKey()', function() {
it('returns a key for a tile coord', function() {
var key = ol.tilecoord.getKey([1, 2, 3]);
expect(key).to.eql('1/2/3');
});
});
describe('fromKey()', function() {
it('returns a tile coord given a key', function() {
var tileCoord = [1, 2, 3];
var key = ol.tilecoord.getKey(tileCoord);
var returned = ol.tilecoord.fromKey(key);
expect(returned).to.eql(tileCoord);
});
});
describe('hash', function() {
it('produces different hashes for different tile coords', function() {
var tileCoord1 = [3, 2, 1];