chore: include vendorized static dependencies
2
.github/workflows/test-docs.yml
vendored
|
@ -40,7 +40,7 @@ jobs:
|
|||
sudo apt update
|
||||
sudo apt install libgdal-dev
|
||||
python -m pip install --upgrade pip
|
||||
make develop installjs vendors
|
||||
make develop
|
||||
- name: run tests
|
||||
run: make test
|
||||
env:
|
||||
|
|
1
.gitignore
vendored
|
@ -4,7 +4,6 @@ umap/settings/local/*
|
|||
docs/_build
|
||||
umap/remote_static
|
||||
tmp/*
|
||||
umap/static/umap/vendors
|
||||
site/*
|
||||
.pytest_cache/
|
||||
node_modules
|
||||
|
|
15
Dockerfile
|
@ -1,17 +1,3 @@
|
|||
FROM node:alpine AS vendors
|
||||
|
||||
RUN apk add git
|
||||
|
||||
WORKDIR /srv/umap
|
||||
|
||||
COPY package.json .
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run vendors
|
||||
|
||||
# This part installs deps needed at runtime.
|
||||
FROM python:3.11-slim as common
|
||||
|
||||
|
@ -59,7 +45,6 @@ FROM common
|
|||
|
||||
COPY --from=build /srv/umap/docker/ /srv/umap/docker/
|
||||
COPY --from=build /venv/ /venv/
|
||||
COPY --from=vendors /srv/umap/umap/static/umap/vendors /srv/umap/static/umap/vendors
|
||||
|
||||
WORKDIR /srv/umap
|
||||
|
||||
|
|
|
@ -70,12 +70,6 @@ docker = [
|
|||
[project.scripts]
|
||||
umap = "umap.bin:main"
|
||||
|
||||
[tool.hatch.build]
|
||||
artifacts = [
|
||||
# Required because part of .gitignore (and thus excluded by hatch).
|
||||
"/umap/static/umap/vendors",
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.sdist]
|
||||
include = [
|
||||
"/umap",
|
||||
|
|
318
umap/static/umap/vendors/colorbrewer/colorbrewer.js
vendored
Normal file
|
@ -0,0 +1,318 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.colorbrewer = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
var index = {
|
||||
schemeGroups: {
|
||||
sequential: ["BuGn", "BuPu", "GnBu", "OrRd", "PuBu", "PuBuGn", "PuRd", "RdPu", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd"],
|
||||
singlehue: ["Blues", "Greens", "Greys", "Oranges", "Purples", "Reds"],
|
||||
diverging: ["BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral"],
|
||||
qualitative: ["Accent", "Dark2", "Paired", "Pastel1", "Pastel2", "Set1", "Set2", "Set3"]
|
||||
}, YlGn: {
|
||||
3: ["#f7fcb9", "#addd8e", "#31a354"],
|
||||
4: ["#ffffcc", "#c2e699", "#78c679", "#238443"],
|
||||
5: ["#ffffcc", "#c2e699", "#78c679", "#31a354", "#006837"],
|
||||
6: ["#ffffcc", "#d9f0a3", "#addd8e", "#78c679", "#31a354", "#006837"],
|
||||
7: ["#ffffcc", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#005a32"],
|
||||
8: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#005a32"],
|
||||
9: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"]
|
||||
}, YlGnBu: {
|
||||
3: ["#edf8b1", "#7fcdbb", "#2c7fb8"],
|
||||
4: ["#ffffcc", "#a1dab4", "#41b6c4", "#225ea8"],
|
||||
5: ["#ffffcc", "#a1dab4", "#41b6c4", "#2c7fb8", "#253494"],
|
||||
6: ["#ffffcc", "#c7e9b4", "#7fcdbb", "#41b6c4", "#2c7fb8", "#253494"],
|
||||
7: ["#ffffcc", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#0c2c84"],
|
||||
8: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#0c2c84"],
|
||||
9: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"]
|
||||
}, GnBu: {
|
||||
3: ["#e0f3db", "#a8ddb5", "#43a2ca"],
|
||||
4: ["#f0f9e8", "#bae4bc", "#7bccc4", "#2b8cbe"],
|
||||
5: ["#f0f9e8", "#bae4bc", "#7bccc4", "#43a2ca", "#0868ac"],
|
||||
6: ["#f0f9e8", "#ccebc5", "#a8ddb5", "#7bccc4", "#43a2ca", "#0868ac"],
|
||||
7: ["#f0f9e8", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#08589e"],
|
||||
8: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#08589e"],
|
||||
9: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"]
|
||||
}, BuGn: {
|
||||
3: ["#e5f5f9", "#99d8c9", "#2ca25f"],
|
||||
4: ["#edf8fb", "#b2e2e2", "#66c2a4", "#238b45"],
|
||||
5: ["#edf8fb", "#b2e2e2", "#66c2a4", "#2ca25f", "#006d2c"],
|
||||
6: ["#edf8fb", "#ccece6", "#99d8c9", "#66c2a4", "#2ca25f", "#006d2c"],
|
||||
7: ["#edf8fb", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#005824"],
|
||||
8: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#005824"],
|
||||
9: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"]
|
||||
}, PuBuGn: {
|
||||
3: ["#ece2f0", "#a6bddb", "#1c9099"],
|
||||
4: ["#f6eff7", "#bdc9e1", "#67a9cf", "#02818a"],
|
||||
5: ["#f6eff7", "#bdc9e1", "#67a9cf", "#1c9099", "#016c59"],
|
||||
6: ["#f6eff7", "#d0d1e6", "#a6bddb", "#67a9cf", "#1c9099", "#016c59"],
|
||||
7: ["#f6eff7", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016450"],
|
||||
8: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016450"],
|
||||
9: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"]
|
||||
}, PuBu: {
|
||||
3: ["#ece7f2", "#a6bddb", "#2b8cbe"],
|
||||
4: ["#f1eef6", "#bdc9e1", "#74a9cf", "#0570b0"],
|
||||
5: ["#f1eef6", "#bdc9e1", "#74a9cf", "#2b8cbe", "#045a8d"],
|
||||
6: ["#f1eef6", "#d0d1e6", "#a6bddb", "#74a9cf", "#2b8cbe", "#045a8d"],
|
||||
7: ["#f1eef6", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#034e7b"],
|
||||
8: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#034e7b"],
|
||||
9: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"]
|
||||
}, BuPu: {
|
||||
3: ["#e0ecf4", "#9ebcda", "#8856a7"],
|
||||
4: ["#edf8fb", "#b3cde3", "#8c96c6", "#88419d"],
|
||||
5: ["#edf8fb", "#b3cde3", "#8c96c6", "#8856a7", "#810f7c"],
|
||||
6: ["#edf8fb", "#bfd3e6", "#9ebcda", "#8c96c6", "#8856a7", "#810f7c"],
|
||||
7: ["#edf8fb", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#6e016b"],
|
||||
8: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#6e016b"],
|
||||
9: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"]
|
||||
}, RdPu: {
|
||||
3: ["#fde0dd", "#fa9fb5", "#c51b8a"],
|
||||
4: ["#feebe2", "#fbb4b9", "#f768a1", "#ae017e"],
|
||||
5: ["#feebe2", "#fbb4b9", "#f768a1", "#c51b8a", "#7a0177"],
|
||||
6: ["#feebe2", "#fcc5c0", "#fa9fb5", "#f768a1", "#c51b8a", "#7a0177"],
|
||||
7: ["#feebe2", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177"],
|
||||
8: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177"],
|
||||
9: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"]
|
||||
}, PuRd: {
|
||||
3: ["#e7e1ef", "#c994c7", "#dd1c77"],
|
||||
4: ["#f1eef6", "#d7b5d8", "#df65b0", "#ce1256"],
|
||||
5: ["#f1eef6", "#d7b5d8", "#df65b0", "#dd1c77", "#980043"],
|
||||
6: ["#f1eef6", "#d4b9da", "#c994c7", "#df65b0", "#dd1c77", "#980043"],
|
||||
7: ["#f1eef6", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#91003f"],
|
||||
8: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#91003f"],
|
||||
9: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"]
|
||||
}, OrRd: {
|
||||
3: ["#fee8c8", "#fdbb84", "#e34a33"],
|
||||
4: ["#fef0d9", "#fdcc8a", "#fc8d59", "#d7301f"],
|
||||
5: ["#fef0d9", "#fdcc8a", "#fc8d59", "#e34a33", "#b30000"],
|
||||
6: ["#fef0d9", "#fdd49e", "#fdbb84", "#fc8d59", "#e34a33", "#b30000"],
|
||||
7: ["#fef0d9", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#990000"],
|
||||
8: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#990000"],
|
||||
9: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"]
|
||||
}, YlOrRd: {
|
||||
3: ["#ffeda0", "#feb24c", "#f03b20"],
|
||||
4: ["#ffffb2", "#fecc5c", "#fd8d3c", "#e31a1c"],
|
||||
5: ["#ffffb2", "#fecc5c", "#fd8d3c", "#f03b20", "#bd0026"],
|
||||
6: ["#ffffb2", "#fed976", "#feb24c", "#fd8d3c", "#f03b20", "#bd0026"],
|
||||
7: ["#ffffb2", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#b10026"],
|
||||
8: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#b10026"],
|
||||
9: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"]
|
||||
}, YlOrBr: {
|
||||
3: ["#fff7bc", "#fec44f", "#d95f0e"],
|
||||
4: ["#ffffd4", "#fed98e", "#fe9929", "#cc4c02"],
|
||||
5: ["#ffffd4", "#fed98e", "#fe9929", "#d95f0e", "#993404"],
|
||||
6: ["#ffffd4", "#fee391", "#fec44f", "#fe9929", "#d95f0e", "#993404"],
|
||||
7: ["#ffffd4", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#8c2d04"],
|
||||
8: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#8c2d04"],
|
||||
9: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"]
|
||||
}, Purples: {
|
||||
3: ["#efedf5", "#bcbddc", "#756bb1"],
|
||||
4: ["#f2f0f7", "#cbc9e2", "#9e9ac8", "#6a51a3"],
|
||||
5: ["#f2f0f7", "#cbc9e2", "#9e9ac8", "#756bb1", "#54278f"],
|
||||
6: ["#f2f0f7", "#dadaeb", "#bcbddc", "#9e9ac8", "#756bb1", "#54278f"],
|
||||
7: ["#f2f0f7", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#4a1486"],
|
||||
8: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#4a1486"],
|
||||
9: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"]
|
||||
}, Blues: {
|
||||
3: ["#deebf7", "#9ecae1", "#3182bd"],
|
||||
4: ["#eff3ff", "#bdd7e7", "#6baed6", "#2171b5"],
|
||||
5: ["#eff3ff", "#bdd7e7", "#6baed6", "#3182bd", "#08519c"],
|
||||
6: ["#eff3ff", "#c6dbef", "#9ecae1", "#6baed6", "#3182bd", "#08519c"],
|
||||
7: ["#eff3ff", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#084594"],
|
||||
8: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#084594"],
|
||||
9: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"]
|
||||
}, Greens: {
|
||||
3: ["#e5f5e0", "#a1d99b", "#31a354"],
|
||||
4: ["#edf8e9", "#bae4b3", "#74c476", "#238b45"],
|
||||
5: ["#edf8e9", "#bae4b3", "#74c476", "#31a354", "#006d2c"],
|
||||
6: ["#edf8e9", "#c7e9c0", "#a1d99b", "#74c476", "#31a354", "#006d2c"],
|
||||
7: ["#edf8e9", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#005a32"],
|
||||
8: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#005a32"],
|
||||
9: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"]
|
||||
}, Oranges: {
|
||||
3: ["#fee6ce", "#fdae6b", "#e6550d"],
|
||||
4: ["#feedde", "#fdbe85", "#fd8d3c", "#d94701"],
|
||||
5: ["#feedde", "#fdbe85", "#fd8d3c", "#e6550d", "#a63603"],
|
||||
6: ["#feedde", "#fdd0a2", "#fdae6b", "#fd8d3c", "#e6550d", "#a63603"],
|
||||
7: ["#feedde", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#8c2d04"],
|
||||
8: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#8c2d04"],
|
||||
9: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"]
|
||||
}, Reds: {
|
||||
3: ["#fee0d2", "#fc9272", "#de2d26"],
|
||||
4: ["#fee5d9", "#fcae91", "#fb6a4a", "#cb181d"],
|
||||
5: ["#fee5d9", "#fcae91", "#fb6a4a", "#de2d26", "#a50f15"],
|
||||
6: ["#fee5d9", "#fcbba1", "#fc9272", "#fb6a4a", "#de2d26", "#a50f15"],
|
||||
7: ["#fee5d9", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#99000d"],
|
||||
8: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#99000d"],
|
||||
9: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"]
|
||||
}, Greys: {
|
||||
3: ["#f0f0f0", "#bdbdbd", "#636363"],
|
||||
4: ["#f7f7f7", "#cccccc", "#969696", "#525252"],
|
||||
5: ["#f7f7f7", "#cccccc", "#969696", "#636363", "#252525"],
|
||||
6: ["#f7f7f7", "#d9d9d9", "#bdbdbd", "#969696", "#636363", "#252525"],
|
||||
7: ["#f7f7f7", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525"],
|
||||
8: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525"],
|
||||
9: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"]
|
||||
}, PuOr: {
|
||||
3: ["#f1a340", "#f7f7f7", "#998ec3"],
|
||||
4: ["#e66101", "#fdb863", "#b2abd2", "#5e3c99"],
|
||||
5: ["#e66101", "#fdb863", "#f7f7f7", "#b2abd2", "#5e3c99"],
|
||||
6: ["#b35806", "#f1a340", "#fee0b6", "#d8daeb", "#998ec3", "#542788"],
|
||||
7: ["#b35806", "#f1a340", "#fee0b6", "#f7f7f7", "#d8daeb", "#998ec3", "#542788"],
|
||||
8: ["#b35806", "#e08214", "#fdb863", "#fee0b6", "#d8daeb", "#b2abd2", "#8073ac", "#542788"],
|
||||
9: ["#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788"],
|
||||
10: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"],
|
||||
11: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"]
|
||||
}, BrBG: {
|
||||
3: ["#d8b365", "#f5f5f5", "#5ab4ac"],
|
||||
4: ["#a6611a", "#dfc27d", "#80cdc1", "#018571"],
|
||||
5: ["#a6611a", "#dfc27d", "#f5f5f5", "#80cdc1", "#018571"],
|
||||
6: ["#8c510a", "#d8b365", "#f6e8c3", "#c7eae5", "#5ab4ac", "#01665e"],
|
||||
7: ["#8c510a", "#d8b365", "#f6e8c3", "#f5f5f5", "#c7eae5", "#5ab4ac", "#01665e"],
|
||||
8: ["#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#c7eae5", "#80cdc1", "#35978f", "#01665e"],
|
||||
9: ["#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e"],
|
||||
10: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"],
|
||||
11: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"]
|
||||
}, PRGn: {
|
||||
3: ["#af8dc3", "#f7f7f7", "#7fbf7b"],
|
||||
4: ["#7b3294", "#c2a5cf", "#a6dba0", "#008837"],
|
||||
5: ["#7b3294", "#c2a5cf", "#f7f7f7", "#a6dba0", "#008837"],
|
||||
6: ["#762a83", "#af8dc3", "#e7d4e8", "#d9f0d3", "#7fbf7b", "#1b7837"],
|
||||
7: ["#762a83", "#af8dc3", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#7fbf7b", "#1b7837"],
|
||||
8: ["#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837"],
|
||||
9: ["#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837"],
|
||||
10: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"],
|
||||
11: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"]
|
||||
}, PiYG: {
|
||||
3: ["#e9a3c9", "#f7f7f7", "#a1d76a"],
|
||||
4: ["#d01c8b", "#f1b6da", "#b8e186", "#4dac26"],
|
||||
5: ["#d01c8b", "#f1b6da", "#f7f7f7", "#b8e186", "#4dac26"],
|
||||
6: ["#c51b7d", "#e9a3c9", "#fde0ef", "#e6f5d0", "#a1d76a", "#4d9221"],
|
||||
7: ["#c51b7d", "#e9a3c9", "#fde0ef", "#f7f7f7", "#e6f5d0", "#a1d76a", "#4d9221"],
|
||||
8: ["#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221"],
|
||||
9: ["#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221"],
|
||||
10: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"],
|
||||
11: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"]
|
||||
}, RdBu: {
|
||||
3: ["#ef8a62", "#f7f7f7", "#67a9cf"],
|
||||
4: ["#ca0020", "#f4a582", "#92c5de", "#0571b0"],
|
||||
5: ["#ca0020", "#f4a582", "#f7f7f7", "#92c5de", "#0571b0"],
|
||||
6: ["#b2182b", "#ef8a62", "#fddbc7", "#d1e5f0", "#67a9cf", "#2166ac"],
|
||||
7: ["#b2182b", "#ef8a62", "#fddbc7", "#f7f7f7", "#d1e5f0", "#67a9cf", "#2166ac"],
|
||||
8: ["#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac"],
|
||||
9: ["#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac"],
|
||||
10: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"],
|
||||
11: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"]
|
||||
}, RdGy: {
|
||||
3: ["#ef8a62", "#ffffff", "#999999"],
|
||||
4: ["#ca0020", "#f4a582", "#bababa", "#404040"],
|
||||
5: ["#ca0020", "#f4a582", "#ffffff", "#bababa", "#404040"],
|
||||
6: ["#b2182b", "#ef8a62", "#fddbc7", "#e0e0e0", "#999999", "#4d4d4d"],
|
||||
7: ["#b2182b", "#ef8a62", "#fddbc7", "#ffffff", "#e0e0e0", "#999999", "#4d4d4d"],
|
||||
8: ["#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#e0e0e0", "#bababa", "#878787", "#4d4d4d"],
|
||||
9: ["#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d"],
|
||||
10: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"],
|
||||
11: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"]
|
||||
}, RdYlBu: {
|
||||
3: ["#fc8d59", "#ffffbf", "#91bfdb"],
|
||||
4: ["#d7191c", "#fdae61", "#abd9e9", "#2c7bb6"],
|
||||
5: ["#d7191c", "#fdae61", "#ffffbf", "#abd9e9", "#2c7bb6"],
|
||||
6: ["#d73027", "#fc8d59", "#fee090", "#e0f3f8", "#91bfdb", "#4575b4"],
|
||||
7: ["#d73027", "#fc8d59", "#fee090", "#ffffbf", "#e0f3f8", "#91bfdb", "#4575b4"],
|
||||
8: ["#d73027", "#f46d43", "#fdae61", "#fee090", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4"],
|
||||
9: ["#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4"],
|
||||
10: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"],
|
||||
11: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"]
|
||||
}, Spectral: {
|
||||
3: ["#fc8d59", "#ffffbf", "#99d594"],
|
||||
4: ["#d7191c", "#fdae61", "#abdda4", "#2b83ba"],
|
||||
5: ["#d7191c", "#fdae61", "#ffffbf", "#abdda4", "#2b83ba"],
|
||||
6: ["#d53e4f", "#fc8d59", "#fee08b", "#e6f598", "#99d594", "#3288bd"],
|
||||
7: ["#d53e4f", "#fc8d59", "#fee08b", "#ffffbf", "#e6f598", "#99d594", "#3288bd"],
|
||||
8: ["#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#e6f598", "#abdda4", "#66c2a5", "#3288bd"],
|
||||
9: ["#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd"],
|
||||
10: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"],
|
||||
11: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"]
|
||||
}, RdYlGn: {
|
||||
3: ["#fc8d59", "#ffffbf", "#91cf60"],
|
||||
4: ["#d7191c", "#fdae61", "#a6d96a", "#1a9641"],
|
||||
5: ["#d7191c", "#fdae61", "#ffffbf", "#a6d96a", "#1a9641"],
|
||||
6: ["#d73027", "#fc8d59", "#fee08b", "#d9ef8b", "#91cf60", "#1a9850"],
|
||||
7: ["#d73027", "#fc8d59", "#fee08b", "#ffffbf", "#d9ef8b", "#91cf60", "#1a9850"],
|
||||
8: ["#d73027", "#f46d43", "#fdae61", "#fee08b", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850"],
|
||||
9: ["#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850"],
|
||||
10: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"],
|
||||
11: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"]
|
||||
}, Accent: {
|
||||
3: ["#7fc97f", "#beaed4", "#fdc086"],
|
||||
4: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99"],
|
||||
5: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0"],
|
||||
6: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f"],
|
||||
7: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17"],
|
||||
8: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"]
|
||||
}, Dark2: {
|
||||
3: ["#1b9e77", "#d95f02", "#7570b3"],
|
||||
4: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a"],
|
||||
5: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e"],
|
||||
6: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02"],
|
||||
7: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d"],
|
||||
8: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"]
|
||||
}, Paired: {
|
||||
3: ["#a6cee3", "#1f78b4", "#b2df8a"],
|
||||
4: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c"],
|
||||
5: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99"],
|
||||
6: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c"],
|
||||
7: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f"],
|
||||
8: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00"],
|
||||
9: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6"],
|
||||
10: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a"],
|
||||
11: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99"],
|
||||
12: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"]
|
||||
}, Pastel1: {
|
||||
3: ["#fbb4ae", "#b3cde3", "#ccebc5"],
|
||||
4: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4"],
|
||||
5: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6"],
|
||||
6: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc"],
|
||||
7: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd"],
|
||||
8: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec"],
|
||||
9: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"]
|
||||
}, Pastel2: {
|
||||
3: ["#b3e2cd", "#fdcdac", "#cbd5e8"],
|
||||
4: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4"],
|
||||
5: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9"],
|
||||
6: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae"],
|
||||
7: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc"],
|
||||
8: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"]
|
||||
}, Set1: {
|
||||
3: ["#e41a1c", "#377eb8", "#4daf4a"],
|
||||
4: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3"],
|
||||
5: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00"],
|
||||
6: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33"],
|
||||
7: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628"],
|
||||
8: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf"],
|
||||
9: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"]
|
||||
}, Set2: {
|
||||
3: ["#66c2a5", "#fc8d62", "#8da0cb"],
|
||||
4: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3"],
|
||||
5: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854"],
|
||||
6: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f"],
|
||||
7: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494"],
|
||||
8: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"]
|
||||
}, Set3: {
|
||||
3: ["#8dd3c7", "#ffffb3", "#bebada"],
|
||||
4: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072"],
|
||||
5: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3"],
|
||||
6: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462"],
|
||||
7: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69"],
|
||||
8: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5"],
|
||||
9: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9"],
|
||||
10: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd"],
|
||||
11: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5"],
|
||||
12: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"]
|
||||
}
|
||||
};
|
||||
|
||||
return index;
|
||||
|
||||
})));
|
1
umap/static/umap/vendors/contextmenu/leaflet.contextmenu.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.leaflet-contextmenu{display:none;box-shadow:0 1px 7px rgba(0,0,0,0.4);-webkit-border-radius:4px;border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.leaflet-contextmenu a.leaflet-contextmenu-item{display:block;color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;outline:0}.leaflet-contextmenu a.leaflet-contextmenu-item-disabled{opacity:.5}.leaflet-contextmenu a.leaflet-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.leaflet-contextmenu a.leaflet-contextmenu-item-disabled.over{background-color:inherit;border-top:1px solid transparent;border-bottom:1px solid transparent}.leaflet-contextmenu-icon{margin:2px 8px 0 0;width:16px;height:16px;float:left;border:0}.leaflet-contextmenu-separator{border-bottom:1px solid #ccc;margin:5px 0}
|
7
umap/static/umap/vendors/contextmenu/leaflet.contextmenu.min.js
vendored
Normal file
542
umap/static/umap/vendors/csv2geojson/csv2geojson.js
vendored
Normal file
|
@ -0,0 +1,542 @@
|
|||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.csv2geojson = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var dsv = require('d3-dsv'),
|
||||
sexagesimal = require('@mapbox/sexagesimal');
|
||||
|
||||
var latRegex = /(Lat)(itude)?/gi,
|
||||
lonRegex = /(L)(on|ng)(gitude)?/i;
|
||||
|
||||
function guessHeader(row, regexp) {
|
||||
var name, match, score;
|
||||
for (var f in row) {
|
||||
match = f.match(regexp);
|
||||
if (match && (!name || match[0].length / f.length > score)) {
|
||||
score = match[0].length / f.length;
|
||||
name = f;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
function guessLatHeader(row) { return guessHeader(row, latRegex); }
|
||||
function guessLonHeader(row) { return guessHeader(row, lonRegex); }
|
||||
|
||||
function isLat(f) { return !!f.match(latRegex); }
|
||||
function isLon(f) { return !!f.match(lonRegex); }
|
||||
|
||||
function keyCount(o) {
|
||||
return (typeof o == 'object') ? Object.keys(o).length : 0;
|
||||
}
|
||||
|
||||
function autoDelimiter(x) {
|
||||
var delimiters = [',', ';', '\t', '|'];
|
||||
var results = [];
|
||||
|
||||
delimiters.forEach(function (delimiter) {
|
||||
var res = dsv.dsvFormat(delimiter).parse(x);
|
||||
if (res.length >= 1) {
|
||||
var count = keyCount(res[0]);
|
||||
for (var i = 0; i < res.length; i++) {
|
||||
if (keyCount(res[i]) !== count) return;
|
||||
}
|
||||
results.push({
|
||||
delimiter: delimiter,
|
||||
arity: Object.keys(res[0]).length,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (results.length) {
|
||||
return results.sort(function (a, b) {
|
||||
return b.arity - a.arity;
|
||||
})[0].delimiter;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Silly stopgap for dsv to d3-dsv upgrade
|
||||
*
|
||||
* @param {Array} x dsv output
|
||||
* @returns {Array} array without columns member
|
||||
*/
|
||||
function deleteColumns(x) {
|
||||
delete x.columns;
|
||||
return x;
|
||||
}
|
||||
|
||||
function auto(x) {
|
||||
var delimiter = autoDelimiter(x);
|
||||
if (!delimiter) return null;
|
||||
return deleteColumns(dsv.dsvFormat(delimiter).parse(x));
|
||||
}
|
||||
|
||||
function csv2geojson(x, options, callback) {
|
||||
|
||||
if (!callback) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
options.delimiter = options.delimiter || ',';
|
||||
|
||||
var latfield = options.latfield || '',
|
||||
lonfield = options.lonfield || '',
|
||||
crs = options.crs || '';
|
||||
|
||||
var features = [],
|
||||
featurecollection = {type: 'FeatureCollection', features: features};
|
||||
|
||||
if (crs !== '') {
|
||||
featurecollection.crs = {type: 'name', properties: {name: crs}};
|
||||
}
|
||||
|
||||
if (options.delimiter === 'auto' && typeof x == 'string') {
|
||||
options.delimiter = autoDelimiter(x);
|
||||
if (!options.delimiter) {
|
||||
callback({
|
||||
type: 'Error',
|
||||
message: 'Could not autodetect delimiter'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var numericFields = options.numericFields ? options.numericFields.split(',') : null;
|
||||
|
||||
var parsed = (typeof x == 'string') ?
|
||||
dsv.dsvFormat(options.delimiter).parse(x, function (d) {
|
||||
if (numericFields) {
|
||||
for (var key in d) {
|
||||
if (numericFields.includes(key)) {
|
||||
d[key] = +d[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}) : x;
|
||||
|
||||
if (!parsed.length) {
|
||||
callback(null, featurecollection);
|
||||
return;
|
||||
}
|
||||
|
||||
var errors = [];
|
||||
var i;
|
||||
|
||||
|
||||
if (!latfield) latfield = guessLatHeader(parsed[0]);
|
||||
if (!lonfield) lonfield = guessLonHeader(parsed[0]);
|
||||
var noGeometry = (!latfield || !lonfield);
|
||||
|
||||
if (noGeometry) {
|
||||
for (i = 0; i < parsed.length; i++) {
|
||||
features.push({
|
||||
type: 'Feature',
|
||||
properties: parsed[i],
|
||||
geometry: null
|
||||
});
|
||||
}
|
||||
callback(errors.length ? errors : null, featurecollection);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < parsed.length; i++) {
|
||||
if (parsed[i][lonfield] !== undefined &&
|
||||
parsed[i][latfield] !== undefined) {
|
||||
|
||||
var lonk = parsed[i][lonfield],
|
||||
latk = parsed[i][latfield],
|
||||
lonf, latf,
|
||||
a;
|
||||
|
||||
a = sexagesimal(lonk, 'EW');
|
||||
if (a) lonk = a;
|
||||
a = sexagesimal(latk, 'NS');
|
||||
if (a) latk = a;
|
||||
|
||||
lonf = parseFloat(lonk);
|
||||
latf = parseFloat(latk);
|
||||
|
||||
if (isNaN(lonf) ||
|
||||
isNaN(latf)) {
|
||||
errors.push({
|
||||
message: 'A row contained an invalid value for latitude or longitude',
|
||||
row: parsed[i],
|
||||
index: i
|
||||
});
|
||||
} else {
|
||||
if (!options.includeLatLon) {
|
||||
delete parsed[i][lonfield];
|
||||
delete parsed[i][latfield];
|
||||
}
|
||||
|
||||
features.push({
|
||||
type: 'Feature',
|
||||
properties: parsed[i],
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [
|
||||
parseFloat(lonf),
|
||||
parseFloat(latf)
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callback(errors.length ? errors : null, featurecollection);
|
||||
}
|
||||
|
||||
function toLine(gj) {
|
||||
var features = gj.features;
|
||||
var line = {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'LineString',
|
||||
coordinates: []
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
line.geometry.coordinates.push(features[i].geometry.coordinates);
|
||||
}
|
||||
line.properties = features.reduce(function (aggregatedProperties, newFeature) {
|
||||
for (var key in newFeature.properties) {
|
||||
if (!aggregatedProperties[key]) {
|
||||
aggregatedProperties[key] = [];
|
||||
}
|
||||
aggregatedProperties[key].push(newFeature.properties[key]);
|
||||
}
|
||||
return aggregatedProperties;
|
||||
}, {});
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: [line]
|
||||
};
|
||||
}
|
||||
|
||||
function toPolygon(gj) {
|
||||
var features = gj.features;
|
||||
var poly = {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [[]]
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
poly.geometry.coordinates[0].push(features[i].geometry.coordinates);
|
||||
}
|
||||
poly.properties = features.reduce(function (aggregatedProperties, newFeature) {
|
||||
for (var key in newFeature.properties) {
|
||||
if (!aggregatedProperties[key]) {
|
||||
aggregatedProperties[key] = [];
|
||||
}
|
||||
aggregatedProperties[key].push(newFeature.properties[key]);
|
||||
}
|
||||
return aggregatedProperties;
|
||||
}, {});
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: [poly]
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isLon: isLon,
|
||||
isLat: isLat,
|
||||
guessLatHeader: guessLatHeader,
|
||||
guessLonHeader: guessLonHeader,
|
||||
csv: dsv.csvParse,
|
||||
tsv: dsv.tsvParse,
|
||||
dsv: dsv,
|
||||
auto: auto,
|
||||
csv2geojson: csv2geojson,
|
||||
toLine: toLine,
|
||||
toPolygon: toPolygon
|
||||
};
|
||||
|
||||
},{"@mapbox/sexagesimal":2,"d3-dsv":3}],2:[function(require,module,exports){
|
||||
module.exports = element;
|
||||
module.exports.pair = pair;
|
||||
module.exports.format = format;
|
||||
module.exports.formatPair = formatPair;
|
||||
module.exports.coordToDMS = coordToDMS;
|
||||
|
||||
|
||||
function element(input, dims) {
|
||||
var result = search(input, dims);
|
||||
return (result === null) ? null : result.val;
|
||||
}
|
||||
|
||||
|
||||
function formatPair(input) {
|
||||
return format(input.lat, 'lat') + ' ' + format(input.lon, 'lon');
|
||||
}
|
||||
|
||||
|
||||
// Is 0 North or South?
|
||||
function format(input, dim) {
|
||||
var dms = coordToDMS(input, dim);
|
||||
return dms.whole + '° ' +
|
||||
(dms.minutes ? dms.minutes + '\' ' : '') +
|
||||
(dms.seconds ? dms.seconds + '" ' : '') + dms.dir;
|
||||
}
|
||||
|
||||
|
||||
function coordToDMS(input, dim) {
|
||||
var dirs = { lat: ['N', 'S'], lon: ['E', 'W'] }[dim] || '';
|
||||
var dir = dirs[input >= 0 ? 0 : 1];
|
||||
var abs = Math.abs(input);
|
||||
var whole = Math.floor(abs);
|
||||
var fraction = abs - whole;
|
||||
var fractionMinutes = fraction * 60;
|
||||
var minutes = Math.floor(fractionMinutes);
|
||||
var seconds = Math.floor((fractionMinutes - minutes) * 60);
|
||||
|
||||
return {
|
||||
whole: whole,
|
||||
minutes: minutes,
|
||||
seconds: seconds,
|
||||
dir: dir
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function search(input, dims) {
|
||||
if (!dims) dims = 'NSEW';
|
||||
if (typeof input !== 'string') return null;
|
||||
|
||||
input = input.toUpperCase();
|
||||
var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
|
||||
|
||||
var m = input.match(regex);
|
||||
if (!m) return null; // no match
|
||||
|
||||
var matched = m[0];
|
||||
|
||||
// extract dimension.. m[1] = leading, m[5] = trailing
|
||||
var dim;
|
||||
if (m[1] && m[5]) { // if matched both..
|
||||
dim = m[1]; // keep leading
|
||||
matched = matched.slice(0, -1); // remove trailing dimension from match
|
||||
} else {
|
||||
dim = m[1] || m[5];
|
||||
}
|
||||
|
||||
// if unrecognized dimension
|
||||
if (dim && dims.indexOf(dim) === -1) return null;
|
||||
|
||||
// extract DMS
|
||||
var deg = m[2] ? parseFloat(m[2]) : 0;
|
||||
var min = m[3] ? parseFloat(m[3]) / 60 : 0;
|
||||
var sec = m[4] ? parseFloat(m[4]) / 3600 : 0;
|
||||
var sign = (deg < 0) ? -1 : 1;
|
||||
if (dim === 'S' || dim === 'W') sign *= -1;
|
||||
|
||||
return {
|
||||
val: (Math.abs(deg) + min + sec) * sign,
|
||||
dim: dim,
|
||||
matched: matched,
|
||||
remain: input.slice(matched.length)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function pair(input, dims) {
|
||||
input = input.trim();
|
||||
var one = search(input, dims);
|
||||
if (!one) return null;
|
||||
|
||||
input = one.remain.trim();
|
||||
var two = search(input, dims);
|
||||
if (!two || two.remain) return null;
|
||||
|
||||
if (one.dim) {
|
||||
return swapdim(one.val, two.val, one.dim);
|
||||
} else {
|
||||
return [one.val, two.val];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function swapdim(a, b, dim) {
|
||||
if (dim === 'N' || dim === 'S') return [a, b];
|
||||
if (dim === 'W' || dim === 'E') return [b, a];
|
||||
}
|
||||
|
||||
},{}],3:[function(require,module,exports){
|
||||
// https://d3js.org/d3-dsv/ Version 1.0.1. Copyright 2016 Mike Bostock.
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.d3 = global.d3 || {})));
|
||||
}(this, function (exports) { 'use strict';
|
||||
|
||||
function objectConverter(columns) {
|
||||
return new Function("d", "return {" + columns.map(function(name, i) {
|
||||
return JSON.stringify(name) + ": d[" + i + "]";
|
||||
}).join(",") + "}");
|
||||
}
|
||||
|
||||
function customConverter(columns, f) {
|
||||
var object = objectConverter(columns);
|
||||
return function(row, i) {
|
||||
return f(object(row), i, columns);
|
||||
};
|
||||
}
|
||||
|
||||
// Compute unique columns in order of discovery.
|
||||
function inferColumns(rows) {
|
||||
var columnSet = Object.create(null),
|
||||
columns = [];
|
||||
|
||||
rows.forEach(function(row) {
|
||||
for (var column in row) {
|
||||
if (!(column in columnSet)) {
|
||||
columns.push(columnSet[column] = column);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
function dsv(delimiter) {
|
||||
var reFormat = new RegExp("[\"" + delimiter + "\n]"),
|
||||
delimiterCode = delimiter.charCodeAt(0);
|
||||
|
||||
function parse(text, f) {
|
||||
var convert, columns, rows = parseRows(text, function(row, i) {
|
||||
if (convert) return convert(row, i - 1);
|
||||
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
|
||||
});
|
||||
rows.columns = columns;
|
||||
return rows;
|
||||
}
|
||||
|
||||
function parseRows(text, f) {
|
||||
var EOL = {}, // sentinel value for end-of-line
|
||||
EOF = {}, // sentinel value for end-of-file
|
||||
rows = [], // output rows
|
||||
N = text.length,
|
||||
I = 0, // current character index
|
||||
n = 0, // the current line number
|
||||
t, // the current token
|
||||
eol; // is the current token followed by EOL?
|
||||
|
||||
function token() {
|
||||
if (I >= N) return EOF; // special case: end of file
|
||||
if (eol) return eol = false, EOL; // special case: end of line
|
||||
|
||||
// special case: quotes
|
||||
var j = I, c;
|
||||
if (text.charCodeAt(j) === 34) {
|
||||
var i = j;
|
||||
while (i++ < N) {
|
||||
if (text.charCodeAt(i) === 34) {
|
||||
if (text.charCodeAt(i + 1) !== 34) break;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
I = i + 2;
|
||||
c = text.charCodeAt(i + 1);
|
||||
if (c === 13) {
|
||||
eol = true;
|
||||
if (text.charCodeAt(i + 2) === 10) ++I;
|
||||
} else if (c === 10) {
|
||||
eol = true;
|
||||
}
|
||||
return text.slice(j + 1, i).replace(/""/g, "\"");
|
||||
}
|
||||
|
||||
// common case: find next delimiter or newline
|
||||
while (I < N) {
|
||||
var k = 1;
|
||||
c = text.charCodeAt(I++);
|
||||
if (c === 10) eol = true; // \n
|
||||
else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
|
||||
else if (c !== delimiterCode) continue;
|
||||
return text.slice(j, I - k);
|
||||
}
|
||||
|
||||
// special case: last token before EOF
|
||||
return text.slice(j);
|
||||
}
|
||||
|
||||
while ((t = token()) !== EOF) {
|
||||
var a = [];
|
||||
while (t !== EOL && t !== EOF) {
|
||||
a.push(t);
|
||||
t = token();
|
||||
}
|
||||
if (f && (a = f(a, n++)) == null) continue;
|
||||
rows.push(a);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
function format(rows, columns) {
|
||||
if (columns == null) columns = inferColumns(rows);
|
||||
return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
|
||||
return columns.map(function(column) {
|
||||
return formatValue(row[column]);
|
||||
}).join(delimiter);
|
||||
})).join("\n");
|
||||
}
|
||||
|
||||
function formatRows(rows) {
|
||||
return rows.map(formatRow).join("\n");
|
||||
}
|
||||
|
||||
function formatRow(row) {
|
||||
return row.map(formatValue).join(delimiter);
|
||||
}
|
||||
|
||||
function formatValue(text) {
|
||||
return text == null ? ""
|
||||
: reFormat.test(text += "") ? "\"" + text.replace(/\"/g, "\"\"") + "\""
|
||||
: text;
|
||||
}
|
||||
|
||||
return {
|
||||
parse: parse,
|
||||
parseRows: parseRows,
|
||||
format: format,
|
||||
formatRows: formatRows
|
||||
};
|
||||
}
|
||||
|
||||
var csv = dsv(",");
|
||||
|
||||
var csvParse = csv.parse;
|
||||
var csvParseRows = csv.parseRows;
|
||||
var csvFormat = csv.format;
|
||||
var csvFormatRows = csv.formatRows;
|
||||
|
||||
var tsv = dsv("\t");
|
||||
|
||||
var tsvParse = tsv.parse;
|
||||
var tsvParseRows = tsv.parseRows;
|
||||
var tsvFormat = tsv.format;
|
||||
var tsvFormatRows = tsv.formatRows;
|
||||
|
||||
exports.dsvFormat = dsv;
|
||||
exports.csvParse = csvParse;
|
||||
exports.csvParseRows = csvParseRows;
|
||||
exports.csvFormat = csvFormat;
|
||||
exports.csvFormatRows = csvFormatRows;
|
||||
exports.tsvParse = tsvParse;
|
||||
exports.tsvParseRows = tsvParseRows;
|
||||
exports.tsvFormat = tsvFormat;
|
||||
exports.tsvFormatRows = tsvFormatRows;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
},{}]},{},[1])(1)
|
||||
});
|
1555
umap/static/umap/vendors/dompurify/purify.es.js
vendored
Normal file
1
umap/static/umap/vendors/dompurify/purify.es.mjs.map
vendored
Normal file
1946
umap/static/umap/vendors/editable/Leaflet.Editable.js
vendored
Normal file
138
umap/static/umap/vendors/editable/Path.Drag.js
vendored
Normal file
|
@ -0,0 +1,138 @@
|
|||
'use strict';
|
||||
|
||||
/* A Draggable that does not update the element position
|
||||
and takes care of only bubbling to targetted path in Canvas mode. */
|
||||
L.PathDraggable = L.Draggable.extend({
|
||||
|
||||
initialize: function (path) {
|
||||
this._path = path;
|
||||
this._canvas = (path._map.getRenderer(path) instanceof L.Canvas);
|
||||
var element = this._canvas ? this._path._map.getRenderer(this._path)._container : this._path._path;
|
||||
L.Draggable.prototype.initialize.call(this, element, element, true);
|
||||
},
|
||||
|
||||
_updatePosition: function () {
|
||||
var e = {originalEvent: this._lastEvent};
|
||||
this.fire('drag', e);
|
||||
},
|
||||
|
||||
_onDown: function (e) {
|
||||
var first = e.touches ? e.touches[0] : e;
|
||||
this._startPoint = new L.Point(first.clientX, first.clientY);
|
||||
if (this._canvas && !this._path._containsPoint(this._path._map.mouseEventToLayerPoint(first))) { return; }
|
||||
L.Draggable.prototype._onDown.call(this, e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
L.Handler.PathDrag = L.Handler.extend({
|
||||
|
||||
initialize: function (path) {
|
||||
this._path = path;
|
||||
},
|
||||
|
||||
getEvents: function () {
|
||||
return {
|
||||
dragstart: this._onDragStart,
|
||||
drag: this._onDrag,
|
||||
dragend: this._onDragEnd
|
||||
};
|
||||
},
|
||||
|
||||
addHooks: function () {
|
||||
if (!this._draggable) { this._draggable = new L.PathDraggable(this._path); }
|
||||
this._draggable.on(this.getEvents(), this).enable();
|
||||
L.DomUtil.addClass(this._draggable._element, 'leaflet-path-draggable');
|
||||
},
|
||||
|
||||
removeHooks: function () {
|
||||
this._draggable.off(this.getEvents(), this).disable();
|
||||
L.DomUtil.removeClass(this._draggable._element, 'leaflet-path-draggable');
|
||||
},
|
||||
|
||||
moved: function () {
|
||||
return this._draggable && this._draggable._moved;
|
||||
},
|
||||
|
||||
_onDragStart: function () {
|
||||
this._startPoint = this._draggable._startPoint;
|
||||
this._path
|
||||
.closePopup()
|
||||
.fire('movestart')
|
||||
.fire('dragstart');
|
||||
},
|
||||
|
||||
_onDrag: function (e) {
|
||||
var path = this._path,
|
||||
event = (e.originalEvent.touches && e.originalEvent.touches.length === 1 ? e.originalEvent.touches[0] : e.originalEvent),
|
||||
newPoint = L.point(event.clientX, event.clientY),
|
||||
latlng = path._map.layerPointToLatLng(newPoint);
|
||||
|
||||
this._offset = newPoint.subtract(this._startPoint);
|
||||
this._startPoint = newPoint;
|
||||
|
||||
this._path.eachLatLng(this.updateLatLng, this);
|
||||
path.redraw();
|
||||
|
||||
e.latlng = latlng;
|
||||
e.offset = this._offset;
|
||||
path.fire('drag', e);
|
||||
e.latlng = this._path.getCenter ? this._path.getCenter() : this._path.getLatLng();
|
||||
path.fire('move', e);
|
||||
},
|
||||
|
||||
_onDragEnd: function (e) {
|
||||
if (this._path._bounds) this.resetBounds();
|
||||
this._path.fire('moveend')
|
||||
.fire('dragend', e);
|
||||
},
|
||||
|
||||
latLngToLayerPoint: function (latlng) {
|
||||
// Same as map.latLngToLayerPoint, but without the round().
|
||||
var projectedPoint = this._path._map.project(L.latLng(latlng));
|
||||
return projectedPoint._subtract(this._path._map.getPixelOrigin());
|
||||
},
|
||||
|
||||
updateLatLng: function (latlng) {
|
||||
var oldPoint = this.latLngToLayerPoint(latlng);
|
||||
oldPoint._add(this._offset);
|
||||
var newLatLng = this._path._map.layerPointToLatLng(oldPoint);
|
||||
latlng.lat = newLatLng.lat;
|
||||
latlng.lng = newLatLng.lng;
|
||||
},
|
||||
|
||||
resetBounds: function () {
|
||||
this._path._bounds = new L.LatLngBounds();
|
||||
this._path.eachLatLng(function (latlng) {
|
||||
this._bounds.extend(latlng);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.Path.include({
|
||||
|
||||
eachLatLng: function (callback, context) {
|
||||
context = context || this;
|
||||
var loop = function (latlngs) {
|
||||
for (var i = 0; i < latlngs.length; i++) {
|
||||
if (L.Util.isArray(latlngs[i])) loop(latlngs[i]);
|
||||
else callback.call(context, latlngs[i]);
|
||||
}
|
||||
};
|
||||
loop(this.getLatLngs ? this.getLatLngs() : [this.getLatLng()]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.Path.addInitHook(function () {
|
||||
|
||||
this.dragging = new L.Handler.PathDrag(this);
|
||||
if (this.options.draggable) {
|
||||
this.once('add', function () {
|
||||
this.dragging.enable();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
46
umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.css
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
.leaflet-control-edit-in-osm-simple,
|
||||
.leaflet-control-edit-in-osm {
|
||||
background: none repeat scroll 0 0 #F8F8F9;
|
||||
border: 1px solid #888888;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
.leaflet-control-edit-in-osm .leaflet-control-edit-in-osm-toggle {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
display: block;
|
||||
}
|
||||
.leaflet-control-edit-in-osm .leaflet-control-edit-in-osm-toggle {
|
||||
background-image: url("./edit-in-osm.png");
|
||||
}
|
||||
.leaflet-control-edit-in-osm .osm-editor + .osm-editor {
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
.leaflet-control-edit-in-osm-simple a.osm-editor,
|
||||
.leaflet-control-edit-in-osm a.osm-editor {
|
||||
display: none;
|
||||
height: 36px;
|
||||
min-width: 36px;
|
||||
text-align: center;
|
||||
line-height: 36px;
|
||||
color: #333;
|
||||
padding: 0 5px;
|
||||
text-decoration: none;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.leaflet-control-edit-in-osm-simple a.osm-editor,
|
||||
.leaflet-control-edit-in-osm:hover a.osm-editor {
|
||||
display: inline-block;
|
||||
}
|
||||
a.osm-editor:hover {
|
||||
box-shadow: 0 0 2px 0 black inset;
|
||||
}
|
||||
.leaflet-control-edit-in-osm:hover .leaflet-control-edit-in-osm-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.leaflet-control-edit-hidden {
|
||||
display: none;
|
||||
}
|
240
umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.js
vendored
Normal file
|
@ -0,0 +1,240 @@
|
|||
(function (factory) {
|
||||
var L;
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['leaflet'], function(L) {
|
||||
factory(L, setTimeout);
|
||||
});
|
||||
} else if (typeof module !== 'undefined') {
|
||||
// Node/CommonJS
|
||||
L = require('leaflet');
|
||||
module.exports = factory(L, setTimeout);
|
||||
} else {
|
||||
// Browser globals
|
||||
if (typeof window.L === 'undefined')
|
||||
throw 'Leaflet must be loaded first';
|
||||
factory(window.L, setTimeout);
|
||||
}
|
||||
}(function (L, setTimeout) {
|
||||
var _controlContainer,
|
||||
_map,
|
||||
_zoomThreshold,
|
||||
_hideClass = 'leaflet-control-edit-hidden',
|
||||
_anchorClass = 'leaflet-control-edit-in-osm-toggle',
|
||||
|
||||
_Widgets = {
|
||||
SimpleButton: function (config) {
|
||||
var className = (config && config.className) || 'leaflet-control-edit-in-osm-simple',
|
||||
helpText = config && config.helpText,
|
||||
addEditors = (config && config.addEditors) || function (container, editors) {
|
||||
addEditorToWidget(container, editors[0], helpText);
|
||||
};
|
||||
|
||||
return {
|
||||
className: className,
|
||||
helpText: helpText,
|
||||
addEditors: addEditors
|
||||
};
|
||||
},
|
||||
MultiButton: function (config) {
|
||||
var className = 'leaflet-control-edit-in-osm',
|
||||
helpText = "Open this map extent in a map editor to provide more accurate data to OpenStreetMap",
|
||||
addEditors = function (container, editors) {
|
||||
for (var i in editors) {
|
||||
addEditorToWidget(container, editors[i]);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
className: (config && config.className) || className,
|
||||
helpText: (config && config.helpText) || helpText,
|
||||
addEditors: (config && config.addEditors) || addEditors
|
||||
};
|
||||
},
|
||||
AttributionBox: function (config) {
|
||||
var className = 'leaflet-control-attribution',
|
||||
helpText = "Edit in OSM",
|
||||
addEditors = function (container, editors) {
|
||||
addEditorToWidget(container, editors[0], helpText);
|
||||
};
|
||||
|
||||
return {
|
||||
className: (config && config.className) || className,
|
||||
helpText: (config && config.helpText) || helpText,
|
||||
addEditors: (config && config.addEditors) || addEditors
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
_Editors = {
|
||||
Id: function (config) {
|
||||
var url = 'https://www.openstreetmap.org/edit?editor=id#map=',
|
||||
displayName = "iD",
|
||||
buildUrl = function (map) {
|
||||
return this.url + [
|
||||
map.getZoom(),
|
||||
map.getCenter().wrap().lat,
|
||||
map.getCenter().wrap().lng
|
||||
].join('/');
|
||||
};
|
||||
return {
|
||||
url: (config && config.url) || url,
|
||||
displayName: (config && config.displayName) || displayName,
|
||||
buildUrl: (config && config.buildUrl) || buildUrl
|
||||
};
|
||||
},
|
||||
Josm: function (config) {
|
||||
var url = 'http://127.0.0.1:8111/load_and_zoom',
|
||||
timeout = 1000,
|
||||
displayName = "JOSM",
|
||||
buildUrl = function (map) {
|
||||
var bounds = map.getBounds();
|
||||
return this.url + L.Util.getParamString({
|
||||
left: bounds.getNorthWest().lng,
|
||||
right: bounds.getSouthEast().lng,
|
||||
top: bounds.getNorthWest().lat,
|
||||
bottom: bounds.getSouthEast().lat
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
url: (config && config.url) || url,
|
||||
timeout: (config && config.timeout) || timeout,
|
||||
displayName: (config && config.displayName) || displayName,
|
||||
buildUrl: (config && config.buildUrl) || buildUrl
|
||||
};
|
||||
},
|
||||
Potlatch: function (config) {
|
||||
var url = 'http://open.mapquestapi.com/dataedit/index_flash.html',
|
||||
displayName = "P2",
|
||||
buildUrl = function (map) {
|
||||
return this.url + L.Util.getParamString({
|
||||
lon: map.getCenter().wrap().lng,
|
||||
lat: map.getCenter().wrap().lat,
|
||||
zoom: map.getZoom()
|
||||
});
|
||||
};
|
||||
return {
|
||||
url: (config && config.url) || url,
|
||||
displayName: (config && config.displayName) || displayName,
|
||||
buildUrl: (config && config.buildUrl) || buildUrl
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Takes an editor, calls their buildUrl method
|
||||
// and opens the url in the browser
|
||||
function openRemote (editor) {
|
||||
var url = editor.buildUrl(_map),
|
||||
w = window.open(url);
|
||||
if (editor.timeout) {
|
||||
setTimeout(function() {w.close();}, editor.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
function addEditorToWidget(widgetContainer, editor, text) {
|
||||
var editorWidget = L.DomUtil.create('a', "osm-editor", widgetContainer);
|
||||
editorWidget.href = "#";
|
||||
editorWidget.innerHTML = text || editor.displayName;
|
||||
L.DomEvent.on(editorWidget, "click", function (e) {
|
||||
openRemote(editor);
|
||||
L.DomEvent.stop(e);
|
||||
});
|
||||
}
|
||||
|
||||
// Make the EditInOSM widget visible or invisible after each
|
||||
// zoom event.
|
||||
//
|
||||
// configurable by setting the *zoomThreshold* option.
|
||||
function showOrHideUI() {
|
||||
var zoom = _map.getZoom();
|
||||
if (zoom < _zoomThreshold) {
|
||||
L.DomUtil.addClass(_controlContainer, _hideClass);
|
||||
} else {
|
||||
L.DomUtil.removeClass(_controlContainer, _hideClass);
|
||||
}
|
||||
}
|
||||
|
||||
L.Control.EditInOSM = L.Control.extend({
|
||||
|
||||
options: {
|
||||
position: "topright",
|
||||
zoomThreshold: 0,
|
||||
widget: "multiButton",
|
||||
editors: ["id", "josm"]
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
var newEditors = [],
|
||||
widget,
|
||||
widgetSmallName,
|
||||
editor,
|
||||
editorSmallName;
|
||||
|
||||
L.setOptions(this, options);
|
||||
|
||||
_zoomThreshold = this.options.zoomThreshold;
|
||||
|
||||
widget = this.options.widget;
|
||||
widgetSmallName = typeof(widget) === 'string' ? widget.toLowerCase() : '';
|
||||
|
||||
// setup widget from string or object
|
||||
if (widgetSmallName === "simplebutton") {
|
||||
this.options.widget = new _Widgets.SimpleButton(this.options.widgetOptions);
|
||||
} else if (widgetSmallName === "multibutton") {
|
||||
this.options.widget = new _Widgets.MultiButton(this.options.widgetOptions);
|
||||
} else if (widgetSmallName === "attributionbox") {
|
||||
this.options.widget = new _Widgets.AttributionBox(this.options.widgetOptions);
|
||||
}
|
||||
|
||||
// setup editors from strings or objects
|
||||
for (var i in this.options.editors) {
|
||||
editor = this.options.editors[i],
|
||||
editorSmallName = typeof(editor) === "string" ? editor.toLowerCase() : null;
|
||||
|
||||
if (editorSmallName === "id") {
|
||||
newEditors.push(new _Editors.Id());
|
||||
} else if (editorSmallName === "josm") {
|
||||
newEditors.push(new _Editors.Josm());
|
||||
} else if (editorSmallName === "potlatch") {
|
||||
newEditors.push(new _Editors.Potlatch());
|
||||
} else {
|
||||
newEditors.push(editor);
|
||||
}
|
||||
}
|
||||
this.options.editors = newEditors;
|
||||
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
_map = map;
|
||||
map.on('zoomend', showOrHideUI);
|
||||
|
||||
_controlContainer = L.DomUtil.create('div', this.options.widget.className);
|
||||
|
||||
_controlContainer.title = this.options.widget.helpText || '';
|
||||
|
||||
L.DomUtil.create('a', _anchorClass, _controlContainer);
|
||||
|
||||
this.options.widget.addEditors(_controlContainer, this.options.editors);
|
||||
return _controlContainer;
|
||||
},
|
||||
|
||||
onRemove: function (map) {
|
||||
map.off('zoomend', showOrHideUI);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.Control.EditInOSM.Widgets = _Widgets;
|
||||
L.Control.EditInOSM.Editors = _Editors;
|
||||
|
||||
L.Map.addInitHook(function () {
|
||||
if (this.options.editInOSMControlOptions) {
|
||||
var options = this.options.editInOSMControlOptions || {};
|
||||
this.editInOSMControl = (new L.Control.EditInOSM(options)).addTo(this);
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
BIN
umap/static/umap/vendors/editinosm/edit-in-osm.png
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
464
umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js
vendored
Normal file
|
@ -0,0 +1,464 @@
|
|||
L.FormBuilder = L.Evented.extend({
|
||||
options: {
|
||||
className: 'leaflet-form',
|
||||
},
|
||||
|
||||
defaultOptions: {
|
||||
// Eg.:
|
||||
// name: {label: L._('name')},
|
||||
// description: {label: L._('description'), handler: 'Textarea'},
|
||||
// opacity: {label: L._('opacity'), helpText: L._('Opacity, from 0.1 to 1.0 (opaque).')},
|
||||
},
|
||||
|
||||
initialize: function (obj, fields, options) {
|
||||
L.setOptions(this, options)
|
||||
this.obj = obj
|
||||
this.form = L.DomUtil.create('form', this.options.className)
|
||||
this.setFields(fields)
|
||||
if (this.options.id) {
|
||||
this.form.id = this.options.id
|
||||
}
|
||||
if (this.options.className) {
|
||||
L.DomUtil.addClass(this.form, this.options.className)
|
||||
}
|
||||
},
|
||||
|
||||
setFields: function (fields) {
|
||||
this.fields = fields || []
|
||||
this.helpers = {}
|
||||
},
|
||||
|
||||
build: function () {
|
||||
this.form.innerHTML = ''
|
||||
for (const idx in this.fields) {
|
||||
this.buildField(this.fields[idx])
|
||||
}
|
||||
this.on('postsync', this.onPostSync)
|
||||
return this.form
|
||||
},
|
||||
|
||||
buildField: function (field) {
|
||||
// field can be either a string like "option.name" or a full definition array,
|
||||
// like ['options.tilelayer.tms', {handler: 'CheckBox', helpText: 'TMS format'}]
|
||||
let type
|
||||
let helper
|
||||
let options
|
||||
if (Array.isArray(field)) {
|
||||
options = field[1] || {}
|
||||
field = field[0]
|
||||
} else {
|
||||
options = this.defaultOptions[this.getName(field)] || {}
|
||||
}
|
||||
type = options.handler || 'Input'
|
||||
if (typeof type === 'string' && L.FormBuilder[type]) {
|
||||
helper = new L.FormBuilder[type](this, field, options)
|
||||
} else {
|
||||
helper = new type(this, field, options)
|
||||
}
|
||||
this.helpers[field] = helper
|
||||
return helper
|
||||
},
|
||||
|
||||
getter: function (field) {
|
||||
const path = field.split('.')
|
||||
let value = this.obj
|
||||
for (const sub of path) {
|
||||
value = value[sub]
|
||||
}
|
||||
return value
|
||||
},
|
||||
|
||||
setter: function (field, value) {
|
||||
const path = field.split('.')
|
||||
let obj = this.obj
|
||||
let what
|
||||
for (let i = 0, l = path.length; i < l; i++) {
|
||||
what = path[i]
|
||||
if (what === path[l - 1]) {
|
||||
if (typeof value === 'undefined') {
|
||||
delete obj[what]
|
||||
} else {
|
||||
obj[what] = value
|
||||
}
|
||||
} else {
|
||||
obj = obj[what]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
restoreField: function (field) {
|
||||
const initial = this.helpers[field].initial
|
||||
this.setter(field, initial)
|
||||
},
|
||||
|
||||
getName: (field) => {
|
||||
const fieldEls = field.split('.')
|
||||
return fieldEls[fieldEls.length - 1]
|
||||
},
|
||||
|
||||
fetchAll: function () {
|
||||
for (const helper of Object.values(this.helpers)) {
|
||||
helper.fetch()
|
||||
}
|
||||
},
|
||||
|
||||
syncAll: function () {
|
||||
for (const helper of Object.values(this.helpers)) {
|
||||
helper.sync()
|
||||
}
|
||||
},
|
||||
|
||||
onPostSync: function (e) {
|
||||
if (e.helper.options.callback) {
|
||||
e.helper.options.callback.call(e.helper.options.callbackContext || this.obj, e)
|
||||
}
|
||||
if (this.options.callback) {
|
||||
this.options.callback.call(this.options.callbackContext || this.obj, e)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.Element = L.Evented.extend({
|
||||
initialize: function (builder, field, options) {
|
||||
this.builder = builder
|
||||
this.obj = this.builder.obj
|
||||
this.form = this.builder.form
|
||||
this.field = field
|
||||
L.setOptions(this, options)
|
||||
this.fieldEls = this.field.split('.')
|
||||
this.name = this.builder.getName(field)
|
||||
this.parentNode = this.getParentNode()
|
||||
this.buildLabel()
|
||||
this.build()
|
||||
this.buildHelpText()
|
||||
this.fireAndForward('helper:init')
|
||||
},
|
||||
|
||||
fireAndForward: function (type, e = {}) {
|
||||
e.helper = this
|
||||
this.fire(type, e)
|
||||
this.builder.fire(type, e)
|
||||
if (this.obj.fire) this.obj.fire(type, e)
|
||||
},
|
||||
|
||||
getParentNode: function () {
|
||||
return this.options.wrapper
|
||||
? L.DomUtil.create(
|
||||
this.options.wrapper,
|
||||
this.options.wrapperClass || '',
|
||||
this.form
|
||||
)
|
||||
: this.form
|
||||
},
|
||||
|
||||
get: function () {
|
||||
return this.builder.getter(this.field)
|
||||
},
|
||||
|
||||
toHTML: function () {
|
||||
return this.get()
|
||||
},
|
||||
|
||||
toJS: function () {
|
||||
return this.value()
|
||||
},
|
||||
|
||||
sync: function () {
|
||||
this.fireAndForward('presync')
|
||||
this.set()
|
||||
this.fireAndForward('postsync')
|
||||
},
|
||||
|
||||
set: function () {
|
||||
this.builder.setter(this.field, this.toJS())
|
||||
},
|
||||
|
||||
getLabelParent: function () {
|
||||
return this.parentNode
|
||||
},
|
||||
|
||||
getHelpTextParent: function () {
|
||||
return this.parentNode
|
||||
},
|
||||
|
||||
buildLabel: function () {
|
||||
if (this.options.label) {
|
||||
this.label = L.DomUtil.create('label', '', this.getLabelParent())
|
||||
this.label.innerHTML = this.options.label
|
||||
}
|
||||
},
|
||||
|
||||
buildHelpText: function () {
|
||||
if (this.options.helpText) {
|
||||
const container = L.DomUtil.create('small', 'help-text', this.getHelpTextParent())
|
||||
container.innerHTML = this.options.helpText
|
||||
}
|
||||
},
|
||||
|
||||
fetch: () => {},
|
||||
|
||||
finish: function () {
|
||||
this.fireAndForward('finish')
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.Textarea = L.FormBuilder.Element.extend({
|
||||
build: function () {
|
||||
this.input = L.DomUtil.create(
|
||||
'textarea',
|
||||
this.options.className || '',
|
||||
this.parentNode
|
||||
)
|
||||
if (this.options.placeholder) this.input.placeholder = this.options.placeholder
|
||||
this.fetch()
|
||||
L.DomEvent.on(this.input, 'input', this.sync, this)
|
||||
L.DomEvent.on(this.input, 'keypress', this.onKeyPress, this)
|
||||
},
|
||||
|
||||
fetch: function () {
|
||||
const value = this.toHTML()
|
||||
this.initial = value
|
||||
if (value) {
|
||||
this.input.value = value
|
||||
}
|
||||
},
|
||||
|
||||
value: function () {
|
||||
return this.input.value
|
||||
},
|
||||
|
||||
onKeyPress: function (e) {
|
||||
if (e.key === 'Enter' && (e.shiftKey || e.ctrlKey)) {
|
||||
L.DomEvent.stop(e)
|
||||
this.finish()
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.Input = L.FormBuilder.Element.extend({
|
||||
build: function () {
|
||||
this.input = L.DomUtil.create(
|
||||
'input',
|
||||
this.options.className || '',
|
||||
this.parentNode
|
||||
)
|
||||
this.input.type = this.type()
|
||||
this.input.name = this.name
|
||||
this.input._helper = this
|
||||
if (this.options.placeholder) {
|
||||
this.input.placeholder = this.options.placeholder
|
||||
}
|
||||
if (this.options.min !== undefined) {
|
||||
this.input.min = this.options.min
|
||||
}
|
||||
if (this.options.max !== undefined) {
|
||||
this.input.max = this.options.max
|
||||
}
|
||||
if (this.options.step) {
|
||||
this.input.step = this.options.step
|
||||
}
|
||||
this.fetch()
|
||||
L.DomEvent.on(this.input, this.getSyncEvent(), this.sync, this)
|
||||
L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this)
|
||||
},
|
||||
|
||||
fetch: function () {
|
||||
const value = this.toHTML() !== undefined ? this.toHTML() : null
|
||||
this.initial = value
|
||||
this.input.value = value
|
||||
},
|
||||
|
||||
getSyncEvent: () => 'input',
|
||||
|
||||
type: function () {
|
||||
return this.options.type || 'text'
|
||||
},
|
||||
|
||||
value: function () {
|
||||
return this.input.value || undefined
|
||||
},
|
||||
|
||||
onKeyDown: function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
L.DomEvent.stop(e)
|
||||
this.finish()
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.BlurInput = L.FormBuilder.Input.extend({
|
||||
getSyncEvent: () => 'blur',
|
||||
|
||||
build: function () {
|
||||
L.FormBuilder.Input.prototype.build.call(this)
|
||||
L.DomEvent.on(this.input, 'focus', this.fetch, this)
|
||||
},
|
||||
|
||||
finish: function () {
|
||||
this.sync()
|
||||
L.FormBuilder.Input.prototype.finish.call(this)
|
||||
},
|
||||
|
||||
sync: function () {
|
||||
// Do not commit any change if user only clicked
|
||||
// on the field than clicked outside
|
||||
if (this.initial !== this.value()) {
|
||||
L.FormBuilder.Input.prototype.sync.call(this)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.IntegerMixin = {
|
||||
value: function () {
|
||||
return !isNaN(this.input.value) && this.input.value !== ''
|
||||
? parseInt(this.input.value, 10)
|
||||
: undefined
|
||||
},
|
||||
|
||||
type: () => 'number',
|
||||
}
|
||||
|
||||
L.FormBuilder.IntInput = L.FormBuilder.Input.extend({
|
||||
includes: [L.FormBuilder.IntegerMixin],
|
||||
})
|
||||
|
||||
L.FormBuilder.BlurIntInput = L.FormBuilder.BlurInput.extend({
|
||||
includes: [L.FormBuilder.IntegerMixin],
|
||||
})
|
||||
|
||||
L.FormBuilder.FloatMixin = {
|
||||
value: function () {
|
||||
return !isNaN(this.input.value) && this.input.value !== ''
|
||||
? parseFloat(this.input.value)
|
||||
: undefined
|
||||
},
|
||||
|
||||
type: () => 'number',
|
||||
}
|
||||
|
||||
L.FormBuilder.FloatInput = L.FormBuilder.Input.extend({
|
||||
options: {
|
||||
step: 'any',
|
||||
},
|
||||
|
||||
includes: [L.FormBuilder.FloatMixin],
|
||||
})
|
||||
|
||||
L.FormBuilder.BlurFloatInput = L.FormBuilder.BlurInput.extend({
|
||||
options: {
|
||||
step: 'any',
|
||||
},
|
||||
|
||||
includes: [L.FormBuilder.FloatMixin],
|
||||
})
|
||||
|
||||
L.FormBuilder.CheckBox = L.FormBuilder.Element.extend({
|
||||
build: function () {
|
||||
const container = L.DomUtil.create('div', 'checkbox-wrapper', this.parentNode)
|
||||
this.input = L.DomUtil.create('input', this.options.className || '', container)
|
||||
this.input.type = 'checkbox'
|
||||
this.input.name = this.name
|
||||
this.input._helper = this
|
||||
this.fetch()
|
||||
L.DomEvent.on(this.input, 'change', this.sync, this)
|
||||
},
|
||||
|
||||
fetch: function () {
|
||||
this.initial = this.toHTML()
|
||||
this.input.checked = this.initial === true
|
||||
},
|
||||
|
||||
value: function () {
|
||||
return this.input.checked
|
||||
},
|
||||
|
||||
toHTML: function () {
|
||||
return [1, true].indexOf(this.get()) !== -1
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.Select = L.FormBuilder.Element.extend({
|
||||
selectOptions: [['value', 'label']],
|
||||
|
||||
build: function () {
|
||||
this.select = L.DomUtil.create('select', '', this.parentNode)
|
||||
this.select.name = this.name
|
||||
this.validValues = []
|
||||
this.buildOptions()
|
||||
L.DomEvent.on(this.select, 'change', this.sync, this)
|
||||
},
|
||||
|
||||
getOptions: function () {
|
||||
return this.options.selectOptions || this.selectOptions
|
||||
},
|
||||
|
||||
fetch: function () {
|
||||
this.buildOptions()
|
||||
},
|
||||
|
||||
buildOptions: function () {
|
||||
this.select.innerHTML = ''
|
||||
for (const option of this.getOptions()) {
|
||||
if (typeof option === 'string') this.buildOption(option, option)
|
||||
else this.buildOption(option[0], option[1])
|
||||
}
|
||||
},
|
||||
|
||||
buildOption: function (value, label) {
|
||||
this.validValues.push(value)
|
||||
const option = L.DomUtil.create('option', '', this.select)
|
||||
option.value = value
|
||||
option.innerHTML = label
|
||||
if (this.toHTML() === value) {
|
||||
option.selected = 'selected'
|
||||
}
|
||||
},
|
||||
|
||||
value: function () {
|
||||
if (this.select[this.select.selectedIndex])
|
||||
return this.select[this.select.selectedIndex].value
|
||||
},
|
||||
|
||||
getDefault: function () {
|
||||
return this.getOptions()[0][0]
|
||||
},
|
||||
|
||||
toJS: function () {
|
||||
const value = this.value()
|
||||
if (this.validValues.indexOf(value) !== -1) {
|
||||
return value
|
||||
}
|
||||
return this.getDefault()
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.IntSelect = L.FormBuilder.Select.extend({
|
||||
value: function () {
|
||||
return parseInt(L.FormBuilder.Select.prototype.value.apply(this), 10)
|
||||
},
|
||||
})
|
||||
|
||||
L.FormBuilder.NullableBoolean = L.FormBuilder.Select.extend({
|
||||
selectOptions: [
|
||||
[undefined, 'inherit'],
|
||||
[true, 'yes'],
|
||||
[false, 'no'],
|
||||
],
|
||||
|
||||
toJS: function () {
|
||||
let value = this.value()
|
||||
switch (value) {
|
||||
case 'true':
|
||||
case true:
|
||||
value = true
|
||||
break
|
||||
case 'false':
|
||||
case false:
|
||||
value = false
|
||||
break
|
||||
default:
|
||||
value = undefined
|
||||
}
|
||||
return value
|
||||
},
|
||||
})
|
152
umap/static/umap/vendors/fullscreen/Leaflet.fullscreen.js
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
L.Control.Fullscreen = L.Control.extend({
|
||||
options: {
|
||||
position: 'topleft',
|
||||
title: {
|
||||
'false': 'View Fullscreen',
|
||||
'true': 'Exit Fullscreen'
|
||||
}
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control');
|
||||
|
||||
this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container);
|
||||
this.link.href = '#';
|
||||
|
||||
this._map = map;
|
||||
this._map.on('fullscreenchange', this._toggleTitle, this);
|
||||
this._toggleTitle();
|
||||
|
||||
L.DomEvent.on(this.link, 'click', this._click, this);
|
||||
|
||||
return container;
|
||||
},
|
||||
|
||||
_click: function (e) {
|
||||
L.DomEvent.stopPropagation(e);
|
||||
L.DomEvent.preventDefault(e);
|
||||
this._map.toggleFullscreen(this.options);
|
||||
},
|
||||
|
||||
_toggleTitle: function() {
|
||||
this.link.title = this.options.title[this._map.isFullscreen()];
|
||||
}
|
||||
});
|
||||
|
||||
L.Map.include({
|
||||
isFullscreen: function () {
|
||||
return this._isFullscreen || false;
|
||||
},
|
||||
|
||||
toggleFullscreen: function (options) {
|
||||
var container = this.getContainer();
|
||||
if (this.isFullscreen()) {
|
||||
if (options && options.pseudoFullscreen) {
|
||||
this._disablePseudoFullscreen(container);
|
||||
} else if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
} else {
|
||||
this._disablePseudoFullscreen(container);
|
||||
}
|
||||
} else {
|
||||
if (options && options.pseudoFullscreen) {
|
||||
this._enablePseudoFullscreen(container);
|
||||
} else if (container.requestFullscreen) {
|
||||
container.requestFullscreen();
|
||||
} else if (container.mozRequestFullScreen) {
|
||||
container.mozRequestFullScreen();
|
||||
} else if (container.webkitRequestFullscreen) {
|
||||
container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
} else if (container.msRequestFullscreen) {
|
||||
container.msRequestFullscreen();
|
||||
} else {
|
||||
this._enablePseudoFullscreen(container);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_enablePseudoFullscreen: function (container) {
|
||||
L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen');
|
||||
this._setFullscreen(true);
|
||||
this.fire('fullscreenchange');
|
||||
},
|
||||
|
||||
_disablePseudoFullscreen: function (container) {
|
||||
L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen');
|
||||
this._setFullscreen(false);
|
||||
this.fire('fullscreenchange');
|
||||
},
|
||||
|
||||
_setFullscreen: function(fullscreen) {
|
||||
this._isFullscreen = fullscreen;
|
||||
var container = this.getContainer();
|
||||
if (fullscreen) {
|
||||
L.DomUtil.addClass(container, 'leaflet-fullscreen-on');
|
||||
} else {
|
||||
L.DomUtil.removeClass(container, 'leaflet-fullscreen-on');
|
||||
}
|
||||
this.invalidateSize();
|
||||
},
|
||||
|
||||
_onFullscreenChange: function (e) {
|
||||
var fullscreenElement =
|
||||
document.fullscreenElement ||
|
||||
document.mozFullScreenElement ||
|
||||
document.webkitFullscreenElement ||
|
||||
document.msFullscreenElement;
|
||||
|
||||
if (fullscreenElement === this.getContainer() && !this._isFullscreen) {
|
||||
this._setFullscreen(true);
|
||||
this.fire('fullscreenchange');
|
||||
} else if (fullscreenElement !== this.getContainer() && this._isFullscreen) {
|
||||
this._setFullscreen(false);
|
||||
this.fire('fullscreenchange');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
L.Map.mergeOptions({
|
||||
fullscreenControl: false
|
||||
});
|
||||
|
||||
L.Map.addInitHook(function () {
|
||||
if (this.options.fullscreenControl) {
|
||||
this.fullscreenControl = new L.Control.Fullscreen(this.options.fullscreenControl);
|
||||
this.addControl(this.fullscreenControl);
|
||||
}
|
||||
|
||||
var fullscreenchange;
|
||||
|
||||
if ('onfullscreenchange' in document) {
|
||||
fullscreenchange = 'fullscreenchange';
|
||||
} else if ('onmozfullscreenchange' in document) {
|
||||
fullscreenchange = 'mozfullscreenchange';
|
||||
} else if ('onwebkitfullscreenchange' in document) {
|
||||
fullscreenchange = 'webkitfullscreenchange';
|
||||
} else if ('onmsfullscreenchange' in document) {
|
||||
fullscreenchange = 'MSFullscreenChange';
|
||||
}
|
||||
|
||||
if (fullscreenchange) {
|
||||
var onFullscreenChange = L.bind(this._onFullscreenChange, this);
|
||||
|
||||
this.whenReady(function () {
|
||||
L.DomEvent.on(document, fullscreenchange, onFullscreenChange);
|
||||
});
|
||||
|
||||
this.on('unload', function () {
|
||||
L.DomEvent.off(document, fullscreenchange, onFullscreenChange);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
L.control.fullscreen = function (options) {
|
||||
return new L.Control.Fullscreen(options);
|
||||
};
|
1
umap/static/umap/vendors/fullscreen/Leaflet.fullscreen.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
L.Control.Fullscreen=L.Control.extend({options:{position:"topleft",title:{"false":"View Fullscreen","true":"Exit Fullscreen"}},onAdd:function(map){var container=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",container);this.link.href="#";this._map=map;this._map.on("fullscreenchange",this._toggleTitle,this);this._toggleTitle();L.DomEvent.on(this.link,"click",this._click,this);return container},_click:function(e){L.DomEvent.stopPropagation(e);L.DomEvent.preventDefault(e);this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||false},toggleFullscreen:function(options){var container=this.getContainer();if(this.isFullscreen()){if(options&&options.pseudoFullscreen){this._disablePseudoFullscreen(container)}else if(document.exitFullscreen){document.exitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else{this._disablePseudoFullscreen(container)}}else{if(options&&options.pseudoFullscreen){this._enablePseudoFullscreen(container)}else if(container.requestFullscreen){container.requestFullscreen()}else if(container.mozRequestFullScreen){container.mozRequestFullScreen()}else if(container.webkitRequestFullscreen){container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}else if(container.msRequestFullscreen){container.msRequestFullscreen()}else{this._enablePseudoFullscreen(container)}}},_enablePseudoFullscreen:function(container){L.DomUtil.addClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(true);this.fire("fullscreenchange")},_disablePseudoFullscreen:function(container){L.DomUtil.removeClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(false);this.fire("fullscreenchange")},_setFullscreen:function(fullscreen){this._isFullscreen=fullscreen;var container=this.getContainer();if(fullscreen){L.DomUtil.addClass(container,"leaflet-fullscreen-on")}else{L.DomUtil.removeClass(container,"leaflet-fullscreen-on")}this.invalidateSize()},_onFullscreenChange:function(e){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;if(fullscreenElement===this.getContainer()&&!this._isFullscreen){this._setFullscreen(true);this.fire("fullscreenchange")}else if(fullscreenElement!==this.getContainer()&&this._isFullscreen){this._setFullscreen(false);this.fire("fullscreenchange")}}});L.Map.mergeOptions({fullscreenControl:false});L.Map.addInitHook(function(){if(this.options.fullscreenControl){this.fullscreenControl=new L.Control.Fullscreen(this.options.fullscreenControl);this.addControl(this.fullscreenControl)}var fullscreenchange;if("onfullscreenchange"in document){fullscreenchange="fullscreenchange"}else if("onmozfullscreenchange"in document){fullscreenchange="mozfullscreenchange"}else if("onwebkitfullscreenchange"in document){fullscreenchange="webkitfullscreenchange"}else if("onmsfullscreenchange"in document){fullscreenchange="MSFullscreenChange"}if(fullscreenchange){var onFullscreenChange=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,fullscreenchange,onFullscreenChange)});this.on("unload",function(){L.DomEvent.off(document,fullscreenchange,onFullscreenChange)})}});L.control.fullscreen=function(options){return new L.Control.Fullscreen(options)};
|
BIN
umap/static/umap/vendors/fullscreen/fullscreen.png
vendored
Normal file
After Width: | Height: | Size: 299 B |
BIN
umap/static/umap/vendors/fullscreen/fullscreen@2x.png
vendored
Normal file
After Width: | Height: | Size: 420 B |
40
umap/static/umap/vendors/fullscreen/leaflet.fullscreen.css
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
.leaflet-control-fullscreen a {
|
||||
background:#fff url(fullscreen.png) no-repeat 0 0;
|
||||
background-size:26px 52px;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-fullscreen a {
|
||||
background-position: 2px 2px;
|
||||
}
|
||||
.leaflet-fullscreen-on .leaflet-control-fullscreen a {
|
||||
background-position:0 -26px;
|
||||
}
|
||||
.leaflet-touch.leaflet-fullscreen-on .leaflet-control-fullscreen a {
|
||||
background-position: 2px -24px;
|
||||
}
|
||||
|
||||
/* Do not combine these two rules; IE will break. */
|
||||
.leaflet-container:-webkit-full-screen {
|
||||
width:100%!important;
|
||||
height:100%!important;
|
||||
}
|
||||
.leaflet-container.leaflet-fullscreen-on {
|
||||
width:100%!important;
|
||||
height:100%!important;
|
||||
}
|
||||
|
||||
.leaflet-pseudo-fullscreen {
|
||||
position:fixed!important;
|
||||
width:100%!important;
|
||||
height:100%!important;
|
||||
top:0!important;
|
||||
left:0!important;
|
||||
z-index:99999;
|
||||
}
|
||||
|
||||
@media
|
||||
(-webkit-min-device-pixel-ratio:2),
|
||||
(min-resolution:192dpi) {
|
||||
.leaflet-control-fullscreen a {
|
||||
background-image:url(fullscreen@2x.png);
|
||||
}
|
||||
}
|
155
umap/static/umap/vendors/geojson-to-gpx/index.js
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
export default function GeoJsonToGpx(geoJson, options, implementation) {
|
||||
if (implementation === void 0) { implementation = document.implementation; }
|
||||
var doc = implementation.createDocument('http://www.topografix.com/GPX/1/1', '');
|
||||
var instruct = doc.createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"');
|
||||
doc.appendChild(instruct);
|
||||
var defaultPackageName = '@dwayneparton/geojson-to-gpx';
|
||||
var creator = (options === null || options === void 0 ? void 0 : options.creator) || defaultPackageName;
|
||||
var createElementWithNS = function (tagName) {
|
||||
return doc.createElementNS('http://www.topografix.com/GPX/1/1', tagName);
|
||||
};
|
||||
var gpx = createElementWithNS('gpx');
|
||||
gpx.setAttribute('version', '1.1');
|
||||
gpx.setAttribute('creator', creator);
|
||||
var wpts = [];
|
||||
var trks = [];
|
||||
function createTagInParentElement(parent, tagName, content) {
|
||||
if (content === undefined) {
|
||||
return;
|
||||
}
|
||||
var element = createElementWithNS(tagName);
|
||||
var contentEl = doc.createTextNode(String(content));
|
||||
element.appendChild(contentEl);
|
||||
parent.appendChild(element);
|
||||
}
|
||||
function addSupportedPropertiesFromObject(el, supports, properties) {
|
||||
if (properties && typeof properties === 'object') {
|
||||
supports.forEach(function (key) {
|
||||
var value = properties[key];
|
||||
if (value && typeof value === 'string' && supports.includes(key)) {
|
||||
createTagInParentElement(el, key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function createLinkInParentElement(parent, props) {
|
||||
var href = props.href;
|
||||
if (!href) {
|
||||
return;
|
||||
}
|
||||
var el = createElementWithNS('link');
|
||||
el.setAttribute('href', href);
|
||||
addSupportedPropertiesFromObject(el, ['text', 'type'], props);
|
||||
parent.appendChild(el);
|
||||
}
|
||||
function createTrk(properties) {
|
||||
var el = createElementWithNS('trk');
|
||||
var supports = ['name', 'desc', 'src', 'type'];
|
||||
addSupportedPropertiesFromObject(el, supports, properties);
|
||||
return el;
|
||||
}
|
||||
function createPt(type, position, properties) {
|
||||
var lon = position[0], lat = position[1], ele = position[2], time = position[3];
|
||||
var el = createElementWithNS(type);
|
||||
el.setAttribute('lat', String(lat));
|
||||
el.setAttribute('lon', String(lon));
|
||||
createTagInParentElement(el, 'ele', ele);
|
||||
createTagInParentElement(el, 'time', time);
|
||||
var supports = ['name', 'desc', 'src', 'type'];
|
||||
addSupportedPropertiesFromObject(el, supports, properties);
|
||||
return el;
|
||||
}
|
||||
function createTrkSeg(coordinates) {
|
||||
var el = createElementWithNS('trkseg');
|
||||
coordinates.forEach(function (point) {
|
||||
el.appendChild(createPt('trkpt', point));
|
||||
});
|
||||
return el;
|
||||
}
|
||||
function interpretFeature(feature) {
|
||||
var geometry = feature.geometry, properties = feature.properties;
|
||||
var type = geometry.type;
|
||||
switch (type) {
|
||||
case 'Polygon':
|
||||
break;
|
||||
case 'Point': {
|
||||
wpts.push(createPt('wpt', geometry.coordinates, properties));
|
||||
break;
|
||||
}
|
||||
case 'MultiPoint': {
|
||||
geometry.coordinates.forEach(function (coord) {
|
||||
wpts.push(createPt('wpt', coord, properties));
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'LineString': {
|
||||
var lineTrk = createTrk(properties);
|
||||
var trkseg = createTrkSeg(geometry.coordinates);
|
||||
lineTrk.appendChild(trkseg);
|
||||
trks.push(lineTrk);
|
||||
break;
|
||||
}
|
||||
case 'MultiLineString': {
|
||||
var trk_1 = createTrk(properties);
|
||||
geometry.coordinates.forEach(function (pos) {
|
||||
var trkseg = createTrkSeg(pos);
|
||||
trk_1.appendChild(trkseg);
|
||||
});
|
||||
trks.push(trk_1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (options && typeof options.metadata === 'object') {
|
||||
var meta = options.metadata;
|
||||
var metadata = createElementWithNS('metadata');
|
||||
createTagInParentElement(metadata, 'name', meta.name);
|
||||
createTagInParentElement(metadata, 'desc', meta.desc);
|
||||
if (meta.author && typeof meta.author === 'object') {
|
||||
var author = createElementWithNS('author');
|
||||
createTagInParentElement(author, 'name', meta.author.name);
|
||||
createTagInParentElement(author, 'email', meta.author.email);
|
||||
if (meta.author.link && typeof meta.author.link === 'object') {
|
||||
createLinkInParentElement(author, meta.author.link);
|
||||
}
|
||||
metadata.appendChild(author);
|
||||
}
|
||||
if (typeof meta.copyright === 'object') {
|
||||
var copyright = createElementWithNS('copyright');
|
||||
if (meta.copyright.author) {
|
||||
copyright.setAttribute('author', meta.copyright.author);
|
||||
}
|
||||
createTagInParentElement(copyright, 'year', meta.copyright.year);
|
||||
createTagInParentElement(copyright, 'license', meta.copyright.license);
|
||||
metadata.appendChild(copyright);
|
||||
}
|
||||
if (typeof meta.link === 'object') {
|
||||
createLinkInParentElement(metadata, meta.link);
|
||||
}
|
||||
createTagInParentElement(metadata, 'time', meta.time);
|
||||
createTagInParentElement(metadata, 'keywords', meta.keywords);
|
||||
gpx.appendChild(metadata);
|
||||
}
|
||||
var type = geoJson.type;
|
||||
switch (type) {
|
||||
case 'Feature': {
|
||||
interpretFeature(geoJson);
|
||||
break;
|
||||
}
|
||||
case 'FeatureCollection': {
|
||||
var features = geoJson.features;
|
||||
features.forEach(function (feature) {
|
||||
interpretFeature(feature);
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wpts.forEach(function (wpt) { return gpx.appendChild(wpt); });
|
||||
trks.forEach(function (trk) { return gpx.appendChild(trk); });
|
||||
doc.appendChild(gpx);
|
||||
return doc;
|
||||
}
|
89
umap/static/umap/vendors/georsstogeojson/GeoRSSToGeoJSON.js
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
var GeoRSSToGeoJSON = function (dom, options) {
|
||||
|
||||
function get(x, y) { return x.getElementsByTagName(y); }
|
||||
function get1(x, y) { var n = get(x, y); return n.length ? n[0] : null; }
|
||||
function norm(el) { if (el.normalize) { el.normalize(); } return el; }
|
||||
function nodeVal(x) { if (x) {norm(x);} return x && x.firstChild && x.firstChild.nodeValue; }
|
||||
function attr(x, y) { return x.getAttribute(y); }
|
||||
|
||||
var g = {
|
||||
type: 'FeatureCollection',
|
||||
features: []
|
||||
};
|
||||
|
||||
function geom (node) {
|
||||
|
||||
function p(c) {return parseFloat(c);}
|
||||
function r(c) {return c.reverse().map(p);} // we have latlon we want lonlat
|
||||
function e(f) {var _=[]; for (var i=0; i<f.length; i+=2) {_.push(r(f.slice(i, i+2)));} return _;}
|
||||
|
||||
var type, coordinates;
|
||||
|
||||
NODE = node;
|
||||
if (get1(node, 'geo:long')) {
|
||||
type = 'Point';
|
||||
coordinates = [p(nodeVal(get1(node, 'geo:long'))), p(nodeVal(get1(node, 'geo:lat')))];
|
||||
} else if (get1(node, 'long')) {
|
||||
type = 'Point';
|
||||
coordinates = [p(nodeVal(get1(node, 'long'))), p(nodeVal(get1(node, 'lat')))];
|
||||
} else if (get1(node, 'georss:point')) {
|
||||
type = 'Point';
|
||||
coordinates = r(nodeVal(get1(node, 'georss:point')).split(' '));
|
||||
} else if (get1(node, 'point')) {
|
||||
type = 'Point';
|
||||
coordinates = r(nodeVal(get1(node, 'point')).split(' '));
|
||||
} else {
|
||||
var line = get1(node, 'georss:line'),
|
||||
poly = get1(node, 'georss:polygon');
|
||||
if (line || poly) {
|
||||
type = line ? 'LineString' : 'Polygon';
|
||||
var tag = line ? 'georss:line' : 'georss:polygon';
|
||||
coordinates = nodeVal(get1(node, tag)).split(' ');
|
||||
if (coordinates.length % 2 !== 0) return;
|
||||
coordinates = e(coordinates);
|
||||
if (poly) {
|
||||
coordinates = [coordinates];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type && coordinates) {
|
||||
return {
|
||||
type: type,
|
||||
coordinates: coordinates
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function processOne (node) {
|
||||
var geometry = geom(node);
|
||||
// TODO collect and fire errors
|
||||
if (!geometry) return;
|
||||
var f = {
|
||||
type: "Feature",
|
||||
geometry: geometry,
|
||||
properties: {
|
||||
title: nodeVal(get1(node, 'title')),
|
||||
description: nodeVal(get1(node, 'description')),
|
||||
link: nodeVal(get1(node, 'link')),
|
||||
}
|
||||
};
|
||||
var media = get1(node, 'media:content'), mime;
|
||||
if (!media) {
|
||||
media = get1(node, 'enclosure'), mime;
|
||||
}
|
||||
if (media) {
|
||||
mime = attr(media, 'type');
|
||||
if (mime.indexOf('image') !== -1) {
|
||||
f.properties.img = attr(media, "url"); // How not to invent a key?
|
||||
}
|
||||
}
|
||||
g.features.push(f);
|
||||
}
|
||||
|
||||
var items = get(dom, 'item');
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
processOne(items[i]);
|
||||
}
|
||||
return g;
|
||||
};
|
||||
if (typeof module !== 'undefined') module.exports = {GeoRSSToGeoJSON: GeoRSSToGeoJSON};
|
162
umap/static/umap/vendors/hash/leaflet-hash.js
vendored
Normal file
|
@ -0,0 +1,162 @@
|
|||
(function(window) {
|
||||
var HAS_HASHCHANGE = (function() {
|
||||
var doc_mode = window.documentMode;
|
||||
return ('onhashchange' in window) &&
|
||||
(doc_mode === undefined || doc_mode > 7);
|
||||
})();
|
||||
|
||||
L.Hash = function(map) {
|
||||
this.onHashChange = L.Util.bind(this.onHashChange, this);
|
||||
|
||||
if (map) {
|
||||
this.init(map);
|
||||
}
|
||||
};
|
||||
|
||||
L.Hash.parseHash = function(hash) {
|
||||
if(hash.indexOf('#') === 0) {
|
||||
hash = hash.substr(1);
|
||||
}
|
||||
var args = hash.split("/");
|
||||
if (args.length == 3) {
|
||||
var zoom = parseInt(args[0], 10),
|
||||
lat = parseFloat(args[1]),
|
||||
lon = parseFloat(args[2]);
|
||||
if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) {
|
||||
return false;
|
||||
} else {
|
||||
return {
|
||||
center: new L.LatLng(lat, lon),
|
||||
zoom: zoom
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
L.Hash.formatHash = function(map) {
|
||||
var center = map.getCenter(),
|
||||
zoom = map.getZoom(),
|
||||
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
|
||||
|
||||
return "#" + [zoom,
|
||||
center.lat.toFixed(precision),
|
||||
center.lng.toFixed(precision)
|
||||
].join("/");
|
||||
},
|
||||
|
||||
L.Hash.prototype = {
|
||||
map: null,
|
||||
lastHash: null,
|
||||
|
||||
parseHash: L.Hash.parseHash,
|
||||
formatHash: L.Hash.formatHash,
|
||||
|
||||
init: function(map) {
|
||||
this.map = map;
|
||||
|
||||
// reset the hash
|
||||
this.lastHash = null;
|
||||
this.onHashChange();
|
||||
|
||||
if (!this.isListening) {
|
||||
this.startListening();
|
||||
}
|
||||
},
|
||||
|
||||
removeFrom: function(map) {
|
||||
if (this.changeTimeout) {
|
||||
clearTimeout(this.changeTimeout);
|
||||
}
|
||||
|
||||
if (this.isListening) {
|
||||
this.stopListening();
|
||||
}
|
||||
|
||||
this.map = null;
|
||||
},
|
||||
|
||||
onMapMove: function() {
|
||||
// bail if we're moving the map (updating from a hash),
|
||||
// or if the map is not yet loaded
|
||||
|
||||
if (this.movingMap || !this.map._loaded) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var hash = this.formatHash(this.map);
|
||||
if (this.lastHash != hash) {
|
||||
location.replace(hash);
|
||||
this.lastHash = hash;
|
||||
}
|
||||
},
|
||||
|
||||
movingMap: false,
|
||||
update: function() {
|
||||
var hash = location.hash;
|
||||
if (hash === this.lastHash) {
|
||||
return;
|
||||
}
|
||||
var parsed = this.parseHash(hash);
|
||||
if (parsed) {
|
||||
this.movingMap = true;
|
||||
|
||||
this.map.setView(parsed.center, parsed.zoom);
|
||||
|
||||
this.movingMap = false;
|
||||
} else {
|
||||
this.onMapMove(this.map);
|
||||
}
|
||||
},
|
||||
|
||||
// defer hash change updates every 100ms
|
||||
changeDefer: 100,
|
||||
changeTimeout: null,
|
||||
onHashChange: function() {
|
||||
// throttle calls to update() so that they only happen every
|
||||
// `changeDefer` ms
|
||||
if (!this.changeTimeout) {
|
||||
var that = this;
|
||||
this.changeTimeout = setTimeout(function() {
|
||||
that.update();
|
||||
that.changeTimeout = null;
|
||||
}, this.changeDefer);
|
||||
}
|
||||
},
|
||||
|
||||
isListening: false,
|
||||
hashChangeInterval: null,
|
||||
startListening: function() {
|
||||
this.map.on("moveend", this.onMapMove, this);
|
||||
|
||||
if (HAS_HASHCHANGE) {
|
||||
L.DomEvent.addListener(window, "hashchange", this.onHashChange);
|
||||
} else {
|
||||
clearInterval(this.hashChangeInterval);
|
||||
this.hashChangeInterval = setInterval(this.onHashChange, 50);
|
||||
}
|
||||
this.isListening = true;
|
||||
},
|
||||
|
||||
stopListening: function() {
|
||||
this.map.off("moveend", this.onMapMove, this);
|
||||
|
||||
if (HAS_HASHCHANGE) {
|
||||
L.DomEvent.removeListener(window, "hashchange", this.onHashChange);
|
||||
} else {
|
||||
clearInterval(this.hashChangeInterval);
|
||||
}
|
||||
this.isListening = false;
|
||||
}
|
||||
};
|
||||
L.hash = function(map) {
|
||||
return new L.Hash(map);
|
||||
};
|
||||
L.Map.prototype.addHash = function() {
|
||||
this._hash = L.hash(this);
|
||||
};
|
||||
L.Map.prototype.removeHash = function() {
|
||||
this._hash.removeFrom();
|
||||
};
|
||||
})(window);
|
11
umap/static/umap/vendors/heat/leaflet-heat.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
(c) 2014, Vladimir Agafonkin
|
||||
simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas
|
||||
https://github.com/mourner/simpleheat
|
||||
*/
|
||||
!function(){"use strict";function t(i){return this instanceof t?(this._canvas=i="string"==typeof i?document.getElementById(i):i,this._ctx=i.getContext("2d"),this._width=i.width,this._height=i.height,this._max=1,void this.clear()):new t(i)}t.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t,i){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,i){i=i||15;var a=this._circle=document.createElement("canvas"),s=a.getContext("2d"),e=this._r=t+i;return a.width=a.height=2*e,s.shadowOffsetX=s.shadowOffsetY=200,s.shadowBlur=i,s.shadowColor="black",s.beginPath(),s.arc(e-200,e-200,t,0,2*Math.PI,!0),s.closePath(),s.fill(),this},gradient:function(t){var i=document.createElement("canvas"),a=i.getContext("2d"),s=a.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var e in t)s.addColorStop(e,t[e]);return a.fillStyle=s,a.fillRect(0,0,1,256),this._grad=a.getImageData(0,0,1,256).data,this},draw:function(t){this._circle||this.radius(this.defaultRadius),this._grad||this.gradient(this.defaultGradient);var i=this._ctx;i.clearRect(0,0,this._width,this._height);for(var a,s=0,e=this._data.length;e>s;s++)a=this._data[s],i.globalAlpha=Math.max(a[2]/this._max,t||.05),i.drawImage(this._circle,a[0]-this._r,a[1]-this._r);var n=i.getImageData(0,0,this._width,this._height);return this._colorize(n.data,this._grad),i.putImageData(n,0,0),this},_colorize:function(t,i){for(var a,s=3,e=t.length;e>s;s+=4)a=4*t[s],a&&(t[s-3]=i[a],t[s-2]=i[a+1],t[s-1]=i[a+2])}},window.simpleheat=t}(),/*
|
||||
(c) 2014, Vladimir Agafonkin
|
||||
Leaflet.heat, a tiny and fast heatmap plugin for Leaflet.
|
||||
https://github.com/Leaflet/Leaflet.heat
|
||||
*/
|
||||
L.HeatLayer=(L.Layer?L.Layer:L.Class).extend({initialize:function(t,i){this._latlngs=t,L.setOptions(this,i)},setLatLngs:function(t){return this._latlngs=t,this.redraw()},addLatLng:function(t){return this._latlngs.push(t),this.redraw()},setOptions:function(t){return L.setOptions(this,t),this._heat&&this._updateOptions(),this.redraw()},redraw:function(){return!this._heat||this._frame||this._map._animating||(this._frame=L.Util.requestAnimFrame(this._redraw,this)),this},onAdd:function(t){this._map=t,this._canvas||this._initCanvas(),t._panes.overlayPane.appendChild(this._canvas),t.on("moveend",this._reset,this),t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._canvas),t.off("moveend",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},_initCanvas:function(){var t=this._canvas=L.DomUtil.create("canvas","leaflet-heatmap-layer leaflet-layer"),i=L.DomUtil.testProp(["transformOrigin","WebkitTransformOrigin","msTransformOrigin"]);t.style[i]="50% 50%";var a=this._map.getSize();t.width=a.x,t.height=a.y;var s=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(t,"leaflet-zoom-"+(s?"animated":"hide")),this._heat=simpleheat(t),this._updateOptions()},_updateOptions:function(){this._heat.radius(this.options.radius||this._heat.defaultRadius,this.options.blur),this.options.gradient&&this._heat.gradient(this.options.gradient),this.options.max&&this._heat.max(this.options.max)},_reset:function(){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t);var i=this._map.getSize();this._heat._width!==i.x&&(this._canvas.width=this._heat._width=i.x),this._heat._height!==i.y&&(this._canvas.height=this._heat._height=i.y),this._redraw()},_redraw:function(){var t,i,a,s,e,n,h,o,r,d=[],_=this._heat._r,l=this._map.getSize(),m=new L.Bounds(L.point([-_,-_]),l.add([_,_])),c=void 0===this.options.max?1:this.options.max,u=void 0===this.options.maxZoom?this._map.getMaxZoom():this.options.maxZoom,f=1/Math.pow(2,Math.max(0,Math.min(u-this._map.getZoom(),12))),g=_/2,p=[],v=this._map._getMapPanePos(),w=v.x%g,y=v.y%g;for(t=0,i=this._latlngs.length;i>t;t++)if(a=this._map.latLngToContainerPoint(this._latlngs[t]),m.contains(a)){e=Math.floor((a.x-w)/g)+2,n=Math.floor((a.y-y)/g)+2;var x=void 0!==this._latlngs[t].alt?this._latlngs[t].alt:void 0!==this._latlngs[t][2]?+this._latlngs[t][2]:1;r=x*f,p[n]=p[n]||[],s=p[n][e],s?(s[0]=(s[0]*s[2]+a.x*r)/(s[2]+r),s[1]=(s[1]*s[2]+a.y*r)/(s[2]+r),s[2]+=r):p[n][e]=[a.x,a.y,r]}for(t=0,i=p.length;i>t;t++)if(p[t])for(h=0,o=p[t].length;o>h;h++)s=p[t][h],s&&d.push([Math.round(s[0]),Math.round(s[1]),Math.min(s[2],c)]);this._heat.data(d).draw(this.options.minOpacity),this._frame=null},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),a=this._map._getCenterOffset(t.center)._multiplyBy(-i).subtract(this._map._getMapPanePos());L.DomUtil.setTransform?L.DomUtil.setTransform(this._canvas,a,i):this._canvas.style[L.DomUtil.TRANSFORM]=L.DomUtil.getTranslateString(a)+" scale("+i+")"}}),L.heatLayer=function(t,i){return new L.HeatLayer(t,i)};
|
41
umap/static/umap/vendors/i18n/Leaflet.i18n.js
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Following https://github.com/Leaflet/Leaflet/blob/master/PLUGIN-GUIDE.md
|
||||
(function (factory, window) {
|
||||
|
||||
// define an AMD module that relies on 'leaflet'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['leaflet'], factory);
|
||||
|
||||
// define a Common JS module that relies on 'leaflet'
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory(require('leaflet'));
|
||||
}
|
||||
|
||||
// attach your plugin to the global 'L' variable
|
||||
if (typeof window !== 'undefined' && window.L) {
|
||||
factory(window.L);
|
||||
|
||||
}
|
||||
}(function (L) {
|
||||
L.locales = {};
|
||||
L.locale = null;
|
||||
L.registerLocale = function registerLocale(code, locale) {
|
||||
L.locales[code] = L.Util.extend({}, L.locales[code], locale);
|
||||
};
|
||||
L.setLocale = function setLocale(code) {
|
||||
L.locale = code;
|
||||
};
|
||||
return L.i18n = L._ = function translate(string, data) {
|
||||
if (L.locale && L.locales[L.locale] && typeof L.locales[L.locale][string] !== "undefined") {
|
||||
string = L.locales[L.locale][string];
|
||||
}
|
||||
try {
|
||||
// Do not fail if some data is missing
|
||||
// a bad translation should not break the app
|
||||
string = L.Util.template(string, data);
|
||||
}
|
||||
catch (err) {/*pass*/
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
}, window));
|
BIN
umap/static/umap/vendors/iconlayers/check.png
vendored
Normal file
After Width: | Height: | Size: 2.9 KiB |
62
umap/static/umap/vendors/iconlayers/iconLayers.css
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
.leaflet-iconLayers {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.leaflet-iconLayers-layersRow { display: table; pointer-events: auto; }
|
||||
.leaflet-iconLayers-layerCell { display: table-cell; background-image: url('transparent-pixel.png'); /* ie9 fix */ }
|
||||
|
||||
.leaflet-iconLayers_topleft .leaflet-iconLayers-layerCell, .leaflet-iconLayers_bottomleft .leaflet-iconLayers-layerCell { padding-right: 5px; }
|
||||
.leaflet-iconLayers_topright .leaflet-iconLayers-layerCell, .leaflet-iconLayers_bottomright .leaflet-iconLayers-layerCell { padding-left: 5px; }
|
||||
|
||||
.leaflet-iconLayers_topleft .leaflet-iconLayers-layerCell, .leaflet-iconLayers_topright .leaflet-iconLayers-layerCell { padding-bottom: 5px; }
|
||||
.leaflet-iconLayers_bottomleft .leaflet-iconLayers-layerCell, .leaflet-iconLayers_bottomright .leaflet-iconLayers-layerCell { padding-top: 5px; }
|
||||
|
||||
.leaflet-iconLayers-layer {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background-color: #fff;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 5px #000;
|
||||
}
|
||||
|
||||
.leaflet-iconLayers-layerTitleContainer {
|
||||
display: table;
|
||||
width: 100%;
|
||||
background: rgba(255,255,255,0.6);
|
||||
height: 25%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
position: absolute;
|
||||
bottom: 0%;
|
||||
transition: bottom .35s ease;
|
||||
}
|
||||
|
||||
.leaflet-iconLayers-layerCheckIcon {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 3px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background: url('check.png');
|
||||
background-color: #fff;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 4px 4px;
|
||||
border-radius: 10px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(0,0,0,0.6);
|
||||
}
|
||||
|
||||
.leaflet-iconLayers-layerTitle {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.leaflet-iconLayers-layerCell_hidden { display: none; }
|
||||
.leaflet-iconLayers-layerCell_active .leaflet-iconLayers-layer { cursor: default; }
|
||||
.leaflet-iconLayers-layerCell_active .leaflet-iconLayers-layerCheckIcon { display: block; }
|
310
umap/static/umap/vendors/iconlayers/iconLayers.js
vendored
Normal file
|
@ -0,0 +1,310 @@
|
|||
/*eslint-env commonjs, browser */
|
||||
(function(factory) {
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = factory(require('leaflet'));
|
||||
} else {
|
||||
window.L.control.iconLayers = factory(window.L);
|
||||
window.L.Control.IconLayers = window.L.control.iconLayers.Constructor;
|
||||
}
|
||||
})(function(L) {
|
||||
function each(o, cb) {
|
||||
for (var p in o) {
|
||||
if (o.hasOwnProperty(p)) {
|
||||
cb(o[p], p, o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function find(ar, cb) {
|
||||
if (ar.length) {
|
||||
for (var i = 0; i < ar.length; i++) {
|
||||
if (cb(ar[i])) {
|
||||
return ar[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var p in ar) {
|
||||
if (ar.hasOwnProperty(p) && cb(ar[p])) {
|
||||
return ar[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function first(o) {
|
||||
for (var p in o) {
|
||||
if (o.hasOwnProperty(p)) {
|
||||
return o[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function length(o) {
|
||||
var length = 0;
|
||||
for (var p in o) {
|
||||
if (o.hasOwnProperty(p)) {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
function prepend(parent, el) {
|
||||
if (parent.children.length) {
|
||||
parent.insertBefore(el, parent.children[0]);
|
||||
} else {
|
||||
parent.appendChild(el);
|
||||
}
|
||||
}
|
||||
|
||||
var IconLayers = L.Control.extend({
|
||||
includes: L.Mixin.Events,
|
||||
_getActiveLayer: function() {
|
||||
if (this._activeLayerId) {
|
||||
return this._layers[this._activeLayerId];
|
||||
} else if (length(this._layers)) {
|
||||
return first(this._layers);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
_getPreviousLayer: function() {
|
||||
var activeLayer = this._getActiveLayer();
|
||||
if (!activeLayer) {
|
||||
return null;
|
||||
} else if (this._previousLayerId) {
|
||||
return this._layers[this._previousLayerId];
|
||||
} else {
|
||||
return find(this._layers, function(l) {
|
||||
return l.id !== activeLayer.id;
|
||||
}.bind(this)) || null;
|
||||
}
|
||||
},
|
||||
_getInactiveLayers: function() {
|
||||
var ar = [];
|
||||
var activeLayerId = this._getActiveLayer() ? this._getActiveLayer().id : null;
|
||||
var previousLayerId = this._getPreviousLayer() ? this._getPreviousLayer().id : null;
|
||||
each(this._layers, function(l) {
|
||||
if ((l.id !== activeLayerId) && (l.id !== previousLayerId)) {
|
||||
ar.push(l);
|
||||
}
|
||||
});
|
||||
return ar;
|
||||
},
|
||||
_arrangeLayers: function() {
|
||||
var behaviors = {};
|
||||
behaviors.previous = function() {
|
||||
var layers = this._getInactiveLayers();
|
||||
if (this._getActiveLayer()) {
|
||||
layers.unshift(this._getActiveLayer());
|
||||
}
|
||||
if (this._getPreviousLayer()) {
|
||||
layers.unshift(this._getPreviousLayer());
|
||||
}
|
||||
return layers;
|
||||
};
|
||||
return behaviors[this.options.behavior].apply(this, arguments);
|
||||
},
|
||||
_getLayerCellByLayerId: function(id) {
|
||||
var els = this._container.getElementsByClassName('leaflet-iconLayers-layerCell');
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
if (els[i].getAttribute('data-layerid') == id) {
|
||||
return els[i];
|
||||
}
|
||||
}
|
||||
},
|
||||
_createLayerElement: function(layerObj) {
|
||||
var el = L.DomUtil.create('div', 'leaflet-iconLayers-layer');
|
||||
if (layerObj.title) {
|
||||
var titleContainerEl = L.DomUtil.create('div', 'leaflet-iconLayers-layerTitleContainer');
|
||||
var titleEl = L.DomUtil.create('div', 'leaflet-iconLayers-layerTitle');
|
||||
var checkIconEl = L.DomUtil.create('div', 'leaflet-iconLayers-layerCheckIcon');
|
||||
titleEl.innerHTML = layerObj.title;
|
||||
titleContainerEl.appendChild(titleEl);
|
||||
el.appendChild(titleContainerEl);
|
||||
el.appendChild(checkIconEl);
|
||||
}
|
||||
if (layerObj.icon) {
|
||||
el.setAttribute('style', 'background-image: url(\'' + layerObj.icon + '\')');
|
||||
}
|
||||
return el;
|
||||
},
|
||||
_createLayerElements: function() {
|
||||
var currentRow, layerCell;
|
||||
var layers = this._arrangeLayers();
|
||||
var activeLayerId = this._getActiveLayer() && this._getActiveLayer().id;
|
||||
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
if (i % this.options.maxLayersInRow === 0) {
|
||||
currentRow = L.DomUtil.create('div', 'leaflet-iconLayers-layersRow');
|
||||
if (this.options.position.indexOf('bottom') === -1) {
|
||||
this._container.appendChild(currentRow);
|
||||
} else {
|
||||
prepend(this._container, currentRow);
|
||||
}
|
||||
}
|
||||
layerCell = L.DomUtil.create('div', 'leaflet-iconLayers-layerCell');
|
||||
layerCell.setAttribute('data-layerid', layers[i].id);
|
||||
if (i !== 0) {
|
||||
L.DomUtil.addClass(layerCell, 'leaflet-iconLayers-layerCell_hidden');
|
||||
}
|
||||
if (layers[i].id === activeLayerId) {
|
||||
L.DomUtil.addClass(layerCell, 'leaflet-iconLayers-layerCell_active');
|
||||
}
|
||||
if (this._expandDirection === 'left') {
|
||||
L.DomUtil.addClass(layerCell, 'leaflet-iconLayers-layerCell_expandLeft');
|
||||
} else {
|
||||
L.DomUtil.addClass(layerCell, 'leaflet-iconLayers-layerCell_expandRight');
|
||||
}
|
||||
layerCell.appendChild(this._createLayerElement(layers[i]));
|
||||
|
||||
if (this.options.position.indexOf('right') === -1) {
|
||||
currentRow.appendChild(layerCell);
|
||||
} else {
|
||||
prepend(currentRow, layerCell);
|
||||
}
|
||||
}
|
||||
},
|
||||
_onLayerClick: function(e) {
|
||||
e.stopPropagation();
|
||||
var layerId = e.currentTarget.getAttribute('data-layerid');
|
||||
var layer = this._layers[layerId];
|
||||
this.setActiveLayer(layer.layer);
|
||||
this.expand();
|
||||
},
|
||||
_attachEvents: function() {
|
||||
each(this._layers, function(l) {
|
||||
var e = this._getLayerCellByLayerId(l.id);
|
||||
if (e) {
|
||||
e.addEventListener('click', this._onLayerClick.bind(this));
|
||||
}
|
||||
}.bind(this));
|
||||
var layersRowCollection = this._container.getElementsByClassName('leaflet-iconLayers-layersRow');
|
||||
|
||||
var onMouseEnter = function(e) {
|
||||
e.stopPropagation();
|
||||
this.expand();
|
||||
}.bind(this);
|
||||
|
||||
var onMouseLeave = function(e) {
|
||||
e.stopPropagation();
|
||||
this.collapse();
|
||||
}.bind(this);
|
||||
|
||||
var stopPropagation = function(e) {
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
//TODO Don't make functions within a loop.
|
||||
for (var i = 0; i < layersRowCollection.length; i++) {
|
||||
var el = layersRowCollection[i];
|
||||
el.addEventListener('mouseenter', onMouseEnter);
|
||||
el.addEventListener('mouseleave', onMouseLeave);
|
||||
el.addEventListener('mousemove', stopPropagation);
|
||||
}
|
||||
},
|
||||
_render: function() {
|
||||
this._container.innerHTML = '';
|
||||
this._createLayerElements();
|
||||
this._attachEvents();
|
||||
},
|
||||
_switchMapLayers: function() {
|
||||
if (!this._map) {
|
||||
return;
|
||||
}
|
||||
var activeLayer = this._getActiveLayer();
|
||||
var previousLayer = this._getPreviousLayer();
|
||||
if (previousLayer) {
|
||||
this._map.removeLayer(previousLayer.layer);
|
||||
} else {
|
||||
each(this._layers, function(layerObject) {
|
||||
var layer = layerObject.layer;
|
||||
this._map.removeLayer(layer);
|
||||
}.bind(this));
|
||||
}
|
||||
if (activeLayer) {
|
||||
this._map.addLayer(activeLayer.layer);
|
||||
}
|
||||
},
|
||||
options: {
|
||||
position: 'bottomleft', // one of expanding directions depends on this
|
||||
behavior: 'previous', // may be 'previous', 'expanded' or 'first'
|
||||
expand: 'horizontal', // or 'vertical'
|
||||
autoZIndex: true, // from L.Control.Layers
|
||||
maxLayersInRow: 5,
|
||||
manageLayers: true
|
||||
},
|
||||
initialize: function(layers, options) {
|
||||
if (!L.Util.isArray(arguments[0])) {
|
||||
// first argument is options
|
||||
options = layers;
|
||||
layers = [];
|
||||
}
|
||||
L.setOptions(this, options);
|
||||
this._expandDirection = (this.options.position.indexOf('left') != -1) ? 'right' : 'left';
|
||||
if (this.options.manageLayers) {
|
||||
this.on('activelayerchange', this._switchMapLayers, this);
|
||||
}
|
||||
this.setLayers(layers);
|
||||
},
|
||||
onAdd: function(map) {
|
||||
this._container = L.DomUtil.create('div', 'leaflet-iconLayers');
|
||||
L.DomUtil.addClass(this._container, 'leaflet-iconLayers_' + this.options.position);
|
||||
this._render();
|
||||
map.on('click', this.collapse, this);
|
||||
if (this.options.manageLayers) {
|
||||
this._switchMapLayers();
|
||||
}
|
||||
return this._container;
|
||||
},
|
||||
onRemove: function(map) {
|
||||
map.off('click', this.collapse, this);
|
||||
},
|
||||
setLayers: function(layers) {
|
||||
this._layers = {};
|
||||
layers.map(function(layer) {
|
||||
var id = L.stamp(layer.layer);
|
||||
this._layers[id] = L.extend(layer, {
|
||||
id: id
|
||||
});
|
||||
}.bind(this));
|
||||
if (this._container) {
|
||||
this._render();
|
||||
}
|
||||
},
|
||||
setActiveLayer: function(layer) {
|
||||
var l = layer && this._layers[L.stamp(layer)];
|
||||
if (!l || l.id === this._activeLayerId) {
|
||||
return;
|
||||
}
|
||||
this._previousLayerId = this._activeLayerId;
|
||||
this._activeLayerId = l.id;
|
||||
if (this._container) {
|
||||
this._render();
|
||||
}
|
||||
this.fire('activelayerchange', {
|
||||
layer: layer
|
||||
});
|
||||
},
|
||||
expand: function() {
|
||||
this._arrangeLayers().slice(1).map(function(l) {
|
||||
var el = this._getLayerCellByLayerId(l.id);
|
||||
L.DomUtil.removeClass(el, 'leaflet-iconLayers-layerCell_hidden');
|
||||
}.bind(this));
|
||||
},
|
||||
collapse: function() {
|
||||
this._arrangeLayers().slice(1).map(function(l) {
|
||||
var el = this._getLayerCellByLayerId(l.id);
|
||||
L.DomUtil.addClass(el, 'leaflet-iconLayers-layerCell_hidden');
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
var iconLayers = function(layers, options) {
|
||||
return new IconLayers(layers, options);
|
||||
};
|
||||
|
||||
iconLayers.Constructor = IconLayers;
|
||||
|
||||
return iconLayers;
|
||||
});
|
BIN
umap/static/umap/vendors/iconlayers/transparent-pixel.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
umap/static/umap/vendors/leaflet/images/layers-2x.png
vendored
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
umap/static/umap/vendors/leaflet/images/layers.png
vendored
Normal file
After Width: | Height: | Size: 696 B |
BIN
umap/static/umap/vendors/leaflet/images/marker-icon-2x.png
vendored
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
umap/static/umap/vendors/leaflet/images/marker-icon.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
umap/static/umap/vendors/leaflet/images/marker-shadow.png
vendored
Normal file
After Width: | Height: | Size: 618 B |
14419
umap/static/umap/vendors/leaflet/leaflet-src.esm.js
vendored
Normal file
1
umap/static/umap/vendors/leaflet/leaflet-src.esm.js.map
vendored
Normal file
14512
umap/static/umap/vendors/leaflet/leaflet-src.js
vendored
Normal file
1
umap/static/umap/vendors/leaflet/leaflet-src.js.map
vendored
Normal file
661
umap/static/umap/vendors/leaflet/leaflet.css
vendored
Normal file
|
@ -0,0 +1,661 @@
|
|||
/* required styles */
|
||||
|
||||
.leaflet-pane,
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-tile-container,
|
||||
.leaflet-pane > svg,
|
||||
.leaflet-pane > canvas,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-layer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
/* Prevents IE11 from highlighting tiles in blue */
|
||||
.leaflet-tile::selection {
|
||||
background: transparent;
|
||||
}
|
||||
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
|
||||
.leaflet-safari .leaflet-tile {
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
}
|
||||
/* hack that prevents hw layers "stretching" when loading new tiles */
|
||||
.leaflet-safari .leaflet-tile-container {
|
||||
width: 1600px;
|
||||
height: 1600px;
|
||||
-webkit-transform-origin: 0 0;
|
||||
}
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
display: block;
|
||||
}
|
||||
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
|
||||
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
|
||||
.leaflet-container .leaflet-overlay-pane svg {
|
||||
max-width: none !important;
|
||||
max-height: none !important;
|
||||
}
|
||||
.leaflet-container .leaflet-marker-pane img,
|
||||
.leaflet-container .leaflet-shadow-pane img,
|
||||
.leaflet-container .leaflet-tile-pane img,
|
||||
.leaflet-container img.leaflet-image-layer,
|
||||
.leaflet-container .leaflet-tile {
|
||||
max-width: none !important;
|
||||
max-height: none !important;
|
||||
width: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.leaflet-container img.leaflet-tile {
|
||||
/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
|
||||
mix-blend-mode: plus-lighter;
|
||||
}
|
||||
|
||||
.leaflet-container.leaflet-touch-zoom {
|
||||
-ms-touch-action: pan-x pan-y;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
.leaflet-container.leaflet-touch-drag {
|
||||
-ms-touch-action: pinch-zoom;
|
||||
/* Fallback for FF which doesn't support pinch-zoom */
|
||||
touch-action: none;
|
||||
touch-action: pinch-zoom;
|
||||
}
|
||||
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
.leaflet-container {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.leaflet-container a {
|
||||
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
|
||||
}
|
||||
.leaflet-tile {
|
||||
filter: inherit;
|
||||
visibility: hidden;
|
||||
}
|
||||
.leaflet-tile-loaded {
|
||||
visibility: inherit;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
z-index: 800;
|
||||
}
|
||||
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
|
||||
.leaflet-overlay-pane svg {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
.leaflet-pane { z-index: 400; }
|
||||
|
||||
.leaflet-tile-pane { z-index: 200; }
|
||||
.leaflet-overlay-pane { z-index: 400; }
|
||||
.leaflet-shadow-pane { z-index: 500; }
|
||||
.leaflet-marker-pane { z-index: 600; }
|
||||
.leaflet-tooltip-pane { z-index: 650; }
|
||||
.leaflet-popup-pane { z-index: 700; }
|
||||
|
||||
.leaflet-map-pane canvas { z-index: 100; }
|
||||
.leaflet-map-pane svg { z-index: 200; }
|
||||
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.lvml {
|
||||
behavior: url(#default#VML);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
/* control positioning */
|
||||
|
||||
.leaflet-control {
|
||||
position: relative;
|
||||
z-index: 800;
|
||||
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-top,
|
||||
.leaflet-bottom {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-top {
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-right {
|
||||
right: 0;
|
||||
}
|
||||
.leaflet-bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
.leaflet-left {
|
||||
left: 0;
|
||||
}
|
||||
.leaflet-control {
|
||||
float: left;
|
||||
clear: both;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
float: right;
|
||||
}
|
||||
.leaflet-top .leaflet-control {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.leaflet-left .leaflet-control {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* zoom and fade animations */
|
||||
|
||||
.leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
.leaflet-zoom-animated {
|
||||
-webkit-transform-origin: 0 0;
|
||||
-ms-transform-origin: 0 0;
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
svg.leaflet-zoom-animated {
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-tile,
|
||||
.leaflet-pan-anim .leaflet-tile {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-zoom-hide {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
/* cursors */
|
||||
|
||||
.leaflet-interactive {
|
||||
cursor: pointer;
|
||||
}
|
||||
.leaflet-grab {
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
.leaflet-crosshair,
|
||||
.leaflet-crosshair .leaflet-interactive {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-control {
|
||||
cursor: auto;
|
||||
}
|
||||
.leaflet-dragging .leaflet-grab,
|
||||
.leaflet-dragging .leaflet-grab .leaflet-interactive,
|
||||
.leaflet-dragging .leaflet-marker-draggable {
|
||||
cursor: move;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* marker & overlays interactivity */
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-pane > svg path,
|
||||
.leaflet-tile-container {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon.leaflet-interactive,
|
||||
.leaflet-image-layer.leaflet-interactive,
|
||||
.leaflet-pane > svg path.leaflet-interactive,
|
||||
svg.leaflet-image-layer.leaflet-interactive path {
|
||||
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* visual tweaks */
|
||||
|
||||
.leaflet-container {
|
||||
background: #ddd;
|
||||
outline-offset: 1px;
|
||||
}
|
||||
.leaflet-container a {
|
||||
color: #0078A8;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
border: 2px dotted #38f;
|
||||
background: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
|
||||
/* general typography */
|
||||
.leaflet-container {
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
|
||||
/* general toolbar styles */
|
||||
|
||||
.leaflet-bar {
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.leaflet-bar a {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ccc;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
.leaflet-bar a,
|
||||
.leaflet-control-layers-toggle {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
}
|
||||
.leaflet-bar a:hover,
|
||||
.leaflet-bar a:focus {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.leaflet-bar a:first-child {
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
.leaflet-bar a:last-child {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.leaflet-bar a.leaflet-disabled {
|
||||
cursor: default;
|
||||
background-color: #f4f4f4;
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-bar a {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.leaflet-touch .leaflet-bar a:first-child {
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
}
|
||||
.leaflet-touch .leaflet-bar a:last-child {
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
/* zoom control */
|
||||
|
||||
.leaflet-control-zoom-in,
|
||||
.leaflet-control-zoom-out {
|
||||
font: bold 18px 'Lucida Console', Monaco, monospace;
|
||||
text-indent: 1px;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
|
||||
/* layers control */
|
||||
|
||||
.leaflet-control-layers {
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
|
||||
background: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.leaflet-control-layers-toggle {
|
||||
background-image: url(images/layers.png);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
.leaflet-retina .leaflet-control-layers-toggle {
|
||||
background-image: url(images/layers-2x.png);
|
||||
background-size: 26px 26px;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers-toggle {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
.leaflet-control-layers .leaflet-control-layers-list,
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
|
||||
display: none;
|
||||
}
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-list {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.leaflet-control-layers-expanded {
|
||||
padding: 6px 10px 6px 6px;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
.leaflet-control-layers-scrollbar {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding-right: 5px;
|
||||
}
|
||||
.leaflet-control-layers-selector {
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.leaflet-control-layers label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-size: 1.08333em;
|
||||
}
|
||||
.leaflet-control-layers-separator {
|
||||
height: 0;
|
||||
border-top: 1px solid #ddd;
|
||||
margin: 5px -10px 5px -6px;
|
||||
}
|
||||
|
||||
/* Default icon URLs */
|
||||
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
|
||||
background-image: url(images/marker-icon.png);
|
||||
}
|
||||
|
||||
|
||||
/* attribution and scale controls */
|
||||
|
||||
.leaflet-container .leaflet-control-attribution {
|
||||
background: #fff;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
margin: 0;
|
||||
}
|
||||
.leaflet-control-attribution,
|
||||
.leaflet-control-scale-line {
|
||||
padding: 0 5px;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.leaflet-control-attribution a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.leaflet-control-attribution a:hover,
|
||||
.leaflet-control-attribution a:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.leaflet-attribution-flag {
|
||||
display: inline !important;
|
||||
vertical-align: baseline !important;
|
||||
width: 1em;
|
||||
height: 0.6669em;
|
||||
}
|
||||
.leaflet-left .leaflet-control-scale {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control-scale {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.leaflet-control-scale-line {
|
||||
border: 2px solid #777;
|
||||
border-top: none;
|
||||
line-height: 1.1;
|
||||
padding: 2px 5px 1px;
|
||||
white-space: nowrap;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
text-shadow: 1px 1px #fff;
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child) {
|
||||
border-top: 2px solid #777;
|
||||
border-bottom: none;
|
||||
margin-top: -2px;
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
|
||||
border-bottom: 2px solid #777;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-attribution,
|
||||
.leaflet-touch .leaflet-control-layers,
|
||||
.leaflet-touch .leaflet-bar {
|
||||
box-shadow: none;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers,
|
||||
.leaflet-touch .leaflet-bar {
|
||||
border: 2px solid rgba(0,0,0,0.2);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
|
||||
/* popup */
|
||||
|
||||
.leaflet-popup {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
margin: 13px 24px 13px 20px;
|
||||
line-height: 1.3;
|
||||
font-size: 13px;
|
||||
font-size: 1.08333em;
|
||||
min-height: 1px;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
margin: 17px 0;
|
||||
margin: 1.3em 0;
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-top: -1px;
|
||||
margin-left: -20px;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-popup-tip {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
padding: 1px;
|
||||
|
||||
margin: -10px auto 0;
|
||||
pointer-events: auto;
|
||||
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.leaflet-popup-content-wrapper,
|
||||
.leaflet-popup-tip {
|
||||
background: white;
|
||||
color: #333;
|
||||
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border: none;
|
||||
text-align: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font: 16px/24px Tahoma, Verdana, sans-serif;
|
||||
color: #757575;
|
||||
text-decoration: none;
|
||||
background: transparent;
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button:hover,
|
||||
.leaflet-container a.leaflet-popup-close-button:focus {
|
||||
color: #585858;
|
||||
}
|
||||
.leaflet-popup-scrolled {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-popup-content-wrapper {
|
||||
-ms-zoom: 1;
|
||||
}
|
||||
.leaflet-oldie .leaflet-popup-tip {
|
||||
width: 24px;
|
||||
margin: 0 auto;
|
||||
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-control-zoom,
|
||||
.leaflet-oldie .leaflet-control-layers,
|
||||
.leaflet-oldie .leaflet-popup-content-wrapper,
|
||||
.leaflet-oldie .leaflet-popup-tip {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
|
||||
/* div icon */
|
||||
|
||||
.leaflet-div-icon {
|
||||
background: #fff;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
|
||||
/* Tooltip */
|
||||
/* Base styles for the element that has a tooltip */
|
||||
.leaflet-tooltip {
|
||||
position: absolute;
|
||||
padding: 6px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 3px;
|
||||
color: #222;
|
||||
white-space: nowrap;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-tooltip.leaflet-interactive {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-tooltip-top:before,
|
||||
.leaflet-tooltip-bottom:before,
|
||||
.leaflet-tooltip-left:before,
|
||||
.leaflet-tooltip-right:before {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border: 6px solid transparent;
|
||||
background: transparent;
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Directions */
|
||||
|
||||
.leaflet-tooltip-bottom {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.leaflet-tooltip-top {
|
||||
margin-top: -6px;
|
||||
}
|
||||
.leaflet-tooltip-bottom:before,
|
||||
.leaflet-tooltip-top:before {
|
||||
left: 50%;
|
||||
margin-left: -6px;
|
||||
}
|
||||
.leaflet-tooltip-top:before {
|
||||
bottom: 0;
|
||||
margin-bottom: -12px;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-bottom:before {
|
||||
top: 0;
|
||||
margin-top: -12px;
|
||||
margin-left: -6px;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-left {
|
||||
margin-left: -6px;
|
||||
}
|
||||
.leaflet-tooltip-right {
|
||||
margin-left: 6px;
|
||||
}
|
||||
.leaflet-tooltip-left:before,
|
||||
.leaflet-tooltip-right:before {
|
||||
top: 50%;
|
||||
margin-top: -6px;
|
||||
}
|
||||
.leaflet-tooltip-left:before {
|
||||
right: 0;
|
||||
margin-right: -12px;
|
||||
border-left-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-right:before {
|
||||
left: 0;
|
||||
margin-left: -12px;
|
||||
border-right-color: #fff;
|
||||
}
|
||||
|
||||
/* Printing */
|
||||
|
||||
@media print {
|
||||
/* Prevent printers from removing background-images of controls. */
|
||||
.leaflet-control {
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
}
|
6
umap/static/umap/vendors/leaflet/leaflet.js
vendored
Normal file
1
umap/static/umap/vendors/leaflet/leaflet.js.map
vendored
Normal file
26
umap/static/umap/vendors/loading/Control.Loading.css
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
.leaflet-control-loading:empty {
|
||||
/* Spinner via ajaxload.info, base64-encoded */
|
||||
background-image: url(data:image/gif;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAAKAAEALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWMx+lwSKkICJ0QsHi9RgKBwnVTiRQQgwF4I4UFDQQEwi6/3YSGWRRmjhEETAJfIgMFCnAKM0KDV4EEEAQLiF18TAYNXDaSe3x6mjidN1s3IQAh+QQACgACACwAAAAAEAAQAAAFeCAgAgLZDGU5jgRECEUiCI+yioSDwDJyLKsXoHFQxBSHAoAAFBhqtMJg8DgQBgfrEsJAEAg4YhZIEiwgKtHiMBgtpg3wbUZXGO7kOb1MUKRFMysCChAoggJCIg0GC2aNe4gqQldfL4l/Ag1AXySJgn5LcoE3QXI3IQAh+QQACgADACwAAAAAEAAQAAAFdiAgAgLZNGU5joQhCEjxIssqEo8bC9BRjy9Ag7GILQ4QEoE0gBAEBcOpcBA0DoxSK/e8LRIHn+i1cK0IyKdg0VAoljYIg+GgnRrwVS/8IAkICyosBIQpBAMoKy9dImxPhS+GKkFrkX+TigtLlIyKXUF+NjagNiEAIfkEAAoABAAsAAAAABAAEAAABWwgIAICaRhlOY4EIgjH8R7LKhKHGwsMvb4AAy3WODBIBBKCsYA9TjuhDNDKEVSERezQEL0WrhXucRUQGuik7bFlngzqVW9LMl9XWvLdjFaJtDFqZ1cEZUB0dUgvL3dgP4WJZn4jkomWNpSTIyEAIfkEAAoABQAsAAAAABAAEAAABX4gIAICuSxlOY6CIgiD8RrEKgqGOwxwUrMlAoSwIzAGpJpgoSDAGifDY5kopBYDlEpAQBwevxfBtRIUGi8xwWkDNBCIwmC9Vq0aiQQDQuK+VgQPDXV9hCJjBwcFYU5pLwwHXQcMKSmNLQcIAExlbH8JBwttaX0ABAcNbWVbKyEAIfkEAAoABgAsAAAAABAAEAAABXkgIAICSRBlOY7CIghN8zbEKsKoIjdFzZaEgUBHKChMJtRwcWpAWoWnifm6ESAMhO8lQK0EEAV3rFopIBCEcGwDKAqPh4HUrY4ICHH1dSoTFgcHUiZjBhAJB2AHDykpKAwHAwdzf19KkASIPl9cDgcnDkdtNwiMJCshACH5BAAKAAcALAAAAAAQABAAAAV3ICACAkkQZTmOAiosiyAoxCq+KPxCNVsSMRgBsiClWrLTSWFoIQZHl6pleBh6suxKMIhlvzbAwkBWfFWrBQTxNLq2RG2yhSUkDs2b63AYDAoJXAcFRwADeAkJDX0AQCsEfAQMDAIPBz0rCgcxky0JRWE1AmwpKyEAIfkEAAoACAAsAAAAABAAEAAABXkgIAICKZzkqJ4nQZxLqZKv4NqNLKK2/Q4Ek4lFXChsg5ypJjs1II3gEDUSRInEGYAw6B6zM4JhrDAtEosVkLUtHA7RHaHAGJQEjsODcEg0FBAFVgkQJQ1pAwcDDw8KcFtSInwJAowCCA6RIwqZAgkPNgVpWndjdyohACH5BAAKAAkALAAAAAAQABAAAAV5ICACAimc5KieLEuUKvm2xAKLqDCfC2GaO9eL0LABWTiBYmA06W6kHgvCqEJiAIJiu3gcvgUsscHUERm+kaCxyxa+zRPk0SgJEgfIvbAdIAQLCAYlCj4DBw0IBQsMCjIqBAcPAooCBg9pKgsJLwUFOhCZKyQDA3YqIQAh+QQACgAKACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQACgALACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.leaflet-control-loading,
|
||||
.leaflet-control-zoom a.leaflet-control-loading,
|
||||
.leaflet-control-zoomslider a.leaflet-control-loading,
|
||||
.leaflet-control-layer-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.leaflet-control-loading.is-loading,
|
||||
.leaflet-control-zoom a.leaflet-control-loading.is-loading,
|
||||
.leaflet-control-zoomslider a.leaflet-control-loading.is-loading,
|
||||
.leaflet-control-layer-container.is-loading {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Necessary for display consistency in Leaflet >= 0.6 */
|
||||
.leaflet-bar-part-bottom {
|
||||
border-bottom: medium none;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
351
umap/static/umap/vendors/loading/Control.Loading.js
vendored
Normal file
|
@ -0,0 +1,351 @@
|
|||
/*
|
||||
* L.Control.Loading is a control that shows a loading indicator when tiles are
|
||||
* loading or when map-related AJAX requests are taking place.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
var console = window.console || {
|
||||
error: function () {},
|
||||
warn: function () {}
|
||||
};
|
||||
|
||||
function defineLeafletLoading(L) {
|
||||
L.Control.Loading = L.Control.extend({
|
||||
options: {
|
||||
delayIndicator: null,
|
||||
position: 'topleft',
|
||||
separate: false,
|
||||
zoomControl: null,
|
||||
spinjs: false,
|
||||
spin: {
|
||||
lines: 7,
|
||||
length: 3,
|
||||
width: 3,
|
||||
radius: 5,
|
||||
rotate: 13,
|
||||
top: "83%"
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
L.setOptions(this, options);
|
||||
this._dataLoaders = {};
|
||||
|
||||
// Try to set the zoom control this control is attached to from the
|
||||
// options
|
||||
if (this.options.zoomControl !== null) {
|
||||
this.zoomControl = this.options.zoomControl;
|
||||
}
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
if (this.options.spinjs && (typeof Spinner !== 'function')) {
|
||||
return console.error("Leaflet.loading cannot load because you didn't load spin.js (http://fgnass.github.io/spin.js/), even though you set it in options.");
|
||||
}
|
||||
this._addLayerListeners(map);
|
||||
this._addMapListeners(map);
|
||||
|
||||
// Try to set the zoom control this control is attached to from the map
|
||||
// the control is being added to
|
||||
if (!this.options.separate && !this.zoomControl) {
|
||||
if (map.zoomControl) {
|
||||
this.zoomControl = map.zoomControl;
|
||||
} else if (map.zoomsliderControl) {
|
||||
this.zoomControl = map.zoomsliderControl;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the loading indicator
|
||||
var classes = 'leaflet-control-loading';
|
||||
var container;
|
||||
if (this.zoomControl && !this.options.separate) {
|
||||
// If there is a zoom control, hook into the bottom of it
|
||||
container = this.zoomControl._container;
|
||||
// These classes are no longer used as of Leaflet 0.6
|
||||
classes += ' leaflet-bar-part-bottom leaflet-bar-part last';
|
||||
|
||||
// Loading control will be added to the zoom control. So the visible last element is not the
|
||||
// last dom element anymore. So add the part-bottom class.
|
||||
L.DomUtil.addClass(this._getLastControlButton(), 'leaflet-bar-part-bottom');
|
||||
}
|
||||
else {
|
||||
// Otherwise, create a container for the indicator
|
||||
container = L.DomUtil.create('div', 'leaflet-control-zoom leaflet-control-layer-container leaflet-bar');
|
||||
}
|
||||
this._indicatorContainer = container;
|
||||
this._indicator = L.DomUtil.create('a', classes, container);
|
||||
if (this.options.spinjs) {
|
||||
this._spinner = new Spinner(this.options.spin).spin();
|
||||
this._indicator.appendChild(this._spinner.el);
|
||||
}
|
||||
return container;
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
this._removeLayerListeners(map);
|
||||
this._removeMapListeners(map);
|
||||
},
|
||||
|
||||
removeFrom: function (map) {
|
||||
if (this.zoomControl && !this.options.separate) {
|
||||
// Override Control.removeFrom() to avoid clobbering the entire
|
||||
// _container, which is the same as zoomControl's
|
||||
this._container.removeChild(this._indicator);
|
||||
this._map = null;
|
||||
this.onRemove(map);
|
||||
return this;
|
||||
}
|
||||
else {
|
||||
// If this control is separate from the zoomControl, call the
|
||||
// parent method so we don't leave behind an empty container
|
||||
return L.Control.prototype.removeFrom.call(this, map);
|
||||
}
|
||||
},
|
||||
|
||||
addLoader: function(id) {
|
||||
this._dataLoaders[id] = true;
|
||||
if (this.options.delayIndicator && !this.delayIndicatorTimeout) {
|
||||
// If we are delaying showing the indicator and we're not
|
||||
// already waiting for that delay, set up a timeout.
|
||||
var that = this;
|
||||
this.delayIndicatorTimeout = setTimeout(function () {
|
||||
that.updateIndicator();
|
||||
that.delayIndicatorTimeout = null;
|
||||
}, this.options.delayIndicator);
|
||||
}
|
||||
else {
|
||||
// Otherwise show the indicator immediately
|
||||
this.updateIndicator();
|
||||
}
|
||||
},
|
||||
|
||||
removeLoader: function(id) {
|
||||
delete this._dataLoaders[id];
|
||||
this.updateIndicator();
|
||||
|
||||
// If removing this loader means we're in no danger of loading,
|
||||
// clear the timeout. This prevents old delays from instantly
|
||||
// triggering the indicator.
|
||||
if (this.options.delayIndicator && this.delayIndicatorTimeout && !this.isLoading()) {
|
||||
clearTimeout(this.delayIndicatorTimeout);
|
||||
this.delayIndicatorTimeout = null;
|
||||
}
|
||||
},
|
||||
|
||||
updateIndicator: function() {
|
||||
if (this.isLoading()) {
|
||||
this._showIndicator();
|
||||
}
|
||||
else {
|
||||
this._hideIndicator();
|
||||
}
|
||||
},
|
||||
|
||||
isLoading: function() {
|
||||
return this._countLoaders() > 0;
|
||||
},
|
||||
|
||||
_countLoaders: function() {
|
||||
var size = 0, key;
|
||||
for (key in this._dataLoaders) {
|
||||
if (this._dataLoaders.hasOwnProperty(key)) size++;
|
||||
}
|
||||
return size;
|
||||
},
|
||||
|
||||
_showIndicator: function() {
|
||||
// Show loading indicator
|
||||
L.DomUtil.addClass(this._indicator, 'is-loading');
|
||||
L.DomUtil.addClass(this._indicatorContainer, 'is-loading');
|
||||
|
||||
// If zoomControl exists, make the zoom-out button not last
|
||||
if (!this.options.separate) {
|
||||
if (this.zoomControl instanceof L.Control.Zoom) {
|
||||
L.DomUtil.removeClass(this._getLastControlButton(), 'leaflet-bar-part-bottom');
|
||||
}
|
||||
else if (typeof L.Control.Zoomslider === 'function' && this.zoomControl instanceof L.Control.Zoomslider) {
|
||||
L.DomUtil.removeClass(this.zoomControl._ui.zoomOut, 'leaflet-bar-part-bottom');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_hideIndicator: function() {
|
||||
// Hide loading indicator
|
||||
L.DomUtil.removeClass(this._indicator, 'is-loading');
|
||||
L.DomUtil.removeClass(this._indicatorContainer, 'is-loading');
|
||||
|
||||
// If zoomControl exists, make the zoom-out button last
|
||||
if (!this.options.separate) {
|
||||
if (this.zoomControl instanceof L.Control.Zoom) {
|
||||
L.DomUtil.addClass(this._getLastControlButton(), 'leaflet-bar-part-bottom');
|
||||
}
|
||||
else if (typeof L.Control.Zoomslider === 'function' && this.zoomControl instanceof L.Control.Zoomslider) {
|
||||
L.DomUtil.addClass(this.zoomControl._ui.zoomOut, 'leaflet-bar-part-bottom');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_getLastControlButton: function() {
|
||||
var container = this.zoomControl._container,
|
||||
index = container.children.length - 1;
|
||||
|
||||
// Find the last visible control button that is not our loading
|
||||
// indicator
|
||||
while (index > 0) {
|
||||
var button = container.children[index];
|
||||
if (!(this._indicator === button || button.offsetWidth === 0 || button.offsetHeight === 0)) {
|
||||
break;
|
||||
}
|
||||
index--;
|
||||
}
|
||||
|
||||
return container.children[index];
|
||||
},
|
||||
|
||||
_handleLoading: function(e) {
|
||||
this.addLoader(this.getEventId(e));
|
||||
},
|
||||
|
||||
_handleBaseLayerChange: function (e) {
|
||||
var that = this;
|
||||
|
||||
// Check for a target 'layer' that contains multiple layers, such as
|
||||
// L.LayerGroup. This will happen if you have an L.LayerGroup in an
|
||||
// L.Control.Layers.
|
||||
if (e.layer && e.layer.eachLayer && typeof e.layer.eachLayer === 'function') {
|
||||
e.layer.eachLayer(function (layer) {
|
||||
that._handleBaseLayerChange({ layer: layer });
|
||||
});
|
||||
}
|
||||
else {
|
||||
// If we're changing to a canvas layer, don't handle loading
|
||||
// as canvas layers will not fire load events.
|
||||
if (!(L.TileLayer.Canvas && e.layer instanceof L.TileLayer.Canvas)) {
|
||||
that._handleLoading(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_handleLoad: function(e) {
|
||||
this.removeLoader(this.getEventId(e));
|
||||
},
|
||||
|
||||
getEventId: function(e) {
|
||||
if (e.id) {
|
||||
return e.id;
|
||||
}
|
||||
else if (e.layer) {
|
||||
return e.layer._leaflet_id;
|
||||
}
|
||||
return e.target._leaflet_id;
|
||||
},
|
||||
|
||||
_layerAdd: function(e) {
|
||||
if (!e.layer || !e.layer.on) return
|
||||
try {
|
||||
e.layer.on({
|
||||
loading: this._handleLoading,
|
||||
load: this._handleLoad
|
||||
}, this);
|
||||
}
|
||||
catch (exception) {
|
||||
console.warn('L.Control.Loading: Tried and failed to add ' +
|
||||
' event handlers to layer', e.layer);
|
||||
console.warn('L.Control.Loading: Full details', exception);
|
||||
}
|
||||
},
|
||||
|
||||
_layerRemove: function(e) {
|
||||
if (!e.layer || !e.layer.off) return;
|
||||
try {
|
||||
e.layer.off({
|
||||
loading: this._handleLoading,
|
||||
load: this._handleLoad
|
||||
}, this);
|
||||
}
|
||||
catch (exception) {
|
||||
console.warn('L.Control.Loading: Tried and failed to remove ' +
|
||||
'event handlers from layer', e.layer);
|
||||
console.warn('L.Control.Loading: Full details', exception);
|
||||
}
|
||||
},
|
||||
|
||||
_addLayerListeners: function(map) {
|
||||
// Add listeners for begin and end of load to any layers already on the
|
||||
// map
|
||||
map.eachLayer(function(layer) {
|
||||
if (!layer.on) return;
|
||||
layer.on({
|
||||
loading: this._handleLoading,
|
||||
load: this._handleLoad
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
// When a layer is added to the map, add listeners for begin and end
|
||||
// of load
|
||||
map.on('layeradd', this._layerAdd, this);
|
||||
map.on('layerremove', this._layerRemove, this);
|
||||
},
|
||||
|
||||
_removeLayerListeners: function(map) {
|
||||
// Remove listeners for begin and end of load from all layers
|
||||
map.eachLayer(function(layer) {
|
||||
if (!layer.off) return;
|
||||
layer.off({
|
||||
loading: this._handleLoading,
|
||||
load: this._handleLoad
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
// Remove layeradd/layerremove listener from map
|
||||
map.off('layeradd', this._layerAdd, this);
|
||||
map.off('layerremove', this._layerRemove, this);
|
||||
},
|
||||
|
||||
_addMapListeners: function(map) {
|
||||
// Add listeners to the map for (custom) dataloading and dataload
|
||||
// events, eg, for AJAX calls that affect the map but will not be
|
||||
// reflected in the above layer events.
|
||||
map.on({
|
||||
baselayerchange: this._handleBaseLayerChange,
|
||||
dataloading: this._handleLoading,
|
||||
dataload: this._handleLoad,
|
||||
layerremove: this._handleLoad
|
||||
}, this);
|
||||
},
|
||||
|
||||
_removeMapListeners: function(map) {
|
||||
map.off({
|
||||
baselayerchange: this._handleBaseLayerChange,
|
||||
dataloading: this._handleLoading,
|
||||
dataload: this._handleLoad,
|
||||
layerremove: this._handleLoad
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
L.Map.addInitHook(function () {
|
||||
if (this.options.loadingControl) {
|
||||
this.loadingControl = new L.Control.Loading();
|
||||
this.addControl(this.loadingControl);
|
||||
}
|
||||
});
|
||||
|
||||
L.Control.loading = function(options) {
|
||||
return new L.Control.Loading(options);
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Try to add leaflet.loading to Leaflet using AMD
|
||||
define(['leaflet'], function (L) {
|
||||
defineLeafletLoading(L);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Else use the global L
|
||||
defineLeafletLoading(L);
|
||||
}
|
||||
|
||||
})();
|
1
umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.leaflet-control-locate a{cursor:pointer}.leaflet-control-locate a .leaflet-control-locate-location-arrow{display:inline-block;width:16px;height:16px;margin:7px;background-image:url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="black" d="M445 4 29 195c-48 23-32 93 19 93h176v176c0 51 70 67 93 19L508 67c16-38-25-79-63-63z"/></svg>')}.leaflet-control-locate a .leaflet-control-locate-spinner{display:inline-block;width:16px;height:16px;margin:7px;background-image:url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="black" d="M304 48a48 48 0 1 1-96 0 48 48 0 0 1 96 0zm-48 368a48 48 0 1 0 0 96 48 48 0 0 0 0-96zm208-208a48 48 0 1 0 0 96 48 48 0 0 0 0-96zM96 256a48 48 0 1 0-96 0 48 48 0 0 0 96 0zm13 99a48 48 0 1 0 0 96 48 48 0 0 0 0-96zm294 0a48 48 0 1 0 0 96 48 48 0 0 0 0-96zM109 61a48 48 0 1 0 0 96 48 48 0 0 0 0-96z"/></svg>');animation:leaflet-control-locate-spin 2s linear infinite}.leaflet-control-locate.active a .leaflet-control-locate-location-arrow{background-image:url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="rgb(32, 116, 182)" d="M445 4 29 195c-48 23-32 93 19 93h176v176c0 51 70 67 93 19L508 67c16-38-25-79-63-63z"/></svg>')}.leaflet-control-locate.following a .leaflet-control-locate-location-arrow{background-image:url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="rgb(252, 132, 40)" d="M445 4 29 195c-48 23-32 93 19 93h176v176c0 51 70 67 93 19L508 67c16-38-25-79-63-63z"/></svg>')}.leaflet-touch .leaflet-bar .leaflet-locate-text-active{width:100%;max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:0 10px}.leaflet-touch .leaflet-bar .leaflet-locate-text-active .leaflet-locate-icon{padding:0 5px 0 0}.leaflet-control-locate-location circle{animation:leaflet-control-locate-throb 4s ease infinite}@keyframes leaflet-control-locate-throb{0%{stroke-width:1}50%{stroke-width:3;transform:scale(0.8, 0.8)}100%{stroke-width:1}}@keyframes leaflet-control-locate-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}/*# sourceMappingURL=L.Control.Locate.min.css.map */
|
1
umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.css.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sourceRoot":"","sources":["../src/L.Control.Locate.scss"],"names":[],"mappings":"AASE,0BACE,eAEA,iEACE,qBACA,WACA,YACA,WACA,0OAGF,0DACE,qBACA,WACA,YACA,WACA,6bACA,yDAIJ,wEACE,sPAGF,2EACE,sPAIJ,wDACE,WACA,gBACA,uBACA,mBACA,gBACA,eAEA,6EACE,kBAIJ,wCACE,wDAGF,wCACE,GACE,eAGF,IACE,eACA,0BAGF,KACE,gBAIJ,uCACE,GACE,uBAGF,KACE","file":"L.Control.Locate.min.css"}
|
4
umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.js
vendored
Normal file
1
umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.js.map
vendored
Normal file
60
umap/static/umap/vendors/markercluster/MarkerCluster.Default.css
vendored
Executable file
|
@ -0,0 +1,60 @@
|
|||
.marker-cluster-small {
|
||||
background-color: rgba(181, 226, 140, 0.6);
|
||||
}
|
||||
.marker-cluster-small div {
|
||||
background-color: rgba(110, 204, 57, 0.6);
|
||||
}
|
||||
|
||||
.marker-cluster-medium {
|
||||
background-color: rgba(241, 211, 87, 0.6);
|
||||
}
|
||||
.marker-cluster-medium div {
|
||||
background-color: rgba(240, 194, 12, 0.6);
|
||||
}
|
||||
|
||||
.marker-cluster-large {
|
||||
background-color: rgba(253, 156, 115, 0.6);
|
||||
}
|
||||
.marker-cluster-large div {
|
||||
background-color: rgba(241, 128, 23, 0.6);
|
||||
}
|
||||
|
||||
/* IE 6-8 fallback colors */
|
||||
.leaflet-oldie .marker-cluster-small {
|
||||
background-color: rgb(181, 226, 140);
|
||||
}
|
||||
.leaflet-oldie .marker-cluster-small div {
|
||||
background-color: rgb(110, 204, 57);
|
||||
}
|
||||
|
||||
.leaflet-oldie .marker-cluster-medium {
|
||||
background-color: rgb(241, 211, 87);
|
||||
}
|
||||
.leaflet-oldie .marker-cluster-medium div {
|
||||
background-color: rgb(240, 194, 12);
|
||||
}
|
||||
|
||||
.leaflet-oldie .marker-cluster-large {
|
||||
background-color: rgb(253, 156, 115);
|
||||
}
|
||||
.leaflet-oldie .marker-cluster-large div {
|
||||
background-color: rgb(241, 128, 23);
|
||||
}
|
||||
|
||||
.marker-cluster {
|
||||
background-clip: padding-box;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.marker-cluster div {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
.marker-cluster span {
|
||||
line-height: 30px;
|
||||
}
|
14
umap/static/umap/vendors/markercluster/MarkerCluster.css
vendored
Executable file
|
@ -0,0 +1,14 @@
|
|||
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
|
||||
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
}
|
||||
|
||||
.leaflet-cluster-spider-leg {
|
||||
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
|
||||
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
|
||||
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
|
||||
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
|
||||
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
|
||||
}
|
5
umap/static/umap/vendors/markercluster/WhereAreTheJavascriptFiles.txt
vendored
Executable file
|
@ -0,0 +1,5 @@
|
|||
We don't ship the .js files in the git master branch.
|
||||
They are only present in version tags and in npm.
|
||||
|
||||
See how to get the JS files here: https://github.com/Leaflet/Leaflet.markercluster#using-the-plugin
|
||||
Or how to build them: https://github.com/Leaflet/Leaflet.markercluster#building-testing-and-linting-scripts
|
2718
umap/static/umap/vendors/markercluster/leaflet.markercluster-src.js
vendored
Executable file
1
umap/static/umap/vendors/markercluster/leaflet.markercluster-src.js.map
vendored
Executable file
2
umap/static/umap/vendors/markercluster/leaflet.markercluster.js
vendored
Executable file
1
umap/static/umap/vendors/markercluster/leaflet.markercluster.js.map
vendored
Executable file
39
umap/static/umap/vendors/measurable/Leaflet.Measurable.css
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
.leaflet-measure-control {
|
||||
background: none no-repeat scroll center center #F8F8F9;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #bbb;
|
||||
box-shadow: none;
|
||||
}
|
||||
.leaflet-measure-control a {
|
||||
background-position: -1px -81px;
|
||||
}
|
||||
.leaflet-measure-edge {
|
||||
background: none repeat scroll 0 0 #2F4F4F;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.leaflet-measure-toggle {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.leaflet-measure-control input:checked + label:before {
|
||||
content: '✓';
|
||||
padding-left: -2em;
|
||||
}
|
||||
.leaflet-measure-control input[type=radio] {
|
||||
display: none;
|
||||
}
|
||||
.leaflet-measure-control input[type=radio] + label {
|
||||
display: none;
|
||||
line-height: 36px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
.measure-enabled .leaflet-measure-control input[type=radio] + label {
|
||||
display: inline-block;
|
||||
}
|
212
umap/static/umap/vendors/measurable/Leaflet.Measurable.js
vendored
Normal file
|
@ -0,0 +1,212 @@
|
|||
L.GeoUtil = L.extend(L.GeoUtil || {}, {
|
||||
// Ported from the OpenLayers implementation. See https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Geometry/LinearRing.js#L270
|
||||
geodesicArea: function (latLngs) {
|
||||
var pointsCount = latLngs.length,
|
||||
area = 0.0,
|
||||
d2r = Math.PI / 180,
|
||||
p1, p2;
|
||||
|
||||
if (pointsCount > 2) {
|
||||
for (var i = 0; i < pointsCount; i++) {
|
||||
p1 = latLngs[i];
|
||||
p2 = latLngs[(i + 1) % pointsCount];
|
||||
area += ((p2.lng - p1.lng) * d2r) *
|
||||
(2 + Math.sin(p1.lat * d2r) + Math.sin(p2.lat * d2r));
|
||||
}
|
||||
area = area * L.Projection.SphericalMercator.R * L.Projection.SphericalMercator.R / 2.0;
|
||||
}
|
||||
|
||||
return Math.abs(area);
|
||||
},
|
||||
|
||||
readableArea: function (area, unit) {
|
||||
var areaStr;
|
||||
|
||||
if (unit === 'mi') {
|
||||
// Square yards in 1 meter
|
||||
area /= 0.836127;
|
||||
//3097600 square yards in 1 square mile
|
||||
if (area >= 3097600) areaStr = L._('{area} mi²', {area: (area / 3097600).toFixed(2)});
|
||||
//48040 square yards in 1 acre
|
||||
else if (area >= 4840) areaStr = L._('{area} acres', {area: (area / 4840).toFixed(2)});
|
||||
else areaStr = L._('{area} yd²'), {area: Math.ceil(area)};
|
||||
} else {
|
||||
if (area >= 100000) areaStr = L._('{area} ha', {area: (area * 0.0001).toFixed(2)});
|
||||
else areaStr = L._('{area} m²', {area: area.toFixed(2)});
|
||||
}
|
||||
|
||||
return areaStr;
|
||||
},
|
||||
|
||||
readableDistance: function (distance, unit) {
|
||||
var distanceStr;
|
||||
|
||||
if (unit === 'mi') {
|
||||
distance *= 1.09361;
|
||||
if (distance > 1760) distanceStr = L._('{distance} miles', {distance: (distance / 1760).toFixed(1)});
|
||||
else distanceStr = L._('{distance} yd', {distance: distance.toFixed(2)});
|
||||
} else if (unit === 'nm') {
|
||||
distance /= 1852;
|
||||
distanceStr = L._('{distance} NM', {distance: Math.ceil(distance)});
|
||||
} else {
|
||||
if (distance > 100000) distanceStr = L._('{distance} km', {distance: Math.ceil(distance / 1000)});
|
||||
else if (distance > 1000) distanceStr = L._('{distance} km', {distance: (distance / 1000).toFixed(1)});
|
||||
else distanceStr = L._('{distance} m', {distance: distance.toFixed(2)});
|
||||
}
|
||||
|
||||
return distanceStr;
|
||||
},
|
||||
|
||||
lineLength: function (map, latlngs) {
|
||||
var distance = 0, latlng, previous;
|
||||
for (var i = 0; i < latlngs.length; i++) {
|
||||
latlng = latlngs[i];
|
||||
if (previous) {
|
||||
distance += map.distance(latlng, previous);
|
||||
}
|
||||
previous = latlng;
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.MeasureLine = L.Polyline.extend({
|
||||
options: {
|
||||
color: '#222',
|
||||
weight: 1
|
||||
}
|
||||
});
|
||||
|
||||
L.MeasureVertex = L.Editable.VertexMarker.extend({
|
||||
options: {
|
||||
className: 'leaflet-div-icon leaflet-editing-icon leaflet-measure-edge'
|
||||
}
|
||||
});
|
||||
|
||||
L.Measurable = L.Editable.extend({
|
||||
|
||||
options: {
|
||||
vertexMarkerClass: L.MeasureVertex,
|
||||
polylineClass: L.MeasureLine,
|
||||
lineGuideOptions: {
|
||||
color: '#222'
|
||||
},
|
||||
skipMiddleMarkers: true,
|
||||
defaultUnit: 'km'
|
||||
},
|
||||
|
||||
initialize: function (map, options) {
|
||||
L.Editable.prototype.initialize.call(this, map, options);
|
||||
map.measureTools = this;
|
||||
this.on('editable:editing', function (e) {
|
||||
var latlng, latlngs = e.layer._defaultShape();
|
||||
for (var i = 0; i < latlngs.length; i++) {
|
||||
latlng = latlngs[i];
|
||||
latlng.__vertex.closeTooltip();
|
||||
}
|
||||
if (latlng && latlng.__vertex) {
|
||||
var length = L.GeoUtil.lineLength(map, e.layer._defaultShape());
|
||||
latlng.__vertex.bindTooltip(L.GeoUtil.readableDistance(length, this.getMeasureUnit()), {permanent: true});
|
||||
}
|
||||
});
|
||||
this.on('editable:drawing:end', function () {
|
||||
if (this.enabled()) this.startPolyline();
|
||||
});
|
||||
this.on('editable:shape:deleted', function (e) {
|
||||
if (!e.layer._defaultShape().length) e.layer.remove();
|
||||
});
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
if (this.enabled()) this.disable();
|
||||
else this.enable();
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
if (this.map.editTools) this.map.editTools.on('editable:drawing:start', this.disable, this);
|
||||
L.DomUtil.addClass(this.map._container, 'measure-enabled');
|
||||
this.fireAndForward('showmeasure');
|
||||
this.startPolyline();
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
if (this.map.editTools) this.map.editTools.off('editable:drawing:start', this.disable, this);
|
||||
L.DomUtil.removeClass(this.map._container, 'measure-enabled');
|
||||
this.featuresLayer.clearLayers();
|
||||
this.unregisterForDrawing();
|
||||
this.fireAndForward('hidemeasure');
|
||||
},
|
||||
|
||||
enabled: function () {
|
||||
return L.DomUtil.hasClass(this.map._container, 'measure-enabled');
|
||||
},
|
||||
|
||||
getMeasureUnit: function () {
|
||||
var input = document.querySelector('input[name=unit]:checked');
|
||||
return input ? input.value : this.options.defaultUnit;
|
||||
},
|
||||
|
||||
|
||||
blockEvents: function () {
|
||||
// Keep events active for now
|
||||
// see: https://github.com/Leaflet/Leaflet.Editable/issues/99
|
||||
// see: https://github.com/umap-project/umap/issues/423
|
||||
},
|
||||
|
||||
unblockEvents: function () {},
|
||||
|
||||
});
|
||||
|
||||
L.MeasureControl = L.Control.extend({
|
||||
|
||||
options: {
|
||||
position: 'topleft'
|
||||
},
|
||||
|
||||
addUnit: function (container, value, short, long, selected) {
|
||||
var input = L.DomUtil.create('input', '', container);
|
||||
input.type = 'radio';
|
||||
input.id = value;
|
||||
input.name = 'unit';
|
||||
input.value = value;
|
||||
if (value === this.map.measureTools.options.defaultUnit) input.checked = 'checked';
|
||||
var label = L.DomUtil.create('label', '', container);
|
||||
label.innerHTML = short;
|
||||
label.title = long;
|
||||
label.setAttribute('for', value);
|
||||
},
|
||||
|
||||
initHandler: function (map) {
|
||||
new L.Measurable(map);
|
||||
return this;
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
this.map = map;
|
||||
|
||||
this._container = L.DomUtil.create('div', 'leaflet-measure-control leaflet-control');
|
||||
|
||||
if (!map.measureTools) this.initHandler(map);
|
||||
|
||||
var toggle = L.DomUtil.create('a', 'leaflet-measure-toggle', this._container);
|
||||
toggle.href = '#';
|
||||
toggle.title = L._('Measure distances');
|
||||
this.addUnit(this._container, 'km', L._('km'), L._('kilometers'), true)
|
||||
this.addUnit(this._container, 'mi', L._('mi'), L._('miles'))
|
||||
this.addUnit(this._container, 'nm', L._('NM'), L._('nautical miles'))
|
||||
L.DomEvent.disableClickPropagation(this._container);
|
||||
|
||||
L.DomEvent
|
||||
.addListener(toggle, 'click', L.DomEvent.stop)
|
||||
.addListener(toggle, 'click', this.map.measureTools.toggle, this.map.measureTools);
|
||||
|
||||
return this._container;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
L._ = L._ || function (s, data) { // Fallback if L.I18n is not used.
|
||||
return L.Util.template(s, data);
|
||||
};
|
1
umap/static/umap/vendors/minimap/Control.MiniMap.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.leaflet-control-minimap{border:rgba(255,255,255,1) solid;box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:3px;background:#f8f8f9;transition:all .6s}.leaflet-control-minimap a{background-color:rgba(255,255,255,1);background-repeat:no-repeat;z-index:99999;transition:all .6s}.leaflet-control-minimap a.minimized-bottomright{-webkit-transform:rotate(180deg);transform:rotate(180deg);border-radius:0}.leaflet-control-minimap a.minimized-topleft{-webkit-transform:rotate(0deg);transform:rotate(0deg);border-radius:0}.leaflet-control-minimap a.minimized-bottomleft{-webkit-transform:rotate(270deg);transform:rotate(270deg);border-radius:0}.leaflet-control-minimap a.minimized-topright{-webkit-transform:rotate(90deg);transform:rotate(90deg);border-radius:0}.leaflet-control-minimap-toggle-display{background-image:url(images/toggle.svg);background-size:cover;position:absolute;border-radius:3px 0 0}.leaflet-oldie .leaflet-control-minimap-toggle-display{background-image:url(images/toggle.png)}.leaflet-control-minimap-toggle-display-bottomright{bottom:0;right:0}.leaflet-control-minimap-toggle-display-topleft{top:0;left:0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.leaflet-control-minimap-toggle-display-bottomleft{bottom:0;left:0;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.leaflet-control-minimap-toggle-display-topright{top:0;right:0;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.leaflet-oldie .leaflet-control-minimap{border:1px solid #999}.leaflet-oldie .leaflet-control-minimap a{background-color:#fff}.leaflet-oldie .leaflet-control-minimap a.minimized{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)}
|
1
umap/static/umap/vendors/minimap/Control.MiniMap.min.js
vendored
Normal file
BIN
umap/static/umap/vendors/minimap/images/toggle.png
vendored
Normal file
After Width: | Height: | Size: 219 B |
1
umap/static/umap/vendors/minimap/images/toggle.svg
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="18" width="18"><defs><marker orient="auto" overflow="visible"><path d="M-2.6-2.828L-5.428 0-2.6 2.828.228 0-2.6-2.828z" fill-rule="evenodd" stroke="#000" stroke-width=".4pt"/></marker><marker orient="auto" overflow="visible"><g fill="none" stroke="#000" stroke-width=".8" stroke-linecap="round"><path d="M4.566 4.75L-.652 0"/><path d="M1.544 4.75L-3.674 0"/><path d="M-1.566 4.75L-6.784 0"/><path d="M4.566-5.013L-.652-.263"/><path d="M1.544-5.013l-5.218 4.75"/><path d="M-1.566-5.013l-5.218 4.75"/></g></marker><marker orient="auto" overflow="visible"><path d="M-5.6-5.657L-11.257 0-5.6 5.657.057 0-5.6-5.657z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M4.616 0l-6.92 4v-8l6.92 4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M-10.69-4.437L1.328-.017l-12.018 4.42c1.92-2.61 1.91-6.18 0-8.84z" font-size="12" fill-rule="evenodd" stroke-width=".6875" stroke-linejoin="round"/></marker><marker orient="auto" overflow="visible"><path d="M-4.616 0l6.92-4v8l-6.92-4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M10 0l4-4L0 0l14 4-4-4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M10.69 4.437L-1.328.017l12.018-4.42c-1.92 2.61-1.91 6.18 0 8.84z" font-size="12" fill-rule="evenodd" stroke-width=".6875" stroke-linejoin="round"/></marker></defs><path d="M13.18 13.146v-5.81l-5.81 5.81h5.81z" stroke="#000" stroke-width="1.643"/><path d="M12.762 12.727l-6.51-6.51" fill="none" stroke="#000" stroke-width="2.482" stroke-linecap="round"/></svg>
|
After Width: | Height: | Size: 1.7 KiB |
1
umap/static/umap/vendors/osmtogeojson/osmtogeojson.js
vendored
Normal file
484
umap/static/umap/vendors/photon/leaflet.photon.js
vendored
Normal file
|
@ -0,0 +1,484 @@
|
|||
L.PhotonBase = L.Class.extend({
|
||||
|
||||
forEach: function (els, callback) {
|
||||
Array.prototype.forEach.call(els, callback);
|
||||
},
|
||||
|
||||
ajax: function (callback, thisobj) {
|
||||
if (typeof this.xhr === 'object') {
|
||||
this.xhr.abort();
|
||||
}
|
||||
this.xhr = new XMLHttpRequest();
|
||||
var self = this;
|
||||
this.xhr.open('GET', this.options.url + this.buildQueryString(this.getParams()), true);
|
||||
|
||||
this.xhr.onload = function(e) {
|
||||
self.fire('ajax:return');
|
||||
if (this.status === 200) {
|
||||
if (callback) {
|
||||
var raw = this.response;
|
||||
raw = JSON.parse(raw);
|
||||
callback.call(thisobj || this, raw);
|
||||
}
|
||||
}
|
||||
delete this.xhr;
|
||||
};
|
||||
|
||||
this.fire('ajax:send');
|
||||
this.xhr.send();
|
||||
},
|
||||
|
||||
buildQueryString: function (params) {
|
||||
var queryString = [];
|
||||
for (var key in params) {
|
||||
if (params[key]) {
|
||||
queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
|
||||
}
|
||||
}
|
||||
return queryString.join('&');
|
||||
},
|
||||
|
||||
featureToPopupContent: function (feature) {
|
||||
var container = L.DomUtil.create('div', 'leaflet-photon-popup'),
|
||||
title = L.DomUtil.create('h3', '', container);
|
||||
title.innerHTML = feature.properties.label;
|
||||
return container;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
L.PhotonBaseSearch = L.PhotonBase.extend({
|
||||
|
||||
includes: ((typeof L.Evented !== 'undefined' && L.Evented.prototype) || L.Mixin.Events),
|
||||
|
||||
options: {
|
||||
url: 'https://photon.komoot.io/api/?',
|
||||
placeholder: 'Start typing...',
|
||||
minChar: 3,
|
||||
limit: 5,
|
||||
submitDelay: 300,
|
||||
includePosition: true,
|
||||
bbox: null,
|
||||
noResultLabel: 'No result',
|
||||
feedbackEmail: 'photon@komoot.de', // Set to null to remove feedback box
|
||||
feedbackLabel: 'Feedback'
|
||||
},
|
||||
|
||||
CACHE: '',
|
||||
RESULTS: [],
|
||||
KEYS: {
|
||||
LEFT: 37,
|
||||
UP: 38,
|
||||
RIGHT: 39,
|
||||
DOWN: 40,
|
||||
TAB: 9,
|
||||
RETURN: 13,
|
||||
ESC: 27,
|
||||
APPLE: 91,
|
||||
SHIFT: 16,
|
||||
ALT: 17,
|
||||
CTRL: 18
|
||||
},
|
||||
|
||||
initialize: function (input, options) {
|
||||
this.input = input;
|
||||
L.setOptions(this, options);
|
||||
var CURRENT = null;
|
||||
|
||||
try {
|
||||
Object.defineProperty(this, 'CURRENT', {
|
||||
get: function () {
|
||||
return CURRENT;
|
||||
},
|
||||
set: function (index) {
|
||||
if (typeof index === 'object') {
|
||||
index = this.resultToIndex(index);
|
||||
}
|
||||
CURRENT = index;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// Hello IE8
|
||||
}
|
||||
this.input.type = L.Browser.ie ? 'text' : 'search';
|
||||
this.input.placeholder = this.options.placeholder;
|
||||
this.input.autocomplete = 'off';
|
||||
this.input.autocorrect = 'off';
|
||||
L.DomEvent.disableClickPropagation(this.input);
|
||||
|
||||
L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this);
|
||||
L.DomEvent.on(this.input, 'input', this.onInput, this);
|
||||
L.DomEvent.on(this.input, 'blur', this.onBlur, this);
|
||||
L.DomEvent.on(this.input, 'focus', this.onFocus, this);
|
||||
this.createResultsContainer();
|
||||
},
|
||||
|
||||
createResultsContainer: function () {
|
||||
this.resultsContainer = this.options.resultsContainer || L.DomUtil.create('ul', 'photon-autocomplete', document.querySelector('body'));
|
||||
},
|
||||
|
||||
resizeContainer: function()
|
||||
{
|
||||
var l = this.getLeft(this.input);
|
||||
var t = this.getTop(this.input) + this.input.offsetHeight;
|
||||
this.resultsContainer.style.left = l + 'px';
|
||||
this.resultsContainer.style.top = t + 'px';
|
||||
var width = this.options.width ? this.options.width : this.input.offsetWidth - 2;
|
||||
this.resultsContainer.style.width = width + 'px';
|
||||
},
|
||||
|
||||
onKeyDown: function (e) {
|
||||
switch (e.keyCode) {
|
||||
case this.KEYS.TAB:
|
||||
if(this.CURRENT !== null)
|
||||
{
|
||||
this.setChoice();
|
||||
}
|
||||
L.DomEvent.stop(e);
|
||||
break;
|
||||
case this.KEYS.RETURN:
|
||||
L.DomEvent.stop(e);
|
||||
this.setChoice();
|
||||
break;
|
||||
case this.KEYS.ESC:
|
||||
L.DomEvent.stop(e);
|
||||
this.hide();
|
||||
this.input.blur();
|
||||
break;
|
||||
case this.KEYS.DOWN:
|
||||
if(this.RESULTS.length > 0) {
|
||||
if(this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one resutl?
|
||||
this.CURRENT++;
|
||||
this.highlight();
|
||||
}
|
||||
else if(this.CURRENT === null) {
|
||||
this.CURRENT = 0;
|
||||
this.highlight();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case this.KEYS.UP:
|
||||
if(this.CURRENT !== null) {
|
||||
L.DomEvent.stop(e);
|
||||
}
|
||||
if(this.RESULTS.length > 0) {
|
||||
if(this.CURRENT > 0) {
|
||||
this.CURRENT--;
|
||||
this.highlight();
|
||||
}
|
||||
else if(this.CURRENT === 0) {
|
||||
this.CURRENT = null;
|
||||
this.highlight();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onInput: function (e) {
|
||||
if (typeof this.submitDelay === 'number') {
|
||||
window.clearTimeout(this.submitDelay);
|
||||
delete this.submitDelay;
|
||||
}
|
||||
this.submitDelay = window.setTimeout(L.Util.bind(this.search, this), this.options.submitDelay);
|
||||
},
|
||||
|
||||
onBlur: function (e) {
|
||||
this.fire('blur');
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
self.hide();
|
||||
}, 100);
|
||||
},
|
||||
|
||||
onFocus: function (e) {
|
||||
this.fire('focus');
|
||||
this.input.select();
|
||||
this.search(); // In case we have a value from a previous search.
|
||||
},
|
||||
|
||||
clear: function () {
|
||||
this.RESULTS = [];
|
||||
this.CURRENT = null;
|
||||
this.CACHE = '';
|
||||
this.resultsContainer.innerHTML = '';
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.fire('hide');
|
||||
this.clear();
|
||||
this.resultsContainer.style.display = 'none';
|
||||
},
|
||||
|
||||
setChoice: function (choice) {
|
||||
choice = choice || this.RESULTS[this.CURRENT];
|
||||
if (choice) {
|
||||
this.hide();
|
||||
this.fire('selected', {choice: choice.feature});
|
||||
this.onSelected(choice.feature);
|
||||
this.input.value = '';
|
||||
}
|
||||
},
|
||||
|
||||
search: function() {
|
||||
var val = this.input.value;
|
||||
var minChar = typeof this.options.minChar === 'function' ? this.options.minChar(val) : val.length >= this.options.minChar;
|
||||
if (!val || !minChar) return this.clear();
|
||||
if(val + '' === this.CACHE + '') return;
|
||||
else this.CACHE = val;
|
||||
this._doSearch();
|
||||
},
|
||||
|
||||
_doSearch: function () {
|
||||
this.ajax(this.handleResults, this);
|
||||
},
|
||||
|
||||
_onSelected: function (feature) {
|
||||
},
|
||||
|
||||
onSelected: function (choice) {
|
||||
return (this.options.onSelected || this._onSelected).call(this, choice);
|
||||
},
|
||||
|
||||
_formatResult: function (feature, el) {
|
||||
var title = L.DomUtil.create('strong', '', el),
|
||||
detailsContainer = L.DomUtil.create('small', '', el),
|
||||
details = [],
|
||||
type = this.formatType(feature);
|
||||
if (feature.properties.name) {
|
||||
title.innerHTML = feature.properties.name;
|
||||
} else if (feature.properties.housenumber) {
|
||||
title.innerHTML = feature.properties.housenumber;
|
||||
if (feature.properties.street) {
|
||||
title.innerHTML += ' ' + feature.properties.street;
|
||||
}
|
||||
}
|
||||
if (type) details.push(type);
|
||||
if (feature.properties.city && feature.properties.city !== feature.properties.name) {
|
||||
details.push(feature.properties.city);
|
||||
}
|
||||
if (feature.properties.country) details.push(feature.properties.country);
|
||||
detailsContainer.innerHTML = details.join(', ');
|
||||
},
|
||||
|
||||
formatResult: function (feature, el) {
|
||||
return (this.options.formatResult || this._formatResult).call(this, feature, el);
|
||||
},
|
||||
|
||||
formatType: function (feature) {
|
||||
return (this.options.formatType || this._formatType).call(this, feature);
|
||||
},
|
||||
|
||||
_formatType: function (feature) {
|
||||
return feature.properties.osm_value === 'yes'
|
||||
? feature.properties.osm_key
|
||||
: feature.properties.osm_value;
|
||||
},
|
||||
|
||||
createResult: function (feature) {
|
||||
var el = L.DomUtil.create('li', '', this.resultsContainer);
|
||||
this.formatResult(feature, el);
|
||||
var result = {
|
||||
feature: feature,
|
||||
el: el
|
||||
};
|
||||
// Touch handling needed
|
||||
L.DomEvent.on(el, 'mouseover', function (e) {
|
||||
this.CURRENT = result;
|
||||
this.highlight();
|
||||
}, this);
|
||||
L.DomEvent.on(el, 'mousedown', function (e) {
|
||||
this.setChoice();
|
||||
}, this);
|
||||
return result;
|
||||
},
|
||||
|
||||
resultToIndex: function (result) {
|
||||
var out = null;
|
||||
this.forEach(this.RESULTS, function (item, index) {
|
||||
if (item === result) {
|
||||
out = index;
|
||||
return;
|
||||
}
|
||||
});
|
||||
return out;
|
||||
},
|
||||
|
||||
handleResults: function(geojson) {
|
||||
var self = this;
|
||||
this.clear();
|
||||
this.resultsContainer.style.display = 'block';
|
||||
this.resizeContainer();
|
||||
this.forEach(geojson.features, function (feature) {
|
||||
self.RESULTS.push(self.createResult(feature));
|
||||
});
|
||||
if (geojson.features.length === 0) {
|
||||
var noresult = L.DomUtil.create('li', 'photon-no-result', this.resultsContainer);
|
||||
noresult.innerHTML = this.options.noResultLabel;
|
||||
}
|
||||
if (this.options.feedbackEmail) {
|
||||
var feedback = L.DomUtil.create('a', 'photon-feedback', this.resultsContainer);
|
||||
feedback.href = 'mailto:' + this.options.feedbackEmail;
|
||||
feedback.innerHTML = this.options.feedbackLabel;
|
||||
}
|
||||
this.CURRENT = 0;
|
||||
this.highlight();
|
||||
if (this.options.resultsHandler) {
|
||||
this.options.resultsHandler(geojson);
|
||||
}
|
||||
},
|
||||
|
||||
highlight: function () {
|
||||
var self = this;
|
||||
this.forEach(this.RESULTS, function (item, index) {
|
||||
if (index === self.CURRENT) {
|
||||
L.DomUtil.addClass(item.el, 'on');
|
||||
}
|
||||
else {
|
||||
L.DomUtil.removeClass(item.el, 'on');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getLeft: function (el) {
|
||||
var tmp = el.offsetLeft;
|
||||
el = el.offsetParent;
|
||||
while(el) {
|
||||
tmp += el.offsetLeft;
|
||||
el = el.offsetParent;
|
||||
}
|
||||
return tmp;
|
||||
},
|
||||
|
||||
getTop: function (el) {
|
||||
var tmp = el.offsetTop;
|
||||
el = el.offsetParent;
|
||||
while(el) {
|
||||
tmp += el.offsetTop;
|
||||
el = el.offsetParent;
|
||||
}
|
||||
return tmp;
|
||||
},
|
||||
|
||||
getParams: function () {
|
||||
return {
|
||||
q: this.CACHE,
|
||||
lang: this.options.lang,
|
||||
limit: this.options.limit,
|
||||
osm_tag: this.options.osm_tag
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.PhotonSearch = L.PhotonBaseSearch.extend({
|
||||
|
||||
initialize: function (map, input, options) {
|
||||
this.map = map;
|
||||
L.PhotonBaseSearch.prototype.initialize.call(this, input, options);
|
||||
},
|
||||
|
||||
_onSelected: function (feature) {
|
||||
this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], 16);
|
||||
},
|
||||
|
||||
getParams: function () {
|
||||
var params = L.PhotonBaseSearch.prototype.getParams.call(this);
|
||||
if (this.options.includePosition) {
|
||||
params.lat = this.map.getCenter().lat;
|
||||
params.lon = this.map.getCenter().lng;
|
||||
if (this.options.location_bias_scale) {
|
||||
params.location_bias_scale = this.options.location_bias_scale;
|
||||
}
|
||||
}
|
||||
if (this.options.bbox && this.options.bbox.length === 4) {
|
||||
params.bbox = this.options.bbox.join(',');
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.Control.Photon = L.Control.extend({
|
||||
|
||||
includes: ((typeof L.Evented !== 'undefined' && L.Evented.prototype) || L.Mixin.Events),
|
||||
|
||||
onAdd: function (map, options) {
|
||||
this.map = map;
|
||||
this.container = L.DomUtil.create('div', 'leaflet-photon');
|
||||
|
||||
this.options = L.Util.extend(this.options, options);
|
||||
|
||||
this.input = L.DomUtil.create('input', 'photon-input', this.container);
|
||||
this.search = new L.PhotonSearch(map, this.input, this.options);
|
||||
this.search.on('blur', this.forwardEvent, this);
|
||||
this.search.on('focus', this.forwardEvent, this);
|
||||
this.search.on('hide', this.forwardEvent, this);
|
||||
this.search.on('selected', this.forwardEvent, this);
|
||||
this.search.on('ajax:send', this.forwardEvent, this);
|
||||
this.search.on('ajax:return', this.forwardEvent, this);
|
||||
return this.container;
|
||||
},
|
||||
|
||||
// TODO onRemove
|
||||
|
||||
forwardEvent: function (e) {
|
||||
this.fire(e.type, e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
L.control.photon = function(options) {
|
||||
return new L.Control.Photon(options);
|
||||
}
|
||||
|
||||
L.Map.addInitHook(function () {
|
||||
if (this.options.photonControl) {
|
||||
this.photonControl = new L.Control.Photon(this.options.photonControlOptions || {});
|
||||
this.addControl(this.photonControl);
|
||||
}
|
||||
});
|
||||
|
||||
L.PhotonReverse = L.PhotonBase.extend({
|
||||
|
||||
includes: ((typeof L.Evented !== 'undefined' && L.Evented.prototype) || L.Mixin.Events),
|
||||
|
||||
options: {
|
||||
url: 'https://photon.komoot.io/reverse/?',
|
||||
limit: 1,
|
||||
handleResults: null
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
L.setOptions(this, options);
|
||||
},
|
||||
|
||||
doReverse: function (latlng) {
|
||||
latlng = L.latLng(latlng);
|
||||
this.fire('reverse', {latlng: latlng});
|
||||
this.latlng = latlng;
|
||||
this.ajax(this.handleResults, this);
|
||||
},
|
||||
|
||||
_handleResults: function (data) {
|
||||
/*eslint-disable no-console */
|
||||
console.log(data);
|
||||
/*eslint-enable no-alert */
|
||||
},
|
||||
|
||||
handleResults: function (data) {
|
||||
return (this.options.handleResults || this._handleResults).call(this, data);
|
||||
},
|
||||
|
||||
getParams: function () {
|
||||
return {
|
||||
lang: this.options.lang,
|
||||
limit: this.options.limit,
|
||||
lat: this.latlng.lat,
|
||||
lon: this.latlng.lng,
|
||||
osm_tag: this.options.osm_tag
|
||||
};
|
||||
}
|
||||
|
||||
});
|
2
umap/static/umap/vendors/simple-statistics/simple-statistics.min.js
vendored
Normal file
1
umap/static/umap/vendors/simple-statistics/simple-statistics.min.js.map
vendored
Normal file
1109
umap/static/umap/vendors/togeojson/togeojson.es.js
vendored
Normal file
1
umap/static/umap/vendors/togeojson/togeojson.es.mjs.map
vendored
Normal file
895
umap/static/umap/vendors/tokml/tokml.es.js
vendored
Normal file
|
@ -0,0 +1,895 @@
|
|||
/**
|
||||
* @typedef {import('unist').Node} Node
|
||||
* @typedef {import('unist').Parent} Parent
|
||||
* @typedef {import('unist').Literal} Literal
|
||||
* @typedef {Object.<string, unknown>} Props
|
||||
* @typedef {Array.<Node>|string} ChildrenOrValue
|
||||
*
|
||||
* @typedef {(<T extends string, P extends Record<string, unknown>, C extends Node[]>(type: T, props: P, children: C) => {type: T, children: C} & P)} BuildParentWithProps
|
||||
* @typedef {(<T extends string, P extends Record<string, unknown>>(type: T, props: P, value: string) => {type: T, value: string} & P)} BuildLiteralWithProps
|
||||
* @typedef {(<T extends string, P extends Record<string, unknown>>(type: T, props: P) => {type: T} & P)} BuildVoidWithProps
|
||||
* @typedef {(<T extends string, C extends Node[]>(type: T, children: C) => {type: T, children: C})} BuildParent
|
||||
* @typedef {(<T extends string>(type: T, value: string) => {type: T, value: string})} BuildLiteral
|
||||
* @typedef {(<T extends string>(type: T) => {type: T})} BuildVoid
|
||||
*/
|
||||
|
||||
var u = /**
|
||||
* @type {BuildVoid & BuildVoidWithProps & BuildLiteral & BuildLiteralWithProps & BuildParent & BuildParentWithProps}
|
||||
*/ (
|
||||
/**
|
||||
* @param {string} type Type of node
|
||||
* @param {Props|ChildrenOrValue} [props] Additional properties for node (or `children` or `value`)
|
||||
* @param {ChildrenOrValue} [value] `children` or `value` of node
|
||||
* @returns {Node}
|
||||
*/
|
||||
function (type, props, value) {
|
||||
/** @type {Node} */
|
||||
var node = {type: String(type)};
|
||||
|
||||
if (
|
||||
(value === undefined || value === null) &&
|
||||
(typeof props === 'string' || Array.isArray(props))
|
||||
) {
|
||||
value = props;
|
||||
} else {
|
||||
Object.assign(node, props);
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
node.children = value;
|
||||
} else if (value !== undefined && value !== null) {
|
||||
node.value = String(value);
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* @typedef {import('xast').Root} Root
|
||||
* @typedef {import('xast').Element} Element
|
||||
* @typedef {Root['children'][number]} Child
|
||||
* @typedef {Child|Root} Node
|
||||
* @typedef {Root|Element} XResult
|
||||
* @typedef {string|number|boolean|null|undefined} XValue
|
||||
* @typedef {{[attribute: string]: XValue}} XAttributes Attributes to support JS primitive types
|
||||
*
|
||||
* @typedef {string|number|null|undefined} XPrimitiveChild
|
||||
* @typedef {Array.<Node|XPrimitiveChild>} XArrayChild
|
||||
* @typedef {Node|XPrimitiveChild|XArrayChild} XChild
|
||||
* @typedef {import('./jsx-classic').Element} x.JSX.Element
|
||||
* @typedef {import('./jsx-classic').IntrinsicAttributes} x.JSX.IntrinsicAttributes
|
||||
* @typedef {import('./jsx-classic').IntrinsicElements} x.JSX.IntrinsicElements
|
||||
* @typedef {import('./jsx-classic').ElementChildrenAttribute} x.JSX.ElementChildrenAttribute
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create XML trees in xast.
|
||||
*
|
||||
* @param name Qualified name. Case sensitive and can contain a namespace prefix (such as `rdf:RDF`). Pass `null|undefined` to build a root.
|
||||
* @param attributes Map of attributes. Nullish (null or undefined) or NaN values are ignored, other values (strings, booleans) are cast to strings.
|
||||
* @param children (Lists of) child nodes. When strings are encountered, they are mapped to Text nodes.
|
||||
*/
|
||||
const x =
|
||||
/**
|
||||
* @type {{
|
||||
* (): Root
|
||||
* (name: null|undefined, ...children: XChild[]): Root
|
||||
* (name: string, attributes: XAttributes, ...children: XChild[]): Element
|
||||
* (name: string, ...children: XChild[]): Element
|
||||
* }}
|
||||
*/
|
||||
(
|
||||
/**
|
||||
* Hyperscript compatible DSL for creating virtual xast trees.
|
||||
*
|
||||
* @param {string|null} [name]
|
||||
* @param {XAttributes|XChild} [attributes]
|
||||
* @param {XChild[]} children
|
||||
* @returns {XResult}
|
||||
*/
|
||||
function (name, attributes, ...children) {
|
||||
var index = -1;
|
||||
/** @type {XResult} */
|
||||
var node;
|
||||
/** @type {string} */
|
||||
var key;
|
||||
|
||||
if (name === undefined || name === null) {
|
||||
node = {type: 'root', children: []};
|
||||
// @ts-ignore Root builder doesn’t accept attributes.
|
||||
children.unshift(attributes);
|
||||
} else if (typeof name === 'string') {
|
||||
node = {type: 'element', name, attributes: {}, children: []};
|
||||
|
||||
if (isAttributes(attributes)) {
|
||||
for (key in attributes) {
|
||||
// Ignore nullish and NaN values.
|
||||
if (
|
||||
attributes[key] !== undefined &&
|
||||
attributes[key] !== null &&
|
||||
(typeof attributes[key] !== 'number' ||
|
||||
!Number.isNaN(attributes[key]))
|
||||
) {
|
||||
// @ts-ignore Pretty sure we just set it.
|
||||
node.attributes[key] = String(attributes[key]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
children.unshift(attributes);
|
||||
}
|
||||
} else {
|
||||
throw new TypeError('Expected element name, got `' + name + '`')
|
||||
}
|
||||
|
||||
// Handle children.
|
||||
while (++index < children.length) {
|
||||
addChild(node.children, children[index]);
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* @param {Array.<Child>} nodes
|
||||
* @param {XChild} value
|
||||
*/
|
||||
function addChild(nodes, value) {
|
||||
var index = -1;
|
||||
|
||||
if (value === undefined || value === null) ; else if (typeof value === 'string' || typeof value === 'number') {
|
||||
nodes.push({type: 'text', value: String(value)});
|
||||
} else if (Array.isArray(value)) {
|
||||
while (++index < value.length) {
|
||||
addChild(nodes, value[index]);
|
||||
}
|
||||
} else if (typeof value === 'object' && 'type' in value) {
|
||||
if (value.type === 'root') {
|
||||
addChild(nodes, value.children);
|
||||
} else {
|
||||
nodes.push(value);
|
||||
}
|
||||
} else {
|
||||
throw new TypeError('Expected node, nodes, string, got `' + value + '`')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {XAttributes|XChild} value
|
||||
* @returns {value is XAttributes}
|
||||
*/
|
||||
function isAttributes(value) {
|
||||
if (
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
typeof value !== 'object' ||
|
||||
Array.isArray(value)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Parent} Parent
|
||||
* @typedef {import('./index.js').Context} Context
|
||||
* @typedef {import('./index.js').Child} Child
|
||||
*/
|
||||
|
||||
/**
|
||||
* Serialize all children of `parent`.
|
||||
*
|
||||
* @param {Parent} parent
|
||||
* @param {Context} ctx
|
||||
* @returns {string}
|
||||
*
|
||||
*/
|
||||
function all(parent, ctx) {
|
||||
/** @type {Array.<Child>} */
|
||||
var children = (parent && parent.children) || [];
|
||||
var index = -1;
|
||||
/** @type {Array.<string>} */
|
||||
var results = [];
|
||||
|
||||
while (++index < children.length) {
|
||||
results[index] = one(children[index], ctx);
|
||||
}
|
||||
|
||||
return results.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} CoreOptions
|
||||
* @property {string[]} [subset=[]]
|
||||
* Whether to only escape the given subset of characters.
|
||||
* @property {boolean} [escapeOnly=false]
|
||||
* Whether to only escape possibly dangerous characters.
|
||||
* Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
|
||||
*
|
||||
* @typedef {Object} FormatOptions
|
||||
* @property {(code: number, next: number, options: CoreWithFormatOptions) => string} format
|
||||
* Format strategy.
|
||||
*
|
||||
* @typedef {CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions} CoreWithFormatOptions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Encode certain characters in `value`.
|
||||
*
|
||||
* @param {string} value
|
||||
* @param {CoreWithFormatOptions} options
|
||||
* @returns {string}
|
||||
*/
|
||||
function core(value, options) {
|
||||
value = value.replace(
|
||||
options.subset ? charactersToExpression(options.subset) : /["&'<>`]/g,
|
||||
basic
|
||||
);
|
||||
|
||||
if (options.subset || options.escapeOnly) {
|
||||
return value
|
||||
}
|
||||
|
||||
return (
|
||||
value
|
||||
// Surrogate pairs.
|
||||
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, surrogate)
|
||||
// BMP control characters (C0 except for LF, CR, SP; DEL; and some more
|
||||
// non-ASCII ones).
|
||||
.replace(
|
||||
// eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
|
||||
/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,
|
||||
basic
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* @param {string} pair
|
||||
* @param {number} index
|
||||
* @param {string} all
|
||||
*/
|
||||
function surrogate(pair, index, all) {
|
||||
return options.format(
|
||||
(pair.charCodeAt(0) - 0xd800) * 0x400 +
|
||||
pair.charCodeAt(1) -
|
||||
0xdc00 +
|
||||
0x10000,
|
||||
all.charCodeAt(index + 2),
|
||||
options
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} character
|
||||
* @param {number} index
|
||||
* @param {string} all
|
||||
*/
|
||||
function basic(character, index, all) {
|
||||
return options.format(
|
||||
character.charCodeAt(0),
|
||||
all.charCodeAt(index + 1),
|
||||
options
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} subset
|
||||
* @returns {RegExp}
|
||||
*/
|
||||
function charactersToExpression(subset) {
|
||||
/** @type {string[]} */
|
||||
const groups = [];
|
||||
let index = -1;
|
||||
|
||||
while (++index < subset.length) {
|
||||
groups.push(subset[index].replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'));
|
||||
}
|
||||
|
||||
return new RegExp('(?:' + groups.join('|') + ')', 'g')
|
||||
}
|
||||
|
||||
/**
|
||||
* The smallest way to encode a character.
|
||||
*
|
||||
* @param {number} code
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatBasic(code) {
|
||||
return '&#x' + code.toString(16).toUpperCase() + ';'
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./core.js').CoreOptions & import('./util/format-smart.js').FormatSmartOptions} Options
|
||||
* @typedef {import('./core.js').CoreOptions} LightOptions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Encode special characters in `value` as hexadecimals.
|
||||
*
|
||||
* @param {string} value
|
||||
* Value to encode.
|
||||
* @param {LightOptions} [options]
|
||||
* Configuration.
|
||||
* @returns {string}
|
||||
* Encoded value.
|
||||
*/
|
||||
function stringifyEntitiesLight(value, options) {
|
||||
return core(value, Object.assign({format: formatBasic}, options))
|
||||
}
|
||||
|
||||
var noncharacter = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
|
||||
|
||||
/**
|
||||
* Escape a string.
|
||||
*
|
||||
* @param {string} value
|
||||
* @param {Array.<string>} subset
|
||||
* @param {RegExp} [unsafe]
|
||||
* @returns {string}
|
||||
*/
|
||||
function escape(value, subset, unsafe) {
|
||||
var result = clean(value);
|
||||
|
||||
return unsafe ? result.replace(unsafe, encode) : encode(result)
|
||||
|
||||
/**
|
||||
* @param {string} $0
|
||||
* @returns {string}
|
||||
*/
|
||||
function encode($0) {
|
||||
return stringifyEntitiesLight($0, {subset})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
function clean(value) {
|
||||
return String(value || '').replace(noncharacter, '')
|
||||
}
|
||||
|
||||
var subset$3 = ['\t', '\n', ' ', '"', '&', "'", '/', '<', '=', '>'];
|
||||
|
||||
/**
|
||||
* Serialize a node name.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
function name(value) {
|
||||
return escape(value, subset$3)
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how often a character (or substring) is used in a string.
|
||||
*
|
||||
* @param {string} value
|
||||
* Value to search in.
|
||||
* @param {string} character
|
||||
* Character (or substring) to look for.
|
||||
* @return {number}
|
||||
* Number of times `character` occurred in `value`.
|
||||
*/
|
||||
function ccount(value, character) {
|
||||
const source = String(value);
|
||||
|
||||
if (typeof character !== 'string') {
|
||||
throw new TypeError('Expected character')
|
||||
}
|
||||
|
||||
let count = 0;
|
||||
let index = source.indexOf(character);
|
||||
|
||||
while (index !== -1) {
|
||||
count++;
|
||||
index = source.indexOf(character, index + character.length);
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Context} Context
|
||||
*/
|
||||
|
||||
/**
|
||||
* Serialize an attribute value.
|
||||
*
|
||||
* @param {string} value
|
||||
* @param {Context} ctx
|
||||
* @returns {string}
|
||||
*/
|
||||
function value(value, ctx) {
|
||||
var primary = ctx.quote;
|
||||
var secondary = ctx.alternative;
|
||||
var result = String(value);
|
||||
var quote =
|
||||
secondary && ccount(result, primary) > ccount(result, secondary)
|
||||
? secondary
|
||||
: primary;
|
||||
|
||||
return quote + escape(result, ['<', '&', quote]) + quote
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Element} Element
|
||||
* @typedef {import('./index.js').Attributes} Attributes
|
||||
*/
|
||||
|
||||
var own$1 = {}.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Serialize an element.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Element} node
|
||||
*/
|
||||
function element(node, ctx) {
|
||||
var nodeName = name(node.name);
|
||||
var content = all(node, ctx);
|
||||
/** @type {Attributes} */
|
||||
var attributes = node.attributes || {};
|
||||
var close = content ? false : ctx.close;
|
||||
/** @type {Array.<string>} */
|
||||
var attrs = [];
|
||||
/** @type {string} */
|
||||
var key;
|
||||
/** @type {Attributes[keyof Attributes]} */
|
||||
var result;
|
||||
|
||||
for (key in attributes) {
|
||||
if (own$1.call(attributes, key)) {
|
||||
result = attributes[key];
|
||||
|
||||
if (result !== null && result !== undefined) {
|
||||
attrs.push(name(key) + '=' + value(result, ctx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
'<' +
|
||||
nodeName +
|
||||
(attrs.length === 0 ? '' : ' ' + attrs.join(' ')) +
|
||||
(close ? (ctx.tight ? '' : ' ') + '/' : '') +
|
||||
'>' +
|
||||
content +
|
||||
(close ? '' : '</' + nodeName + '>')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Text} Text
|
||||
*/
|
||||
|
||||
var subset$2 = ['&', '<'];
|
||||
|
||||
/**
|
||||
* Serialize a text.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Text} node
|
||||
*/
|
||||
function text(node) {
|
||||
return escape(node.value, subset$2)
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Comment} Comment
|
||||
*/
|
||||
|
||||
/**
|
||||
* Serialize a comment.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Comment} node
|
||||
*/
|
||||
function comment(node) {
|
||||
return '<!--' + escape(node.value, ['-']) + '-->'
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Doctype} Doctype
|
||||
*/
|
||||
|
||||
/**
|
||||
* Serialize a doctype.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Doctype} node
|
||||
*/
|
||||
function doctype(node, ctx) {
|
||||
var nodeName = name(node.name);
|
||||
var pub = node.public;
|
||||
var sys = node.system;
|
||||
var result = '<!DOCTYPE';
|
||||
|
||||
if (nodeName !== '') {
|
||||
result += ' ' + nodeName;
|
||||
}
|
||||
|
||||
if (pub !== null && pub !== undefined && pub !== '') {
|
||||
result += ' PUBLIC ' + value(pub, ctx);
|
||||
} else if (sys !== null && sys !== undefined && sys !== '') {
|
||||
result += ' SYSTEM';
|
||||
}
|
||||
|
||||
if (sys !== null && sys !== undefined && sys !== '') {
|
||||
result += ' ' + value(sys, ctx);
|
||||
}
|
||||
|
||||
return result + '>'
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Instruction} Instruction
|
||||
*/
|
||||
|
||||
var unsafe$1 = /\?>/g;
|
||||
var subset$1 = ['>'];
|
||||
|
||||
/**
|
||||
* Serialize an instruction.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Instruction} node
|
||||
*/
|
||||
function instruction(node) {
|
||||
var nodeName = name(node.name) || 'x';
|
||||
var result = escape(node.value, subset$1, unsafe$1);
|
||||
return '<?' + nodeName + (result ? ' ' + result : '') + '?>'
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Cdata} Cdata
|
||||
*/
|
||||
|
||||
var unsafe = /]]>/g;
|
||||
var subset = ['>'];
|
||||
|
||||
/**
|
||||
* Serialize a CDATA section.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Cdata} node
|
||||
*/
|
||||
function cdata(node) {
|
||||
return '<![CDATA[' + escape(node.value, subset, unsafe) + ']]>'
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
* @typedef {import('./index.js').Raw} Raw
|
||||
*/
|
||||
|
||||
/**
|
||||
* Serialize a (non-standard) raw.
|
||||
*
|
||||
* @type {Handle}
|
||||
* @param {Raw} node
|
||||
*/
|
||||
function raw(node, ctx) {
|
||||
// @ts-ignore Looks like a text.
|
||||
return ctx.dangerous ? node.value : text(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./index.js').Handle} Handle
|
||||
*/
|
||||
|
||||
var own = {}.hasOwnProperty;
|
||||
|
||||
var handlers = {
|
||||
root: all,
|
||||
element,
|
||||
text,
|
||||
comment,
|
||||
doctype,
|
||||
instruction,
|
||||
cdata,
|
||||
raw
|
||||
};
|
||||
|
||||
/**
|
||||
* Serialize a node.
|
||||
*
|
||||
* @type {Handle}
|
||||
*/
|
||||
function one(node, ctx) {
|
||||
var type = node && node.type;
|
||||
|
||||
if (!type) {
|
||||
throw new Error('Expected node, not `' + node + '`')
|
||||
}
|
||||
|
||||
if (!own.call(handlers, type)) {
|
||||
throw new Error('Cannot compile unknown node `' + type + '`')
|
||||
}
|
||||
|
||||
// @ts-ignore Hush, it works.
|
||||
return handlers[type](node, ctx)
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('xast').Root} Root
|
||||
* @typedef {import('xast').Element} Element
|
||||
* @typedef {import('xast').Cdata} Cdata
|
||||
* @typedef {import('xast').Comment} Comment
|
||||
* @typedef {import('xast').Doctype} Doctype
|
||||
* @typedef {import('xast').Instruction} Instruction
|
||||
* @typedef {import('xast').Text} Text
|
||||
* @typedef {import('xast').Literal & {type: 'raw'}} Raw
|
||||
* @typedef {Root|Element} Parent
|
||||
* @typedef {import('xast').Attributes} Attributes
|
||||
* @typedef {Root['children'][number]} Child
|
||||
* @typedef {Child|Root} Node
|
||||
*
|
||||
* @typedef {'"'|"'"} Quote
|
||||
*
|
||||
* @typedef Options
|
||||
* @property {Quote} [quote='"'] Preferred quote to use
|
||||
* @property {boolean} [quoteSmart=false] Use the other quote if that results in
|
||||
* less bytes
|
||||
* @property {boolean} [closeEmptyElements=false] Close elements without any
|
||||
* content with slash (/) on the opening tag instead of an end tag:
|
||||
* `<circle />` instead of `<circle></circle>`.
|
||||
* See `tightClose` to control whether a space is used before the slash.
|
||||
* @property {boolean} [tightClose=false] Do not use an extra space when closing
|
||||
* self-closing elements: `<circle/>` instead of `<circle />`.
|
||||
* @property {boolean} [allowDangerousXml=false] Allow `raw` nodes and insert
|
||||
* them as raw XML. When falsey, encodes `raw` nodes.
|
||||
* Only set this if you completely trust the content!
|
||||
*
|
||||
* @typedef Context
|
||||
* @property {Quote} quote
|
||||
* @property {Quote} alternative
|
||||
* @property {boolean} close
|
||||
* @property {boolean} tight
|
||||
* @property {boolean} dangerous
|
||||
*
|
||||
* @callback Handle
|
||||
* @param {Node} node
|
||||
* @param {Context} context
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Serialize the given xast tree (or list of nodes).
|
||||
*
|
||||
* @param {Node|Array.<Node>} node
|
||||
* @param {Options} [options]
|
||||
* @returns {string}
|
||||
*/
|
||||
function toXml(node, options = {}) {
|
||||
var quote = options.quote || '"';
|
||||
/** @type {Quote} */
|
||||
var alternative = quote === '"' ? "'" : '"';
|
||||
var smart = options.quoteSmart;
|
||||
/** @type {Node} */
|
||||
// @ts-ignore Assume no `root` in `node`.
|
||||
var value = Array.isArray(node) ? {type: 'root', children: node} : node;
|
||||
|
||||
if (quote !== '"' && quote !== "'") {
|
||||
throw new Error('Invalid quote `' + quote + '`, expected `\'` or `"`')
|
||||
}
|
||||
|
||||
return one(value, {
|
||||
dangerous: options.allowDangerousXml,
|
||||
close: options.closeEmptyElements,
|
||||
tight: options.tightClose,
|
||||
quote,
|
||||
alternative: smart ? alternative : null
|
||||
})
|
||||
}
|
||||
|
||||
const BR = u('text', '\n');
|
||||
const TAB = u('text', ' ');
|
||||
/**
|
||||
* Convert nested folder structure to KML. This expects
|
||||
* input that follows the same patterns as [toGeoJSON](https://github.com/placemark/togeojson)'s
|
||||
* kmlWithFolders method: a tree of folders and features,
|
||||
* starting with a root element.
|
||||
*/
|
||||
function foldersToKML(root) {
|
||||
return toXml(u('root', [
|
||||
x('kml', { xmlns: 'http://www.opengis.net/kml/2.2' }, x('Document', root.children.flatMap((child) => convertChild(child)))),
|
||||
]));
|
||||
}
|
||||
/**
|
||||
* Convert a GeoJSON FeatureCollection to a string of
|
||||
* KML data.
|
||||
*/
|
||||
function toKML(featureCollection) {
|
||||
return toXml(u('root', [
|
||||
x('kml', { xmlns: 'http://www.opengis.net/kml/2.2' }, x('Document', featureCollection.features.flatMap((feature) => convertFeature(feature)))),
|
||||
]));
|
||||
}
|
||||
function convertChild(child) {
|
||||
switch (child.type) {
|
||||
case 'Feature':
|
||||
return convertFeature(child);
|
||||
case 'folder':
|
||||
return convertFolder(child);
|
||||
}
|
||||
}
|
||||
function convertFolder(folder) {
|
||||
const id = ['string', 'number'].includes(typeof folder.meta.id)
|
||||
? {
|
||||
id: String(folder.meta.id),
|
||||
}
|
||||
: {};
|
||||
return [
|
||||
BR,
|
||||
x('Folder', id, [
|
||||
BR,
|
||||
...folderMeta(folder.meta),
|
||||
BR,
|
||||
TAB,
|
||||
...folder.children.flatMap((child) => convertChild(child)),
|
||||
]),
|
||||
];
|
||||
}
|
||||
const META_PROPERTIES = [
|
||||
'address',
|
||||
'description',
|
||||
'name',
|
||||
'open',
|
||||
'visibility',
|
||||
'phoneNumber',
|
||||
];
|
||||
function folderMeta(meta) {
|
||||
return META_PROPERTIES.filter((p) => meta[p] !== undefined).map((p) => {
|
||||
return x(p, [u('text', String(meta[p]))]);
|
||||
});
|
||||
}
|
||||
function convertFeature(feature) {
|
||||
const { id } = feature;
|
||||
const idMember = ['string', 'number'].includes(typeof id)
|
||||
? {
|
||||
id: id,
|
||||
}
|
||||
: {};
|
||||
return [
|
||||
BR,
|
||||
x('Placemark', idMember, [
|
||||
BR,
|
||||
...propertiesToTags(feature.properties),
|
||||
BR,
|
||||
TAB,
|
||||
...(feature.geometry ? [convertGeometry(feature.geometry)] : []),
|
||||
]),
|
||||
];
|
||||
}
|
||||
function join(position) {
|
||||
return `${position[0]},${position[1]}`;
|
||||
}
|
||||
function coord1(coordinates) {
|
||||
return x('coordinates', [u('text', join(coordinates))]);
|
||||
}
|
||||
function coord2(coordinates) {
|
||||
return x('coordinates', [u('text', coordinates.map(join).join('\n'))]);
|
||||
}
|
||||
function toString(value) {
|
||||
switch (typeof value) {
|
||||
case 'string': {
|
||||
return value;
|
||||
}
|
||||
case 'boolean':
|
||||
case 'number': {
|
||||
return String(value);
|
||||
}
|
||||
case 'object': {
|
||||
try {
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
catch (e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
function maybeCData(value) {
|
||||
if (value &&
|
||||
typeof value === 'object' &&
|
||||
'@type' in value &&
|
||||
value['@type'] === 'html' &&
|
||||
'value' in value &&
|
||||
typeof value.value === 'string') {
|
||||
return u('cdata', value.value);
|
||||
}
|
||||
return toString(value);
|
||||
}
|
||||
function propertiesToTags(properties) {
|
||||
if (!properties)
|
||||
return [];
|
||||
const { name, description, visibility, ...otherProperties } = properties;
|
||||
return [
|
||||
name && x('name', [u('text', toString(name))]),
|
||||
description && x('description', [u('text', maybeCData(description))]),
|
||||
visibility !== undefined &&
|
||||
x('visibility', [u('text', visibility ? '1' : '0')]),
|
||||
x('ExtendedData', Object.entries(otherProperties).flatMap(([name, value]) => [
|
||||
BR,
|
||||
TAB,
|
||||
x('Data', { name: name }, [
|
||||
x('value', [
|
||||
u('text', typeof value === 'string' ? value : JSON.stringify(value)),
|
||||
]),
|
||||
]),
|
||||
])),
|
||||
].filter(Boolean);
|
||||
}
|
||||
const linearRing = (ring) => x('LinearRing', [coord2(ring)]);
|
||||
function convertMultiPoint(geometry) {
|
||||
return x('MultiGeometry', geometry.coordinates.flatMap((coordinates) => [
|
||||
BR,
|
||||
convertGeometry({
|
||||
type: 'Point',
|
||||
coordinates,
|
||||
}),
|
||||
]));
|
||||
}
|
||||
function convertMultiLineString(geometry) {
|
||||
return x('MultiGeometry', geometry.coordinates.flatMap((coordinates) => [
|
||||
BR,
|
||||
convertGeometry({
|
||||
type: 'LineString',
|
||||
coordinates,
|
||||
}),
|
||||
]));
|
||||
}
|
||||
function convertMultiPolygon(geometry) {
|
||||
return x('MultiGeometry', geometry.coordinates.flatMap((coordinates) => [
|
||||
BR,
|
||||
convertGeometry({
|
||||
type: 'Polygon',
|
||||
coordinates,
|
||||
}),
|
||||
]));
|
||||
}
|
||||
function convertPolygon(geometry) {
|
||||
const [outerBoundary, ...innerRings] = geometry.coordinates;
|
||||
return x('Polygon', [
|
||||
BR,
|
||||
x('outerBoundaryIs', [BR, TAB, linearRing(outerBoundary)]),
|
||||
...innerRings.flatMap((innerRing) => [
|
||||
BR,
|
||||
x('innerBoundaryIs', [BR, TAB, linearRing(innerRing)]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
function convertGeometry(geometry) {
|
||||
switch (geometry.type) {
|
||||
case 'Point':
|
||||
return x('Point', [coord1(geometry.coordinates)]);
|
||||
case 'MultiPoint':
|
||||
return convertMultiPoint(geometry);
|
||||
case 'LineString':
|
||||
return x('LineString', [coord2(geometry.coordinates)]);
|
||||
case 'MultiLineString':
|
||||
return convertMultiLineString(geometry);
|
||||
case 'Polygon':
|
||||
return convertPolygon(geometry);
|
||||
case 'MultiPolygon':
|
||||
return convertMultiPolygon(geometry);
|
||||
case 'GeometryCollection':
|
||||
return x('MultiGeometry', geometry.geometries.flatMap((geometry) => [
|
||||
BR,
|
||||
convertGeometry(geometry),
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
export { foldersToKML, toKML };
|
||||
//# sourceMappingURL=tokml.es.mjs.map
|
1
umap/static/umap/vendors/tokml/tokml.es.mjs.map
vendored
Normal file
117
umap/static/umap/vendors/toolbar/leaflet.toolbar-src.css
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* Variables and Mixins */
|
||||
/* Generic L.Toolbar */
|
||||
.leaflet-toolbar-0 {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
|
||||
}
|
||||
.leaflet-toolbar-0 > li {
|
||||
position: relative;
|
||||
}
|
||||
.leaflet-toolbar-0 > li > .leaflet-toolbar-icon {
|
||||
display: block;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
margin-right: 0;
|
||||
padding-right: 0;
|
||||
border-right: 0;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.leaflet-toolbar-0 > li > .leaflet-toolbar-icon:hover {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.leaflet-toolbar-0 .leaflet-toolbar-1 {
|
||||
display: none;
|
||||
list-style: none;
|
||||
}
|
||||
.leaflet-toolbar-tip-container {
|
||||
margin: 0 auto;
|
||||
height: 12px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-toolbar-tip {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin: -6px auto 0;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
/* L.Toolbar.Control */
|
||||
.leaflet-control-toolbar {
|
||||
/* Secondary Toolbar */
|
||||
}
|
||||
.leaflet-control-toolbar > li > .leaflet-toolbar-icon {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.leaflet-control-toolbar > li:first-child > .leaflet-toolbar-icon {
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
.leaflet-control-toolbar > li:last-child > .leaflet-toolbar-icon {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
.leaflet-control-toolbar .leaflet-toolbar-1 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
left: 26px;
|
||||
/* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */
|
||||
top: 0;
|
||||
white-space: nowrap;
|
||||
height: 26px;
|
||||
}
|
||||
.leaflet-control-toolbar .leaflet-toolbar-1 > li {
|
||||
display: inline-block;
|
||||
}
|
||||
.leaflet-control-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon {
|
||||
display: block;
|
||||
background-color: #919187;
|
||||
border-left: 1px solid #aaa;
|
||||
color: #fff;
|
||||
font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
line-height: 26px;
|
||||
text-decoration: none;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
height: 26px;
|
||||
}
|
||||
.leaflet-control-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon:hover {
|
||||
background-color: #a0a098;
|
||||
}
|
||||
/* L.Toolbar.Popup */
|
||||
.leaflet-popup-toolbar {
|
||||
position: relative;
|
||||
}
|
||||
.leaflet-popup-toolbar > li {
|
||||
float: left;
|
||||
}
|
||||
.leaflet-popup-toolbar > li:first-child > .leaflet-toolbar-icon {
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.leaflet-popup-toolbar > li:last-child > .leaflet-toolbar-icon {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
.leaflet-popup-toolbar .leaflet-toolbar-1 {
|
||||
position: absolute;
|
||||
top: 26px;
|
||||
left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
.leaflet-popup-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
}
|
365
umap/static/umap/vendors/toolbar/leaflet.toolbar-src.js
vendored
Normal file
|
@ -0,0 +1,365 @@
|
|||
(function(window, document, undefined) {
|
||||
|
||||
"use strict";
|
||||
|
||||
L.Toolbar = (L.Layer || L.Class).extend({
|
||||
statics: {
|
||||
baseClass: 'leaflet-toolbar'
|
||||
},
|
||||
|
||||
includes: L.Mixin.Events,
|
||||
|
||||
options: {
|
||||
className: '',
|
||||
filter: function() { return true; },
|
||||
actions: []
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
L.setOptions(this, options);
|
||||
this._toolbar_type = this.constructor._toolbar_class_id;
|
||||
},
|
||||
|
||||
addTo: function(map) {
|
||||
this._arguments = [].slice.call(arguments);
|
||||
|
||||
map.addLayer(this);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
var currentToolbar = map._toolbars[this._toolbar_type];
|
||||
|
||||
if (this._calculateDepth() === 0) {
|
||||
if (currentToolbar) { map.removeLayer(currentToolbar); }
|
||||
map._toolbars[this._toolbar_type] = this;
|
||||
}
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
/*
|
||||
* TODO: Cleanup event listeners.
|
||||
* For some reason, this throws:
|
||||
* "Uncaught TypeError: Cannot read property 'dragging' of null"
|
||||
* on this._marker when a toolbar icon is clicked.
|
||||
*/
|
||||
// for (var i = 0, l = this._disabledEvents.length; i < l; i++) {
|
||||
// L.DomEvent.off(this._ul, this._disabledEvents[i], L.DomEvent.stopPropagation);
|
||||
// }
|
||||
|
||||
if (this._calculateDepth() === 0) {
|
||||
delete map._toolbars[this._toolbar_type];
|
||||
}
|
||||
},
|
||||
|
||||
appendToContainer: function(container) {
|
||||
var baseClass = this.constructor.baseClass + '-' + this._calculateDepth(),
|
||||
className = baseClass + ' ' + this.options.className,
|
||||
Action, action,
|
||||
i, j, l, m;
|
||||
|
||||
this._container = container;
|
||||
this._ul = L.DomUtil.create('ul', className, container);
|
||||
|
||||
/* Ensure that clicks, drags, etc. don't bubble up to the map. */
|
||||
this._disabledEvents = ['click', 'mousemove', 'dblclick'];
|
||||
|
||||
for (j = 0, m = this._disabledEvents.length; j < m; j++) {
|
||||
L.DomEvent.on(this._ul, this._disabledEvents[j], L.DomEvent.stopPropagation);
|
||||
}
|
||||
|
||||
/* Instantiate each toolbar action and add its corresponding toolbar icon. */
|
||||
for (i = 0, l = this.options.actions.length; i < l; i++) {
|
||||
Action = this._getActionConstructor(this.options.actions[i]);
|
||||
|
||||
action = new Action();
|
||||
action._createIcon(this, this._ul, this._arguments);
|
||||
}
|
||||
},
|
||||
|
||||
_getActionConstructor: function(Action) {
|
||||
var args = this._arguments,
|
||||
toolbar = this;
|
||||
|
||||
return Action.extend({
|
||||
initialize: function() {
|
||||
Action.prototype.initialize.apply(this, args);
|
||||
},
|
||||
enable: function(e) {
|
||||
/* Ensure that only one action in a toolbar will be active at a time. */
|
||||
if (toolbar._active) { toolbar._active.disable(); }
|
||||
toolbar._active = this;
|
||||
|
||||
Action.prototype.enable.call(this, e);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/* Used to hide subToolbars without removing them from the map. */
|
||||
_hide: function() {
|
||||
this._ul.style.display = 'none';
|
||||
},
|
||||
|
||||
/* Used to show subToolbars without removing them from the map. */
|
||||
_show: function() {
|
||||
this._ul.style.display = 'block';
|
||||
},
|
||||
|
||||
_calculateDepth: function() {
|
||||
var depth = 0,
|
||||
toolbar = this.parentToolbar;
|
||||
|
||||
while (toolbar) {
|
||||
depth += 1;
|
||||
toolbar = toolbar.parentToolbar;
|
||||
}
|
||||
|
||||
return depth;
|
||||
}
|
||||
});
|
||||
|
||||
L.toolbar = {};
|
||||
|
||||
var toolbar_class_id = 0;
|
||||
|
||||
L.Toolbar.extend = function extend(props) {
|
||||
var statics = L.extend({}, props.statics, {
|
||||
"_toolbar_class_id": toolbar_class_id
|
||||
});
|
||||
|
||||
toolbar_class_id += 1;
|
||||
L.extend(props, { statics: statics });
|
||||
|
||||
return L.Class.extend.call(this, props);
|
||||
};
|
||||
|
||||
L.Map.addInitHook(function() {
|
||||
this._toolbars = {};
|
||||
});
|
||||
|
||||
L.ToolbarAction = L.Handler.extend({
|
||||
statics: {
|
||||
baseClass: 'leaflet-toolbar-icon'
|
||||
},
|
||||
|
||||
options: {
|
||||
toolbarIcon: {
|
||||
html: '',
|
||||
className: '',
|
||||
tooltip: ''
|
||||
},
|
||||
subToolbar: new L.Toolbar()
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
var defaultIconOptions = L.ToolbarAction.prototype.options.toolbarIcon;
|
||||
|
||||
L.setOptions(this, options);
|
||||
this.options.toolbarIcon = L.extend({}, defaultIconOptions, this.options.toolbarIcon);
|
||||
},
|
||||
|
||||
enable: function(e) {
|
||||
if (e) { L.DomEvent.preventDefault(e); }
|
||||
if (this._enabled) { return; }
|
||||
this._enabled = true;
|
||||
|
||||
if (this.addHooks) { this.addHooks(); }
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
if (!this._enabled) { return; }
|
||||
this._enabled = false;
|
||||
|
||||
if (this.removeHooks) { this.removeHooks(); }
|
||||
},
|
||||
|
||||
_createIcon: function(toolbar, container, args) {
|
||||
var iconOptions = this.options.toolbarIcon;
|
||||
|
||||
this.toolbar = toolbar;
|
||||
this._icon = L.DomUtil.create('li', '', container);
|
||||
this._link = L.DomUtil.create('a', '', this._icon);
|
||||
|
||||
this._link.innerHTML = iconOptions.html;
|
||||
this._link.setAttribute('href', '#');
|
||||
this._link.setAttribute('title', iconOptions.tooltip);
|
||||
|
||||
L.DomUtil.addClass(this._link, this.constructor.baseClass);
|
||||
if (iconOptions.className) {
|
||||
L.DomUtil.addClass(this._link, iconOptions.className);
|
||||
}
|
||||
|
||||
L.DomEvent.on(this._link, 'click', this.enable, this);
|
||||
|
||||
/* Add secondary toolbar */
|
||||
this._addSubToolbar(toolbar, this._icon, args);
|
||||
},
|
||||
|
||||
_addSubToolbar: function(toolbar, container, args) {
|
||||
var subToolbar = this.options.subToolbar,
|
||||
addHooks = this.addHooks,
|
||||
removeHooks = this.removeHooks;
|
||||
|
||||
/* For calculating the nesting depth. */
|
||||
subToolbar.parentToolbar = toolbar;
|
||||
|
||||
if (subToolbar.options.actions.length > 0) {
|
||||
/* Make a copy of args so as not to pollute the args array used by other actions. */
|
||||
args = [].slice.call(args);
|
||||
args.push(this);
|
||||
|
||||
subToolbar.addTo.apply(subToolbar, args);
|
||||
subToolbar.appendToContainer(container);
|
||||
|
||||
this.addHooks = function(map) {
|
||||
if (typeof addHooks === 'function') { addHooks.call(this, map); }
|
||||
subToolbar._show();
|
||||
};
|
||||
|
||||
this.removeHooks = function(map) {
|
||||
if (typeof removeHooks === 'function') { removeHooks.call(this, map); }
|
||||
subToolbar._hide();
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
L.toolbarAction = function toolbarAction(options) {
|
||||
return new L.ToolbarAction(options);
|
||||
};
|
||||
|
||||
L.ToolbarAction.extendOptions = function(options) {
|
||||
return this.extend({ options: options });
|
||||
};
|
||||
|
||||
L.Toolbar.Control = L.Toolbar.extend({
|
||||
statics: {
|
||||
baseClass: 'leaflet-control-toolbar ' + L.Toolbar.baseClass
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
L.Toolbar.prototype.initialize.call(this, options);
|
||||
|
||||
this._control = new L.Control.Toolbar(this.options);
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
this._control.addTo(map);
|
||||
|
||||
L.Toolbar.prototype.onAdd.call(this, map);
|
||||
|
||||
this.appendToContainer(this._control.getContainer());
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
L.Toolbar.prototype.onRemove.call(this, map);
|
||||
if (this._control.remove) {this._control.remove();} // Leaflet 1.0
|
||||
else {this._control.removeFrom(map);}
|
||||
}
|
||||
});
|
||||
|
||||
L.Control.Toolbar = L.Control.extend({
|
||||
onAdd: function() {
|
||||
return L.DomUtil.create('div', '');
|
||||
}
|
||||
});
|
||||
|
||||
L.toolbar.control = function(options) {
|
||||
return new L.Toolbar.Control(options);
|
||||
};
|
||||
|
||||
// A convenience class for built-in popup toolbars.
|
||||
|
||||
L.Toolbar.Popup = L.Toolbar.extend({
|
||||
statics: {
|
||||
baseClass: 'leaflet-popup-toolbar ' + L.Toolbar.baseClass
|
||||
},
|
||||
|
||||
options: {
|
||||
anchor: [0, 0]
|
||||
},
|
||||
|
||||
initialize: function(latlng, options) {
|
||||
L.Toolbar.prototype.initialize.call(this, options);
|
||||
|
||||
/*
|
||||
* Developers can't pass a DivIcon in the options for L.Toolbar.Popup
|
||||
* (the use of DivIcons is an implementation detail which may change).
|
||||
*/
|
||||
this._marker = new L.Marker(latlng, {
|
||||
icon : new L.DivIcon({
|
||||
className: this.options.className,
|
||||
iconAnchor: [0, 0]
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
onAdd: function(map) {
|
||||
this._map = map;
|
||||
this._marker.addTo(map);
|
||||
|
||||
L.Toolbar.prototype.onAdd.call(this, map);
|
||||
|
||||
this.appendToContainer(this._marker._icon);
|
||||
|
||||
this._setStyles();
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
map.removeLayer(this._marker);
|
||||
|
||||
L.Toolbar.prototype.onRemove.call(this, map);
|
||||
|
||||
delete this._map;
|
||||
},
|
||||
|
||||
setLatLng: function(latlng) {
|
||||
this._marker.setLatLng(latlng);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_setStyles: function() {
|
||||
var container = this._container,
|
||||
toolbar = this._ul,
|
||||
anchor = L.point(this.options.anchor),
|
||||
icons = toolbar.querySelectorAll('.leaflet-toolbar-icon'),
|
||||
buttonHeights = [],
|
||||
toolbarWidth = 0,
|
||||
toolbarHeight,
|
||||
tipSize,
|
||||
tipAnchor;
|
||||
|
||||
/* Calculate the dimensions of the toolbar. */
|
||||
for (var i = 0, l = icons.length; i < l; i++) {
|
||||
if (icons[i].parentNode.parentNode === toolbar) {
|
||||
buttonHeights.push(parseInt(L.DomUtil.getStyle(icons[i], 'height'), 10));
|
||||
toolbarWidth += Math.ceil(parseFloat(L.DomUtil.getStyle(icons[i], 'width')));
|
||||
}
|
||||
}
|
||||
toolbar.style.width = toolbarWidth + 'px';
|
||||
|
||||
/* Create and place the toolbar tip. */
|
||||
this._tipContainer = L.DomUtil.create('div', 'leaflet-toolbar-tip-container', container);
|
||||
this._tipContainer.style.width = toolbarWidth + 'px';
|
||||
|
||||
this._tip = L.DomUtil.create('div', 'leaflet-toolbar-tip', this._tipContainer);
|
||||
|
||||
/* Set the tipAnchor point. */
|
||||
toolbarHeight = Math.max.apply(undefined, buttonHeights);
|
||||
tipSize = parseInt(L.DomUtil.getStyle(this._tip, 'width'), 10);
|
||||
tipAnchor = new L.Point(toolbarWidth/2, toolbarHeight + 0.7071*tipSize);
|
||||
|
||||
/* The anchor option allows app developers to adjust the toolbar's position. */
|
||||
container.style.marginLeft = (anchor.x - tipAnchor.x) + 'px';
|
||||
container.style.marginTop = (anchor.y - tipAnchor.y) + 'px';
|
||||
}
|
||||
});
|
||||
|
||||
L.toolbar.popup = function(options) {
|
||||
return new L.Toolbar.Popup(options);
|
||||
};
|
||||
|
||||
|
||||
})(window, document);
|
1
umap/static/umap/vendors/toolbar/leaflet.toolbar.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.leaflet-toolbar-0{list-style:none;padding-left:0;box-shadow:0 1px 5px rgba(0,0,0,.65)}.leaflet-toolbar-0>li{position:relative}.leaflet-toolbar-0>li>.leaflet-toolbar-icon{display:block;width:26px;height:26px;line-height:26px;margin-right:0;padding-right:0;border-right:0;text-align:center;text-decoration:none;background-color:#fff}.leaflet-toolbar-0>li>.leaflet-toolbar-icon:hover{background-color:#f4f4f4}.leaflet-toolbar-0 .leaflet-toolbar-1{display:none;list-style:none}.leaflet-toolbar-tip-container{margin:0 auto;height:12px;position:relative;overflow:hidden}.leaflet-toolbar-tip{width:12px;height:12px;margin:-6px auto 0;background-color:#fff;box-shadow:0 1px 5px rgba(0,0,0,.65);-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-control-toolbar>li>.leaflet-toolbar-icon{border-bottom:1px solid #ccc}.leaflet-control-toolbar>li:first-child>.leaflet-toolbar-icon{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-control-toolbar>li:last-child>.leaflet-toolbar-icon{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom-width:0}.leaflet-control-toolbar .leaflet-toolbar-1{margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap;height:26px}.leaflet-control-toolbar .leaflet-toolbar-1>li{display:inline-block}.leaflet-control-toolbar .leaflet-toolbar-1>li>.leaflet-toolbar-icon{display:block;background-color:#919187;border-left:1px solid #aaa;color:#fff;font:11px/19px "Helvetica Neue",Arial,Helvetica,sans-serif;line-height:26px;text-decoration:none;padding-left:10px;padding-right:10px;height:26px}.leaflet-control-toolbar .leaflet-toolbar-1>li>.leaflet-toolbar-icon:hover{background-color:#a0a098}.leaflet-popup-toolbar{position:relative}.leaflet-popup-toolbar>li{float:left}.leaflet-popup-toolbar>li:first-child>.leaflet-toolbar-icon{border-top-left-radius:4px;border-bottom-left-radius:4px}.leaflet-popup-toolbar>li:last-child>.leaflet-toolbar-icon{border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-width:0}.leaflet-popup-toolbar .leaflet-toolbar-1{position:absolute;top:26px;left:0;padding-left:0}.leaflet-popup-toolbar .leaflet-toolbar-1>li>.leaflet-toolbar-icon{position:relative;float:left;width:26px;height:26px}
|