[Pkg-javascript-commits] [leaflet] 188/301: merge GeoJSON altitude pull with some tweaks #1822
Jonas Smedegaard
js at moszumanska.debian.org
Mon Jan 27 22:22:50 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet.
commit 5d6641360b138d0ed1f3dec660cf052f31f71a39
Merge: ddbb01c 8e98e52
Author: Vladimir Agafonkin <agafonkin at gmail.com>
Date: Wed Nov 6 23:17:14 2013 +0200
merge GeoJSON altitude pull with some tweaks #1822
spec/suites/geo/LatLngSpec.js | 14 ++++++
spec/suites/layer/GeoJSONSpec.js | 102 +++++++++++++++++++++++++++++++++++----
src/geo/LatLng.js | 14 ++++--
src/layer/GeoJSON.js | 11 +++--
4 files changed, 123 insertions(+), 18 deletions(-)
diff --cc src/geo/LatLng.js
index a7e3336,fbc1f56..6a1a8c5
--- a/src/geo/LatLng.js
+++ b/src/geo/LatLng.js
@@@ -2,16 -2,20 +2,20 @@@
* L.LatLng represents a geographical point with latitude and longitude coordinates.
*/
- L.LatLng = function (rawLat, rawLng) { // (Number, Number)
-L.LatLng = function (rawLat, rawLng, rawAlt) { // (Number, Number, Number)
-- var lat = parseFloat(rawLat),
-- lng = parseFloat(rawLng);
++L.LatLng = function (lat, lng, alt) { // (Number, Number, Number)
++ var lat = parseFloat(lat),
++ lng = parseFloat(lng);
if (isNaN(lat) || isNaN(lng)) {
-- throw new Error('Invalid LatLng object: (' + rawLat + ', ' + rawLng + ')');
++ throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');
}
this.lat = lat;
this.lng = lng;
-
- if (typeof rawAlt !== 'undefined') {
- this.alt = parseFloat(rawAlt);
++
++ if (alt !== undefined) {
++ this.alt = parseFloat(alt);
+ }
};
L.extend(L.LatLng, {
@@@ -75,11 -79,7 +79,11 @@@ L.latLng = function (a, b) { // (LatLng
return a;
}
if (L.Util.isArray(a)) {
- return new L.LatLng(a[0], a[1], a[2]);
+ if (typeof a[0] === 'number' || typeof a[0] === 'string') {
- return new L.LatLng(a[0], a[1]);
++ return new L.LatLng(a[0], a[1], a[2]);
+ } else {
+ return null;
+ }
}
if (a === undefined || a === null) {
return a;
diff --cc src/layer/GeoJSON.js
index efdaf8e,32798f1..a5b87c3
--- a/src/layer/GeoJSON.js
+++ b/src/layer/GeoJSON.js
@@@ -147,8 -146,12 +147,13 @@@ L.extend(L.GeoJSON,
return latlngs;
},
-- latLngToCoords: function (latLng) {
- return [latLng.lng, latLng.lat];
- if (typeof latLng.alt === 'undefined') {
- return [latLng.lng, latLng.lat];
- } else {
- return [latLng.lng, latLng.lat, latLng.alt];
++ latLngToCoords: function (latlng) {
++ var coords = [latlng.lng, latlng.lat];
++
++ if (latlng.alt === undefined) {
++ coords.push(latlng.alt);
+ }
++ return coords;
},
latLngsToCoords: function (latLngs) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git
More information about the Pkg-javascript-commits
mailing list