Format/EncodedPolyline: Added opt_factor parameter to encode/decode()

This commit is contained in:
Tobias Bieniek
2013-05-18 15:07:49 +02:00
committed by Bart van den Eijnden
parent 0bb804c9e7
commit 4399ebcb04

View File

@@ -102,8 +102,9 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
* {Array(Array(int))} An array containing n-dimensional arrays of
* coordinates.
*/
decode: function(encoded, dims) {
var flatPoints = this.decodeDeltas(encoded, dims, 1);
decode: function(encoded, dims, opt_factor) {
var factor = opt_factor || 1;
var flatPoints = this.decodeDeltas(encoded, dims, factor);
var flatPointsLength = flatPoints.length;
var points = [];
@@ -177,7 +178,8 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
* Returns:
* {String} An encoded string
*/
encode: function (points, dims) {
encode: function (points, dims, opt_factor) {
var factor = opt_factor || 1;
var flatPoints = [];
var pointsLength = points.length;
@@ -189,7 +191,7 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
}
}
return this.encodeDeltas(flatPoints, dims, 1);
return this.encodeDeltas(flatPoints, dims, factor);
},
/**