+1
-2
@@ -3,8 +3,7 @@
|
|||||||
/build/gh-pages
|
/build/gh-pages
|
||||||
/build/check-requires-timestamp
|
/build/check-requires-timestamp
|
||||||
/build/jsdoc-*-timestamp
|
/build/jsdoc-*-timestamp
|
||||||
/build/lint-spec-timestamp
|
/build/lint-timestamp
|
||||||
/build/lint-src-timestamp
|
|
||||||
/build/ol.css
|
/build/ol.css
|
||||||
/build/ol.js
|
/build/ol.js
|
||||||
/build/ol-all.js
|
/build/ol-all.js
|
||||||
|
|||||||
@@ -229,15 +229,15 @@ def serve_precommit(t):
|
|||||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'build/ol-all.json', 'test/test.json')
|
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'build/ol-all.json', 'test/test.json')
|
||||||
|
|
||||||
|
|
||||||
virtual('lint', 'build/lint-src-timestamp', 'build/lint-spec-timestamp', 'build/check-requires-timestamp')
|
virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp')
|
||||||
|
|
||||||
|
|
||||||
@target('build/lint-src-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC, precious=True)
|
@target('build/lint-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC, SPEC, precious=True)
|
||||||
def build_lint_src_timestamp(t):
|
def build_lint_src_timestamp(t):
|
||||||
limited_doc_files = [path
|
limited_doc_files = [path
|
||||||
for path in ifind('externs', 'build/src/external/externs')
|
for path in ifind('externs', 'build/src/external/externs')
|
||||||
if path.endswith('.js')]
|
if path.endswith('.js')]
|
||||||
t.run('%(GJSLINT)s', '--strict', '--limited_doc_files=%s' % (','.join(limited_doc_files),), t.newer(SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC))
|
t.run('%(GJSLINT)s', '--strict', '--limited_doc_files=%s' % (','.join(limited_doc_files),), t.newer(t.dependencies))
|
||||||
t.touch()
|
t.touch()
|
||||||
|
|
||||||
|
|
||||||
@@ -331,12 +331,6 @@ def build_check_requires_timestamp(t):
|
|||||||
t.touch()
|
t.touch()
|
||||||
|
|
||||||
|
|
||||||
@target('build/lint-spec-timestamp', SPEC, precious=True)
|
|
||||||
def build_lint_spec_timestamp(t):
|
|
||||||
t.run('%(GJSLINT)s', t.newer(SPEC))
|
|
||||||
t.touch()
|
|
||||||
|
|
||||||
|
|
||||||
virtual('plovr', PLOVR_JAR)
|
virtual('plovr', PLOVR_JAR)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -325,15 +325,16 @@ describe('ol.Ellipsoid', function() {
|
|||||||
|
|
||||||
it('returns the same distances as Chris Veness\'s reference implementation',
|
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||||
function() {
|
function() {
|
||||||
var e, i, v;
|
var e, i, v;
|
||||||
for (i = 0; i < expected.length; ++i) {
|
for (i = 0; i < expected.length; ++i) {
|
||||||
e = expected[i];
|
e = expected[i];
|
||||||
v = ol.ellipsoid.WGS84.vincenty(e.c1, e.c2, 1e-12, 100);
|
v = ol.ellipsoid.WGS84.vincenty(e.c1, e.c2, 1e-12, 100);
|
||||||
expect(v.distance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
expect(v.distance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
||||||
expect(v.finalBearing).toRoughlyEqual(e.vincentyFinalBearing, 1e-9);
|
expect(v.finalBearing).toRoughlyEqual(e.vincentyFinalBearing, 1e-9);
|
||||||
expect(v.initialBearing).toRoughlyEqual(e.vincentyInitialBearing, 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',
|
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||||
function() {
|
function() {
|
||||||
var e, i, vincentyDistance;
|
var e, i, vincentyDistance;
|
||||||
for (i = 0; i < expected.length; ++i) {
|
for (i = 0; i < expected.length; ++i) {
|
||||||
e = expected[i];
|
e = expected[i];
|
||||||
vincentyDistance =
|
vincentyDistance =
|
||||||
ol.ellipsoid.WGS84.vincentyDistance(e.c1, e.c2, 1e-12, 100);
|
ol.ellipsoid.WGS84.vincentyDistance(e.c1, e.c2, 1e-12, 100);
|
||||||
expect(vincentyDistance).toRoughlyEqual(e.vincentyDistance, 1e-8);
|
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',
|
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||||
function() {
|
function() {
|
||||||
var e, i, vincentyFinalBearing;
|
var e, i, vincentyFinalBearing;
|
||||||
for (i = 0; i < expected.length; ++i) {
|
for (i = 0; i < expected.length; ++i) {
|
||||||
e = expected[i];
|
e = expected[i];
|
||||||
vincentyFinalBearing =
|
vincentyFinalBearing =
|
||||||
ol.ellipsoid.WGS84.vincentyFinalBearing(e.c1, e.c2, 1e-12, 100);
|
ol.ellipsoid.WGS84.vincentyFinalBearing(e.c1, e.c2, 1e-12, 100);
|
||||||
expect(vincentyFinalBearing).toRoughlyEqual(
|
expect(vincentyFinalBearing).toRoughlyEqual(
|
||||||
e.vincentyFinalBearing, 1e-9);
|
e.vincentyFinalBearing, 1e-9);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -372,15 +373,15 @@ describe('ol.Ellipsoid', function() {
|
|||||||
|
|
||||||
it('returns the same distances as Chris Veness\'s reference implementation',
|
it('returns the same distances as Chris Veness\'s reference implementation',
|
||||||
function() {
|
function() {
|
||||||
var e, i, vincentyInitialBearing;
|
var e, i, vincentyInitialBearing;
|
||||||
for (i = 0; i < expected.length; ++i) {
|
for (i = 0; i < expected.length; ++i) {
|
||||||
e = expected[i];
|
e = expected[i];
|
||||||
vincentyInitialBearing =
|
vincentyInitialBearing = ol.ellipsoid.WGS84.vincentyInitialBearing(
|
||||||
ol.ellipsoid.WGS84.vincentyInitialBearing(e.c1, e.c2, 1e-12, 100);
|
e.c1, e.c2, 1e-12, 100);
|
||||||
expect(vincentyInitialBearing).toRoughlyEqual(
|
expect(vincentyInitialBearing).toRoughlyEqual(
|
||||||
e.vincentyInitialBearing, 1e-9);
|
e.vincentyInitialBearing, 1e-9);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ goog.provide('ol.test.parser.ogc.WMSCapabilities');
|
|||||||
describe('test WMSCapabilities', function() {
|
describe('test WMSCapabilities', function() {
|
||||||
describe('test getVersion', function() {
|
describe('test getVersion', function() {
|
||||||
var snippet = '<WMS_Capabilities version="1.3.0" ' +
|
var snippet = '<WMS_Capabilities version="1.3.0" ' +
|
||||||
'xmlns="http://www.opengis.net/wms"><Service></Service>' +
|
'xmlns="http://www.opengis.net/wms"><Service></Service>' +
|
||||||
'</WMS_Capabilities>';
|
'</WMS_Capabilities>';
|
||||||
var snippet2 = '<WMS_Capabilities xmlns="http://www.opengis.net/wms">' +
|
var snippet2 = '<WMS_Capabilities xmlns="http://www.opengis.net/wms">' +
|
||||||
'<Service></Service></WMS_Capabilities>';
|
'<Service></Service></WMS_Capabilities>';
|
||||||
it('Version taken from document', function() {
|
it('Version taken from document', function() {
|
||||||
var parser = new ol.parser.ogc.WMSCapabilities();
|
var parser = new ol.parser.ogc.WMSCapabilities();
|
||||||
var data = parser.read(snippet);
|
var data = parser.read(snippet);
|
||||||
@@ -28,7 +28,7 @@ describe('test WMSCapabilities', function() {
|
|||||||
expect(version).toEqual('1.3.0');
|
expect(version).toEqual('1.3.0');
|
||||||
});
|
});
|
||||||
var msg = 'defaultVersion returned if no version specified in options ' +
|
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() {
|
it(msg, function() {
|
||||||
var version = parser.getVersion(null);
|
var version = parser.getVersion(null);
|
||||||
expect(version).toEqual('1.1.1');
|
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(getfeatureinfo.post.href).toEqual(post);
|
||||||
expect(capability.layers).toBeTruthy();
|
expect(capability.layers).toBeTruthy();
|
||||||
expect(capability.layers.length).toEqual(22);
|
expect(capability.layers.length).toEqual(22);
|
||||||
var infoFormats = ['text/plain', 'text/html',
|
var infoFormats =
|
||||||
'application/vnd.ogc.gml'];
|
['text/plain', 'text/html', 'application/vnd.ogc.gml'];
|
||||||
expect(layer.infoFormats).toEqual(infoFormats);
|
expect(layer.infoFormats).toEqual(infoFormats);
|
||||||
expect(layer.name).toEqual('tiger:tiger_roads');
|
expect(layer.name).toEqual('tiger:tiger_roads');
|
||||||
expect(layer.prefix).toEqual('tiger');
|
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..';
|
var abstr = 'Highly simplified road layout of Manhattan in New York..';
|
||||||
expect(layer['abstract']).toEqual(abstr);
|
expect(layer['abstract']).toEqual(abstr);
|
||||||
var bbox = [-74.08769307536667, 40.660618924633326,
|
var bbox = [-74.08769307536667, 40.660618924633326,
|
||||||
-73.84653192463333, 40.90178007536667];
|
-73.84653192463333, 40.90178007536667];
|
||||||
expect(layer.llbbox).toEqual(bbox);
|
expect(layer.llbbox).toEqual(bbox);
|
||||||
expect(layer.styles.length).toEqual(1);
|
expect(layer.styles.length).toEqual(1);
|
||||||
expect(layer.styles[0].name).toEqual('tiger_roads');
|
expect(layer.styles[0].name).toEqual('tiger_roads');
|
||||||
var legend = 'http://publicus.opengeo.org:80/geoserver/wms/' +
|
var legend = 'http://publicus.opengeo.org:80/geoserver/wms/' +
|
||||||
'GetLegendGraphic?VERSION=1.0.0&FORMAT=image/png&WIDTH=20&' +
|
'GetLegendGraphic?VERSION=1.0.0&FORMAT=image/png&WIDTH=20&' +
|
||||||
'HEIGHT=20&LAYER=tiger:tiger_roads';
|
'HEIGHT=20&LAYER=tiger:tiger_roads';
|
||||||
expect(layer.styles[0].legend.href).toEqual(legend);
|
expect(layer.styles[0].legend.href).toEqual(legend);
|
||||||
expect(layer.styles[0].legend.format).toEqual('image/png');
|
expect(layer.styles[0].legend.format).toEqual('image/png');
|
||||||
expect(layer.queryable).toBeTruthy();
|
expect(layer.queryable).toBeTruthy();
|
||||||
@@ -168,28 +168,28 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() {
|
|||||||
expect(elevation['default']).toEqual('0');
|
expect(elevation['default']).toEqual('0');
|
||||||
expect(elevation.nearestVal).toBeTruthy();
|
expect(elevation.nearestVal).toBeTruthy();
|
||||||
expect(elevation.multipleVal).toBeFalsy();
|
expect(elevation.multipleVal).toBeFalsy();
|
||||||
expect(elevation.values).toEqual(['0', '1000', '3000', '5000',
|
expect(elevation.values).toEqual(
|
||||||
'10000']);
|
['0', '1000', '3000', '5000', '10000']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('test contact info', function() {
|
describe('test contact info', function() {
|
||||||
it('Test contact info', function() {
|
it('Test contact info', function() {
|
||||||
var obj, service, contactinfo, personPrimary, addr;
|
var obj, service, contactinfo, personPrimary, addr;
|
||||||
runs(function() {
|
runs(function() {
|
||||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||||
'ogcsample.xml';
|
'ogcsample.xml';
|
||||||
goog.net.XhrIo.send(url, function(e) {
|
goog.net.XhrIo.send(url, function(e) {
|
||||||
var xhr = e.target;
|
var xhr = e.target;
|
||||||
obj = parser.read(xhr.getResponseXml());
|
obj = parser.read(xhr.getResponseXml());
|
||||||
service = obj.service;
|
service = obj.service;
|
||||||
contactinfo = service.contactInformation;
|
contactinfo = service.contactInformation;
|
||||||
personPrimary = contactinfo.personPrimary;
|
personPrimary = contactinfo.personPrimary;
|
||||||
addr = contactinfo.contactAddress;
|
addr = contactinfo.contactAddress;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
waitsFor(function() {
|
waitsFor(function() {
|
||||||
return (obj !== undefined);
|
return (obj !== undefined);
|
||||||
}, 'XHR timeout', 1000);
|
}, 'XHR timeout', 1000);
|
||||||
runs(function() {
|
runs(function() {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1_wmsc', function() {
|
|||||||
runs(function() {
|
runs(function() {
|
||||||
expect(tilesets.length).toEqual(2);
|
expect(tilesets.length).toEqual(2);
|
||||||
var bbox = [-13697515.466796875, 5165920.118906248,
|
var bbox = [-13697515.466796875, 5165920.118906248,
|
||||||
-13619243.94984375, 5244191.635859374];
|
-13619243.94984375, 5244191.635859374];
|
||||||
expect(tileset.bbox['EPSG:900913'].bbox).toEqual(bbox);
|
expect(tileset.bbox['EPSG:900913'].bbox).toEqual(bbox);
|
||||||
expect(tileset.format).toEqual('image/png');
|
expect(tileset.format).toEqual('image/png');
|
||||||
expect(tileset.height).toEqual(256);
|
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.layers).toEqual('medford:hydro');
|
||||||
expect(tileset.srs['EPSG:900913']).toBeTruthy();
|
expect(tileset.srs['EPSG:900913']).toBeTruthy();
|
||||||
var resolutions = [156543.03390625, 78271.516953125, 39135.7584765625,
|
var resolutions = [156543.03390625, 78271.516953125, 39135.7584765625,
|
||||||
19567.87923828125, 9783.939619140625, 4891.9698095703125,
|
19567.87923828125, 9783.939619140625, 4891.9698095703125,
|
||||||
2445.9849047851562, 1222.9924523925781, 611.4962261962891,
|
2445.9849047851562, 1222.9924523925781, 611.4962261962891,
|
||||||
305.74811309814453, 152.87405654907226, 76.43702827453613,
|
305.74811309814453, 152.87405654907226, 76.43702827453613,
|
||||||
38.218514137268066, 19.109257068634033, 9.554628534317017,
|
38.218514137268066, 19.109257068634033, 9.554628534317017,
|
||||||
4.777314267158508, 2.388657133579254, 1.194328566789627,
|
4.777314267158508, 2.388657133579254, 1.194328566789627,
|
||||||
0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
|
0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
|
||||||
0.07464553542435169, 0.037322767712175846, 0.018661383856087923,
|
0.07464553542435169, 0.037322767712175846, 0.018661383856087923,
|
||||||
0.009330691928043961, 0.004665345964021981];
|
0.009330691928043961, 0.004665345964021981];
|
||||||
expect(tileset.resolutions).toEqual(resolutions);
|
expect(tileset.resolutions).toEqual(resolutions);
|
||||||
expect(tileset.styles).toEqual('');
|
expect(tileset.styles).toEqual('');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ describe('ol.parser.ogc.wmscapabilities_v1_3_0', function() {
|
|||||||
expect(elevation['default']).toEqual('0');
|
expect(elevation['default']).toEqual('0');
|
||||||
expect(elevation.nearestVal).toBeTruthy();
|
expect(elevation.nearestVal).toBeTruthy();
|
||||||
expect(elevation.multipleVal).toBeFalsy();
|
expect(elevation.multipleVal).toBeFalsy();
|
||||||
expect(elevation.values).toEqual(['0', '1000', '3000', '5000',
|
expect(elevation.values).toEqual(
|
||||||
'10000']);
|
['0', '1000', '3000', '5000', '10000']);
|
||||||
expect(contactinfo).toBeTruthy();
|
expect(contactinfo).toBeTruthy();
|
||||||
expect(personPrimary).toBeTruthy();
|
expect(personPrimary).toBeTruthy();
|
||||||
expect(personPrimary.person).toEqual('Jeff Smith');
|
expect(personPrimary.person).toEqual('Jeff Smith');
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ describe('ol.parser.ogc.wmtscapabilities_v1_0_0', function() {
|
|||||||
expect(layer.resourceUrls.tile.hasOwnProperty(format)).toBeTruthy();
|
expect(layer.resourceUrls.tile.hasOwnProperty(format)).toBeTruthy();
|
||||||
expect(layer.resourceUrls.tile[format].length).toEqual(2);
|
expect(layer.resourceUrls.tile[format].length).toEqual(2);
|
||||||
var tpl = 'http://a.example.com/wmts/coastlines/{TileMatrix}/' +
|
var tpl = 'http://a.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||||
'{TileRow}/{TileCol}.png';
|
'{TileRow}/{TileCol}.png';
|
||||||
expect(layer.resourceUrls.tile[format][0]).toEqual(tpl);
|
expect(layer.resourceUrls.tile[format][0]).toEqual(tpl);
|
||||||
tpl = 'http://b.example.com/wmts/coastlines/{TileMatrix}/' +
|
tpl = 'http://b.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||||
'{TileRow}/{TileCol}.png';
|
'{TileRow}/{TileCol}.png';
|
||||||
expect(layer.resourceUrls.tile[format][1]).toEqual(tpl);
|
expect(layer.resourceUrls.tile[format][1]).toEqual(tpl);
|
||||||
expect(layer.resourceUrls.hasOwnProperty('FeatureInfo')).toBeTruthy();
|
expect(layer.resourceUrls.hasOwnProperty('FeatureInfo')).toBeTruthy();
|
||||||
format = 'application/gml+xml; version=3.1';
|
format = 'application/gml+xml; version=3.1';
|
||||||
@@ -121,7 +121,7 @@ describe('ol.parser.ogc.wmtscapabilities_v1_0_0', function() {
|
|||||||
.toBeTruthy();
|
.toBeTruthy();
|
||||||
expect(layer.resourceUrls.FeatureInfo[format].length).toEqual(1);
|
expect(layer.resourceUrls.FeatureInfo[format].length).toEqual(1);
|
||||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
||||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||||
expect(layer.resourceUrls.FeatureInfo[format][0]).toEqual(tpl);
|
expect(layer.resourceUrls.FeatureInfo[format][0]).toEqual(tpl);
|
||||||
expect(dimensions.length).toEqual(1);
|
expect(dimensions.length).toEqual(1);
|
||||||
expect(dimensions[0].title).toEqual('Time');
|
expect(dimensions[0].title).toEqual('Time');
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ describe('ol.projection.EPSG3857', function() {
|
|||||||
|
|
||||||
it('returns the correct point scale at the latitude of Toronto',
|
it('returns the correct point scale at the latitude of Toronto',
|
||||||
function() {
|
function() {
|
||||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||||
var resolution = 19.11;
|
var resolution = 19.11;
|
||||||
var point = ol.projection.transform(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
||||||
expect(epsg3857.getPointResolution(resolution, point)).
|
expect(epsg3857.getPointResolution(resolution, point)).
|
||||||
toRoughlyEqual(19.11 * Math.cos(Math.PI * 43.65 / 180), 1e-9);
|
toRoughlyEqual(19.11 * Math.cos(Math.PI * 43.65 / 180), 1e-9);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns the correct point scale at various latitudes', function() {
|
it('returns the correct point scale at various latitudes', function() {
|
||||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ describe('ol.ResolutionConstraint', function() {
|
|||||||
var resolutionConstraint;
|
var resolutionConstraint;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
resolutionConstraint =
|
resolutionConstraint = ol.ResolutionConstraint.createSnapToResolutions(
|
||||||
ol.ResolutionConstraint.createSnapToResolutions(
|
[1000, 500, 250, 100]);
|
||||||
[1000, 500, 250, 100]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('delta 0', function() {
|
describe('delta 0', function() {
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ describe('ol.TileUrlFunction', function() {
|
|||||||
describe('createFromTileUrlFunctions', function() {
|
describe('createFromTileUrlFunctions', function() {
|
||||||
it('creates expected URL', function() {
|
it('creates expected URL', function() {
|
||||||
var tileUrl = ol.TileUrlFunction.createFromTileUrlFunctions([
|
var tileUrl = ol.TileUrlFunction.createFromTileUrlFunctions([
|
||||||
ol.TileUrlFunction.createFromTemplate('a'),
|
ol.TileUrlFunction.createFromTemplate('a'),
|
||||||
ol.TileUrlFunction.createFromTemplate('b')
|
ol.TileUrlFunction.createFromTemplate('b')
|
||||||
]);
|
]);
|
||||||
var tileUrl1 = tileUrl(new ol.TileCoord(1, 0, 0));
|
var tileUrl1 = tileUrl(new ol.TileCoord(1, 0, 0));
|
||||||
var tileUrl2 = tileUrl(new ol.TileCoord(1, 0, 1));
|
var tileUrl2 = tileUrl(new ol.TileCoord(1, 0, 1));
|
||||||
@@ -71,7 +71,7 @@ describe('ol.TileUrlFunction', function() {
|
|||||||
it('creates expected URL', function() {
|
it('creates expected URL', function() {
|
||||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||||
var tileUrlFunction = ol.TileUrlFunction.createBboxParam(
|
var tileUrlFunction = ol.TileUrlFunction.createBboxParam(
|
||||||
'http://wms?foo=bar', tileGrid, epsg3857.getAxisOrientation());
|
'http://wms?foo=bar', tileGrid, epsg3857.getAxisOrientation());
|
||||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||||
var tileUrl = tileUrlFunction(tileCoord);
|
var tileUrl = tileUrlFunction(tileCoord);
|
||||||
var expected = 'http://wms?foo=bar&BBOX=-20037508.342789244' +
|
var expected = 'http://wms?foo=bar&BBOX=-20037508.342789244' +
|
||||||
@@ -82,7 +82,7 @@ describe('ol.TileUrlFunction', function() {
|
|||||||
it('creates expected URL respecting axis orientation', function() {
|
it('creates expected URL respecting axis orientation', function() {
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||||
var tileUrlFunction = ol.TileUrlFunction.createBboxParam(
|
var tileUrlFunction = ol.TileUrlFunction.createBboxParam(
|
||||||
'http://wms?foo=bar', tileGrid, epsg4326.getAxisOrientation());
|
'http://wms?foo=bar', tileGrid, epsg4326.getAxisOrientation());
|
||||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||||
var tileUrl = tileUrlFunction(tileCoord);
|
var tileUrl = tileUrlFunction(tileCoord);
|
||||||
var expected = 'http://wms?foo=bar&BBOX=20037508.342789244' +
|
var expected = 'http://wms?foo=bar&BBOX=20037508.342789244' +
|
||||||
|
|||||||
+15
-15
@@ -18,21 +18,21 @@ describe('ol.View2D', function() {
|
|||||||
|
|
||||||
describe('with maxResolution, numZoomLevels, and zoomFactor options',
|
describe('with maxResolution, numZoomLevels, and zoomFactor options',
|
||||||
function() {
|
function() {
|
||||||
it('gives a correct resolution constraint function', function() {
|
it('gives a correct resolution constraint function', function() {
|
||||||
var options = {
|
var options = {
|
||||||
maxResolution: 81,
|
maxResolution: 81,
|
||||||
numZoomLevels: 4,
|
numZoomLevels: 4,
|
||||||
zoomFactor: 3
|
zoomFactor: 3
|
||||||
};
|
};
|
||||||
var fn = ol.View2D.createConstraints_(options).resolution;
|
var fn = ol.View2D.createConstraints_(options).resolution;
|
||||||
expect(fn(82, 0)).toEqual(81);
|
expect(fn(82, 0)).toEqual(81);
|
||||||
expect(fn(81, 0)).toEqual(81);
|
expect(fn(81, 0)).toEqual(81);
|
||||||
expect(fn(27, 0)).toEqual(27);
|
expect(fn(27, 0)).toEqual(27);
|
||||||
expect(fn(9, 0)).toEqual(9);
|
expect(fn(9, 0)).toEqual(9);
|
||||||
expect(fn(3, 0)).toEqual(3);
|
expect(fn(3, 0)).toEqual(3);
|
||||||
expect(fn(2, 0)).toEqual(3);
|
expect(fn(2, 0)).toEqual(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with resolutions', function() {
|
describe('with resolutions', function() {
|
||||||
it('gives a correct resolution constraint function', function() {
|
it('gives a correct resolution constraint function', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user