committed by
Frederic Junod
parent
5f5bc2ecdb
commit
71ebed07bf
@@ -53,7 +53,7 @@
|
||||
"clean-css": "3.4.20",
|
||||
"coveralls": "2.11.14",
|
||||
"debounce": "^1.0.0",
|
||||
"eslint": "3.8.1",
|
||||
"eslint": "3.9.1",
|
||||
"eslint-config-openlayers": "5.0.0",
|
||||
"eslint-plugin-openlayers-internal": "2.2.0",
|
||||
"expect.js": "0.3.1",
|
||||
|
||||
@@ -124,14 +124,15 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
state.currentLineWidth != lineWidth ||
|
||||
state.currentMiterLimit != miterLimit) {
|
||||
if (state.lastStroke != this.coordinates.length) {
|
||||
this.instructions.push(
|
||||
[ol.render.canvas.Instruction.STROKE]);
|
||||
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||
state.lastStroke = this.coordinates.length;
|
||||
}
|
||||
this.instructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash],
|
||||
[ol.render.canvas.Instruction.BEGIN_PATH]);
|
||||
this.instructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash
|
||||
], [
|
||||
ol.render.canvas.Instruction.BEGIN_PATH
|
||||
]);
|
||||
state.currentStrokeStyle = strokeStyle;
|
||||
state.currentLineCap = lineCap;
|
||||
state.currentLineDash = lineDash;
|
||||
@@ -155,15 +156,16 @@ ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineString
|
||||
}
|
||||
this.setStrokeStyle_();
|
||||
this.beginGeometry(lineStringGeometry, feature);
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash],
|
||||
[ol.render.canvas.Instruction.BEGIN_PATH]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
], [
|
||||
ol.render.canvas.Instruction.BEGIN_PATH
|
||||
]);
|
||||
var flatCoordinates = lineStringGeometry.getFlatCoordinates();
|
||||
var stride = lineStringGeometry.getStride();
|
||||
this.drawFlatCoordinates_(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
this.hitDetectionInstructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||
this.endGeometry(lineStringGeometry, feature);
|
||||
};
|
||||
@@ -182,11 +184,13 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multi
|
||||
}
|
||||
this.setStrokeStyle_();
|
||||
this.beginGeometry(multiLineStringGeometry, feature);
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash],
|
||||
[ol.render.canvas.Instruction.BEGIN_PATH]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
], [
|
||||
ol.render.canvas.Instruction.BEGIN_PATH
|
||||
]);
|
||||
var ends = multiLineStringGeometry.getEnds();
|
||||
var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
|
||||
var stride = multiLineStringGeometry.getStride();
|
||||
|
||||
@@ -135,14 +135,16 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f
|
||||
this.setFillStrokeStyles_(circleGeometry);
|
||||
this.beginGeometry(circleGeometry, feature);
|
||||
// always fill the circle for hit detection
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)
|
||||
]);
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
]);
|
||||
}
|
||||
var flatCoordinates = circleGeometry.getFlatCoordinates();
|
||||
var stride = circleGeometry.getStride();
|
||||
@@ -185,14 +187,16 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry,
|
||||
this.setFillStrokeStyles_(polygonGeometry);
|
||||
this.beginGeometry(polygonGeometry, feature);
|
||||
// always fill the polygon for hit detection
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]
|
||||
);
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
]);
|
||||
}
|
||||
var ends = polygonGeometry.getEnds();
|
||||
var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
|
||||
@@ -220,14 +224,16 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygo
|
||||
this.setFillStrokeStyles_(multiPolygonGeometry);
|
||||
this.beginGeometry(multiPolygonGeometry, feature);
|
||||
// always fill the multi-polygon for hit detection
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)
|
||||
]);
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
]);
|
||||
}
|
||||
var endss = multiPolygonGeometry.getEndss();
|
||||
var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();
|
||||
@@ -365,9 +371,10 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function(geometr
|
||||
state.currentLineJoin != lineJoin ||
|
||||
state.currentLineWidth != lineWidth ||
|
||||
state.currentMiterLimit != miterLimit) {
|
||||
this.instructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash]);
|
||||
this.instructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash
|
||||
]);
|
||||
state.currentStrokeStyle = strokeStyle;
|
||||
state.currentLineCap = lineCap;
|
||||
state.currentLineDash = lineDash;
|
||||
|
||||
@@ -51,15 +51,14 @@ server.on('connection', function(socket) {
|
||||
});
|
||||
});
|
||||
|
||||
['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT',
|
||||
'SIGBUS', 'SIGFPE', 'SIGUSR1', 'SIGSEGV', 'SIGUSR2', 'SIGTERM'].forEach(signal => {
|
||||
process.once(signal, () => {
|
||||
process.stdout.write(`Got ${signal}, stopping...\n`),
|
||||
server.close(() => {
|
||||
process.stdout.write('Stopped.\n');
|
||||
process.exit(0);
|
||||
});
|
||||
['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGBUS', 'SIGFPE', 'SIGUSR1', 'SIGSEGV', 'SIGUSR2', 'SIGTERM'].forEach(signal => {
|
||||
process.once(signal, () => {
|
||||
process.stdout.write(`Got ${signal}, stopping...\n`),
|
||||
server.close(() => {
|
||||
process.stdout.write('Stopped.\n');
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
Object.keys(connections).forEach(cid => connections[cid].destroy());
|
||||
});
|
||||
});
|
||||
Object.keys(connections).forEach(cid => connections[cid].destroy());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -105,8 +105,10 @@ describe('ol.array', function() {
|
||||
);
|
||||
|
||||
describe('default comparison on array of Number(s)', function() {
|
||||
var d = [-897123.9, -321434.58758, -1321.3124, -324, -9, -3, 0, 0, 0,
|
||||
0.31255, 5, 142.88888708, 334, 342, 453, 54254];
|
||||
var d = [
|
||||
-897123.9, -321434.58758, -1321.3124, -324, -9, -3, 0, 0, 0,
|
||||
0.31255, 5, 142.88888708, 334, 342, 453, 54254
|
||||
];
|
||||
it('should find -897123.9 at index 0', function() {
|
||||
expect(ol.array.binarySearch(d, -897123.9)).to.be(0);
|
||||
});
|
||||
@@ -150,8 +152,10 @@ 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];
|
||||
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);
|
||||
|
||||
@@ -307,10 +307,10 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(first.getId()).to.be(6406);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(firstGeom.getExtent(),
|
||||
[-10585772.743554419, 4712365.161160459,
|
||||
-10579560.16462974, 4716567.373073828]))
|
||||
.to.be(true);
|
||||
expect(ol.extent.equals(firstGeom.getExtent(), [
|
||||
-10585772.743554419, 4712365.161160459,
|
||||
-10579560.16462974, 4716567.373073828
|
||||
])).to.be(true);
|
||||
|
||||
var last = result[8];
|
||||
expect(last).to.be.a(ol.Feature);
|
||||
@@ -318,10 +318,10 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(last.getId()).to.be(6030);
|
||||
var lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(lastGeom.getExtent(),
|
||||
[-10555714.026858449, 4576511.565880965,
|
||||
-10553671.199322715, 4578554.9934867555]))
|
||||
.to.be(true);
|
||||
expect(ol.extent.equals(lastGeom.getExtent(), [
|
||||
-10555714.026858449, 4576511.565880965,
|
||||
-10553671.199322715, 4578554.9934867555
|
||||
])).to.be(true);
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
@@ -719,9 +719,9 @@ describe('ol.format.KML', function() {
|
||||
|
||||
it('can write XYZM Polygon geometries', function() {
|
||||
var layout = 'XYZM';
|
||||
var polygon = new ol.geom.Polygon(
|
||||
[[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1],
|
||||
[2, 0, 4, 1], [0, 0, 5, 1]]], layout);
|
||||
var polygon = new ol.geom.Polygon([
|
||||
[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1], [2, 0, 4, 1], [0, 0, 5, 1]]
|
||||
], layout);
|
||||
var features = [new ol.Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
@@ -772,18 +772,20 @@ describe('ol.format.KML', function() {
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(ol.geom.Polygon);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]]);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]
|
||||
]);
|
||||
});
|
||||
|
||||
it('can write complex Polygon geometries', function() {
|
||||
var layout = 'XYZ';
|
||||
var polygon = new ol.geom.Polygon(
|
||||
[[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]], layout);
|
||||
var polygon = new ol.geom.Polygon([
|
||||
[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]
|
||||
], layout);
|
||||
var features = [new ol.Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
@@ -966,9 +968,10 @@ describe('ol.format.KML', function() {
|
||||
expect(f).to.be.an(ol.Feature);
|
||||
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]]]]);
|
||||
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]]]
|
||||
]);
|
||||
expect(g.get('extrude')).to.be.an('array');
|
||||
expect(g.get('extrude')).to.have.length(2);
|
||||
expect(g.get('extrude')[0]).to.be(false);
|
||||
@@ -981,9 +984,10 @@ 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);
|
||||
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);
|
||||
var features = [new ol.Feature(multiPolygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
|
||||
@@ -17,20 +17,27 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
function resetTestingData() {
|
||||
format = new ol.format.Polyline();
|
||||
points = [[-120.20000, 38.50000],
|
||||
[-120.95000, 40.70000],
|
||||
[-126.45300, 43.25200]];
|
||||
flatPoints = [-120.20000, 38.50000,
|
||||
-120.95000, 40.70000,
|
||||
-126.45300, 43.25200];
|
||||
flippedFlatPoints = [38.50000, -120.20000,
|
||||
40.70000, -120.95000,
|
||||
43.25200, -126.45300];
|
||||
points = [
|
||||
[-120.20000, 38.50000],
|
||||
[-120.95000, 40.70000],
|
||||
[-126.45300, 43.25200]
|
||||
];
|
||||
flatPoints = [
|
||||
-120.20000, 38.50000,
|
||||
-120.95000, 40.70000,
|
||||
-126.45300, 43.25200
|
||||
];
|
||||
flippedFlatPoints = [
|
||||
38.50000, -120.20000,
|
||||
40.70000, -120.95000,
|
||||
43.25200, -126.45300
|
||||
];
|
||||
encodedFlatPoints = '_p~iF~ps|U_ulLnnqC_mqNvxq`@';
|
||||
points3857 = [
|
||||
ol.proj.transform([-120.20000, 38.50000], 'EPSG:4326', 'EPSG:3857'),
|
||||
ol.proj.transform([-120.95000, 40.70000], 'EPSG:4326', 'EPSG:3857'),
|
||||
ol.proj.transform([-126.45300, 43.25200], 'EPSG:4326', 'EPSG:3857')];
|
||||
ol.proj.transform([-126.45300, 43.25200], 'EPSG:4326', 'EPSG:3857')
|
||||
];
|
||||
|
||||
floats = [0.00, 0.15, -0.01, -0.16, 0.16, 0.01];
|
||||
smallFloats = [0.00000, 0.00015, -0.00001, -0.00016, 0.00016, 0.00001];
|
||||
|
||||
@@ -274,8 +274,9 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('Empty geometries read / written correctly', function() {
|
||||
var wkts = ['POINT', 'LINESTRING', 'POLYGON',
|
||||
'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON'];
|
||||
var wkts = [
|
||||
'POINT', 'LINESTRING', 'POLYGON', 'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON'
|
||||
];
|
||||
for (var i = 0, ii = wkts.length; i < ii; ++i) {
|
||||
var wkt = wkts[i] + ' EMPTY';
|
||||
var geom = format.readGeometry(wkt);
|
||||
|
||||
@@ -59,8 +59,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
|
||||
it('returns a tile with the expected URL with url list', function() {
|
||||
|
||||
options.urls = ['http://test1.com/MapServer',
|
||||
'http://test2.com/MapServer'];
|
||||
options.urls = ['http://test1.com/MapServer', 'http://test2.com/MapServer'];
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
|
||||
var tile = source.getTile(3, 2, -7, 1, ol.proj.get('EPSG:3857'));
|
||||
@@ -190,15 +189,13 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
describe('#getUrls', function() {
|
||||
|
||||
it('verify getting array of urls', function() {
|
||||
options.urls = ['http://test.com/MapServer',
|
||||
'http://test2.com/MapServer'];
|
||||
options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer'];
|
||||
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
|
||||
var urls = source.getUrls();
|
||||
|
||||
expect(urls).to.eql(['http://test.com/MapServer',
|
||||
'http://test2.com/MapServer']);
|
||||
expect(urls).to.eql(['http://test.com/MapServer', 'http://test2.com/MapServer']);
|
||||
});
|
||||
|
||||
|
||||
@@ -209,27 +206,22 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
it('verify setting urls when not set yet', function() {
|
||||
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
source.setUrls(['http://test.com/MapServer',
|
||||
'http://test2.com/MapServer']);
|
||||
source.setUrls(['http://test.com/MapServer', 'http://test2.com/MapServer']);
|
||||
|
||||
var urls = source.getUrls();
|
||||
|
||||
expect(urls).to.eql(['http://test.com/MapServer',
|
||||
'http://test2.com/MapServer']);
|
||||
expect(urls).to.eql(['http://test.com/MapServer', 'http://test2.com/MapServer']);
|
||||
});
|
||||
|
||||
it('verify setting urls with existing list', function() {
|
||||
options.urls = ['http://test.com/MapServer',
|
||||
'http://test2.com/MapServer'];
|
||||
options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer'];
|
||||
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
source.setUrls(['http://test3.com/MapServer',
|
||||
'http://test4.com/MapServer']);
|
||||
source.setUrls(['http://test3.com/MapServer', 'http://test4.com/MapServer']);
|
||||
|
||||
var urls = source.getUrls();
|
||||
|
||||
expect(urls).to.eql(['http://test3.com/MapServer',
|
||||
'http://test4.com/MapServer']);
|
||||
expect(urls).to.eql(['http://test3.com/MapServer', 'http://test4.com/MapServer']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -246,8 +238,7 @@ describe('ol.source.TileArcGISRest', function() {
|
||||
});
|
||||
|
||||
it('verify setting url with list of urls', function() {
|
||||
options.urls = ['http://test.com/MapServer',
|
||||
'http://test2.com/MapServer'];
|
||||
options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer'];
|
||||
|
||||
var source = new ol.source.TileArcGISRest(options);
|
||||
source.setUrl('http://test3.com/MapServer');
|
||||
|
||||
@@ -55,10 +55,11 @@ describe('ol.source.WMTS', function() {
|
||||
|
||||
it('can create REST options from spec/ol/format/wmts/ogcsample.xml',
|
||||
function() {
|
||||
var options = ol.source.WMTS.optionsFromCapabilities(
|
||||
capabilities,
|
||||
{layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857',
|
||||
requestEncoding: 'REST'});
|
||||
var options = ol.source.WMTS.optionsFromCapabilities(capabilities, {
|
||||
layer: 'BlueMarbleNextGeneration',
|
||||
matrixSet: 'google3857',
|
||||
requestEncoding: 'REST'
|
||||
});
|
||||
|
||||
expect(options.urls).to.be.an('array');
|
||||
expect(options.urls).to.have.length(1);
|
||||
@@ -85,10 +86,11 @@ describe('ol.source.WMTS', function() {
|
||||
});
|
||||
|
||||
it('can find a MatrixSet by SRS identifier', function() {
|
||||
var options = ol.source.WMTS.optionsFromCapabilities(
|
||||
capabilities,
|
||||
{layer: 'BlueMarbleNextGeneration', projection: 'EPSG:3857',
|
||||
requestEncoding: 'REST'});
|
||||
var options = ol.source.WMTS.optionsFromCapabilities(capabilities, {
|
||||
layer: 'BlueMarbleNextGeneration',
|
||||
projection: 'EPSG:3857',
|
||||
requestEncoding: 'REST'
|
||||
});
|
||||
|
||||
expect(options.matrixSet).to.be.eql('google3857');
|
||||
});
|
||||
|
||||
@@ -300,8 +300,10 @@ describe('ol.structs.RBush', function() {
|
||||
var i;
|
||||
for (i = 0; i < 1000; ++i) {
|
||||
var min = [Math.random() * 10000, Math.random() * 10000];
|
||||
var max = [min[0] + Math.random() * 500,
|
||||
min[1] + Math.random() * 500];
|
||||
var max = [
|
||||
min[0] + Math.random() * 500,
|
||||
min[1] + Math.random() * 500
|
||||
];
|
||||
var extent = [min[0], min[1], max[0], max[1]];
|
||||
n += rBush.getInExtent(extent).length;
|
||||
}
|
||||
@@ -312,10 +314,8 @@ describe('ol.structs.RBush', function() {
|
||||
var n = 0;
|
||||
var i;
|
||||
for (i = 0; i < 1000; ++i) {
|
||||
var min = [-(Math.random() * 10000 + 501),
|
||||
-(Math.random() * 10000 + 501)];
|
||||
var max = [min[0] + Math.random() * 500,
|
||||
min[1] + Math.random() * 500];
|
||||
var min = [-(Math.random() * 10000 + 501), -(Math.random() * 10000 + 501)];
|
||||
var max = [min[0] + Math.random() * 500, min[1] + Math.random() * 500];
|
||||
var extent = [min[0], min[1], max[0], max[1]];
|
||||
n += rBush.getInExtent(extent).length;
|
||||
}
|
||||
@@ -330,8 +330,7 @@ describe('ol.structs.RBush', function() {
|
||||
var i;
|
||||
for (i = 1000; i < 2000; ++i) {
|
||||
var min = [Math.random() * 10000, Math.random() * 10000];
|
||||
var max = [min[0] + Math.random() * 500,
|
||||
min[1] + Math.random() * 500];
|
||||
var max = [min[0] + Math.random() * 500, min[1] + Math.random() * 500];
|
||||
var extent = [min[0], min[1], max[0], max[1]];
|
||||
rBush.insert(extent, {id: i});
|
||||
}
|
||||
|
||||
@@ -28,20 +28,22 @@ describe('ol.tilegrid.WMTS', function() {
|
||||
matrixSetObj);
|
||||
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.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.03392811998, 78271.51696419998, 39135.758481959994,
|
||||
19567.879241008, 9783.939620504, 4891.969810252, 2445.984905126,
|
||||
1222.9924525644, 611.4962262807999, 305.74811314039994,
|
||||
152.87405657047998, 76.43702828523999, 38.21851414248,
|
||||
19.109257071295996, 9.554628535647998, 4.777314267823999,
|
||||
2.3886571339119995, 1.1943285669559998, 0.5971642834779999,
|
||||
0.29858214174039993]);
|
||||
expect(tileGrid.resolutions_).to.eql([
|
||||
156543.03392811998, 78271.51696419998, 39135.758481959994,
|
||||
19567.879241008, 9783.939620504, 4891.969810252, 2445.984905126,
|
||||
1222.9924525644, 611.4962262807999, 305.74811314039994,
|
||||
152.87405657047998, 76.43702828523999, 38.21851414248,
|
||||
19.109257071295996, 9.554628535647998, 4.777314267823999,
|
||||
2.3886571339119995, 1.1943285669559998, 0.5971642834779999,
|
||||
0.29858214174039993
|
||||
]);
|
||||
|
||||
expect(tileGrid.origins_).to.be.an('array');
|
||||
expect(tileGrid.origins_).to.have.length(20);
|
||||
|
||||
Reference in New Issue
Block a user