//= require_self
+//= require leaflet.sidebar
+//= require leaflet.locate
//= require leaflet.layers
-//= require leaflet.share
+//= require leaflet.key
//= require leaflet.note
-//= require leaflet.locate
-//= require leaflet.customzoom
+//= require leaflet.share
//= require index/browse
//= require index/export
-//= require index/key
//= require index/notes
$(document).ready(function () {
layers[0].addTo(map);
+ map.noteLayer = new L.LayerGroup({code: 'N'});
+ map.dataLayer = new L.OSM.DataLayer(null);
+
$("#map").on("resized", function () {
map.invalidateSize();
});
- L.control.customZoom({position: 'topright'})
+ L.OSM.zoom({position: 'topright'})
+ .addTo(map);
+
+ L.control.locate({position: 'topright'})
.addTo(map);
- var uiPane = $('#map-ui')[0];
+ var sidebar = L.OSM.sidebar('#map-ui');
L.OSM.layers({
position: 'topright',
layers: layers,
- uiPane: uiPane
+ sidebar: sidebar
}).addTo(map);
- L.control.share({
- getUrl: getShortUrl,
- uiPane: uiPane
+ L.OSM.key({
+ position: 'topright',
+ sidebar: sidebar
+ }).addTo(map);
+
+ L.OSM.share({
+ getShortUrl: getShortUrl,
+ getUrl: getUrl,
+ sidebar: sidebar,
+ short: true
}).addTo(map);
- L.control.note({ position: 'topright' }).addTo(map);
- L.control.locate({ position: 'topright' }).addTo(map);
- L.control.scale().addTo(map);
+ L.OSM.note({
+ position: 'topright',
+ sidebar: sidebar
+ }).addTo(map);
+
+ L.control.scale()
+ .addTo(map);
map.on('moveend layeradd layerremove', updateLocation);
if (!("autofocus" in document.createElement("input"))) {
$("#query").focus();
}
-});
-
-function getMapBaseLayerId(map) {
- for (var i in map._layers) { // TODO: map.eachLayer
- var layer = map._layers[i];
- if (layer.options && layer.options.keyid) {
- return layer.options.keyid;
- }
- }
-}
-
-function getMapLayers(map) {
- var layerConfig = '';
- for (var i in map._layers) { // TODO: map.eachLayer
- var layer = map._layers[i];
- if (layer.options && layer.options.code) {
- layerConfig += layer.options.code;
- }
- }
- return layerConfig;
-}
-// generate a cookie-safe string of map state
-function cookieContent(map) {
- var center = map.getCenter().wrap();
- return [center.lng, center.lat, map.getZoom(), getMapLayers(map)].join('|');
-}
+ initializeExport(map);
+ initializeBrowse(map);
+ initializeNotes(map);
+});
function updateLocation() {
updatelinks(this.getCenter().wrap(),
this.getZoom(),
- getMapLayers(this),
+ this.getLayersCode(),
this.getBounds().wrap(), {});
var expiry = new Date();