Autofix indentation issues (eslint --fix)
This commit is contained in:
@@ -47,20 +47,20 @@ describe('ol.array', function() {
|
||||
expect(pos < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of ' + (a.length) + ' for \'zzz0\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(a, 'zzz0');
|
||||
expect(insertionPoint(pos)).to.be(a.length);
|
||||
}
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(a, 'zzz0');
|
||||
expect(insertionPoint(pos)).to.be(a.length);
|
||||
}
|
||||
);
|
||||
it('should not find \'BA\'', function() {
|
||||
var pos = ol.array.binarySearch(a, 'zzz0');
|
||||
expect(pos < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of 10 for \'BA\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(a, 'BA');
|
||||
expect(insertionPoint(pos)).to.be(10);
|
||||
}
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(a, 'BA');
|
||||
expect(insertionPoint(pos)).to.be(10);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -70,38 +70,38 @@ describe('ol.array', function() {
|
||||
expect(ol.array.binarySearch(b, 'a') < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of 0 for \'a\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(b, 'a');
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
}
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(b, 'a');
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('single element array with default lexiographical comparison',
|
||||
function() {
|
||||
var c = ['only item'];
|
||||
it('should find \'only item\' at index 0', function() {
|
||||
expect(ol.array.binarySearch(c, 'only item')).to.be(0);
|
||||
});
|
||||
it('should not find \'a\'', function() {
|
||||
expect(ol.array.binarySearch(c, 'a') < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of 0 for \'a\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(c, 'a');
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
}
|
||||
);
|
||||
it('should not find \'z\'', function() {
|
||||
expect(ol.array.binarySearch(c, 'z') < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of 1 for \'z\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(c, 'z');
|
||||
expect(insertionPoint(pos)).to.be(1);
|
||||
}
|
||||
);
|
||||
}
|
||||
function() {
|
||||
var c = ['only item'];
|
||||
it('should find \'only item\' at index 0', function() {
|
||||
expect(ol.array.binarySearch(c, 'only item')).to.be(0);
|
||||
});
|
||||
it('should not find \'a\'', function() {
|
||||
expect(ol.array.binarySearch(c, 'a') < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of 0 for \'a\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(c, 'a');
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
}
|
||||
);
|
||||
it('should not find \'z\'', function() {
|
||||
expect(ol.array.binarySearch(c, 'z') < 0).to.be.ok();
|
||||
});
|
||||
it('should have an insertion point of 1 for \'z\'',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(c, 'z');
|
||||
expect(insertionPoint(pos)).to.be(1);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
describe('default comparison on array of Number(s)', function() {
|
||||
@@ -135,10 +135,10 @@ describe('ol.array', function() {
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of ' + (d.length) + ' for 54255',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(d, 54255);
|
||||
expect(insertionPoint(pos)).to.be(d.length);
|
||||
}
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(d, 54255);
|
||||
expect(insertionPoint(pos)).to.be(d.length);
|
||||
}
|
||||
);
|
||||
it('should not find 1.1', function() {
|
||||
var pos = ol.array.binarySearch(d, 1.1);
|
||||
@@ -151,54 +151,54 @@ describe('ol.array', function() {
|
||||
});
|
||||
|
||||
describe('custom comparison function, which reverse orders numbers',
|
||||
function() {
|
||||
var e = [
|
||||
54254, 453, 342, 334, 142.88888708, 5, 0.31255, 0, 0, 0, -3,
|
||||
-9, -324, -1321.3124, -321434.58758, -897123.9
|
||||
];
|
||||
it('should find 54254 at index 0', function() {
|
||||
var pos = ol.array.binarySearch(e, 54254, revNumCompare);
|
||||
expect(pos).to.be(0);
|
||||
});
|
||||
it('should find -897123.9 at index ' + (e.length - 1), function() {
|
||||
var pos = ol.array.binarySearch(e, -897123.9, revNumCompare);
|
||||
expect(pos).to.be(e.length - 1);
|
||||
});
|
||||
it('should find -3 at index 10', function() {
|
||||
var pos = ol.array.binarySearch(e, -3, revNumCompare);
|
||||
expect(pos).to.be(10);
|
||||
});
|
||||
it('should find 0 at index 7 || 8 || 9', function() {
|
||||
var pos = ol.array.binarySearch(e, 0, revNumCompare);
|
||||
expect(pos == 7 || pos == 8 || pos == 9).to.be(true);
|
||||
});
|
||||
it('should not find 54254.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 54254.1, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 0 for 54254.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 54254.1, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
});
|
||||
it('should not find -897124', function() {
|
||||
var pos = ol.array.binarySearch(e, -897124, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of ' + e.length + ' for -897124',
|
||||
function() {
|
||||
function() {
|
||||
var e = [
|
||||
54254, 453, 342, 334, 142.88888708, 5, 0.31255, 0, 0, 0, -3,
|
||||
-9, -324, -1321.3124, -321434.58758, -897123.9
|
||||
];
|
||||
it('should find 54254 at index 0', function() {
|
||||
var pos = ol.array.binarySearch(e, 54254, revNumCompare);
|
||||
expect(pos).to.be(0);
|
||||
});
|
||||
it('should find -897123.9 at index ' + (e.length - 1), function() {
|
||||
var pos = ol.array.binarySearch(e, -897123.9, revNumCompare);
|
||||
expect(pos).to.be(e.length - 1);
|
||||
});
|
||||
it('should find -3 at index 10', function() {
|
||||
var pos = ol.array.binarySearch(e, -3, revNumCompare);
|
||||
expect(pos).to.be(10);
|
||||
});
|
||||
it('should find 0 at index 7 || 8 || 9', function() {
|
||||
var pos = ol.array.binarySearch(e, 0, revNumCompare);
|
||||
expect(pos == 7 || pos == 8 || pos == 9).to.be(true);
|
||||
});
|
||||
it('should not find 54254.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 54254.1, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 0 for 54254.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 54254.1, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
});
|
||||
it('should not find -897124', function() {
|
||||
var pos = ol.array.binarySearch(e, -897124, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(e.length);
|
||||
}
|
||||
);
|
||||
it('should not find 1.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 1.1, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 0 for 1.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 1.1, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(6);
|
||||
});
|
||||
}
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of ' + e.length + ' for -897124',
|
||||
function() {
|
||||
var pos = ol.array.binarySearch(e, -897124, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(e.length);
|
||||
}
|
||||
);
|
||||
it('should not find 1.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 1.1, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 0 for 1.1', function() {
|
||||
var pos = ol.array.binarySearch(e, 1.1, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(6);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
describe('0 length array with custom comparison function', function() {
|
||||
@@ -214,29 +214,29 @@ describe('ol.array', function() {
|
||||
});
|
||||
|
||||
describe('single element array with custom comparison function',
|
||||
function() {
|
||||
var g = [1];
|
||||
it('should find 1 at index 0', function() {
|
||||
var pos = ol.array.binarySearch(g, 1, revNumCompare);
|
||||
expect(pos).to.be(0);
|
||||
});
|
||||
it('should not find 2', function() {
|
||||
var pos = ol.array.binarySearch(g, 2, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 0 for 2', function() {
|
||||
var pos = ol.array.binarySearch(g, 2, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
});
|
||||
it('should not find 0', function() {
|
||||
var pos = ol.array.binarySearch(g, 0, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 1 for 0', function() {
|
||||
var pos = ol.array.binarySearch(g, 0, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(1);
|
||||
});
|
||||
}
|
||||
function() {
|
||||
var g = [1];
|
||||
it('should find 1 at index 0', function() {
|
||||
var pos = ol.array.binarySearch(g, 1, revNumCompare);
|
||||
expect(pos).to.be(0);
|
||||
});
|
||||
it('should not find 2', function() {
|
||||
var pos = ol.array.binarySearch(g, 2, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 0 for 2', function() {
|
||||
var pos = ol.array.binarySearch(g, 2, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(0);
|
||||
});
|
||||
it('should not find 0', function() {
|
||||
var pos = ol.array.binarySearch(g, 0, revNumCompare);
|
||||
expect(pos < 0).to.be(true);
|
||||
});
|
||||
it('should have an insertion point of 1 for 0', function() {
|
||||
var pos = ol.array.binarySearch(g, 0, revNumCompare);
|
||||
expect(insertionPoint(pos)).to.be(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
describe('finding first index when multiple candidates', function() {
|
||||
@@ -249,51 +249,51 @@ describe('ol.array', function() {
|
||||
});
|
||||
|
||||
describe('Don\'t use Array#slice, Function#apply and Function#call',
|
||||
function() {
|
||||
var a = [1, 5, 7, 11, 13, 16, 19, 24, 28, 31, 33, 36, 40, 50, 52, 55];
|
||||
var calls = {
|
||||
'Array#slice': false,
|
||||
'Function#apply': false,
|
||||
'Function#call': false
|
||||
};
|
||||
var origArraySlice;
|
||||
var origFunctionApply;
|
||||
var origFunctionCall;
|
||||
function() {
|
||||
var a = [1, 5, 7, 11, 13, 16, 19, 24, 28, 31, 33, 36, 40, 50, 52, 55];
|
||||
var calls = {
|
||||
'Array#slice': false,
|
||||
'Function#apply': false,
|
||||
'Function#call': false
|
||||
};
|
||||
var origArraySlice;
|
||||
var origFunctionApply;
|
||||
var origFunctionCall;
|
||||
|
||||
it('does not use potentially slow methods (default & custom compare)',
|
||||
function() {
|
||||
// Mockup (I failed to use sinon.spy and beforeEach-hooks)
|
||||
origArraySlice = Array.prototype.slice;
|
||||
origFunctionApply = Function.prototype.apply;
|
||||
origFunctionCall = Function.prototype.call;
|
||||
Array.prototype.slice = function() {
|
||||
calls['Array#slice'] = true;
|
||||
};
|
||||
Function.prototype.apply = function() {
|
||||
calls['Function#apply'] = true;
|
||||
};
|
||||
Function.prototype.call = function() {
|
||||
calls['Function#call'] = true;
|
||||
};
|
||||
it('does not use potentially slow methods (default & custom compare)',
|
||||
function() {
|
||||
// Mockup (I failed to use sinon.spy and beforeEach-hooks)
|
||||
origArraySlice = Array.prototype.slice;
|
||||
origFunctionApply = Function.prototype.apply;
|
||||
origFunctionCall = Function.prototype.call;
|
||||
Array.prototype.slice = function() {
|
||||
calls['Array#slice'] = true;
|
||||
};
|
||||
Function.prototype.apply = function() {
|
||||
calls['Function#apply'] = true;
|
||||
};
|
||||
Function.prototype.call = function() {
|
||||
calls['Function#call'] = true;
|
||||
};
|
||||
|
||||
// Now actually call and test the method twice
|
||||
ol.array.binarySearch(a, 48);
|
||||
ol.array.binarySearch(a, 13, function(a, b) {
|
||||
return a > b ? 1 : a < b ? -1 : 0;
|
||||
});
|
||||
// Now actually call and test the method twice
|
||||
ol.array.binarySearch(a, 48);
|
||||
ol.array.binarySearch(a, 13, function(a, b) {
|
||||
return a > b ? 1 : a < b ? -1 : 0;
|
||||
});
|
||||
|
||||
// Restore mocked up methods
|
||||
Array.prototype.slice = origArraySlice;
|
||||
Function.prototype.apply = origFunctionApply;
|
||||
Function.prototype.call = origFunctionCall;
|
||||
// Restore mocked up methods
|
||||
Array.prototype.slice = origArraySlice;
|
||||
Function.prototype.apply = origFunctionApply;
|
||||
Function.prototype.call = origFunctionCall;
|
||||
|
||||
// Expectations
|
||||
expect(calls['Array#slice']).to.be(false);
|
||||
expect(calls['Function#apply']).to.be(false);
|
||||
expect(calls['Function#call']).to.be(false);
|
||||
}
|
||||
);
|
||||
}
|
||||
// Expectations
|
||||
expect(calls['Array#slice']).to.be(false);
|
||||
expect(calls['Function#apply']).to.be(false);
|
||||
expect(calls['Function#call']).to.be(false);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
describe('when items are not found', function() {
|
||||
@@ -546,7 +546,7 @@ describe('ol.array', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
arr = [{key: 3, val: 'a'}, {key: 2, val: 'b'}, {key: 3, val: 'c'},
|
||||
{key: 4, val: 'd'}, {key: 3, val: 'e'}];
|
||||
{key: 4, val: 'd'}, {key: 3, val: 'e'}];
|
||||
wantedSortedValues = ['b', 'a', 'c', 'e', 'd'];
|
||||
});
|
||||
|
||||
|
||||
@@ -477,7 +477,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(obj).to.be.a(ol.geom.LineString);
|
||||
expect(obj.getLayout()).to.eql('XYZM');
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 1534, 1],
|
||||
[30, 40, 1420, 2]]);
|
||||
[30, 40, 1420, 2]]);
|
||||
});
|
||||
|
||||
it('parses multilinestring', function() {
|
||||
@@ -650,7 +650,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1], [1, 4], [4, 3], [3, 0]], [[2, 2], [3, 2],
|
||||
[3, 3], [2, 3]]],
|
||||
[3, 3], [2, 3]]],
|
||||
[[[10, 1], [11, 5], [14, 3], [13, 0]]]
|
||||
]);
|
||||
});
|
||||
@@ -669,7 +669,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
|
||||
]);
|
||||
});
|
||||
@@ -688,7 +688,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(obj.getLayout()).to.eql('XYM');
|
||||
expect(obj.getCoordinates()).to.eql([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
|
||||
]);
|
||||
});
|
||||
@@ -817,8 +817,8 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('encodes XYZM linestring', function() {
|
||||
var linestring = new ol.geom.LineString([[10, 20, 1534, 1],
|
||||
[30, 40, 1420, 1]],
|
||||
'XYZM');
|
||||
[30, 40, 1420, 1]],
|
||||
'XYZM');
|
||||
var esrijson = format.writeGeometry(linestring);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
@@ -882,7 +882,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('encodes XYZ multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3],
|
||||
[103.0, 1.0, 4]], 'XYZ');
|
||||
[103.0, 1.0, 4]], 'XYZ');
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
@@ -890,7 +890,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('encodes XYM multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3],
|
||||
[103.0, 1.0, 4]], 'XYM');
|
||||
[103.0, 1.0, 4]], 'XYM');
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
@@ -898,7 +898,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('encodes XYZM multipoint', function() {
|
||||
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3, 1],
|
||||
[103.0, 1.0, 4, 1]], 'XYZM');
|
||||
[103.0, 1.0, 4, 1]], 'XYZM');
|
||||
var esrijson = format.writeGeometry(multipoint);
|
||||
expect(multipoint.getCoordinates()).to.eql(
|
||||
format.readGeometry(esrijson).getCoordinates());
|
||||
@@ -959,7 +959,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
it('encodes XYZ multipolygon', function() {
|
||||
var multipolygon = new ol.geom.MultiPolygon([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
|
||||
], 'XYZ');
|
||||
var esrijson = format.writeGeometry(multipolygon);
|
||||
@@ -970,7 +970,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
it('encodes XYM multipolygon', function() {
|
||||
var multipolygon = new ol.geom.MultiPolygon([
|
||||
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[3, 3, 0], [2, 3, 0]]],
|
||||
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
|
||||
], 'XYM');
|
||||
var esrijson = format.writeGeometry(multipolygon);
|
||||
|
||||
@@ -820,7 +820,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('truncates a linestring with decimals option', function() {
|
||||
var linestring = new ol.geom.LineString([[42.123456789, 38.987654321],
|
||||
[43, 39]]);
|
||||
[43, 39]]);
|
||||
var geojson = format.writeGeometry(linestring, {
|
||||
decimals: 6
|
||||
});
|
||||
@@ -832,7 +832,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('rounds a linestring with decimals option = 0', function() {
|
||||
var linestring = new ol.geom.LineString([[42.123456789, 38.987654321],
|
||||
[43, 39]]);
|
||||
[43, 39]]);
|
||||
var geojson = format.writeGeometry(linestring, {
|
||||
decimals: 0
|
||||
});
|
||||
|
||||
@@ -494,18 +494,18 @@ describe('ol.format.GML3', function() {
|
||||
|
||||
it('can read and write a linestring geometry with ' +
|
||||
'correct axis order',
|
||||
function() {
|
||||
var text =
|
||||
function() {
|
||||
var text =
|
||||
'<gml:LineString xmlns:gml="http://www.opengis.net/gml" ' +
|
||||
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +
|
||||
' <gml:posList>-90 -180 90 180</gml:posList>' +
|
||||
'</gml:LineString>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g.getCoordinates()).to.eql([[-180, -90, 0], [180, 90, 0]]);
|
||||
var serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.LineString);
|
||||
expect(g.getCoordinates()).to.eql([[-180, -90, 0], [180, 90, 0]]);
|
||||
var serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a point geometry with correct axis order',
|
||||
function() {
|
||||
@@ -612,8 +612,8 @@ describe('ol.format.GML3', function() {
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Polygon);
|
||||
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
@@ -649,8 +649,8 @@ describe('ol.format.GML3', function() {
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(ol.geom.Polygon);
|
||||
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', surface: true});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
@@ -834,7 +834,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', multiSurface: false});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
@@ -877,7 +877,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
});
|
||||
|
||||
@@ -983,7 +983,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
@@ -1027,7 +1027,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
});
|
||||
|
||||
@@ -1077,7 +1077,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
format = new ol.format.GML({srsName: 'CRS:84', surface: true});
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
|
||||
@@ -849,8 +849,8 @@ describe('ol.format.KML', function() {
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.MultiPolygon);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
|
||||
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]]);
|
||||
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
|
||||
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]]);
|
||||
expect(g.get('extrude')).to.be.an('array');
|
||||
expect(g.get('extrude')).to.have.length(2);
|
||||
expect(g.get('extrude')[0]).to.be(false);
|
||||
@@ -864,8 +864,8 @@ describe('ol.format.KML', function() {
|
||||
it('can write MultiPolygon geometries', function() {
|
||||
var layout = 'XYZ';
|
||||
var multiPolygon = new ol.geom.MultiPolygon(
|
||||
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
|
||||
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]], layout);
|
||||
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
|
||||
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]], layout);
|
||||
var features = [new ol.Feature(multiPolygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
'</ows:ServiceContact>' +
|
||||
'</ows:ServiceProvider>' +
|
||||
'</ows:GetCapabilities>'
|
||||
);
|
||||
);
|
||||
|
||||
var obj = parser.read(doc);
|
||||
expect(obj).to.be.ok();
|
||||
@@ -76,7 +76,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
'<ows:AccessConstraints>none</ows:AccessConstraints>' +
|
||||
'</ows:ServiceIdentification>' +
|
||||
'</ows:GetCapabilities>'
|
||||
);
|
||||
);
|
||||
var obj = parser.readFromNode(doc.firstChild);
|
||||
expect(obj).to.be.ok();
|
||||
|
||||
@@ -129,7 +129,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
'</ows:Operation>' +
|
||||
'</ows:OperationsMetadata>' +
|
||||
'</ows:GetCapabilities>'
|
||||
);
|
||||
);
|
||||
var obj = parser.readFromNode(doc.firstChild);
|
||||
expect(obj).to.be.ok();
|
||||
|
||||
|
||||
@@ -348,14 +348,14 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.or(
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.greaterThan('area', 100),
|
||||
ol.format.filter.greaterThanOrEqualTo('pop', 20000)
|
||||
),
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.lessThan('area', 100),
|
||||
ol.format.filter.lessThanOrEqualTo('pop', 20000)
|
||||
)
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.greaterThan('area', 100),
|
||||
ol.format.filter.greaterThanOrEqualTo('pop', 20000)
|
||||
),
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.lessThan('area', 100),
|
||||
ol.format.filter.lessThanOrEqualTo('pop', 20000)
|
||||
)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
@@ -505,9 +505,9 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: ol.format.filter.and(
|
||||
ol.format.filter.equalTo('name', 'New York'),
|
||||
ol.format.filter.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
|
||||
ol.format.filter.greaterThan('population', 2000000)
|
||||
ol.format.filter.equalTo('name', 'New York'),
|
||||
ol.format.filter.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
|
||||
ol.format.filter.greaterThan('population', 2000000)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
|
||||
@@ -539,11 +539,11 @@ describe('ol.format.WFS', function() {
|
||||
filter: ol.format.filter.intersects(
|
||||
'the_geom',
|
||||
new ol.geom.Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
)
|
||||
});
|
||||
@@ -576,11 +576,11 @@ describe('ol.format.WFS', function() {
|
||||
filter: ol.format.filter.within(
|
||||
'the_geom',
|
||||
new ol.geom.Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
)
|
||||
});
|
||||
@@ -1182,10 +1182,10 @@ describe('ol.format.WFS', function() {
|
||||
' </And>' +
|
||||
'</Filter>';
|
||||
var serialized = ol.format.WFS.writeFilter(
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.like('name', 'Mississippi*'),
|
||||
ol.format.filter.equalTo('waterway', 'riverbank')
|
||||
)
|
||||
ol.format.filter.and(
|
||||
ol.format.filter.like('name', 'Mississippi*'),
|
||||
ol.format.filter.equalTo('waterway', 'riverbank')
|
||||
)
|
||||
);
|
||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
|
||||
var layer = capabilities.Contents.Layer[0];
|
||||
expect(layer.Abstract).to.be
|
||||
.eql('Blue Marble Next Generation NASA Product');
|
||||
.eql('Blue Marble Next Generation NASA Product');
|
||||
expect(layer.Identifier).to.be.eql('BlueMarbleNextGeneration');
|
||||
expect(layer.Title).to.be.eql('Blue Marble Next Generation');
|
||||
|
||||
@@ -51,16 +51,16 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(layer.Style[0].isDefault).to.be(true);
|
||||
expect(layer.Style[0].Title).to.be.eql('Dark Blue');
|
||||
expect(layer.Style[0].LegendURL[0].href).to.be
|
||||
.eql('http://www.miramon.uab.es/wmts/Coastlines/' +
|
||||
.eql('http://www.miramon.uab.es/wmts/Coastlines/' +
|
||||
'coastlines_darkBlue.png');
|
||||
expect(layer.Style[0].LegendURL[0].format).to.be.eql('image/png');
|
||||
|
||||
expect(layer.TileMatrixSetLink).to.be.an('array');
|
||||
expect(layer.TileMatrixSetLink).to.have.length(2);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSet).to.be
|
||||
.eql('BigWorldPixel');
|
||||
.eql('BigWorldPixel');
|
||||
expect(layer.TileMatrixSetLink[1].TileMatrixSet).to.be
|
||||
.eql('google3857');
|
||||
.eql('google3857');
|
||||
|
||||
var wgs84Bbox = layer.WGS84BoundingBox;
|
||||
expect(wgs84Bbox).to.be.an('array');
|
||||
@@ -73,7 +73,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(layer.ResourceURL).to.have.length(2);
|
||||
expect(layer.ResourceURL[0].format).to.be.eql('image/png');
|
||||
expect(layer.ResourceURL[0].template).to.be
|
||||
.eql('http://www.example.com/wmts/coastlines/{TileMatrix}' +
|
||||
.eql('http://www.example.com/wmts/coastlines/{TileMatrix}' +
|
||||
'/{TileRow}/{TileCol}.png');
|
||||
|
||||
});
|
||||
@@ -140,19 +140,19 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(layer.TileMatrixSetLink).to.be.an('array');
|
||||
expect(layer.TileMatrixSetLink).to.have.length(1);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSet).to.be
|
||||
.eql('PM');
|
||||
.eql('PM');
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits).to.be.an('array');
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits).to.have.length(20);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].TileMatrix)
|
||||
.to.be.eql('0');
|
||||
.to.be.eql('0');
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MinTileRow)
|
||||
.to.be.eql(0);
|
||||
.to.be.eql(0);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MaxTileRow)
|
||||
.to.be.eql(1);
|
||||
.to.be.eql(1);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MinTileCol)
|
||||
.to.be.eql(0);
|
||||
.to.be.eql(0);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MaxTileCol)
|
||||
.to.be.eql(1);
|
||||
.to.be.eql(1);
|
||||
|
||||
});
|
||||
|
||||
@@ -168,7 +168,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(pm.TileMatrix[0].MatrixHeight).to.be.eql(1);
|
||||
expect(pm.TileMatrix[0].MatrixWidth).to.be.eql(1);
|
||||
expect(pm.TileMatrix[0].ScaleDenominator)
|
||||
.to.be.eql(559082264.0287178958533332);
|
||||
.to.be.eql(559082264.0287178958533332);
|
||||
expect(pm.TileMatrix[0].TileWidth).to.be.eql(256);
|
||||
expect(pm.TileMatrix[0].TileHeight).to.be.eql(256);
|
||||
expect(pm.TileMatrix[0].TopLeftCorner).to.be.a('array');
|
||||
@@ -178,7 +178,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(pm.TileMatrix[1].MatrixHeight).to.be.eql(2);
|
||||
expect(pm.TileMatrix[1].MatrixWidth).to.be.eql(2);
|
||||
expect(pm.TileMatrix[1].ScaleDenominator)
|
||||
.to.be.eql(279541132.0143588959472254);
|
||||
.to.be.eql(279541132.0143588959472254);
|
||||
expect(pm.TileMatrix[1].TileWidth).to.be.eql(256);
|
||||
expect(pm.TileMatrix[1].TileHeight).to.be.eql(256);
|
||||
expect(pm.TileMatrix[1].TopLeftCorner).to.be.a('array');
|
||||
|
||||
@@ -208,29 +208,29 @@ describe('ol.geom.Circle', function() {
|
||||
describe('#intersectsExtent', function() {
|
||||
|
||||
it('returns false for non-intersecting extents (wide outside own bbox)',
|
||||
function() {
|
||||
var wideOutsideLeftTop = [-3, 2, -2, 3];
|
||||
var wideOutsideRightTop = [2, 2, 3, 3];
|
||||
var wideOutsideRightBottom = [2, -3, 3, -2];
|
||||
var wideOutsideLeftBottom = [-3, -3, -2, -2];
|
||||
expect(circle.intersectsExtent(wideOutsideLeftTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(wideOutsideRightTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(wideOutsideRightBottom)).to.be(false);
|
||||
expect(circle.intersectsExtent(wideOutsideLeftBottom)).to.be(false);
|
||||
}
|
||||
function() {
|
||||
var wideOutsideLeftTop = [-3, 2, -2, 3];
|
||||
var wideOutsideRightTop = [2, 2, 3, 3];
|
||||
var wideOutsideRightBottom = [2, -3, 3, -2];
|
||||
var wideOutsideLeftBottom = [-3, -3, -2, -2];
|
||||
expect(circle.intersectsExtent(wideOutsideLeftTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(wideOutsideRightTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(wideOutsideRightBottom)).to.be(false);
|
||||
expect(circle.intersectsExtent(wideOutsideLeftBottom)).to.be(false);
|
||||
}
|
||||
);
|
||||
|
||||
it('returns false for non-intersecting extents (inside own bbox)',
|
||||
function() {
|
||||
var nearOutsideLeftTop = [-1, 0.9, -0.9, 1];
|
||||
var nearOutsideRightTop = [0.9, 0.9, 1, 1];
|
||||
var nearOutsideRightBottom = [0.9, -1, 1, -0.9];
|
||||
var nearOutsideLeftBottom = [-1, -1, -0.9, -0.9];
|
||||
expect(circle.intersectsExtent(nearOutsideLeftTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(nearOutsideRightTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(nearOutsideRightBottom)).to.be(false);
|
||||
expect(circle.intersectsExtent(nearOutsideLeftBottom)).to.be(false);
|
||||
}
|
||||
function() {
|
||||
var nearOutsideLeftTop = [-1, 0.9, -0.9, 1];
|
||||
var nearOutsideRightTop = [0.9, 0.9, 1, 1];
|
||||
var nearOutsideRightBottom = [0.9, -1, 1, -0.9];
|
||||
var nearOutsideLeftBottom = [-1, -1, -0.9, -0.9];
|
||||
expect(circle.intersectsExtent(nearOutsideLeftTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(nearOutsideRightTop)).to.be(false);
|
||||
expect(circle.intersectsExtent(nearOutsideRightBottom)).to.be(false);
|
||||
expect(circle.intersectsExtent(nearOutsideLeftBottom)).to.be(false);
|
||||
}
|
||||
);
|
||||
|
||||
it('returns true for extents that intersect clearly', function() {
|
||||
|
||||
@@ -13,10 +13,10 @@ describe('ol.geom.flat.center', function() {
|
||||
[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]
|
||||
]]);
|
||||
var got = ol.geom.flat.center.linearRingss(
|
||||
squareMultiPoly.flatCoordinates,
|
||||
0,
|
||||
squareMultiPoly.endss_,
|
||||
2
|
||||
squareMultiPoly.flatCoordinates,
|
||||
0,
|
||||
squareMultiPoly.endss_,
|
||||
2
|
||||
);
|
||||
expect(got).to.eql([0.5, 0.5]);
|
||||
});
|
||||
@@ -31,24 +31,24 @@ describe('ol.geom.flat.center', function() {
|
||||
]
|
||||
]);
|
||||
var got = ol.geom.flat.center.linearRingss(
|
||||
squareMultiPoly.flatCoordinates,
|
||||
0,
|
||||
squareMultiPoly.endss_,
|
||||
2
|
||||
squareMultiPoly.flatCoordinates,
|
||||
0,
|
||||
squareMultiPoly.endss_,
|
||||
2
|
||||
);
|
||||
expect(got).to.eql([0.5, 0.5, 3.5, 0.5]);
|
||||
});
|
||||
|
||||
it('does not care about holes', function() {
|
||||
var polywithHole = new ol.geom.MultiPolygon([[
|
||||
[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]],
|
||||
[[1, 1], [1, 4], [4, 4], [4, 1], [1, 1]]
|
||||
[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]],
|
||||
[[1, 1], [1, 4], [4, 4], [4, 1], [1, 1]]
|
||||
]]);
|
||||
var got = ol.geom.flat.center.linearRingss(
|
||||
polywithHole.flatCoordinates,
|
||||
0,
|
||||
polywithHole.endss_,
|
||||
2
|
||||
polywithHole.flatCoordinates,
|
||||
0,
|
||||
polywithHole.endss_,
|
||||
2
|
||||
);
|
||||
expect(got).to.eql([2.5, 2.5]);
|
||||
});
|
||||
|
||||
@@ -23,12 +23,12 @@ describe('ol.geom.flat.interpolate', function() {
|
||||
|
||||
it('returns the expected value when the mid point is an existing ' +
|
||||
'coordinate',
|
||||
function() {
|
||||
var flatCoordinates = [0, 1, 2, 3, 4, 5];
|
||||
var point = ol.geom.flat.interpolate.lineString(
|
||||
flatCoordinates, 0, 6, 2, 0.5);
|
||||
expect(point).to.eql([2, 3]);
|
||||
});
|
||||
function() {
|
||||
var flatCoordinates = [0, 1, 2, 3, 4, 5];
|
||||
var point = ol.geom.flat.interpolate.lineString(
|
||||
flatCoordinates, 0, 6, 2, 0.5);
|
||||
expect(point).to.eql([2, 3]);
|
||||
});
|
||||
|
||||
xit('also when vertices are repeated', function() {
|
||||
var flatCoordinates = [0, 1, 2, 3, 2, 3, 4, 5];
|
||||
@@ -39,12 +39,12 @@ describe('ol.geom.flat.interpolate', function() {
|
||||
|
||||
it('returns the expected value when the midpoint falls halfway between ' +
|
||||
'two existing coordinates',
|
||||
function() {
|
||||
var flatCoordinates = [0, 1, 2, 3, 4, 5, 6, 7];
|
||||
var point = ol.geom.flat.interpolate.lineString(
|
||||
flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
function() {
|
||||
var flatCoordinates = [0, 1, 2, 3, 4, 5, 6, 7];
|
||||
var point = ol.geom.flat.interpolate.lineString(
|
||||
flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
|
||||
xit('also when vertices are repeated', function() {
|
||||
var flatCoordinates = [0, 1, 2, 3, 2, 3, 4, 5, 6, 7];
|
||||
|
||||
@@ -74,14 +74,14 @@ describe('ol.geom.flat.intersectsextent', function() {
|
||||
});
|
||||
describe('boundary does not intersect the extent and ring does not ' +
|
||||
'contain a corner of the extent',
|
||||
function() {
|
||||
it('returns false', function() {
|
||||
var extent = [2.0, 0.5, 3, 1.5];
|
||||
var r = ol.geom.flat.intersectsextent.linearRing(
|
||||
flatCoordinates, 0, flatCoordinates.length, 2, extent);
|
||||
expect(r).to.be(false);
|
||||
});
|
||||
});
|
||||
function() {
|
||||
it('returns false', function() {
|
||||
var extent = [2.0, 0.5, 3, 1.5];
|
||||
var r = ol.geom.flat.intersectsextent.linearRing(
|
||||
flatCoordinates, 0, flatCoordinates.length, 2, extent);
|
||||
expect(r).to.be(false);
|
||||
});
|
||||
});
|
||||
describe('ring contains the extent', function() {
|
||||
it('returns true', function() {
|
||||
var extent = [0.75, -0.25, 1.25, 0.25];
|
||||
|
||||
@@ -217,7 +217,7 @@ describe('ol.interaction.Modify', function() {
|
||||
it('deletes first vertex of a LineString', function() {
|
||||
var lineFeature = new ol.Feature({
|
||||
geometry: new ol.geom.LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
});
|
||||
features.length = 0;
|
||||
@@ -253,7 +253,7 @@ describe('ol.interaction.Modify', function() {
|
||||
it('deletes last vertex of a LineString', function() {
|
||||
var lineFeature = new ol.Feature({
|
||||
geometry: new ol.geom.LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
});
|
||||
features.length = 0;
|
||||
@@ -289,7 +289,7 @@ describe('ol.interaction.Modify', function() {
|
||||
it('deletes vertex of a LineString programmatically', function() {
|
||||
var lineFeature = new ol.Feature({
|
||||
geometry: new ol.geom.LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
});
|
||||
features.length = 0;
|
||||
@@ -331,7 +331,7 @@ describe('ol.interaction.Modify', function() {
|
||||
it('keeps the third dimension', function() {
|
||||
var lineFeature = new ol.Feature({
|
||||
geometry: new ol.geom.LineString(
|
||||
[[0, 0, 10], [10, 20, 20], [0, 40, 30], [40, 40, 40], [40, 0, 50]]
|
||||
[[0, 0, 10], [10, 20, 20], [0, 40, 30], [40, 40, 40], [40, 0, 50]]
|
||||
)
|
||||
});
|
||||
features.length = 0;
|
||||
|
||||
@@ -32,8 +32,8 @@ describe('ol.interaction.Translate', function() {
|
||||
features = [new ol.Feature({
|
||||
geometry: new ol.geom.Point([10, -20])
|
||||
}), new ol.Feature({
|
||||
geometry: new ol.geom.Point([20, -30])
|
||||
})];
|
||||
geometry: new ol.geom.Point([20, -30])
|
||||
})];
|
||||
source.addFeatures(features);
|
||||
var layer = new ol.layer.Vector({source: source});
|
||||
map = new ol.Map({
|
||||
|
||||
@@ -55,13 +55,13 @@ describe('ol.proj', function() {
|
||||
|
||||
it('gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326 are ' +
|
||||
'equivalent',
|
||||
function() {
|
||||
_testAllEquivalent([
|
||||
'CRS:84',
|
||||
'urn:ogc:def:crs:EPSG:6.6:4326',
|
||||
'EPSG:4326'
|
||||
]);
|
||||
});
|
||||
function() {
|
||||
_testAllEquivalent([
|
||||
'CRS:84',
|
||||
'urn:ogc:def:crs:EPSG:6.6:4326',
|
||||
'EPSG:4326'
|
||||
]);
|
||||
});
|
||||
|
||||
it('requires code and units to be equal for projection evquivalence',
|
||||
function() {
|
||||
|
||||
@@ -84,8 +84,8 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
var multilinestring;
|
||||
|
||||
multilinestring = new ol.geom.MultiLineString(
|
||||
[[[1000, 2000], [2000, 3000]],
|
||||
[[1000, 3000], [2000, 4000], [3000, 3000]]]);
|
||||
[[[1000, 2000], [2000, 3000]],
|
||||
[[1000, 3000], [2000, 4000], [3000, 3000]]]);
|
||||
replay.setFillStrokeStyle(null, strokeStyle1);
|
||||
replay.drawMultiLineString(multilinestring, null);
|
||||
expect(replay.vertices).to.have.length(140);
|
||||
@@ -114,9 +114,9 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
replay.drawCoordinates_(flatCoordinates, 0,
|
||||
flatCoordinates.length, 2);
|
||||
expect(replay.indices).to.eql(
|
||||
[2, 0, 1, 4, 2, 1,
|
||||
2, 4, 3,
|
||||
5, 3, 4, 4, 6, 5]);
|
||||
[2, 0, 1, 4, 2, 1,
|
||||
2, 4, 3,
|
||||
5, 3, 4, 4, 6, 5]);
|
||||
});
|
||||
|
||||
it('optionally creates miters', function() {
|
||||
@@ -134,9 +134,9 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
replay.drawCoordinates_(flatCoordinates, 0,
|
||||
flatCoordinates.length, 2);
|
||||
expect(replay.indices).to.eql(
|
||||
[2, 0, 1, 4, 2, 1,
|
||||
2, 4, 3, 3, 5, 2,
|
||||
6, 3, 4, 4, 7, 6]);
|
||||
[2, 0, 1, 4, 2, 1,
|
||||
2, 4, 3, 3, 5, 2,
|
||||
6, 3, 4, 4, 7, 6]);
|
||||
});
|
||||
|
||||
it('optionally creates caps', function() {
|
||||
@@ -153,11 +153,11 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
replay.drawCoordinates_(flatCoordinates, 0,
|
||||
flatCoordinates.length, 2);
|
||||
expect(replay.indices).to.eql(
|
||||
[2, 0, 1, 1, 3, 2,
|
||||
4, 2, 3, 6, 4, 3,
|
||||
4, 6, 5, 5, 7, 4,
|
||||
8, 5, 6, 6, 9, 8,
|
||||
10, 8, 9, 9, 11, 10]);
|
||||
[2, 0, 1, 1, 3, 2,
|
||||
4, 2, 3, 6, 4, 3,
|
||||
4, 6, 5, 5, 7, 4,
|
||||
8, 5, 6, 6, 9, 8,
|
||||
10, 8, 9, 9, 11, 10]);
|
||||
});
|
||||
|
||||
it('respects segment orientation', function() {
|
||||
@@ -176,9 +176,9 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
replay.drawCoordinates_(flatCoordinates, 0,
|
||||
flatCoordinates.length, 2);
|
||||
expect(replay.indices).to.eql(
|
||||
[2, 0, 1, 4, 2, 0,
|
||||
2, 4, 3,
|
||||
5, 3, 4, 4, 6, 5]);
|
||||
[2, 0, 1, 4, 2, 0,
|
||||
2, 4, 3,
|
||||
5, 3, 4, 4, 6, 5]);
|
||||
});
|
||||
|
||||
it('closes boundaries', function() {
|
||||
@@ -197,12 +197,12 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
replay.drawCoordinates_(flatCoordinates, 0,
|
||||
flatCoordinates.length, 2);
|
||||
expect(replay.indices).to.eql(
|
||||
[0, 2, 1, 3, 1, 2,
|
||||
5, 3, 2,
|
||||
3, 5, 4, 6, 4, 5,
|
||||
8, 6, 5,
|
||||
6, 8, 7, 9, 7, 8,
|
||||
10, 9, 8]);
|
||||
[0, 2, 1, 3, 1, 2,
|
||||
5, 3, 2,
|
||||
3, 5, 4, 6, 4, 5,
|
||||
8, 6, 5,
|
||||
6, 8, 7, 9, 7, 8,
|
||||
10, 9, 8]);
|
||||
expect(replay.vertices.slice(0, 7)).to.eql(
|
||||
replay.vertices.slice(-14, -7));
|
||||
expect(replay.vertices.slice(14, 21)).to.eql(
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
||||
it('sets the buffer data', function() {
|
||||
var polygon1 = new ol.geom.Polygon(
|
||||
[[[1000, 2000], [1200, 2000], [1200, 3000]]]
|
||||
);
|
||||
);
|
||||
replay.drawPolygon(polygon1, null);
|
||||
expect(replay.vertices).to.have.length(8);
|
||||
expect(replay.indices).to.have.length(3);
|
||||
@@ -46,7 +46,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
||||
|
||||
var polygon2 = new ol.geom.Polygon(
|
||||
[[[4000, 2000], [4200, 2000], [4200, 3000]]]
|
||||
);
|
||||
);
|
||||
replay.drawPolygon(polygon2, null);
|
||||
expect(replay.vertices).to.have.length(16);
|
||||
expect(replay.indices).to.have.length(6);
|
||||
|
||||
@@ -164,16 +164,16 @@ describe('ol.source.ImageWMS', function() {
|
||||
});
|
||||
|
||||
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
|
||||
function() {
|
||||
options.serverType = 'geoserver';
|
||||
var source = new ol.source.ImageWMS(options);
|
||||
pixelRatio = 1.325;
|
||||
var image =
|
||||
function() {
|
||||
options.serverType = 'geoserver';
|
||||
var source = new ol.source.ImageWMS(options);
|
||||
pixelRatio = 1.325;
|
||||
var image =
|
||||
source.getImage(extent, resolution, pixelRatio, projection);
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
|
||||
});
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
|
||||
});
|
||||
|
||||
it('sets DPI when the server is QGIS', function() {
|
||||
options.serverType = 'qgis';
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('ol.source.TileUTFGrid', function() {
|
||||
var proj3857 = ol.proj.get('EPSG:3857');
|
||||
var expectedExtent4326 = tileJson.bounds;
|
||||
var expectedExtent3857 = ol.proj.transformExtent(
|
||||
expectedExtent4326, proj4326, proj3857
|
||||
expectedExtent4326, proj4326, proj3857
|
||||
);
|
||||
expect(extent).to.eql(proj3857.getExtent());
|
||||
expect(extent[0]).to.roughlyEqual(expectedExtent3857[0], 1e-8);
|
||||
@@ -261,7 +261,7 @@ describe('ol.source.TileUTFGrid', function() {
|
||||
done();
|
||||
};
|
||||
source.forDataAtCoordinateAndResolution(
|
||||
bonn3857, resolutionZoom1, callback, null, true
|
||||
bonn3857, resolutionZoom1, callback, null, true
|
||||
);
|
||||
});
|
||||
|
||||
@@ -272,7 +272,7 @@ describe('ol.source.TileUTFGrid', function() {
|
||||
done();
|
||||
};
|
||||
source.forDataAtCoordinateAndResolution(
|
||||
bonn3857, resolutionZoom1, callback, scope, true
|
||||
bonn3857, resolutionZoom1, callback, scope, true
|
||||
);
|
||||
});
|
||||
|
||||
@@ -283,7 +283,7 @@ describe('ol.source.TileUTFGrid', function() {
|
||||
done();
|
||||
};
|
||||
source.forDataAtCoordinateAndResolution(
|
||||
noState3857, resolutionZoom1, callback, null, true
|
||||
noState3857, resolutionZoom1, callback, null, true
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -143,14 +143,14 @@ describe('ol.source.TileWMS', function() {
|
||||
});
|
||||
|
||||
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
|
||||
function() {
|
||||
options.serverType = 'geoserver';
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, -3, 1.325, ol.proj.get('CRS:84'));
|
||||
var uri = new URL(tile.src_);
|
||||
var queryData = uri.searchParams;
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
|
||||
});
|
||||
function() {
|
||||
options.serverType = 'geoserver';
|
||||
var source = new ol.source.TileWMS(options);
|
||||
var tile = source.getTile(3, 2, -3, 1.325, ol.proj.get('CRS:84'));
|
||||
var uri = new URL(tile.src_);
|
||||
var queryData = uri.searchParams;
|
||||
expect(queryData.get('FORMAT_OPTIONS')).to.be('dpi:119');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ describe('ol.source.WMTS', function() {
|
||||
expect(options.urls).to.be.an('array');
|
||||
expect(options.urls).to.have.length(1);
|
||||
expect(options.urls[0]).to.be.eql(
|
||||
'https://services.arcgisonline.com/arcgis/rest/services/' +
|
||||
'https://services.arcgisonline.com/arcgis/rest/services/' +
|
||||
'Demographics/USA_Population_Density/MapServer/WMTS?');
|
||||
});
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('ol.source.WMTS', function() {
|
||||
expect(options.urls).to.be.an('array');
|
||||
expect(options.urls).to.have.length(1);
|
||||
expect(options.urls[0]).to.be.eql(
|
||||
'https://services.arcgisonline.com/arcgis/rest/services/' +
|
||||
'https://services.arcgisonline.com/arcgis/rest/services/' +
|
||||
'Demographics/USA_Population_Density/MapServer/WMTS/' +
|
||||
'tile/1.0.0/Demographics_USA_Population_Density/' +
|
||||
'{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png');
|
||||
|
||||
@@ -61,97 +61,97 @@ describe('ol.tilegrid.WMTS', function() {
|
||||
|
||||
|
||||
describe('when creating tileGrid from capabilities with and without TileMatrixSetLimits',
|
||||
function() {
|
||||
var parser = new ol.format.WMTSCapabilities();
|
||||
var capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {
|
||||
try {
|
||||
capabilities = parser.read(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
function() {
|
||||
var parser = new ol.format.WMTSCapabilities();
|
||||
var capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {
|
||||
try {
|
||||
capabilities = parser.read(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can create tileGrid for EPSG:3857 without matrixLimits',
|
||||
function() {
|
||||
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
|
||||
var tileGrid;
|
||||
tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet(
|
||||
matrixSetObj);
|
||||
expect(tileGrid.matrixIds_).to.be.an('array');
|
||||
expect(tileGrid.matrixIds_).to.have.length(22);
|
||||
expect(tileGrid.matrixIds_).to.eql([
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
|
||||
'12', '13', '14', '15', '16', '17', '18', '19', '20', '21'
|
||||
]);
|
||||
|
||||
expect(tileGrid.resolutions_).to.be.an('array');
|
||||
expect(tileGrid.resolutions_).to.have.length(22);
|
||||
expect(tileGrid.resolutions_).to.eql([
|
||||
156543.033928041, 78271.51696402048, 39135.758482010235,
|
||||
19567.87924100512, 9783.93962050256, 4891.96981025128,
|
||||
2445.98490512564, 1222.99245256282, 611.49622628141,
|
||||
305.7481131407048, 152.8740565703525, 76.43702828517624,
|
||||
38.21851414258813, 19.10925707129406, 9.554628535647032,
|
||||
4.777314267823516, 2.388657133911758, 1.194328566955879,
|
||||
0.5971642834779395, 0.2985821417389697, 0.1492910708694849,
|
||||
0.0746455354347424
|
||||
]);
|
||||
|
||||
expect(tileGrid.origins_).to.be.an('array');
|
||||
expect(tileGrid.origins_).to.have.length(22);
|
||||
expect(tileGrid.origins_).to.eql(
|
||||
Array.apply(null, Array(22)).map(Array.prototype.valueOf,
|
||||
[-20037508, 20037508]));
|
||||
|
||||
expect(tileGrid.tileSizes_).to.be.an('array');
|
||||
expect(tileGrid.tileSizes_).to.have.length(22);
|
||||
expect(tileGrid.tileSizes_).to.eql(
|
||||
Array.apply(null, Array(22)).map(Number.prototype.valueOf, 256));
|
||||
|
||||
});
|
||||
|
||||
it('can create tileGrid for EPSG:3857 with matrixLimits',
|
||||
function() {
|
||||
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
|
||||
var matrixLimitArray = capabilities.Contents.Layer[0]
|
||||
.TileMatrixSetLink[0].TileMatrixSetLimits;
|
||||
var tileGrid;
|
||||
tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet(
|
||||
matrixSetObj, undefined, matrixLimitArray);
|
||||
expect(tileGrid.matrixIds_).to.be.an('array');
|
||||
expect(tileGrid.matrixIds_).to.have.length(20);
|
||||
expect(tileGrid.matrixIds_).to.eql([
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
|
||||
'12', '13', '14', '15', '16', '17', '18', '19'
|
||||
]);
|
||||
|
||||
expect(tileGrid.resolutions_).to.be.an('array');
|
||||
expect(tileGrid.resolutions_).to.have.length(20);
|
||||
expect(tileGrid.resolutions_).to.eql([
|
||||
156543.033928041, 78271.51696402048, 39135.758482010235,
|
||||
19567.87924100512, 9783.93962050256, 4891.96981025128,
|
||||
2445.98490512564, 1222.99245256282, 611.49622628141,
|
||||
305.7481131407048, 152.8740565703525, 76.43702828517624,
|
||||
38.21851414258813, 19.10925707129406, 9.554628535647032,
|
||||
4.777314267823516, 2.388657133911758, 1.194328566955879,
|
||||
0.5971642834779395, 0.2985821417389697
|
||||
]);
|
||||
|
||||
expect(tileGrid.origins_).to.be.an('array');
|
||||
expect(tileGrid.origins_).to.have.length(20);
|
||||
expect(tileGrid.origins_).to.eql(
|
||||
Array.apply(null, Array(20)).map(Array.prototype.valueOf,
|
||||
[-20037508, 20037508]));
|
||||
|
||||
expect(tileGrid.tileSizes_).to.be.an('array');
|
||||
expect(tileGrid.tileSizes_).to.have.length(20);
|
||||
expect(tileGrid.tileSizes_).to.eql(
|
||||
Array.apply(null, Array(20)).map(Number.prototype.valueOf, 256));
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
it('can create tileGrid for EPSG:3857 without matrixLimits',
|
||||
function() {
|
||||
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
|
||||
var tileGrid;
|
||||
tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet(
|
||||
matrixSetObj);
|
||||
expect(tileGrid.matrixIds_).to.be.an('array');
|
||||
expect(tileGrid.matrixIds_).to.have.length(22);
|
||||
expect(tileGrid.matrixIds_).to.eql([
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
|
||||
'12', '13', '14', '15', '16', '17', '18', '19', '20', '21'
|
||||
]);
|
||||
|
||||
expect(tileGrid.resolutions_).to.be.an('array');
|
||||
expect(tileGrid.resolutions_).to.have.length(22);
|
||||
expect(tileGrid.resolutions_).to.eql([
|
||||
156543.033928041, 78271.51696402048, 39135.758482010235,
|
||||
19567.87924100512, 9783.93962050256, 4891.96981025128,
|
||||
2445.98490512564, 1222.99245256282, 611.49622628141,
|
||||
305.7481131407048, 152.8740565703525, 76.43702828517624,
|
||||
38.21851414258813, 19.10925707129406, 9.554628535647032,
|
||||
4.777314267823516, 2.388657133911758, 1.194328566955879,
|
||||
0.5971642834779395, 0.2985821417389697, 0.1492910708694849,
|
||||
0.0746455354347424
|
||||
]);
|
||||
|
||||
expect(tileGrid.origins_).to.be.an('array');
|
||||
expect(tileGrid.origins_).to.have.length(22);
|
||||
expect(tileGrid.origins_).to.eql(
|
||||
Array.apply(null, Array(22)).map(Array.prototype.valueOf,
|
||||
[-20037508, 20037508]));
|
||||
|
||||
expect(tileGrid.tileSizes_).to.be.an('array');
|
||||
expect(tileGrid.tileSizes_).to.have.length(22);
|
||||
expect(tileGrid.tileSizes_).to.eql(
|
||||
Array.apply(null, Array(22)).map(Number.prototype.valueOf, 256));
|
||||
|
||||
});
|
||||
|
||||
it('can create tileGrid for EPSG:3857 with matrixLimits',
|
||||
function() {
|
||||
var matrixSetObj = capabilities.Contents.TileMatrixSet[0];
|
||||
var matrixLimitArray = capabilities.Contents.Layer[0]
|
||||
.TileMatrixSetLink[0].TileMatrixSetLimits;
|
||||
var tileGrid;
|
||||
tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet(
|
||||
matrixSetObj, undefined, matrixLimitArray);
|
||||
expect(tileGrid.matrixIds_).to.be.an('array');
|
||||
expect(tileGrid.matrixIds_).to.have.length(20);
|
||||
expect(tileGrid.matrixIds_).to.eql([
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
|
||||
'12', '13', '14', '15', '16', '17', '18', '19'
|
||||
]);
|
||||
|
||||
expect(tileGrid.resolutions_).to.be.an('array');
|
||||
expect(tileGrid.resolutions_).to.have.length(20);
|
||||
expect(tileGrid.resolutions_).to.eql([
|
||||
156543.033928041, 78271.51696402048, 39135.758482010235,
|
||||
19567.87924100512, 9783.93962050256, 4891.96981025128,
|
||||
2445.98490512564, 1222.99245256282, 611.49622628141,
|
||||
305.7481131407048, 152.8740565703525, 76.43702828517624,
|
||||
38.21851414258813, 19.10925707129406, 9.554628535647032,
|
||||
4.777314267823516, 2.388657133911758, 1.194328566955879,
|
||||
0.5971642834779395, 0.2985821417389697
|
||||
]);
|
||||
|
||||
expect(tileGrid.origins_).to.be.an('array');
|
||||
expect(tileGrid.origins_).to.have.length(20);
|
||||
expect(tileGrid.origins_).to.eql(
|
||||
Array.apply(null, Array(20)).map(Array.prototype.valueOf,
|
||||
[-20037508, 20037508]));
|
||||
|
||||
expect(tileGrid.tileSizes_).to.be.an('array');
|
||||
expect(tileGrid.tileSizes_).to.have.length(20);
|
||||
expect(tileGrid.tileSizes_).to.eql(
|
||||
Array.apply(null, Array(20)).map(Number.prototype.valueOf, 256));
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('ol.TileQueue', function() {
|
||||
'yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==#' + tileId;
|
||||
|
||||
var tileLoadFunction = opt_tileLoadFunction ?
|
||||
opt_tileLoadFunction : ol.source.Image.defaultImageLoadFunction;
|
||||
opt_tileLoadFunction : ol.source.Image.defaultImageLoadFunction;
|
||||
return new ol.ImageTile(tileCoord, state, src, null, tileLoadFunction);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('ol.vec.Mat4', function() {
|
||||
describe('ol.vec.Mat4.create()', function() {
|
||||
it('returns the expected matrix', function() {
|
||||
expect(ol.vec.Mat4.create()).to.eql(
|
||||
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
||||
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1160,13 +1160,13 @@ describe('ol.View', function() {
|
||||
});
|
||||
it('animates when duration is defined', function(done) {
|
||||
view.fit(
|
||||
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
|
||||
{
|
||||
size: [200, 200],
|
||||
padding: [100, 0, 0, 100],
|
||||
constrainResolution: false,
|
||||
duration: 25
|
||||
});
|
||||
new ol.geom.LineString([[6000, 46000], [6000, 47100], [7000, 46000]]),
|
||||
{
|
||||
size: [200, 200],
|
||||
padding: [100, 0, 0, 100],
|
||||
constrainResolution: false,
|
||||
duration: 25
|
||||
});
|
||||
|
||||
expect(view.getAnimating()).to.eql(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user