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