[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: {
|
paths: {
|
||||||
"leaflet": "../bower_components/leaflet/dist/leaflet",
|
"leaflet": "../bower_components/leaflet/dist/leaflet",
|
||||||
"leaflet.label": "../bower_components/Leaflet.label/dist/leaflet.label",
|
"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",
|
"chroma-js": "../bower_components/chroma-js/chroma.min",
|
||||||
"moment": "../bower_components/moment/min/moment.min",
|
"moment": "../bower_components/moment/min/moment.min",
|
||||||
"moment.de": "../bower_components/moment/locale/de",
|
"moment.de": "../bower_components/moment/locale/de",
|
||||||
@ -17,7 +16,6 @@ require.config({
|
|||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
"leaflet.label": ["leaflet"],
|
"leaflet.label": ["leaflet"],
|
||||||
"leaflet.providers": ["leaflet"],
|
|
||||||
"moment.de": ["moment"],
|
"moment.de": ["moment"],
|
||||||
"tablesort": {
|
"tablesort": {
|
||||||
exports: "Tablesort"
|
exports: "Tablesort"
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
"d3": "~3.5.17",
|
"d3": "~3.5.17",
|
||||||
"roboto-fontface": "~0.4.5",
|
"roboto-fontface": "~0.4.5",
|
||||||
"virtual-dom": "~2.1.1",
|
"virtual-dom": "~2.1.1",
|
||||||
"leaflet-providers": "~1.1.10",
|
|
||||||
"rbush": "https://github.com/mourner/rbush.git#~1.4.3"
|
"rbush": "https://github.com/mourner/rbush.git#~1.4.3"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
|
76
lib/map.js
76
lib/map.js
@ -1,6 +1,6 @@
|
|||||||
define(["map/clientlayer", "map/labelslayer",
|
define(["map/clientlayer", "map/labelslayer",
|
||||||
"leaflet", "moment", "locationmarker", "rbush", "helper",
|
"leaflet", "moment", "locationmarker", "rbush", "helper",
|
||||||
"leaflet.label", "leaflet.providers", "moment.de"],
|
"leaflet.label", "moment.de"],
|
||||||
function (ClientLayer, LabelsLayer, L, moment, LocationMarker, rbush, helper) {
|
function (ClientLayer, LabelsLayer, L, moment, LocationMarker, rbush, helper) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -9,30 +9,6 @@ define(["map/clientlayer", "map/labelslayer",
|
|||||||
zoomControl: false
|
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({
|
var LocateButton = L.Control.extend({
|
||||||
options: {
|
options: {
|
||||||
position: "bottomright"
|
position: "bottomright"
|
||||||
@ -170,7 +146,6 @@ define(["map/clientlayer", "map/labelslayer",
|
|||||||
|
|
||||||
var map, userLocation;
|
var map, userLocation;
|
||||||
var layerControl;
|
var layerControl;
|
||||||
var customLayers = {};
|
|
||||||
var baseLayers = {};
|
var baseLayers = {};
|
||||||
|
|
||||||
var locateUserButton = new LocateButton(function (d) {
|
var locateUserButton = new LocateButton(function (d) {
|
||||||
@ -239,7 +214,6 @@ define(["map/clientlayer", "map/labelslayer",
|
|||||||
|
|
||||||
function showCoordinates(e) {
|
function showCoordinates(e) {
|
||||||
router.gotoLocation(e.latlng);
|
router.gotoLocation(e.latlng);
|
||||||
// window.prompt("Koordinaten (Lat, Lng)", e.latlng.lat.toFixed(9) + ", " + e.latlng.lng.toFixed(9))
|
|
||||||
disableCoords();
|
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() {
|
function contextMenuOpenLayerMenu() {
|
||||||
document.querySelector(".leaflet-control-layers").classList.add("leaflet-control-layers-expanded");
|
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) {
|
var layers = config.mapLayers.map(function (d) {
|
||||||
return {
|
return {
|
||||||
"name": d.name,
|
"name": d.name + "ak",
|
||||||
"layer": "url" in d ? L.tileLayer(d.url, d.config) : L.tileLayer.provider(d.name)
|
"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(locateUserButton);
|
||||||
addButton(showCoordsPickerButton);
|
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 = L.control.layers(baseLayers, [], {position: "bottomright"});
|
||||||
layerControl.addTo(map);
|
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});
|
var clientLayer = new ClientLayer({minZoom: 15});
|
||||||
clientLayer.addTo(map);
|
clientLayer.addTo(map);
|
||||||
clientLayer.setZIndex(5);
|
clientLayer.setZIndex(5);
|
||||||
|
Loading…
Reference in New Issue
Block a user