Merge branch 'master' of github.com:openlayers/ol3 into wms-improvements
Conflicts: src/ol/source/tiledwmssource.js test/spec/ol/tileurlfunction.test.js
This commit is contained in:
@@ -71,3 +71,5 @@ describe('ol.Color', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.Color');
|
||||
|
||||
@@ -325,15 +325,16 @@ describe('ol.Ellipsoid', function() {
|
||||
|
||||
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||
function() {
|
||||
var e, i, v;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
v = ol.ellipsoid.WGS84.vincenty(e.c1, e.c2, 1e-12, 100);
|
||||
expect(v.distance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
||||
expect(v.finalBearing).toRoughlyEqual(e.vincentyFinalBearing, 1e-9);
|
||||
expect(v.initialBearing).toRoughlyEqual(e.vincentyInitialBearing, 1e-9);
|
||||
}
|
||||
});
|
||||
var e, i, v;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
v = ol.ellipsoid.WGS84.vincenty(e.c1, e.c2, 1e-12, 100);
|
||||
expect(v.distance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
||||
expect(v.finalBearing).toRoughlyEqual(e.vincentyFinalBearing, 1e-9);
|
||||
expect(v.initialBearing).toRoughlyEqual(
|
||||
e.vincentyInitialBearing, 1e-9);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -341,14 +342,14 @@ describe('ol.Ellipsoid', function() {
|
||||
|
||||
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||
function() {
|
||||
var e, i, vincentyDistance;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
vincentyDistance =
|
||||
ol.ellipsoid.WGS84.vincentyDistance(e.c1, e.c2, 1e-12, 100);
|
||||
expect(vincentyDistance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
||||
}
|
||||
});
|
||||
var e, i, vincentyDistance;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
vincentyDistance =
|
||||
ol.ellipsoid.WGS84.vincentyDistance(e.c1, e.c2, 1e-12, 100);
|
||||
expect(vincentyDistance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -356,15 +357,15 @@ describe('ol.Ellipsoid', function() {
|
||||
|
||||
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||
function() {
|
||||
var e, i, vincentyFinalBearing;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
vincentyFinalBearing =
|
||||
ol.ellipsoid.WGS84.vincentyFinalBearing(e.c1, e.c2, 1e-12, 100);
|
||||
expect(vincentyFinalBearing).toRoughlyEqual(
|
||||
e.vincentyFinalBearing, 1e-9);
|
||||
}
|
||||
});
|
||||
var e, i, vincentyFinalBearing;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
vincentyFinalBearing =
|
||||
ol.ellipsoid.WGS84.vincentyFinalBearing(e.c1, e.c2, 1e-12, 100);
|
||||
expect(vincentyFinalBearing).toRoughlyEqual(
|
||||
e.vincentyFinalBearing, 1e-9);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -372,15 +373,15 @@ describe('ol.Ellipsoid', function() {
|
||||
|
||||
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||
function() {
|
||||
var e, i, vincentyInitialBearing;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
vincentyInitialBearing =
|
||||
ol.ellipsoid.WGS84.vincentyInitialBearing(e.c1, e.c2, 1e-12, 100);
|
||||
expect(vincentyInitialBearing).toRoughlyEqual(
|
||||
e.vincentyInitialBearing, 1e-9);
|
||||
}
|
||||
});
|
||||
var e, i, vincentyInitialBearing;
|
||||
for (i = 0; i < expected.length; ++i) {
|
||||
e = expected[i];
|
||||
vincentyInitialBearing = ol.ellipsoid.WGS84.vincentyInitialBearing(
|
||||
e.c1, e.c2, 1e-12, 100);
|
||||
expect(vincentyInitialBearing).toRoughlyEqual(
|
||||
e.vincentyInitialBearing, 1e-9);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -388,4 +389,5 @@ describe('ol.Ellipsoid', function() {
|
||||
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Ellipsoid');
|
||||
goog.require('ol.ellipsoid.WGS84');
|
||||
|
||||
@@ -100,5 +100,6 @@ describe('ol.Extent', function() {
|
||||
});
|
||||
});
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.projection');
|
||||
|
||||
@@ -276,4 +276,6 @@ describe('ol.layer.Layer', function() {
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.layer.Layer');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.Source');
|
||||
|
||||
@@ -187,3 +187,5 @@ describe('ol.structs.LRUCache', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.structs.LRUCache');
|
||||
|
||||
@@ -246,6 +246,9 @@ goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.interaction.DblClickZoom');
|
||||
goog.require('ol.interaction.MouseWheelZoom');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.source.XYZ');
|
||||
|
||||
@@ -3,10 +3,10 @@ goog.provide('ol.test.parser.ogc.WMSCapabilities');
|
||||
describe('test WMSCapabilities', function() {
|
||||
describe('test getVersion', function() {
|
||||
var snippet = '<WMS_Capabilities version="1.3.0" ' +
|
||||
'xmlns="http://www.opengis.net/wms"><Service></Service>' +
|
||||
'</WMS_Capabilities>';
|
||||
'xmlns="http://www.opengis.net/wms"><Service></Service>' +
|
||||
'</WMS_Capabilities>';
|
||||
var snippet2 = '<WMS_Capabilities xmlns="http://www.opengis.net/wms">' +
|
||||
'<Service></Service></WMS_Capabilities>';
|
||||
'<Service></Service></WMS_Capabilities>';
|
||||
it('Version taken from document', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities();
|
||||
var data = parser.read(snippet);
|
||||
@@ -28,7 +28,7 @@ describe('test WMSCapabilities', function() {
|
||||
expect(version).toEqual('1.3.0');
|
||||
});
|
||||
var msg = 'defaultVersion returned if no version specified in options ' +
|
||||
'and no version on the format';
|
||||
'and no version on the format';
|
||||
it(msg, function() {
|
||||
var version = parser.getVersion(null);
|
||||
expect(version).toEqual('1.1.1');
|
||||
|
||||
@@ -57,8 +57,8 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() {
|
||||
expect(getfeatureinfo.post.href).toEqual(post);
|
||||
expect(capability.layers).toBeTruthy();
|
||||
expect(capability.layers.length).toEqual(22);
|
||||
var infoFormats = ['text/plain', 'text/html',
|
||||
'application/vnd.ogc.gml'];
|
||||
var infoFormats =
|
||||
['text/plain', 'text/html', 'application/vnd.ogc.gml'];
|
||||
expect(layer.infoFormats).toEqual(infoFormats);
|
||||
expect(layer.name).toEqual('tiger:tiger_roads');
|
||||
expect(layer.prefix).toEqual('tiger');
|
||||
@@ -66,13 +66,13 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() {
|
||||
var abstr = 'Highly simplified road layout of Manhattan in New York..';
|
||||
expect(layer['abstract']).toEqual(abstr);
|
||||
var bbox = [-74.08769307536667, 40.660618924633326,
|
||||
-73.84653192463333, 40.90178007536667];
|
||||
-73.84653192463333, 40.90178007536667];
|
||||
expect(layer.llbbox).toEqual(bbox);
|
||||
expect(layer.styles.length).toEqual(1);
|
||||
expect(layer.styles[0].name).toEqual('tiger_roads');
|
||||
var legend = 'http://publicus.opengeo.org:80/geoserver/wms/' +
|
||||
'GetLegendGraphic?VERSION=1.0.0&FORMAT=image/png&WIDTH=20&' +
|
||||
'HEIGHT=20&LAYER=tiger:tiger_roads';
|
||||
'GetLegendGraphic?VERSION=1.0.0&FORMAT=image/png&WIDTH=20&' +
|
||||
'HEIGHT=20&LAYER=tiger:tiger_roads';
|
||||
expect(layer.styles[0].legend.href).toEqual(legend);
|
||||
expect(layer.styles[0].legend.format).toEqual('image/png');
|
||||
expect(layer.queryable).toBeTruthy();
|
||||
@@ -168,28 +168,28 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() {
|
||||
expect(elevation['default']).toEqual('0');
|
||||
expect(elevation.nearestVal).toBeTruthy();
|
||||
expect(elevation.multipleVal).toBeFalsy();
|
||||
expect(elevation.values).toEqual(['0', '1000', '3000', '5000',
|
||||
'10000']);
|
||||
expect(elevation.values).toEqual(
|
||||
['0', '1000', '3000', '5000', '10000']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test contact info', function() {
|
||||
it('Test contact info', function() {
|
||||
var obj, service, contactinfo, personPrimary, addr;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
service = obj.service;
|
||||
contactinfo = service.contactInformation;
|
||||
personPrimary = contactinfo.personPrimary;
|
||||
addr = contactinfo.contactAddress;
|
||||
});
|
||||
});
|
||||
waitsFor(function() {
|
||||
it('Test contact info', function() {
|
||||
var obj, service, contactinfo, personPrimary, addr;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
service = obj.service;
|
||||
contactinfo = service.contactInformation;
|
||||
personPrimary = contactinfo.personPrimary;
|
||||
addr = contactinfo.contactAddress;
|
||||
});
|
||||
});
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1_wmsc', function() {
|
||||
runs(function() {
|
||||
expect(tilesets.length).toEqual(2);
|
||||
var bbox = [-13697515.466796875, 5165920.118906248,
|
||||
-13619243.94984375, 5244191.635859374];
|
||||
-13619243.94984375, 5244191.635859374];
|
||||
expect(tileset.bbox['EPSG:900913'].bbox).toEqual(bbox);
|
||||
expect(tileset.format).toEqual('image/png');
|
||||
expect(tileset.height).toEqual(256);
|
||||
@@ -33,14 +33,14 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1_wmsc', function() {
|
||||
expect(tileset.layers).toEqual('medford:hydro');
|
||||
expect(tileset.srs['EPSG:900913']).toBeTruthy();
|
||||
var resolutions = [156543.03390625, 78271.516953125, 39135.7584765625,
|
||||
19567.87923828125, 9783.939619140625, 4891.9698095703125,
|
||||
2445.9849047851562, 1222.9924523925781, 611.4962261962891,
|
||||
305.74811309814453, 152.87405654907226, 76.43702827453613,
|
||||
38.218514137268066, 19.109257068634033, 9.554628534317017,
|
||||
4.777314267158508, 2.388657133579254, 1.194328566789627,
|
||||
0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
|
||||
0.07464553542435169, 0.037322767712175846, 0.018661383856087923,
|
||||
0.009330691928043961, 0.004665345964021981];
|
||||
19567.87923828125, 9783.939619140625, 4891.9698095703125,
|
||||
2445.9849047851562, 1222.9924523925781, 611.4962261962891,
|
||||
305.74811309814453, 152.87405654907226, 76.43702827453613,
|
||||
38.218514137268066, 19.109257068634033, 9.554628534317017,
|
||||
4.777314267158508, 2.388657133579254, 1.194328566789627,
|
||||
0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
|
||||
0.07464553542435169, 0.037322767712175846, 0.018661383856087923,
|
||||
0.009330691928043961, 0.004665345964021981];
|
||||
expect(tileset.resolutions).toEqual(resolutions);
|
||||
expect(tileset.styles).toEqual('');
|
||||
});
|
||||
|
||||
@@ -100,8 +100,8 @@ describe('ol.parser.ogc.wmscapabilities_v1_3_0', function() {
|
||||
expect(elevation['default']).toEqual('0');
|
||||
expect(elevation.nearestVal).toBeTruthy();
|
||||
expect(elevation.multipleVal).toBeFalsy();
|
||||
expect(elevation.values).toEqual(['0', '1000', '3000', '5000',
|
||||
'10000']);
|
||||
expect(elevation.values).toEqual(
|
||||
['0', '1000', '3000', '5000', '10000']);
|
||||
expect(contactinfo).toBeTruthy();
|
||||
expect(personPrimary).toBeTruthy();
|
||||
expect(personPrimary.person).toEqual('Jeff Smith');
|
||||
|
||||
@@ -105,26 +105,24 @@ describe('ol.parser.ogc.wmtscapabilities_v1_0_0', function() {
|
||||
expect(wgs84Bbox.maxX).toEqual(180.0);
|
||||
expect(wgs84Bbox.minY).toEqual(-90.0);
|
||||
expect(wgs84Bbox.maxY).toEqual(90.0);
|
||||
expect(layer.resourceUrl.tile.format).toEqual('image/png');
|
||||
var tpl = 'http://www.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
expect(layer.resourceUrls.hasOwnProperty('tile')).toBeTruthy();
|
||||
var format = 'image/png';
|
||||
expect(layer.resourceUrls.tile.hasOwnProperty(format)).toBeTruthy();
|
||||
expect(layer.resourceUrls.tile[format].length).toEqual(2);
|
||||
var tpl = 'http://a.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrl.tile.template).toEqual(tpl);
|
||||
var format = 'application/gml+xml; version=3.1';
|
||||
expect(layer.resourceUrl.FeatureInfo.format).toEqual(format);
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||
expect(layer.resourceUrl.FeatureInfo.template).toEqual(tpl);
|
||||
expect(layer.resourceUrls[0].format).toEqual('image/png');
|
||||
expect(layer.resourceUrls[0].resourceType).toEqual('tile');
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrls[0].template).toEqual(tpl);
|
||||
expect(layer.resourceUrls.tile[format][0]).toEqual(tpl);
|
||||
tpl = 'http://b.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrls.tile[format][1]).toEqual(tpl);
|
||||
expect(layer.resourceUrls.hasOwnProperty('FeatureInfo')).toBeTruthy();
|
||||
format = 'application/gml+xml; version=3.1';
|
||||
expect(layer.resourceUrls[1].format).toEqual(format);
|
||||
expect(layer.resourceUrls[1].resourceType).toEqual('FeatureInfo');
|
||||
expect(layer.resourceUrls.FeatureInfo.hasOwnProperty(format))
|
||||
.toBeTruthy();
|
||||
expect(layer.resourceUrls.FeatureInfo[format].length).toEqual(1);
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||
expect(layer.resourceUrls[1].template).toEqual(tpl);
|
||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||
expect(layer.resourceUrls.FeatureInfo[format][0]).toEqual(tpl);
|
||||
expect(dimensions.length).toEqual(1);
|
||||
expect(dimensions[0].title).toEqual('Time');
|
||||
expect(dimensions[0]['abstract']).toEqual('Monthly datasets');
|
||||
@@ -180,4 +178,5 @@ describe('ol.parser.ogc.wmtscapabilities_v1_0_0', function() {
|
||||
});
|
||||
|
||||
goog.require('goog.net.XhrIo');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.parser.ogc.WMTSCapabilities');
|
||||
|
||||
@@ -74,7 +74,9 @@
|
||||
</ows:WGS84BoundingBox>
|
||||
<ows:Identifier>coastlines</ows:Identifier>
|
||||
<ResourceURL format="image/png" resourceType="tile"
|
||||
template="http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png" />
|
||||
template="http://a.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png" />
|
||||
<ResourceURL format="image/png" resourceType="tile"
|
||||
template="http://b.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png" />
|
||||
<ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo"
|
||||
template="http://www.example.com/wmts/coastlines/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml" />
|
||||
<Style isDefault="true">
|
||||
|
||||
@@ -16,15 +16,15 @@ describe('ol.projection.EPSG3857', function() {
|
||||
|
||||
it('returns the correct point scale at the latitude of Toronto',
|
||||
function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var resolution = 19.11;
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
||||
expect(epsg3857.getPointResolution(resolution, point)).
|
||||
toRoughlyEqual(19.11 * Math.cos(Math.PI * 43.65 / 180), 1e-9);
|
||||
});
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var resolution = 19.11;
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
||||
expect(epsg3857.getPointResolution(resolution, point)).
|
||||
toRoughlyEqual(19.11 * Math.cos(Math.PI * 43.65 / 180), 1e-9);
|
||||
});
|
||||
|
||||
it('returns the correct point scale at various latitudes', function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
@@ -46,4 +46,5 @@ describe('ol.projection.EPSG3857', function() {
|
||||
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.projection.EPSG3857');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.test.renderer.webgl.ImageLayer');
|
||||
|
||||
describe('ol.renderer.webgl.ImageLayer', function() {
|
||||
describe('updateVertexCoordMatrix_', function() {
|
||||
describe('updateProjectionMatrix_', function() {
|
||||
var map;
|
||||
var renderer;
|
||||
var canvasWidth;
|
||||
@@ -41,9 +41,9 @@ describe('ol.renderer.webgl.ImageLayer', function() {
|
||||
|
||||
it('produces a correct matrix', function() {
|
||||
|
||||
renderer.updateVertexCoordMatrix_(canvasWidth, canvasHeight,
|
||||
renderer.updateProjectionMatrix_(canvasWidth, canvasHeight,
|
||||
viewCenter, viewResolution, viewRotation, imageExtent);
|
||||
var matrix = renderer.getVertexCoordMatrix();
|
||||
var matrix = renderer.getProjectionMatrix();
|
||||
|
||||
var input;
|
||||
var output = goog.vec.Vec4.createNumber();
|
||||
@@ -78,6 +78,7 @@ describe('ol.renderer.webgl.ImageLayer', function() {
|
||||
|
||||
goog.require('goog.vec.Mat4');
|
||||
goog.require('goog.vec.Vec4');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Image');
|
||||
goog.require('ol.Map');
|
||||
|
||||
@@ -7,9 +7,8 @@ describe('ol.ResolutionConstraint', function() {
|
||||
var resolutionConstraint;
|
||||
|
||||
beforeEach(function() {
|
||||
resolutionConstraint =
|
||||
ol.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
resolutionConstraint = ol.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
});
|
||||
|
||||
describe('delta 0', function() {
|
||||
|
||||
@@ -268,12 +268,13 @@ describe('ol.test.source.MockTileSource', function() {
|
||||
});
|
||||
|
||||
goog.require('goog.object');
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Size');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.projection');
|
||||
goog.require('ol.source.Source');
|
||||
goog.require('ol.source.TileSource');
|
||||
goog.require('ol.tilegrid.TileGrid');
|
||||
|
||||
@@ -130,4 +130,5 @@ describe('ol.source.XYZ', function() {
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.tilegrid.XYZ');
|
||||
goog.require('ol.source.XYZ');
|
||||
|
||||
@@ -68,3 +68,6 @@ describe('ol.TileQueue', function() {
|
||||
});
|
||||
});
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileQueue');
|
||||
|
||||
@@ -131,4 +131,5 @@ describe('ol.TileRange', function() {
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileRange');
|
||||
|
||||
@@ -51,8 +51,8 @@ describe('ol.TileUrlFunction', function() {
|
||||
describe('createFromTileUrlFunctions', function() {
|
||||
it('creates expected URL', function() {
|
||||
var tileUrl = ol.TileUrlFunction.createFromTileUrlFunctions([
|
||||
ol.TileUrlFunction.createFromTemplate('a'),
|
||||
ol.TileUrlFunction.createFromTemplate('b')
|
||||
ol.TileUrlFunction.createFromTemplate('a'),
|
||||
ol.TileUrlFunction.createFromTemplate('b')
|
||||
]);
|
||||
var tileUrl1 = tileUrl(new ol.TileCoord(1, 0, 0));
|
||||
var tileUrl2 = tileUrl(new ol.TileCoord(1, 0, 1));
|
||||
@@ -71,7 +71,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
it('creates expected URL', function() {
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
||||
'http://wms?foo=bar', {});
|
||||
'http://wms?foo=bar', {});
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
var tileUrl = tileUrlFunction(tileCoord, tileGrid, epsg3857);
|
||||
var expected = 'http://wms?foo=bar&SERVICE=WMS&VERSION=1.3.0&' +
|
||||
@@ -83,7 +83,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
it('creates expected URL respecting axis orientation', function() {
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
||||
'http://wms?foo=bar', {});
|
||||
'http://wms?foo=bar', {});
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
var tileUrl = tileUrlFunction(tileCoord, tileGrid, epsg4326);
|
||||
var expected = 'http://wms?foo=bar&SERVICE=WMS&VERSION=1.3.0&' +
|
||||
|
||||
@@ -18,21 +18,21 @@ describe('ol.View2D', function() {
|
||||
|
||||
describe('with maxResolution, numZoomLevels, and zoomFactor options',
|
||||
function() {
|
||||
it('gives a correct resolution constraint function', function() {
|
||||
var options = {
|
||||
maxResolution: 81,
|
||||
numZoomLevels: 4,
|
||||
zoomFactor: 3
|
||||
};
|
||||
var fn = ol.View2D.createConstraints_(options).resolution;
|
||||
expect(fn(82, 0)).toEqual(81);
|
||||
expect(fn(81, 0)).toEqual(81);
|
||||
expect(fn(27, 0)).toEqual(27);
|
||||
expect(fn(9, 0)).toEqual(9);
|
||||
expect(fn(3, 0)).toEqual(3);
|
||||
expect(fn(2, 0)).toEqual(3);
|
||||
});
|
||||
});
|
||||
it('gives a correct resolution constraint function', function() {
|
||||
var options = {
|
||||
maxResolution: 81,
|
||||
numZoomLevels: 4,
|
||||
zoomFactor: 3
|
||||
};
|
||||
var fn = ol.View2D.createConstraints_(options).resolution;
|
||||
expect(fn(82, 0)).toEqual(81);
|
||||
expect(fn(81, 0)).toEqual(81);
|
||||
expect(fn(27, 0)).toEqual(27);
|
||||
expect(fn(9, 0)).toEqual(9);
|
||||
expect(fn(3, 0)).toEqual(3);
|
||||
expect(fn(2, 0)).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with resolutions', function() {
|
||||
it('gives a correct resolution constraint function', function() {
|
||||
|
||||
Reference in New Issue
Block a user