Merge pull request #6011 from fredj/rm_unused

Remove unused function
This commit is contained in:
Frédéric Junod
2016-10-21 15:44:08 +02:00
committed by GitHub
2 changed files with 0 additions and 133 deletions

View File

@@ -307,18 +307,6 @@ ol.extent.createOrUpdateFromRings = function(rings, opt_extent) {
};
/**
* Empty an extent in place.
* @param {ol.Extent} extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.empty = function(extent) {
extent[0] = extent[1] = Infinity;
extent[2] = extent[3] = -Infinity;
return extent;
};
/**
* Determine if two extents are equivalent.
* @param {ol.Extent} extent1 Extent 1.
@@ -720,29 +708,6 @@ ol.extent.isEmpty = function(extent) {
};
/**
* @param {ol.Extent} extent Extent.
* @return {boolean} Is infinite.
*/
ol.extent.isInfinite = function(extent) {
return extent[0] == -Infinity || extent[1] == -Infinity ||
extent[2] == Infinity || extent[3] == Infinity;
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Coordinate} coordinate Coordinate.
* @return {ol.Coordinate} Coordinate.
*/
ol.extent.normalize = function(extent, coordinate) {
return [
(coordinate[0] - extent[0]) / (extent[2] - extent[0]),
(coordinate[1] - extent[1]) / (extent[3] - extent[1])
];
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Extent=} opt_extent Extent.
@@ -831,19 +796,6 @@ ol.extent.intersectsSegment = function(extent, start, end) {
};
/**
* @param {ol.Extent} extent1 Extent 1.
* @param {ol.Extent} extent2 Extent 2.
* @return {boolean} Touches.
*/
ol.extent.touches = function(extent1, extent2) {
var intersects = ol.extent.intersects(extent1, extent2);
return intersects &&
(extent1[0] == extent2[2] || extent1[2] == extent2[0] ||
extent1[1] == extent2[3] || extent1[3] == extent2[1]);
};
/**
* Apply a transform function to the extent.
* @param {ol.Extent} extent Extent.

View File

@@ -167,24 +167,6 @@ describe('ol.extent', function() {
});
describe('empty', function() {
it('returns the empty extent', function() {
var extent = [1, 2, 3, 4];
var expected = [Infinity, Infinity, -Infinity, -Infinity];
var got = ol.extent.empty(extent);
expect(got).to.eql(expected);
});
it('empties a passed extent in place', function() {
var extent = [1, 2, 3, 4];
var expected = [Infinity, Infinity, -Infinity, -Infinity];
ol.extent.empty(extent);
expect(extent).to.eql(expected);
});
});
describe('forEachCorner', function() {
var callbackFalse;
@@ -602,73 +584,6 @@ describe('ol.extent', function() {
});
});
describe('isInfinite', function() {
it('returns true for infinite extents', function() {
var extents = [
[-Infinity, 0, 0, 0],
[0, -Infinity, 0, 0],
[0, 0, +Infinity, 0],
[0, 0, 0, +Infinity]
];
expect(ol.extent.isInfinite(extents[0])).to.be(true);
expect(ol.extent.isInfinite(extents[1])).to.be(true);
expect(ol.extent.isInfinite(extents[2])).to.be(true);
expect(ol.extent.isInfinite(extents[3])).to.be(true);
});
it('returns false for other extents', function() {
var extents = [
ol.extent.createEmpty(),
[1, 2, 3, 4]
];
expect(ol.extent.isInfinite(extents[0])).to.be(false);
expect(ol.extent.isInfinite(extents[1])).to.be(false);
});
});
describe('touches', function() {
it('returns the expected value', function() {
var touches = ol.extent.touches;
var extent = [50, 50, 100, 100];
expect(touches(extent, [20, 20, 80, 80])).to.be(false);
expect(touches(extent, [20, 20, 50, 80])).to.be(true);
expect(touches(extent, [20, 20, 50, 40])).to.be(false);
expect(touches(extent, [100, 20, 140, 80])).to.be(true);
expect(touches(extent, [100, 20, 140, 40])).to.be(false);
expect(touches(extent, [20, 20, 80, 50])).to.be(true);
expect(touches(extent, [20, 20, 40, 50])).to.be(false);
expect(touches(extent, [20, 100, 80, 140])).to.be(true);
expect(touches(extent, [20, 100, 40, 140])).to.be(false);
});
});
describe('normalize', function() {
it('returns the expected coordinate', function() {
var extent = [0, 1, 2, 3];
var coordinate;
coordinate = ol.extent.normalize(extent, [1, 2]);
expect(coordinate[0]).to.eql(0.5);
expect(coordinate[1]).to.eql(0.5);
coordinate = ol.extent.normalize(extent, [0, 3]);
expect(coordinate[0]).to.eql(0);
expect(coordinate[1]).to.eql(1);
coordinate = ol.extent.normalize(extent, [2, 1]);
expect(coordinate[0]).to.eql(1);
expect(coordinate[1]).to.eql(0);
coordinate = ol.extent.normalize(extent, [0, 0]);
expect(coordinate[0]).to.eql(0);
expect(coordinate[1]).to.eql(-0.5);
coordinate = ol.extent.normalize(extent, [-1, 1]);
expect(coordinate[0]).to.eql(-0.5);
expect(coordinate[1]).to.eql(0);
});
});
describe('scaleFromCenter', function() {
it('scales the extent from its center', function() {
var extent = [1, 1, 3, 3];