[TASK] Remove leaflet-providers
Issues with loading configutation like copyright notice. Provide your complete configuration in config.json - example in ffrgb branch
This commit is contained in:
parent
50a440455c
commit
6353efe294
2
app.js
2
app.js
@ -5,7 +5,6 @@ require.config({
|
||||
paths: {
|
||||
"leaflet": "../bower_components/leaflet/dist/leaflet",
|
||||
"leaflet.label": "../bower_components/Leaflet.label/dist/leaflet.label",
|
||||
"leaflet.providers": "../bower_components/leaflet-providers/leaflet-providers",
|
||||
"chroma-js": "../bower_components/chroma-js/chroma.min",
|
||||
"moment": "../bower_components/moment/min/moment.min",
|
||||
"moment.de": "../bower_components/moment/locale/de",
|
||||
@ -17,7 +16,6 @@ require.config({
|
||||
},
|
||||
shim: {
|
||||
"leaflet.label": ["leaflet"],
|
||||
"leaflet.providers": ["leaflet"],
|
||||
"moment.de": ["moment"],
|
||||
"tablesort": {
|
||||
exports: "Tablesort"
|
||||
|
@ -20,7 +20,6 @@
|
||||
"d3": "~3.5.17",
|
||||
"roboto-fontface": "~0.4.5",
|
||||
"virtual-dom": "~2.1.1",
|
||||
"leaflet-providers": "~1.1.10",
|
||||
"rbush": "https://github.com/mourner/rbush.git#~1.4.3"
|
||||
},
|
||||
"authors": [
|
||||
|
76
lib/map.js
76
lib/map.js
@ -1,6 +1,6 @@
|
||||
define(["map/clientlayer", "map/labelslayer",
|
||||
"leaflet", "moment", "locationmarker", "rbush", "helper",
|
||||
"leaflet.label", "leaflet.providers", "moment.de"],
|
||||
"leaflet.label", "moment.de"],
|
||||
function (ClientLayer, LabelsLayer, L, moment, LocationMarker, rbush, helper) {
|
||||
"use strict";
|
||||
|
||||
@ -9,30 +9,6 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
zoomControl: false
|
||||
};
|
||||
|
||||
var AddLayerButton = L.Control.extend({
|
||||
options: {
|
||||
position: "bottomright"
|
||||
},
|
||||
|
||||
initialize: function (f, options) {
|
||||
L.Util.setOptions(this, options);
|
||||
this.f = f;
|
||||
},
|
||||
|
||||
onAdd: function () {
|
||||
var button = L.DomUtil.create("button", "add-layer ion-android-add shadow");
|
||||
|
||||
// L.DomEvent.disableClickPropagation(button)
|
||||
// Click propagation isn't disabled as this causes problems with the
|
||||
// location picking mode; instead propagation is stopped in onClick().
|
||||
L.DomEvent.addListener(button, "click", this.f, this);
|
||||
|
||||
this.button = button;
|
||||
|
||||
return button;
|
||||
}
|
||||
});
|
||||
|
||||
var LocateButton = L.Control.extend({
|
||||
options: {
|
||||
position: "bottomright"
|
||||
@ -170,7 +146,6 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
|
||||
var map, userLocation;
|
||||
var layerControl;
|
||||
var customLayers = {};
|
||||
var baseLayers = {};
|
||||
|
||||
var locateUserButton = new LocateButton(function (d) {
|
||||
@ -239,7 +214,6 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
|
||||
function showCoordinates(e) {
|
||||
router.gotoLocation(e.latlng);
|
||||
// window.prompt("Koordinaten (Lat, Lng)", e.latlng.lat.toFixed(9) + ", " + e.latlng.lng.toFixed(9))
|
||||
disableCoords();
|
||||
}
|
||||
|
||||
@ -259,28 +233,6 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
}
|
||||
}
|
||||
|
||||
function addLayer(layerName) {
|
||||
if (layerName in baseLayers) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (layerName in customLayers) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var layer = L.tileLayer.provider(layerName);
|
||||
layerControl.addBaseLayer(layer, layerName);
|
||||
customLayers[layerName] = layer;
|
||||
|
||||
if (helper.localStorageTest()) {
|
||||
localStorage.setItem("map/customLayers", JSON.stringify(Object.keys(customLayers)));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
function contextMenuOpenLayerMenu() {
|
||||
document.querySelector(".leaflet-control-layers").classList.add("leaflet-control-layers-expanded");
|
||||
}
|
||||
@ -292,8 +244,8 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
|
||||
var layers = config.mapLayers.map(function (d) {
|
||||
return {
|
||||
"name": d.name,
|
||||
"layer": "url" in d ? L.tileLayer(d.url, d.config) : L.tileLayer.provider(d.name)
|
||||
"name": d.name + "ak",
|
||||
"layer": "url" in d ? L.tileLayer(d.url, d.config) : console.warn("Missing map url")
|
||||
};
|
||||
});
|
||||
|
||||
@ -311,31 +263,9 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
addButton(locateUserButton);
|
||||
addButton(showCoordsPickerButton);
|
||||
|
||||
addButton(new AddLayerButton(function () {
|
||||
/*eslint no-alert:0*/
|
||||
var layerName = prompt("Leaflet Provider:");
|
||||
addLayer(layerName);
|
||||
}));
|
||||
|
||||
layerControl = L.control.layers(baseLayers, [], {position: "bottomright"});
|
||||
layerControl.addTo(map);
|
||||
|
||||
if (helper.localStorageTest()) {
|
||||
var d = JSON.parse(localStorage.getItem("map/customLayers"));
|
||||
|
||||
if (d) {
|
||||
d.forEach(addLayer);
|
||||
}
|
||||
|
||||
d = JSON.parse(localStorage.getItem("map/selectedLayer"));
|
||||
d = d && d.name in baseLayers ? baseLayers[d.name] : d && d.name in customLayers ? customLayers[d.name] : false;
|
||||
|
||||
if (d) {
|
||||
map.removeLayer(layers[0].layer);
|
||||
map.addLayer(d);
|
||||
}
|
||||
}
|
||||
|
||||
var clientLayer = new ClientLayer({minZoom: 15});
|
||||
clientLayer.addTo(map);
|
||||
clientLayer.setZIndex(5);
|
||||
|
Loading…
Reference in New Issue
Block a user