umap-project 3.4.2__py3-none-any.whl → 3.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  3. umap/locale/br/LC_MESSAGES/django.po +71 -57
  4. umap/locale/de/LC_MESSAGES/django.mo +0 -0
  5. umap/locale/de/LC_MESSAGES/django.po +20 -16
  6. umap/locale/en/LC_MESSAGES/django.po +14 -14
  7. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/hu/LC_MESSAGES/django.po +20 -16
  9. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/pl/LC_MESSAGES/django.po +32 -27
  11. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  12. umap/locale/zh_TW/LC_MESSAGES/django.po +20 -16
  13. umap/management/commands/clean_tilelayer.py +0 -1
  14. umap/management/commands/search_maps.py +95 -0
  15. umap/settings/__init__.py +9 -1
  16. umap/settings/base.py +7 -6
  17. umap/static/umap/css/icon.css +8 -0
  18. umap/static/umap/img/16-white.svg +5 -2
  19. umap/static/umap/img/16.svg +1 -1
  20. umap/static/umap/img/source/16-white.svg +7 -4
  21. umap/static/umap/img/source/16.svg +1 -1
  22. umap/static/umap/js/modules/autocomplete.js +1 -9
  23. umap/static/umap/js/modules/browser.js +27 -10
  24. umap/static/umap/js/modules/data/features.js +3 -2
  25. umap/static/umap/js/modules/data/fields.js +12 -2
  26. umap/static/umap/js/modules/data/layer.js +13 -9
  27. umap/static/umap/js/modules/domutils.js +4 -0
  28. umap/static/umap/js/modules/filters.js +11 -10
  29. umap/static/umap/js/modules/form/builder.js +17 -16
  30. umap/static/umap/js/modules/form/fields.js +16 -16
  31. umap/static/umap/js/modules/permissions.js +10 -2
  32. umap/static/umap/js/modules/rendering/controls.js +202 -9
  33. umap/static/umap/js/modules/rendering/layers/classified.js +1 -1
  34. umap/static/umap/js/modules/rendering/map.js +45 -35
  35. umap/static/umap/js/modules/rendering/template.js +12 -6
  36. umap/static/umap/js/modules/rules.js +1 -1
  37. umap/static/umap/js/modules/ui/bar.js +2 -1
  38. umap/static/umap/js/modules/ui/hash.js +36 -0
  39. umap/static/umap/js/modules/ui/loader.js +26 -0
  40. umap/static/umap/js/modules/ui/panel.js +7 -0
  41. umap/static/umap/js/modules/umap.js +6 -0
  42. umap/static/umap/js/modules/utils.js +5 -4
  43. umap/static/umap/js/umap.controls.js +0 -182
  44. umap/static/umap/locale/am_ET.js +2 -5
  45. umap/static/umap/locale/am_ET.json +2 -5
  46. umap/static/umap/locale/ar.js +2 -5
  47. umap/static/umap/locale/ar.json +2 -5
  48. umap/static/umap/locale/ast.js +2 -5
  49. umap/static/umap/locale/ast.json +2 -5
  50. umap/static/umap/locale/bg.js +2 -5
  51. umap/static/umap/locale/bg.json +2 -5
  52. umap/static/umap/locale/br.js +40 -43
  53. umap/static/umap/locale/br.json +40 -43
  54. umap/static/umap/locale/ca.js +2 -5
  55. umap/static/umap/locale/ca.json +2 -5
  56. umap/static/umap/locale/cs_CZ.js +0 -3
  57. umap/static/umap/locale/cs_CZ.json +0 -3
  58. umap/static/umap/locale/da.js +1 -4
  59. umap/static/umap/locale/da.json +1 -4
  60. umap/static/umap/locale/de.js +27 -30
  61. umap/static/umap/locale/de.json +27 -30
  62. umap/static/umap/locale/el.js +0 -3
  63. umap/static/umap/locale/el.json +0 -3
  64. umap/static/umap/locale/en.js +0 -3
  65. umap/static/umap/locale/en.json +0 -3
  66. umap/static/umap/locale/en_US.json +2 -5
  67. umap/static/umap/locale/es.js +0 -3
  68. umap/static/umap/locale/es.json +0 -3
  69. umap/static/umap/locale/et.js +0 -3
  70. umap/static/umap/locale/et.json +0 -3
  71. umap/static/umap/locale/eu.js +0 -3
  72. umap/static/umap/locale/eu.json +0 -3
  73. umap/static/umap/locale/fa_IR.js +0 -3
  74. umap/static/umap/locale/fa_IR.json +0 -3
  75. umap/static/umap/locale/fi.js +2 -5
  76. umap/static/umap/locale/fi.json +2 -5
  77. umap/static/umap/locale/fr.js +3 -6
  78. umap/static/umap/locale/fr.json +3 -6
  79. umap/static/umap/locale/gl.js +0 -3
  80. umap/static/umap/locale/gl.json +0 -3
  81. umap/static/umap/locale/he.js +2 -5
  82. umap/static/umap/locale/he.json +2 -5
  83. umap/static/umap/locale/hr.js +2 -5
  84. umap/static/umap/locale/hr.json +2 -5
  85. umap/static/umap/locale/hu.js +7 -10
  86. umap/static/umap/locale/hu.json +7 -10
  87. umap/static/umap/locale/id.js +2 -5
  88. umap/static/umap/locale/id.json +2 -5
  89. umap/static/umap/locale/is.js +0 -3
  90. umap/static/umap/locale/is.json +0 -3
  91. umap/static/umap/locale/it.js +0 -3
  92. umap/static/umap/locale/it.json +0 -3
  93. umap/static/umap/locale/ja.js +2 -5
  94. umap/static/umap/locale/ja.json +2 -5
  95. umap/static/umap/locale/ko.js +2 -5
  96. umap/static/umap/locale/ko.json +2 -5
  97. umap/static/umap/locale/lt.js +2 -5
  98. umap/static/umap/locale/lt.json +2 -5
  99. umap/static/umap/locale/ms.js +0 -3
  100. umap/static/umap/locale/ms.json +0 -3
  101. umap/static/umap/locale/nl.js +0 -3
  102. umap/static/umap/locale/nl.json +0 -3
  103. umap/static/umap/locale/no.js +2 -5
  104. umap/static/umap/locale/no.json +2 -5
  105. umap/static/umap/locale/pl.js +2 -5
  106. umap/static/umap/locale/pl.json +2 -5
  107. umap/static/umap/locale/pl_PL.json +2 -5
  108. umap/static/umap/locale/pt.js +0 -3
  109. umap/static/umap/locale/pt.json +0 -3
  110. umap/static/umap/locale/pt_BR.js +2 -5
  111. umap/static/umap/locale/pt_BR.json +2 -5
  112. umap/static/umap/locale/pt_PT.js +2 -5
  113. umap/static/umap/locale/pt_PT.json +2 -5
  114. umap/static/umap/locale/ro.js +2 -5
  115. umap/static/umap/locale/ro.json +2 -5
  116. umap/static/umap/locale/ru.js +2 -5
  117. umap/static/umap/locale/ru.json +2 -5
  118. umap/static/umap/locale/sk_SK.js +2 -5
  119. umap/static/umap/locale/sk_SK.json +2 -5
  120. umap/static/umap/locale/sl.js +2 -5
  121. umap/static/umap/locale/sl.json +2 -5
  122. umap/static/umap/locale/sr.js +2 -5
  123. umap/static/umap/locale/sr.json +2 -5
  124. umap/static/umap/locale/sv.js +2 -5
  125. umap/static/umap/locale/sv.json +2 -5
  126. umap/static/umap/locale/th_TH.js +2 -5
  127. umap/static/umap/locale/th_TH.json +2 -5
  128. umap/static/umap/locale/tr.js +2 -5
  129. umap/static/umap/locale/tr.json +2 -5
  130. umap/static/umap/locale/uk_UA.js +2 -5
  131. umap/static/umap/locale/uk_UA.json +2 -5
  132. umap/static/umap/locale/vi.js +2 -5
  133. umap/static/umap/locale/vi.json +2 -5
  134. umap/static/umap/locale/vi_VN.json +2 -5
  135. umap/static/umap/locale/zh.js +2 -5
  136. umap/static/umap/locale/zh.json +2 -5
  137. umap/static/umap/locale/zh_CN.json +2 -5
  138. umap/static/umap/locale/zh_TW.Big5.json +2 -5
  139. umap/static/umap/locale/zh_TW.js +1 -4
  140. umap/static/umap/locale/zh_TW.json +1 -4
  141. umap/static/umap/map.css +1 -17
  142. umap/static/umap/vendors/locatecontrol/L.Control.Locate.esm.js +942 -0
  143. umap/static/umap/vendors/photon/leaflet.photon.esm.js +472 -0
  144. umap/sync/app.py +4 -1
  145. umap/templates/umap/css.html +0 -2
  146. umap/templates/umap/js.html +0 -5
  147. umap/templates/umap/team_form.html +2 -1
  148. umap/tests/fixtures/test_upload_data_with_enum.umap +151 -0
  149. umap/tests/integration/test_edit_map.py +2 -0
  150. umap/tests/integration/test_filters.py +24 -0
  151. umap/tests/integration/test_import.py +40 -23
  152. umap/tests/integration/test_map.py +1 -1
  153. umap/tests/integration/test_optimistic_merge.py +7 -1
  154. umap/tests/integration/test_remote_data.py +1 -1
  155. umap/tests/test_search_maps_command.py +44 -0
  156. umap/utils.py +9 -3
  157. umap/views.py +17 -4
  158. {umap_project-3.4.2.dist-info → umap_project-3.6.1.dist-info}/METADATA +24 -18
  159. {umap_project-3.4.2.dist-info → umap_project-3.6.1.dist-info}/RECORD +162 -163
  160. {umap_project-3.4.2.dist-info → umap_project-3.6.1.dist-info}/WHEEL +1 -1
  161. umap/static/umap/vendors/hash/leaflet-hash.js +0 -162
  162. umap/static/umap/vendors/loading/Control.Loading.css +0 -26
  163. umap/static/umap/vendors/loading/Control.Loading.js +0 -351
  164. umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.css +0 -1
  165. umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.css.map +0 -1
  166. umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.js +0 -4
  167. umap/static/umap/vendors/locatecontrol/L.Control.Locate.min.js.map +0 -1
  168. umap/static/umap/vendors/photon/leaflet.photon.js +0 -487
  169. {umap_project-3.4.2.dist-info → umap_project-3.6.1.dist-info}/entry_points.txt +0 -0
  170. {umap_project-3.4.2.dist-info → umap_project-3.6.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,487 +0,0 @@
1
- L.PhotonBase = L.Class.extend({
2
-
3
- forEach: function (els, callback) {
4
- Array.prototype.forEach.call(els, callback);
5
- },
6
-
7
- ajax: function (callback, thisobj) {
8
- if (typeof this.xhr === 'object') {
9
- this.xhr.abort();
10
- }
11
- this.xhr = new XMLHttpRequest();
12
- var self = this;
13
- this.xhr.open('GET', this.options.url + this.buildQueryString(this.getParams()), true);
14
-
15
- this.xhr.onload = function(e) {
16
- self.fire('ajax:return');
17
- if (this.status === 200) {
18
- if (callback) {
19
- var raw = this.response;
20
- raw = JSON.parse(raw);
21
- callback.call(thisobj || this, raw);
22
- }
23
- }
24
- delete this.xhr;
25
- };
26
-
27
- this.fire('ajax:send');
28
- this.xhr.send();
29
- },
30
-
31
- buildQueryString: function (params) {
32
- var queryString = [];
33
- for (var key in params) {
34
- if (params[key]) {
35
- queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
36
- }
37
- }
38
- return queryString.join('&');
39
- },
40
-
41
- featureToPopupContent: function (feature) {
42
- var container = L.DomUtil.create('div', 'leaflet-photon-popup'),
43
- title = L.DomUtil.create('h3', '', container);
44
- title.innerHTML = feature.properties.label;
45
- return container;
46
- }
47
-
48
- });
49
-
50
-
51
- L.PhotonBaseSearch = L.PhotonBase.extend({
52
-
53
- includes: ((typeof L.Evented !== 'undefined' && L.Evented.prototype) || L.Mixin.Events),
54
-
55
- options: {
56
- url: 'https://photon.komoot.io/api/?',
57
- placeholder: 'Start typing...',
58
- minChar: 3,
59
- limit: 5,
60
- submitDelay: 300,
61
- includePosition: true,
62
- bbox: null,
63
- noResultLabel: 'No result',
64
- feedbackEmail: 'photon@komoot.de', // Set to null to remove feedback box
65
- feedbackLabel: 'Feedback'
66
- },
67
-
68
- CACHE: '',
69
- RESULTS: [],
70
- KEYS: {
71
- LEFT: 37,
72
- UP: 38,
73
- RIGHT: 39,
74
- DOWN: 40,
75
- TAB: 9,
76
- RETURN: 13,
77
- ESC: 27,
78
- APPLE: 91,
79
- SHIFT: 16,
80
- ALT: 17,
81
- CTRL: 18
82
- },
83
-
84
- initialize: function (input, options) {
85
- this.input = input;
86
- L.setOptions(this, options);
87
- var CURRENT = null;
88
-
89
- try {
90
- Object.defineProperty(this, 'CURRENT', {
91
- get: function () {
92
- return CURRENT;
93
- },
94
- set: function (index) {
95
- if (typeof index === 'object') {
96
- index = this.resultToIndex(index);
97
- }
98
- CURRENT = index;
99
- }
100
- });
101
- } catch (e) {
102
- // Hello IE8
103
- }
104
- this.input.type = L.Browser.ie ? 'text' : 'search';
105
- this.input.placeholder = this.options.placeholder;
106
- this.input.autocomplete = 'off';
107
- this.input.autocorrect = 'off';
108
- L.DomEvent.disableClickPropagation(this.input);
109
-
110
- L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this);
111
- L.DomEvent.on(this.input, 'input', this.onInput, this);
112
- L.DomEvent.on(this.input, 'blur', this.onBlur, this);
113
- L.DomEvent.on(this.input, 'focus', this.onFocus, this);
114
- this.createResultsContainer();
115
- },
116
-
117
- createResultsContainer: function () {
118
- this.resultsContainer = this.options.resultsContainer || L.DomUtil.create('ul', 'photon-autocomplete', document.querySelector('body'));
119
- },
120
-
121
- resizeContainer: function()
122
- {
123
- var l = this.getLeft(this.input);
124
- var t = this.getTop(this.input) + this.input.offsetHeight;
125
- this.resultsContainer.style.left = l + 'px';
126
- this.resultsContainer.style.top = t + 'px';
127
- var width = this.options.width ? this.options.width : this.input.offsetWidth - 2;
128
- this.resultsContainer.style.width = width + 'px';
129
- },
130
-
131
- onKeyDown: function (e) {
132
- switch (e.keyCode) {
133
- case this.KEYS.TAB:
134
- if(this.CURRENT !== null)
135
- {
136
- this.setChoice();
137
- }
138
- L.DomEvent.stop(e);
139
- break;
140
- case this.KEYS.RETURN:
141
- L.DomEvent.stop(e);
142
- this.setChoice();
143
- break;
144
- case this.KEYS.ESC:
145
- L.DomEvent.stop(e);
146
- this.hide();
147
- this.input.blur();
148
- break;
149
- case this.KEYS.DOWN:
150
- if(this.RESULTS.length > 0) {
151
- if(this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one resutl?
152
- this.CURRENT++;
153
- this.highlight();
154
- }
155
- else if(this.CURRENT === null) {
156
- this.CURRENT = 0;
157
- this.highlight();
158
- }
159
- }
160
- break;
161
- case this.KEYS.UP:
162
- if(this.CURRENT !== null) {
163
- L.DomEvent.stop(e);
164
- }
165
- if(this.RESULTS.length > 0) {
166
- if(this.CURRENT > 0) {
167
- this.CURRENT--;
168
- this.highlight();
169
- }
170
- else if(this.CURRENT === 0) {
171
- this.CURRENT = null;
172
- this.highlight();
173
- }
174
- }
175
- break;
176
- }
177
- },
178
-
179
- onInput: function (e) {
180
- if (typeof this.submitDelay === 'number') {
181
- window.clearTimeout(this.submitDelay);
182
- delete this.submitDelay;
183
- }
184
- this.submitDelay = window.setTimeout(L.Util.bind(this.search, this), this.options.submitDelay);
185
- },
186
-
187
- onBlur: function (e) {
188
- this.fire('blur');
189
- var self = this;
190
- setTimeout(function () {
191
- self.hide();
192
- }, 100);
193
- },
194
-
195
- onFocus: function (e) {
196
- this.fire('focus');
197
- this.input.select();
198
- this.search(); // In case we have a value from a previous search.
199
- },
200
-
201
- clear: function () {
202
- this.RESULTS = [];
203
- this.CURRENT = null;
204
- this.CACHE = '';
205
- this.resultsContainer.innerHTML = '';
206
- },
207
-
208
- hide: function() {
209
- this.fire('hide');
210
- this.clear();
211
- this.resultsContainer.style.display = 'none';
212
- },
213
-
214
- setChoice: function (choice) {
215
- choice = choice || this.RESULTS[this.CURRENT];
216
- if (choice) {
217
- this.hide();
218
- this.fire('selected', {choice: choice.feature});
219
- this.onSelected(choice.feature);
220
- this.input.value = '';
221
- }
222
- },
223
-
224
- search: function() {
225
- var val = this.input.value;
226
- var minChar = typeof this.options.minChar === 'function' ? this.options.minChar(val) : val.length >= this.options.minChar;
227
- if (!val || !minChar) return this.clear();
228
- if(val + '' === this.CACHE + '') return;
229
- else this.CACHE = val;
230
- this._doSearch();
231
- },
232
-
233
- _doSearch: function () {
234
- this.ajax(this.handleResults, this);
235
- },
236
-
237
- _onSelected: function (feature) {
238
- },
239
-
240
- onSelected: function (choice) {
241
- return (this.options.onSelected || this._onSelected).call(this, choice);
242
- },
243
-
244
- _formatResult: function (feature, el) {
245
- var title = L.DomUtil.create('strong', '', el),
246
- detailsContainer = L.DomUtil.create('small', '', el),
247
- details = [],
248
- type = this.formatType(feature);
249
- if (feature.properties.name) {
250
- title.innerHTML = feature.properties.name;
251
- } else if (feature.properties.housenumber) {
252
- title.innerHTML = feature.properties.housenumber;
253
- if (feature.properties.street) {
254
- title.innerHTML += ' ' + feature.properties.street;
255
- }
256
- }
257
- if (type) details.push(type);
258
- if (feature.properties.city && feature.properties.city !== feature.properties.name) {
259
- details.push(feature.properties.city);
260
- }
261
- if (feature.properties.state && feature.properties.state !== feature.properties.name) {
262
- details.push(feature.properties.state);
263
- }
264
- if (feature.properties.country) details.push(feature.properties.country);
265
- detailsContainer.innerHTML = details.join(', ');
266
- },
267
-
268
- formatResult: function (feature, el) {
269
- return (this.options.formatResult || this._formatResult).call(this, feature, el);
270
- },
271
-
272
- formatType: function (feature) {
273
- return (this.options.formatType || this._formatType).call(this, feature);
274
- },
275
-
276
- _formatType: function (feature) {
277
- return feature.properties.osm_value === 'yes'
278
- ? feature.properties.osm_key
279
- : feature.properties.osm_value;
280
- },
281
-
282
- createResult: function (feature) {
283
- var el = L.DomUtil.create('li', '', this.resultsContainer);
284
- this.formatResult(feature, el);
285
- var result = {
286
- feature: feature,
287
- el: el
288
- };
289
- // Touch handling needed
290
- L.DomEvent.on(el, 'mouseover', function (e) {
291
- this.CURRENT = result;
292
- this.highlight();
293
- }, this);
294
- L.DomEvent.on(el, 'mousedown', function (e) {
295
- this.setChoice();
296
- }, this);
297
- return result;
298
- },
299
-
300
- resultToIndex: function (result) {
301
- var out = null;
302
- this.forEach(this.RESULTS, function (item, index) {
303
- if (item === result) {
304
- out = index;
305
- return;
306
- }
307
- });
308
- return out;
309
- },
310
-
311
- handleResults: function(geojson) {
312
- var self = this;
313
- this.clear();
314
- this.resultsContainer.style.display = 'block';
315
- this.resizeContainer();
316
- this.forEach(geojson.features, function (feature) {
317
- self.RESULTS.push(self.createResult(feature));
318
- });
319
- if (geojson.features.length === 0) {
320
- var noresult = L.DomUtil.create('li', 'photon-no-result', this.resultsContainer);
321
- noresult.innerHTML = this.options.noResultLabel;
322
- }
323
- if (this.options.feedbackEmail) {
324
- var feedback = L.DomUtil.create('a', 'photon-feedback', this.resultsContainer);
325
- feedback.href = 'mailto:' + this.options.feedbackEmail;
326
- feedback.innerHTML = this.options.feedbackLabel;
327
- }
328
- this.CURRENT = 0;
329
- this.highlight();
330
- if (this.options.resultsHandler) {
331
- this.options.resultsHandler(geojson);
332
- }
333
- },
334
-
335
- highlight: function () {
336
- var self = this;
337
- this.forEach(this.RESULTS, function (item, index) {
338
- if (index === self.CURRENT) {
339
- L.DomUtil.addClass(item.el, 'on');
340
- }
341
- else {
342
- L.DomUtil.removeClass(item.el, 'on');
343
- }
344
- });
345
- },
346
-
347
- getLeft: function (el) {
348
- var tmp = el.offsetLeft;
349
- el = el.offsetParent;
350
- while(el) {
351
- tmp += el.offsetLeft;
352
- el = el.offsetParent;
353
- }
354
- return tmp;
355
- },
356
-
357
- getTop: function (el) {
358
- var tmp = el.offsetTop;
359
- el = el.offsetParent;
360
- while(el) {
361
- tmp += el.offsetTop;
362
- el = el.offsetParent;
363
- }
364
- return tmp;
365
- },
366
-
367
- getParams: function () {
368
- return {
369
- q: this.CACHE,
370
- lang: this.options.lang,
371
- limit: this.options.limit,
372
- osm_tag: this.options.osm_tag
373
- };
374
- }
375
-
376
- });
377
-
378
- L.PhotonSearch = L.PhotonBaseSearch.extend({
379
-
380
- initialize: function (map, input, options) {
381
- this.map = map;
382
- L.PhotonBaseSearch.prototype.initialize.call(this, input, options);
383
- },
384
-
385
- _onSelected: function (feature) {
386
- this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], 16);
387
- },
388
-
389
- getParams: function () {
390
- var params = L.PhotonBaseSearch.prototype.getParams.call(this);
391
- if (this.options.includePosition) {
392
- params.lat = this.map.getCenter().lat;
393
- params.lon = this.map.getCenter().lng;
394
- if (this.options.location_bias_scale) {
395
- params.location_bias_scale = this.options.location_bias_scale;
396
- }
397
- }
398
- if (this.options.bbox && this.options.bbox.length === 4) {
399
- params.bbox = this.options.bbox.join(',');
400
- }
401
- return params;
402
- }
403
-
404
- });
405
-
406
- L.Control.Photon = L.Control.extend({
407
-
408
- includes: ((typeof L.Evented !== 'undefined' && L.Evented.prototype) || L.Mixin.Events),
409
-
410
- onAdd: function (map, options) {
411
- this.map = map;
412
- this.container = L.DomUtil.create('div', 'leaflet-photon');
413
-
414
- this.options = L.Util.extend(this.options, options);
415
-
416
- this.input = L.DomUtil.create('input', 'photon-input', this.container);
417
- this.search = new L.PhotonSearch(map, this.input, this.options);
418
- this.search.on('blur', this.forwardEvent, this);
419
- this.search.on('focus', this.forwardEvent, this);
420
- this.search.on('hide', this.forwardEvent, this);
421
- this.search.on('selected', this.forwardEvent, this);
422
- this.search.on('ajax:send', this.forwardEvent, this);
423
- this.search.on('ajax:return', this.forwardEvent, this);
424
- return this.container;
425
- },
426
-
427
- // TODO onRemove
428
-
429
- forwardEvent: function (e) {
430
- this.fire(e.type, e);
431
- }
432
-
433
- });
434
-
435
- L.control.photon = function(options) {
436
- return new L.Control.Photon(options);
437
- }
438
-
439
- L.Map.addInitHook(function () {
440
- if (this.options.photonControl) {
441
- this.photonControl = new L.Control.Photon(this.options.photonControlOptions || {});
442
- this.addControl(this.photonControl);
443
- }
444
- });
445
-
446
- L.PhotonReverse = L.PhotonBase.extend({
447
-
448
- includes: ((typeof L.Evented !== 'undefined' && L.Evented.prototype) || L.Mixin.Events),
449
-
450
- options: {
451
- url: 'https://photon.komoot.io/reverse/?',
452
- limit: 1,
453
- handleResults: null
454
- },
455
-
456
- initialize: function (options) {
457
- L.setOptions(this, options);
458
- },
459
-
460
- doReverse: function (latlng) {
461
- latlng = L.latLng(latlng);
462
- this.fire('reverse', {latlng: latlng});
463
- this.latlng = latlng;
464
- this.ajax(this.handleResults, this);
465
- },
466
-
467
- _handleResults: function (data) {
468
- /*eslint-disable no-console */
469
- console.log(data);
470
- /*eslint-enable no-alert */
471
- },
472
-
473
- handleResults: function (data) {
474
- return (this.options.handleResults || this._handleResults).call(this, data);
475
- },
476
-
477
- getParams: function () {
478
- return {
479
- lang: this.options.lang,
480
- limit: this.options.limit,
481
- lat: this.latlng.lat,
482
- lon: this.latlng.lng,
483
- osm_tag: this.options.osm_tag
484
- };
485
- }
486
-
487
- });