Remove unused ol.coordinate.fromProjectedArray function

This commit is contained in:
Frederic Junod
2016-09-15 10:29:33 +02:00
parent a4504b0e00
commit 97ececb470
2 changed files with 0 additions and 43 deletions

View File

@@ -319,28 +319,3 @@ ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
ol.coordinate.toStringXY = function(coordinate, opt_fractionDigits) {
return ol.coordinate.format(coordinate, '{x}, {y}', opt_fractionDigits);
};
/**
* Create an ol.Coordinate from an Array and take into account axis order.
*
* Examples:
*
* var northCoord = ol.coordinate.fromProjectedArray([1, 2], 'n');
* // northCoord is now [2, 1]
*
* var eastCoord = ol.coordinate.fromProjectedArray([1, 2], 'e');
* // eastCoord is now [1, 2]
*
* @param {Array} array The array with coordinates.
* @param {string} axis the axis info.
* @return {ol.Coordinate} The coordinate created.
*/
ol.coordinate.fromProjectedArray = function(array, axis) {
var firstAxis = axis.charAt(0);
if (firstAxis === 'n' || firstAxis === 's') {
return [array[1], array[0]];
} else {
return array;
}
};

View File

@@ -232,22 +232,4 @@ describe('ol.coordinate', function() {
});
});
describe('#fromProjectedArray', function() {
it('returns an inverted coord for "n" or "s"', function() {
var northCoord = ol.coordinate.fromProjectedArray([1, 2], 'n');
var southCoord = ol.coordinate.fromProjectedArray([1, 2], 's');
expect(northCoord).to.eql([2, 1]);
expect(southCoord).to.eql([2, 1]);
});
it('returns an unchanged coord for any other "axis"', function() {
var eastCoord = ol.coordinate.fromProjectedArray([1, 2], 'e');
var westCoord = ol.coordinate.fromProjectedArray([1, 2], 'w');
var bogusCoord = ol.coordinate.fromProjectedArray([1, 2], 'q');
var unchangedCoord = ol.coordinate.fromProjectedArray([1, 2], '');
expect(eastCoord).to.eql([1, 2]);
expect(westCoord).to.eql([1, 2]);
expect(bogusCoord).to.eql([1, 2]);
expect(unchangedCoord).to.eql([1, 2]);
});
});
});