Remove unused ol.format.Polyline.encodeFloat function
This commit is contained in:
@@ -237,21 +237,6 @@ ol.format.Polyline.decodeUnsignedIntegers = function(encoded) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Encode one single floating point number and return an encoded string
|
||||
*
|
||||
* @param {number} num Floating point number that should be encoded.
|
||||
* @param {number=} opt_factor The factor by which num will be multiplied.
|
||||
* The remaining decimal places will get rounded away.
|
||||
* @return {string} The encoded string.
|
||||
*/
|
||||
ol.format.Polyline.encodeFloat = function(num, opt_factor) {
|
||||
var factor = goog.isDef(opt_factor) ? opt_factor : 1e5;
|
||||
num = Math.round(num * factor);
|
||||
return ol.format.Polyline.encodeSignedInteger(num);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Encode one single signed integer and return an encoded string
|
||||
*
|
||||
|
||||
@@ -140,24 +140,24 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeFloat', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeFloat = ol.format.Polyline.encodeFloat;
|
||||
var encodeFloats = ol.format.Polyline.encodeFloats;
|
||||
|
||||
expect(encodeFloat(0.00000)).to.eql('?');
|
||||
expect(encodeFloat(-0.00001)).to.eql('@');
|
||||
expect(encodeFloat(0.00001)).to.eql('A');
|
||||
expect(encodeFloat(-0.00002)).to.eql('B');
|
||||
expect(encodeFloat(0.00002)).to.eql('C');
|
||||
expect(encodeFloat(0.00015)).to.eql(']');
|
||||
expect(encodeFloat(-0.00016)).to.eql('^');
|
||||
expect(encodeFloats([0.00000])).to.eql('?');
|
||||
expect(encodeFloats([-0.00001])).to.eql('@');
|
||||
expect(encodeFloats([0.00001])).to.eql('A');
|
||||
expect(encodeFloats([-0.00002])).to.eql('B');
|
||||
expect(encodeFloats([0.00002])).to.eql('C');
|
||||
expect(encodeFloats([0.00015])).to.eql(']');
|
||||
expect(encodeFloats([-0.00016])).to.eql('^');
|
||||
|
||||
expect(encodeFloat(-0.1, 10)).to.eql('@');
|
||||
expect(encodeFloat(0.1, 10)).to.eql('A');
|
||||
expect(encodeFloats([-0.1], 10)).to.eql('@');
|
||||
expect(encodeFloats([0.1], 10)).to.eql('A');
|
||||
|
||||
expect(encodeFloat(16 * 32 / 1e5)).to.eql('__@');
|
||||
expect(encodeFloat(16 * 32 * 32 / 1e5)).to.eql('___@');
|
||||
expect(encodeFloats([16 * 32 / 1e5])).to.eql('__@');
|
||||
expect(encodeFloats([16 * 32 * 32 / 1e5])).to.eql('___@');
|
||||
|
||||
// from the "Encoded Polyline Algorithm Format" page at Google
|
||||
expect(encodeFloat(-179.9832104)).to.eql('`~oia@');
|
||||
expect(encodeFloats([-179.9832104])).to.eql('`~oia@');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user