check-in bower_components
This commit is contained in:
parent
4cc16bccd0
commit
9e08e74132
101 changed files with 90960 additions and 0 deletions
127
bower_components/leaflet-plugins/control/Distance.js
vendored
Normal file
127
bower_components/leaflet-plugins/control/Distance.js
vendored
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
L.Control.Distance = L.Control.extend({
|
||||
options: {
|
||||
position: 'topleft',
|
||||
popups: true
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
L.Util.setOptions(this, options);
|
||||
this._line = new L.Polyline([], {editable: true});
|
||||
this._line.on('edit', this._update, this);
|
||||
this._line.on('click', function(e) {});
|
||||
this._active = false;
|
||||
},
|
||||
|
||||
getLine: function() { return this._line; },
|
||||
|
||||
onAdd: function(map) {
|
||||
var className = 'leaflet-control-distance',
|
||||
container = this._container = L.DomUtil.create('div', className);
|
||||
|
||||
function cb() {
|
||||
if (this._active)
|
||||
this._calc_disable();
|
||||
else
|
||||
this._calc_enable();
|
||||
}
|
||||
|
||||
var link = this._link = this._createButton('Edit', 'leaflet-control-distance leaflet-control-distance-edit', container, cb, this);
|
||||
var del = this._link_delete = this._createButton('Delete', 'leaflet-control-distance leaflet-control-distance-delete', container, this._reset, this);
|
||||
var text = this._text = L.DomUtil.create('div', 'leaflet-control-distance-text', container);
|
||||
|
||||
//text.style.display = 'inline';
|
||||
//text.style.float = 'right';
|
||||
|
||||
this._map.addLayer(this._line);
|
||||
this._calc_disable();
|
||||
return container;
|
||||
},
|
||||
|
||||
_createButton: function (title, className, container, fn, context) {
|
||||
var link = L.DomUtil.create('a', className, container);
|
||||
link.href = '#';
|
||||
link.title = title;
|
||||
|
||||
L.DomEvent
|
||||
.addListener(link, 'click', L.DomEvent.stopPropagation)
|
||||
.addListener(link, 'click', L.DomEvent.preventDefault)
|
||||
.addListener(link, 'click', fn, context);
|
||||
|
||||
return link;
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
this._calc_disable();
|
||||
},
|
||||
|
||||
_calc_enable: function() {
|
||||
this._map.on('click', this._add_point, this);
|
||||
|
||||
this._map.getContainer().style.cursor = 'crosshair';
|
||||
//this._map.addLayer(this._line);
|
||||
L.DomUtil.addClass(this._link, 'leaflet-control-distance-active');
|
||||
this._container.appendChild(this._link_delete);
|
||||
this._container.appendChild(this._text);
|
||||
this._active = true;
|
||||
this._line.editing.enable();
|
||||
if (!this._map.hasLayer(this._line))
|
||||
this._map.addLayer(this._line);
|
||||
this._update();
|
||||
},
|
||||
|
||||
_calc_disable: function() {
|
||||
this._map.off('click', this._add_point, this);
|
||||
//this._map.removeLayer(this._line);
|
||||
this._map.getContainer().style.cursor = 'default';
|
||||
this._container.removeChild(this._link_delete);
|
||||
this._container.removeChild(this._text);
|
||||
L.DomUtil.removeClass(this._link, 'leaflet-control-distance-active');
|
||||
this._active = false;
|
||||
this._line.editing.disable();
|
||||
},
|
||||
|
||||
_add_point: function (e) {
|
||||
var len = this._line.getLatLngs().length;
|
||||
this._line.addLatLng(e.latlng);
|
||||
this._line.editing.updateMarkers();
|
||||
this._line.fire('edit', {});
|
||||
},
|
||||
|
||||
_reset: function(e) {
|
||||
this._line.setLatLngs([]);
|
||||
this._line.fire('edit', {});
|
||||
this._line.redraw();
|
||||
this._line.editing.updateMarkers();
|
||||
},
|
||||
|
||||
_update: function(e) {
|
||||
console.info("Update");
|
||||
this._text.textContent = this._d2txt(this._distance_calc());
|
||||
},
|
||||
|
||||
_d2txt: function(d) {
|
||||
if (d < 2000)
|
||||
return d.toFixed(0) + " m";
|
||||
else
|
||||
return (d/1000).toFixed(1) + " km";
|
||||
},
|
||||
|
||||
_distance_calc: function(e) {
|
||||
var ll = this._line.getLatLngs();
|
||||
var d = 0, p = null;
|
||||
for (var i = 0; i < ll.length; i++) {
|
||||
if (i)
|
||||
d += p.distanceTo(ll[i]);
|
||||
if (this.options.popups) {
|
||||
var m = this._line.editing._markers[i];
|
||||
if (m) {
|
||||
m.bindPopup(this._d2txt(d));
|
||||
m.on('mouseover', m.openPopup, m);
|
||||
m.on('mouseout', m.closePopup, m);
|
||||
}
|
||||
}
|
||||
p = ll[i];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
});
|
||||
60
bower_components/leaflet-plugins/control/Layers.Load.js
vendored
Normal file
60
bower_components/leaflet-plugins/control/Layers.Load.js
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Add async initialization of layers to L.Control.Layers
|
||||
*/
|
||||
L.Control.Layers.include({
|
||||
_loadScripts: function(scripts, cb, args) {
|
||||
if (!scripts || scripts.length == 0)
|
||||
return cb(args);
|
||||
var _this = this, s = scripts.pop(), c;
|
||||
c = L.Control.Layers._script_cache[s];
|
||||
if (c === undefined) {
|
||||
c = {url: s, wait: []};
|
||||
//console.info("Load " + s);
|
||||
var script = document.createElement('script');
|
||||
script.src = s;
|
||||
script.type = 'text/javascript';
|
||||
script.onload = function () {
|
||||
var i = 0;
|
||||
for (i = 0; i < c.wait.length; i++)
|
||||
c.wait[i]();
|
||||
}
|
||||
c.e = script;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
}
|
||||
function _cb() { _this._loadScripts(scripts, cb, args); }
|
||||
c.wait.push(_cb);
|
||||
if (c.e.readyState == "completed")
|
||||
_cb();
|
||||
L.Control.Layers._script_cache[s] = c;
|
||||
},
|
||||
|
||||
addLayerDef: function(name, def) {
|
||||
if (this._layer_defs === undefined)
|
||||
this._layer_defs = {};
|
||||
this._layer_defs[name] = def;
|
||||
},
|
||||
|
||||
addLayerDefs: function(defs) {
|
||||
if (this._layer_defs === undefined)
|
||||
this._layer_defs = {};
|
||||
L.Util.extend(this._layer_defs, defs);
|
||||
},
|
||||
|
||||
loadLayer: function(name, deflt) {
|
||||
var _this = this, l = this._layer_defs[name];
|
||||
l['default'] = deflt;
|
||||
this._loadScripts(l.js.reverse(), function(l) {_this._loadLayer(l)}, l);
|
||||
},
|
||||
|
||||
_loadLayer: function(l) {
|
||||
var x = l.init();
|
||||
if (l['default'] && this._map)
|
||||
this._map.addLayer(x);
|
||||
if (!l.overlay)
|
||||
this.addBaseLayer(x, l.name);
|
||||
else
|
||||
this.addOverlay(x, l.name);
|
||||
}
|
||||
});
|
||||
|
||||
L.Control.Layers._script_cache = {};
|
||||
76
bower_components/leaflet-plugins/control/Permalink.Layer.js
vendored
Normal file
76
bower_components/leaflet-plugins/control/Permalink.Layer.js
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
//#include "Permalink.js
|
||||
|
||||
L.Control.Permalink.include({
|
||||
/*
|
||||
options: {
|
||||
useMarker: true,
|
||||
markerOptions: {}
|
||||
},
|
||||
*/
|
||||
|
||||
initialize_layer: function() {
|
||||
//console.info("Initialize layer");
|
||||
this.on('update', this._set_layer, this);
|
||||
this.on('add', this._onadd_layer, this);
|
||||
},
|
||||
|
||||
_onadd_layer: function(e) {
|
||||
//console.info("onAdd::layer", e);
|
||||
this._map.on('layeradd', this._update_layer, this);
|
||||
this._map.on('layerremove', this._update_layer, this);
|
||||
this._update_layer();
|
||||
},
|
||||
|
||||
_update_layer: function() {
|
||||
if (!this.options.layers) return;
|
||||
//console.info(this.options.layers);
|
||||
var layer = this.options.layers.currentBaseLayer();
|
||||
if (layer)
|
||||
this._update({layer: layer.name});
|
||||
},
|
||||
|
||||
_set_layer: function(e) {
|
||||
//console.info("Set layer", e);
|
||||
var p = e.params;
|
||||
if (!this.options.layers || !p.layer) return;
|
||||
this.options.layers.chooseBaseLayer(p.layer);
|
||||
}
|
||||
});
|
||||
|
||||
L.Control.Layers.include({
|
||||
chooseBaseLayer: function(name) {
|
||||
var layer, obj;
|
||||
for (var i in this._layers) {
|
||||
if (!this._layers.hasOwnProperty(i))
|
||||
continue;
|
||||
obj = this._layers[i];
|
||||
if (!obj.overlay && obj.name == name)
|
||||
layer = obj.layer;
|
||||
}
|
||||
if (!layer || this._map.hasLayer(layer))
|
||||
return;
|
||||
|
||||
for (var i in this._layers) {
|
||||
if (!this._layers.hasOwnProperty(i))
|
||||
continue;
|
||||
obj = this._layers[i];
|
||||
if (!obj.overlay && this._map.hasLayer(obj.layer))
|
||||
this._map.removeLayer(obj.layer)
|
||||
}
|
||||
this._map.addLayer(layer)
|
||||
this._update();
|
||||
},
|
||||
|
||||
currentBaseLayer: function() {
|
||||
for (var i in this._layers) {
|
||||
if (!this._layers.hasOwnProperty(i))
|
||||
continue;
|
||||
var obj = this._layers[i];
|
||||
//console.info("Layer: ", obj.name, obj);
|
||||
if (obj.overlay) continue;
|
||||
if (!obj.overlay && this._map.hasLayer(obj.layer))
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
49
bower_components/leaflet-plugins/control/Permalink.Line.js
vendored
Normal file
49
bower_components/leaflet-plugins/control/Permalink.Line.js
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//#include "Permalink.js
|
||||
|
||||
L.Control.Permalink.include({
|
||||
/*
|
||||
options: {
|
||||
line: null
|
||||
},
|
||||
*/
|
||||
|
||||
initialize_line: function() {
|
||||
this.on('update', this._set_line, this);
|
||||
this.on('add', this._onadd_line, this);
|
||||
},
|
||||
|
||||
_onadd_line: function(e) {
|
||||
//console.info("onAdd::line", e);
|
||||
if (!this.options.line) return;
|
||||
this.options.line.on('edit', this._update_line, this);
|
||||
this._update_line()
|
||||
},
|
||||
|
||||
_update_line: function() {
|
||||
if (!this.options.line) return;
|
||||
var line = this.options.line;
|
||||
if (!line) return;
|
||||
var text = [], coords = line.getLatLngs();
|
||||
if (!coords.length)
|
||||
return this._update({line: null});
|
||||
for (var i in coords)
|
||||
text.push(coords[i].lat.toFixed(4) + "," + coords[i].lng.toFixed(4))
|
||||
this._update({line: text.join(';')});
|
||||
},
|
||||
|
||||
_set_line: function(e) {
|
||||
//console.info("Set line", e.params.line);
|
||||
var p = e.params, l = this.options.line;
|
||||
if (!l || !p.line) return;
|
||||
var coords = [], text = p.line.split(';');
|
||||
for (var i in text) {
|
||||
var ll = text[i].split(',');
|
||||
if (ll.length != 2) continue;
|
||||
coords.push(new L.LatLng(ll[0], ll[1]));
|
||||
}
|
||||
if (!coords.length) return;
|
||||
l.setLatLngs(coords);
|
||||
if (!this._map.hasLayer(l))
|
||||
this._map.addLayer(l);
|
||||
}
|
||||
});
|
||||
31
bower_components/leaflet-plugins/control/Permalink.Marker.js
vendored
Normal file
31
bower_components/leaflet-plugins/control/Permalink.Marker.js
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//#include "Permalink.js
|
||||
|
||||
L.Control.Permalink.include({
|
||||
/*
|
||||
options: {
|
||||
useMarker: true,
|
||||
markerOptions: {}
|
||||
},
|
||||
*/
|
||||
|
||||
initialize_marker: function() {
|
||||
//console.info("Initialize marker");
|
||||
this.on('update', this._set_marker, this);
|
||||
},
|
||||
|
||||
_set_marker: function(e) {
|
||||
//console.info("Set marker", e);
|
||||
var p = e.params;
|
||||
//if (!this.options.useMarker) return;
|
||||
if (this._marker) return;
|
||||
if (p.marker != 1) return;
|
||||
if (p.mlat !== undefined && p.mlon !== undefined)
|
||||
return this._update({mlat: null, mlon: null,
|
||||
lat: p.mlat, lon: p.mlon, marker: 1});
|
||||
this._marker = new L.Marker(new L.LatLng(p.lat, p.lon),
|
||||
this.options.markerOptions);
|
||||
this._marker.bindPopup("<a href='" + this._update_href() + "'>" + this.options.text + "</a>");
|
||||
this._map.addLayer(this._marker);
|
||||
this._update({marker: null});
|
||||
}
|
||||
});
|
||||
163
bower_components/leaflet-plugins/control/Permalink.js
vendored
Normal file
163
bower_components/leaflet-plugins/control/Permalink.js
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
L.Control.Permalink = L.Control.extend({
|
||||
includes: L.Mixin.Events,
|
||||
|
||||
options: {
|
||||
position: "bottomleft",
|
||||
useAnchor: true,
|
||||
useLocation: false,
|
||||
text: "Permalink"
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
L.Util.setOptions(this, options);
|
||||
this._params = {};
|
||||
this._set_urlvars();
|
||||
this.on("update", this._set_center, this);
|
||||
for (var i in this) {
|
||||
if (typeof(i) === "string" && i.indexOf('initialize_') == 0)
|
||||
this[i]();
|
||||
}
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
this._container = L.DomUtil.create('div', 'leaflet-control-attribution leaflet-control-permalink');
|
||||
L.DomEvent.disableClickPropagation(this._container);
|
||||
this._map = map;
|
||||
this._href = L.DomUtil.create('a', null, this._container);
|
||||
this._href.innerHTML = this.options.text
|
||||
|
||||
map.on('moveend', this._update_center, this);
|
||||
this.fire("update", {params: this._params})
|
||||
this._update_center();
|
||||
|
||||
if (this.options.useAnchor && 'onhashchange' in window) {
|
||||
var _this = this, fn = window.onhashchange;
|
||||
window.onhashchange = function() {
|
||||
_this._set_urlvars();
|
||||
if (fn) return fn();
|
||||
}
|
||||
}
|
||||
|
||||
this.fire('add', {map: map});
|
||||
|
||||
return this._container;
|
||||
},
|
||||
|
||||
_update_center: function() {
|
||||
if (!this._map) return;
|
||||
|
||||
var center = this._round_point(this._map.getCenter());
|
||||
this._update({zoom: this._map.getZoom(), lat: center.lat, lon: center.lng});
|
||||
},
|
||||
|
||||
_update_href: function() {
|
||||
var params = L.Util.getParamString(this._params);
|
||||
var sep = '?';
|
||||
if (this.options.useAnchor) sep = '#';
|
||||
var url = this._url_base + sep + params.slice(1);
|
||||
if (this._href) this._href.setAttribute('href', url);
|
||||
if (this.options.useLocation)
|
||||
location.replace('#' + params.slice(1));
|
||||
return url;
|
||||
},
|
||||
|
||||
_round_point : function(point) {
|
||||
var bounds = this._map.getBounds(), size = this._map.getSize();
|
||||
var ne = bounds.getNorthEast(), sw = bounds.getSouthWest();
|
||||
|
||||
var round = function (x, p) {
|
||||
if (p == 0) return x;
|
||||
shift = 1;
|
||||
while (p < 1 && p > -1) {
|
||||
x *= 10;
|
||||
p *= 10;
|
||||
shift *= 10;
|
||||
}
|
||||
return Math.floor(x)/shift;
|
||||
}
|
||||
point.lat = round(point.lat, (ne.lat - sw.lat) / size.y);
|
||||
point.lng = round(point.lng, (ne.lng - sw.lng) / size.x);
|
||||
return point;
|
||||
},
|
||||
|
||||
_update: function(obj, source) {
|
||||
//console.info("Update", obj, this._params);
|
||||
for(var i in obj) {
|
||||
if (!obj.hasOwnProperty(i)) continue;
|
||||
if (obj[i] != null && obj[i] != undefined)
|
||||
this._params[i] = obj[i]
|
||||
else
|
||||
delete this._params[i];
|
||||
}
|
||||
|
||||
this._update_href();
|
||||
},
|
||||
|
||||
_set_urlvars: function()
|
||||
{
|
||||
this._url_base = window.location.href.split('#')[0].split('?')[0];
|
||||
|
||||
var p;
|
||||
if (this.options.useAnchor)
|
||||
p = L.UrlUtil.queryParse(L.UrlUtil.hash());
|
||||
else
|
||||
p = L.UrlUtil.queryParse(L.UrlUtil.query());
|
||||
|
||||
function eq(x, y) {
|
||||
for(var i in x)
|
||||
if (x.hasOwnProperty(i) && x[i] != y[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (eq(p, this._params) && eq(this._params, p))
|
||||
return;
|
||||
this._params = p;
|
||||
this._update_href();
|
||||
this.fire("update", {params: this._params})
|
||||
},
|
||||
|
||||
_set_center: function(e)
|
||||
{
|
||||
//console.info("Update center", e);
|
||||
var params = e.params;
|
||||
if (params.zoom == undefined ||
|
||||
params.lat == undefined ||
|
||||
params.lon == undefined) return;
|
||||
this._map.setView(new L.LatLng(params.lat, params.lon), params.zoom);
|
||||
}
|
||||
});
|
||||
|
||||
L.UrlUtil = {
|
||||
queryParse: function(s) {
|
||||
var p = {};
|
||||
var sep = "&";
|
||||
if (s.search("&") != -1)
|
||||
sep = "&";
|
||||
var params = s.split(sep);
|
||||
for(var i = 0; i < params.length; i++) {
|
||||
var tmp = params[i].split('=');
|
||||
if (tmp.length != 2) continue;
|
||||
p[tmp[0]] = decodeURI(tmp[1]);
|
||||
}
|
||||
return p;
|
||||
},
|
||||
|
||||
query: function() {
|
||||
var href = window.location.href.split('#')[0], idx = href.indexOf('?');
|
||||
if (idx < 0)
|
||||
return '';
|
||||
return href.slice(idx+1);
|
||||
},
|
||||
|
||||
hash: function() { return window.location.hash.slice(1) },
|
||||
|
||||
updateParamString: function (q, obj) {
|
||||
var p = L.UrlUtil.queryParse(q);
|
||||
for (var i in obj) {
|
||||
if (obj.hasOwnProperty(i))
|
||||
p[i] = obj[i];
|
||||
}
|
||||
return L.Util.getParamString(p).slice(1);
|
||||
}
|
||||
};
|
||||
118
bower_components/leaflet-plugins/control/Scale.js
vendored
Normal file
118
bower_components/leaflet-plugins/control/Scale.js
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
L.Control.Scale = L.Control.extend({
|
||||
options: {
|
||||
position: "bottomleft",
|
||||
useCanvas: null,
|
||||
width: 100
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
L.Util.setOptions(this, options);
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
this._map = map;
|
||||
|
||||
this._container = L.DomUtil.create('div', 'leaflet-control-attribution leaflet-control-scale');
|
||||
this._label = L.DomUtil.create('div', null, this._container);
|
||||
this._label.style.textAlign = 'right';
|
||||
|
||||
if (!this.options.useCanvas && this.options.useCanvas != false)
|
||||
this.options.useCanvas = "HTMLCanvasElement" in window;
|
||||
if (this.options.useCanvas) {
|
||||
this._canvas = L.DomUtil.create('canvas', 'leaflet-canvas-marker', this._container);
|
||||
} else {
|
||||
this._canvas = L.DomUtil.create('div', null, this._container);
|
||||
this._canvas.style.border = "1px solid black";
|
||||
this._canvas.innerHTML = " ";
|
||||
//this._canvas.style.padding = "none";
|
||||
//this._canvas.style.margin = "none";
|
||||
//this._canvas.style.width = 100;
|
||||
//this._canvas.style.height = 5;
|
||||
}
|
||||
map.on('zoomend', this._update, this);
|
||||
this._update();
|
||||
return this._container;
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
map._container.removeChild(this._label);
|
||||
map._container.removeChild(this._canvas);
|
||||
map.off('zoomend', this._reset);
|
||||
},
|
||||
|
||||
getPosition: function() {
|
||||
return this.options.position;
|
||||
},
|
||||
|
||||
getContainer: function() {
|
||||
return this._container;
|
||||
},
|
||||
|
||||
_update: function() {
|
||||
if (!this._map) return;
|
||||
|
||||
var size = this.options.width;
|
||||
|
||||
var b = this._map.getBounds(), pb = this._map.getPixelBounds();
|
||||
var width = this._deg_length(b.getNorthEast(), b.getNorthWest());
|
||||
width = size * width / (pb.max.x - pb.min.x);
|
||||
var iw = this._round(width);
|
||||
|
||||
if (iw >= 1)
|
||||
this._label.innerHTML = iw + " km";
|
||||
else
|
||||
this._label.innerHTML = Math.round(1000 * iw) + " m";
|
||||
|
||||
size = size * iw / width;
|
||||
|
||||
if (this.options.useCanvas) {
|
||||
this._canvas.width = size+1;
|
||||
this._canvas.height = 10+1;
|
||||
|
||||
var ctx = this._canvas.getContext("2d");
|
||||
this._draw(ctx, size, 5);
|
||||
} else {
|
||||
this._canvas.style.width = size;
|
||||
this._canvas.style.height = 5;
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
_draw: function(ctx, width, height) {
|
||||
ctx.beginPath();
|
||||
ctx.fillStyle = ctx.strokeStyle = '#000';
|
||||
ctx.lineWidth = 0.5;
|
||||
|
||||
ctx.strokeRect(0, height, width/2, height);
|
||||
ctx.fillRect(0, height, width/2, height);
|
||||
ctx.strokeRect(width/2, height, width/2, height);
|
||||
|
||||
ctx.moveTo(0, 0);
|
||||
ctx.lineTo(0, height);
|
||||
ctx.moveTo(width/2, 0);
|
||||
ctx.lineTo(width/2, height);
|
||||
ctx.moveTo(width, 0);
|
||||
ctx.lineTo(width, height);
|
||||
ctx.stroke();
|
||||
},
|
||||
|
||||
_deg_length : function(p1, p2) {
|
||||
var deglen = 111.12 * L.LatLng.RAD_TO_DEG;
|
||||
var p1lat = p1.lat * L.LatLng.DEG_TO_RAD,
|
||||
p1lng = p1.lng * L.LatLng.DEG_TO_RAD,
|
||||
p2lat = p2.lat * L.LatLng.DEG_TO_RAD,
|
||||
p2lng = p2.lng * L.LatLng.DEG_TO_RAD;
|
||||
return deglen * Math.acos(Math.sin(p1lat) * Math.sin(p2lat) +
|
||||
Math.cos(p1lat) * Math.cos(p2lat) * Math.cos(p2lng - p1lng));
|
||||
},
|
||||
|
||||
_round : function (x) {
|
||||
var div = 1;
|
||||
while (div < x) div *= 10;
|
||||
while (div > x) div /= 10;
|
||||
var s = div;
|
||||
while (s < x) s += div;
|
||||
if (s > 5 * div) s = 10 * div;
|
||||
return s;
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue