Format/EncodedPolyline: Added opt_factor parameter to encode/decode()
This commit is contained in:
committed by
Bart van den Eijnden
parent
0bb804c9e7
commit
4399ebcb04
@@ -102,8 +102,9 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
|
|||||||
* {Array(Array(int))} An array containing n-dimensional arrays of
|
* {Array(Array(int))} An array containing n-dimensional arrays of
|
||||||
* coordinates.
|
* coordinates.
|
||||||
*/
|
*/
|
||||||
decode: function(encoded, dims) {
|
decode: function(encoded, dims, opt_factor) {
|
||||||
var flatPoints = this.decodeDeltas(encoded, dims, 1);
|
var factor = opt_factor || 1;
|
||||||
|
var flatPoints = this.decodeDeltas(encoded, dims, factor);
|
||||||
var flatPointsLength = flatPoints.length;
|
var flatPointsLength = flatPoints.length;
|
||||||
|
|
||||||
var points = [];
|
var points = [];
|
||||||
@@ -177,7 +178,8 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
|
|||||||
* Returns:
|
* Returns:
|
||||||
* {String} An encoded string
|
* {String} An encoded string
|
||||||
*/
|
*/
|
||||||
encode: function (points, dims) {
|
encode: function (points, dims, opt_factor) {
|
||||||
|
var factor = opt_factor || 1;
|
||||||
var flatPoints = [];
|
var flatPoints = [];
|
||||||
|
|
||||||
var pointsLength = points.length;
|
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);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user