Merge branch 'master' of github.com:openlayers/openlayers into transform
Conflicts: theme/default/style.css
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
OpenLayers.js -- OpenLayers Map Viewer Library
|
||||
|
||||
Copyright (c) 2006-2012 by OpenLayers Contributors
|
||||
Copyright (c) 2006-2013 by OpenLayers Contributors
|
||||
Published under the 2-clause BSD license.
|
||||
See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ OpenLayers/Protocol/HTTP.js
|
||||
OpenLayers/Protocol/WFS.js
|
||||
OpenLayers/Protocol/WFS/v1_0_0.js
|
||||
OpenLayers/Strategy/Fixed.js
|
||||
OpenLayers/TileManager.js
|
||||
|
||||
[exclude]
|
||||
|
||||
|
||||
47
examples/encoded-polyline.html
Normal file
47
examples/encoded-polyline.html
Normal file
File diff suppressed because one or more lines are too long
@@ -42,6 +42,7 @@ var init = function (onSelectFeatureFunction) {
|
||||
theme: null,
|
||||
projection: sm,
|
||||
numZoomLevels: 18,
|
||||
tileManager: new OpenLayers.TileManager(),
|
||||
controls: [
|
||||
new OpenLayers.Control.Attribution(),
|
||||
new OpenLayers.Control.TouchNavigation({
|
||||
|
||||
@@ -99,6 +99,7 @@ var map;
|
||||
maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34],
|
||||
maxResolution: 156543.0339,
|
||||
numZoomLevels: 20,
|
||||
tileManager: new OpenLayers.TileManager(),
|
||||
controls: [
|
||||
new OpenLayers.Control.Navigation({
|
||||
mouseWheelOptions: {
|
||||
|
||||
@@ -87,8 +87,9 @@
|
||||
gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn),
|
||||
kml: new OpenLayers.Format.KML(kmlOptionsIn),
|
||||
atom: new OpenLayers.Format.Atom(in_options),
|
||||
gpx: new OpenLayers.Format.GPX(in_options)
|
||||
},
|
||||
gpx: new OpenLayers.Format.GPX(in_options),
|
||||
encoded_polyline: new OpenLayers.Format.EncodedPolyline(in_options)
|
||||
},
|
||||
'out': {
|
||||
wkt: new OpenLayers.Format.WKT(out_options),
|
||||
geojson: new OpenLayers.Format.GeoJSON(out_options),
|
||||
@@ -97,8 +98,9 @@
|
||||
gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut),
|
||||
kml: new OpenLayers.Format.KML(out_options),
|
||||
atom: new OpenLayers.Format.Atom(out_options),
|
||||
gpx: new OpenLayers.Format.GPX(out_options)
|
||||
}
|
||||
gpx: new OpenLayers.Format.GPX(out_options),
|
||||
encoded_polyline: new OpenLayers.Format.EncodedPolyline(out_options)
|
||||
}
|
||||
};
|
||||
}
|
||||
function init(){
|
||||
@@ -202,6 +204,7 @@
|
||||
<option value="gml3">GML (v3)</option>
|
||||
<option value="wkt">Well-Known Text (WKT)</option>
|
||||
<option value="gpx">GPX</option>
|
||||
<option value="encoded_polyline">Encoded Polyline</option>
|
||||
</select>
|
||||
|
||||
<label for="prettyPrint">Pretty print</label>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
@@ -306,6 +306,7 @@
|
||||
"OpenLayers/Format/GML/v2.js",
|
||||
"OpenLayers/Format/GML/v3.js",
|
||||
"OpenLayers/Format/Atom.js",
|
||||
"OpenLayers/Format/EncodedPolyline.js",
|
||||
"OpenLayers/Format/KML.js",
|
||||
"OpenLayers/Format/GeoRSS.js",
|
||||
"OpenLayers/Format/WFS.js",
|
||||
@@ -313,6 +314,10 @@
|
||||
"OpenLayers/Format/OWSCommon/v1.js",
|
||||
"OpenLayers/Format/OWSCommon/v1_0_0.js",
|
||||
"OpenLayers/Format/OWSCommon/v1_1_0.js",
|
||||
"OpenLayers/Format/WCSCapabilities.js",
|
||||
"OpenLayers/Format/WCSCapabilities/v1.js",
|
||||
"OpenLayers/Format/WCSCapabilities/v1_0_0.js",
|
||||
"OpenLayers/Format/WCSCapabilities/v1_1_0.js",
|
||||
"OpenLayers/Format/WFSCapabilities.js",
|
||||
"OpenLayers/Format/WFSCapabilities/v1.js",
|
||||
"OpenLayers/Format/WFSCapabilities/v1_0_0.js",
|
||||
@@ -395,6 +400,7 @@
|
||||
"OpenLayers/Lang.js",
|
||||
"OpenLayers/Lang/en.js",
|
||||
"OpenLayers/Spherical.js",
|
||||
"OpenLayers/TileManager.js",
|
||||
"OpenLayers/WPSClient.js",
|
||||
"OpenLayers/WPSProcess.js"
|
||||
]; // etc.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
@@ -295,7 +295,25 @@ OpenLayers.Number = {
|
||||
str = integer + dsep + rem;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: zeroPad
|
||||
* Create a zero padded string optionally with a radix for casting numbers.
|
||||
*
|
||||
* Parameters:
|
||||
* num - {Number} The number to be zero padded.
|
||||
* len - {Number} The length of the string to be returned.
|
||||
* radix - {Number} An integer between 2 and 36 specifying the base to use
|
||||
* for representing numeric values.
|
||||
*/
|
||||
zeroPad: function(num, len, radix) {
|
||||
var str = num.toString(radix || 10);
|
||||
while (str.length < len) {
|
||||
str = "0" + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
@@ -49,13 +49,6 @@ OpenLayers.Date = {
|
||||
return date.toISOString();
|
||||
};
|
||||
} else {
|
||||
function pad(num, len) {
|
||||
var str = num + "";
|
||||
while (str.length < len) {
|
||||
str = "0" + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
return function(date) {
|
||||
var str;
|
||||
if (isNaN(date.getTime())) {
|
||||
@@ -65,12 +58,12 @@ OpenLayers.Date = {
|
||||
} else {
|
||||
str =
|
||||
date.getUTCFullYear() + "-" +
|
||||
pad(date.getUTCMonth() + 1, 2) + "-" +
|
||||
pad(date.getUTCDate(), 2) + "T" +
|
||||
pad(date.getUTCHours(), 2) + ":" +
|
||||
pad(date.getUTCMinutes(), 2) + ":" +
|
||||
pad(date.getUTCSeconds(), 2) + "." +
|
||||
pad(date.getUTCMilliseconds(), 3) + "Z";
|
||||
OpenLayers.Number.zeroPad(date.getUTCMonth() + 1, 2) + "-" +
|
||||
OpenLayers.Number.zeroPad(date.getUTCDate(), 2) + "T" +
|
||||
OpenLayers.Number.zeroPad(date.getUTCHours(), 2) + ":" +
|
||||
OpenLayers.Number.zeroPad(date.getUTCMinutes(), 2) + ":" +
|
||||
OpenLayers.Number.zeroPad(date.getUTCSeconds(), 2) + "." +
|
||||
OpenLayers.Number.zeroPad(date.getUTCMilliseconds(), 3) + "Z";
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
@@ -453,7 +453,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
isSuitableOverview: function() {
|
||||
var mapExtent = this.map.getExtent();
|
||||
var maxExtent = this.map.maxExtent;
|
||||
var maxExtent = this.map.getMaxExtent();
|
||||
var testExtent = new OpenLayers.Bounds(
|
||||
Math.max(mapExtent.left, maxExtent.left),
|
||||
Math.max(mapExtent.bottom, maxExtent.bottom),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
@@ -305,12 +305,17 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
for(l=0; l<layers.length; ++l) {
|
||||
layer = layers[l];
|
||||
numExcept = 0;
|
||||
while(layer.selectedFeatures.length > numExcept) {
|
||||
feature = layer.selectedFeatures[numExcept];
|
||||
if(!options || options.except != feature) {
|
||||
this.unselect(feature);
|
||||
} else {
|
||||
++numExcept;
|
||||
//layer.selectedFeatures is null when layer is destroyed and
|
||||
//one of it's preremovelayer listener calls setLayer
|
||||
//with another layer on this control
|
||||
if(layer.selectedFeatures != null) {
|
||||
while(layer.selectedFeatures.length > numExcept) {
|
||||
feature = layer.selectedFeatures[numExcept];
|
||||
if(!options || options.except != feature) {
|
||||
this.unselect(feature);
|
||||
} else {
|
||||
++numExcept;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
254
lib/OpenLayers/Format/EncodedPolyline.js
Normal file
254
lib/OpenLayers/Format/EncodedPolyline.js
Normal file
@@ -0,0 +1,254 @@
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format.js
|
||||
* @requires OpenLayers/Feature/Vector.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.EncodedPolyline
|
||||
* Class for reading and writing encoded polylines. Create a new instance
|
||||
* with the <OpenLayers.Format.EncodedPolyline> constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format>
|
||||
*/
|
||||
OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
|
||||
|
||||
/**
|
||||
* APIProperty: geometryType
|
||||
* {String} Geometry type to output. One of: linestring (default),
|
||||
* linearring, point, multipoint or polygon. If the geometryType is
|
||||
* point, only the first point of the string is returned.
|
||||
*/
|
||||
geometryType: "linestring",
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.EncodedPolyline
|
||||
* Create a new parser for encoded polylines
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Format.EncodedPolyline>} A new encoded polylines parser.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Format.prototype.initialize.apply(this, [options]);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: read
|
||||
* Deserialize an encoded polyline string and return a vector feature.
|
||||
*
|
||||
* Parameters:
|
||||
* encoded - {String} An encoded polyline string
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Feature.Vector>} A vector feature with a linestring.
|
||||
*/
|
||||
read: function(encoded) {
|
||||
var geomType;
|
||||
if (this.geometryType == "linestring")
|
||||
geomType = OpenLayers.Geometry.LineString;
|
||||
else if (this.geometryType == "linearring")
|
||||
geomType = OpenLayers.Geometry.LinearRing;
|
||||
else if (this.geometryType == "multipoint")
|
||||
geomType = OpenLayers.Geometry.MultiPoint;
|
||||
else if (this.geometryType != "point" && this.geometryType != "polygon")
|
||||
return null;
|
||||
|
||||
var points = this.decode(encoded, 2);
|
||||
var pointGeometries = new Array();
|
||||
for (var i in points) {
|
||||
var point = points[i];
|
||||
pointGeometries.push(
|
||||
new OpenLayers.Geometry.Point(point[1] * 1e-5, point[0] * 1e-5)
|
||||
);
|
||||
}
|
||||
|
||||
if (this.geometryType == "point")
|
||||
return new OpenLayers.Feature.Vector(
|
||||
pointGeometries[0]
|
||||
);
|
||||
|
||||
if (this.geometryType == "polygon")
|
||||
return new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.Polygon([
|
||||
new OpenLayers.Geometry.LinearRing(pointGeometries)
|
||||
])
|
||||
);
|
||||
|
||||
return new OpenLayers.Feature.Vector(
|
||||
new geomType(pointGeometries)
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: decode
|
||||
* Deserialize an encoded string and return an array of n-dimensional
|
||||
* points.
|
||||
*
|
||||
* Parameters:
|
||||
* encoded - {String} An encoded string
|
||||
* dims - {int} The dimension of the points that are returned
|
||||
*
|
||||
* Returns:
|
||||
* {Array(Array(int))} An array containing n-dimensional arrays of
|
||||
* coordinates.
|
||||
*/
|
||||
decode: function(encoded, dims) {
|
||||
var points = new Array();
|
||||
var point = new Array(dims);
|
||||
|
||||
// Reset the point array
|
||||
for (var i = 0; i < point.length; ++i)
|
||||
point[i] = 0;
|
||||
|
||||
for (var i = 0; i < encoded.length;) {
|
||||
for (var dim = 0; dim < dims; ++dim) {
|
||||
var result = 0;
|
||||
var shift = 0;
|
||||
|
||||
var b;
|
||||
do {
|
||||
b = encoded.charCodeAt(i++) - 63;
|
||||
result |= (b & 0x1f) << shift;
|
||||
shift += 5;
|
||||
} while (b >= 0x20);
|
||||
|
||||
point[dim] += ((result & 1) ? ~(result >> 1) : (result >> 1));
|
||||
}
|
||||
|
||||
points.push(point.slice(0));
|
||||
}
|
||||
|
||||
return points;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: write
|
||||
* Serialize a feature or array of features into a WKT string.
|
||||
*
|
||||
* Parameters:
|
||||
* features - {<OpenLayers.Feature.Vector>|Array} A feature or array of
|
||||
* features
|
||||
*
|
||||
* Returns:
|
||||
* {String} The WKT string representation of the input geometries
|
||||
*/
|
||||
write: function(features) {
|
||||
var feature;
|
||||
if (features.constructor == Array)
|
||||
feature = features[0];
|
||||
else
|
||||
feature = features;
|
||||
|
||||
var geometry = feature.geometry;
|
||||
var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
|
||||
|
||||
var pointGeometries;
|
||||
if (type == "point")
|
||||
pointGeometries = new Array(geometry);
|
||||
else if (type == "linestring" ||
|
||||
type == "linearring" ||
|
||||
type == "multipoint")
|
||||
pointGeometries = geometry.components;
|
||||
else if (type == "polygon")
|
||||
pointGeometries = geometry.components[0].components;
|
||||
else
|
||||
return null;
|
||||
|
||||
var points = new Array();
|
||||
for (var i in pointGeometries) {
|
||||
var pointGeometry = pointGeometries[i];
|
||||
var point = [Math.round(pointGeometry.y * 1e5),
|
||||
Math.round(pointGeometry.x * 1e5)];
|
||||
points.push(point);
|
||||
}
|
||||
|
||||
var result = this.encode(points, 2);
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: encode
|
||||
* Serialize an array of n-dimensional points and return an encoded string
|
||||
*
|
||||
* Parameters:
|
||||
* points - {Array(Array(int))} An array containing n-dimensional
|
||||
* arrays of coordinates
|
||||
* dims - {int} The dimension of the points that should be read
|
||||
*
|
||||
* Returns:
|
||||
* {String} An encoded string
|
||||
*/
|
||||
encode: function (points, dims) {
|
||||
var encoded_points = "";
|
||||
|
||||
var lastPoint = new Array(dims);
|
||||
for (var i = 0; i < lastPoint.length; ++i)
|
||||
lastPoint[i] = 0;
|
||||
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var point = points[i];
|
||||
|
||||
for (var dim = 0; dim < lastPoint.length; ++dim) {
|
||||
var delta = point[dim] - lastPoint[dim];
|
||||
encoded_points += this.encodeSignedNumber(delta);
|
||||
}
|
||||
|
||||
lastPoint = point;
|
||||
}
|
||||
return encoded_points;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: encodeSignedNumber
|
||||
* Encode one single signed integer and return an encoded string
|
||||
*
|
||||
* Parameters:
|
||||
* num - {int} A signed integer that should be encoded
|
||||
*
|
||||
* Returns:
|
||||
* {String} An encoded string
|
||||
*/
|
||||
encodeSignedNumber: function (num) {
|
||||
var sgn_num = num << 1;
|
||||
if (num < 0)
|
||||
sgn_num = ~(sgn_num);
|
||||
|
||||
return this.encodeNumber(sgn_num);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: encodeNumber
|
||||
* Encode one single unsigned integer and return an encoded string
|
||||
*
|
||||
* encodeSignedNumber should be used instead of using this method directly!
|
||||
*
|
||||
* Parameters:
|
||||
* num - {int} An unsigned integer that should be encoded
|
||||
*
|
||||
* Returns:
|
||||
* {String} An encoded string
|
||||
*/
|
||||
encodeNumber: function (num) {
|
||||
var encodeString = "";
|
||||
var value;
|
||||
while (num >= 0x20) {
|
||||
value = (0x20 | (num & 0x1f)) + 63;
|
||||
encodeString += (String.fromCharCode(value));
|
||||
num >>= 5;
|
||||
}
|
||||
value = num + 63;
|
||||
encodeString += (String.fromCharCode(value));
|
||||
return encodeString;
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.EncodedPolyline"
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user