umap-project 2.0.0a0__py3-none-any.whl → 2.0.0a1__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.

Potentially problematic release.


This version of umap-project might be problematic. Click here for more details.

@@ -1,88 +0,0 @@
1
- .leaflet-control-minimap {
2
- border:solid rgba(255, 255, 255, 1.0) 4px;
3
- box-shadow: 0 1px 5px rgba(0,0,0,0.65);
4
- border-radius: 3px;
5
- background: #f8f8f9;
6
- transition: all .6s;
7
- }
8
-
9
- .leaflet-control-minimap a {
10
- background-color: rgba(255, 255, 255, 1.0);
11
- background-repeat: no-repeat;
12
- z-index: 99999;
13
- transition: all .6s;
14
- }
15
-
16
- .leaflet-control-minimap a.minimized-bottomright {
17
- -webkit-transform: rotate(180deg);
18
- transform: rotate(180deg);
19
- border-radius: 0px;
20
- }
21
-
22
- .leaflet-control-minimap a.minimized-topleft {
23
- -webkit-transform: rotate(0deg);
24
- transform: rotate(0deg);
25
- border-radius: 0px;
26
- }
27
-
28
- .leaflet-control-minimap a.minimized-bottomleft {
29
- -webkit-transform: rotate(270deg);
30
- transform: rotate(270deg);
31
- border-radius: 0px;
32
- }
33
-
34
- .leaflet-control-minimap a.minimized-topright {
35
- -webkit-transform: rotate(90deg);
36
- transform: rotate(90deg);
37
- border-radius: 0px;
38
- }
39
-
40
- .leaflet-control-minimap-toggle-display{
41
- background-image: url("images/toggle.svg");
42
- background-size: cover;
43
- position: absolute;
44
- border-radius: 3px 0px 0px 0px;
45
- }
46
-
47
- .leaflet-oldie .leaflet-control-minimap-toggle-display{
48
- background-image: url("images/toggle.png");
49
- }
50
-
51
- .leaflet-control-minimap-toggle-display-bottomright {
52
- bottom: 0;
53
- right: 0;
54
- }
55
-
56
- .leaflet-control-minimap-toggle-display-topleft{
57
- top: 0;
58
- left: 0;
59
- -webkit-transform: rotate(180deg);
60
- transform: rotate(180deg);
61
- }
62
-
63
- .leaflet-control-minimap-toggle-display-bottomleft{
64
- bottom: 0;
65
- left: 0;
66
- -webkit-transform: rotate(90deg);
67
- transform: rotate(90deg);
68
- }
69
-
70
- .leaflet-control-minimap-toggle-display-topright{
71
- top: 0;
72
- right: 0;
73
- -webkit-transform: rotate(270deg);
74
- transform: rotate(270deg);
75
- }
76
-
77
- /* Old IE */
78
- .leaflet-oldie .leaflet-control-minimap {
79
- border: 1px solid #999;
80
- }
81
-
82
- .leaflet-oldie .leaflet-control-minimap a {
83
- background-color: #fff;
84
- }
85
-
86
- .leaflet-oldie .leaflet-control-minimap a.minimized {
87
- filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
88
- }
@@ -1,352 +0,0 @@
1
- // Following https://github.com/Leaflet/Leaflet/blob/master/PLUGIN-GUIDE.md
2
- (function (factory, window) {
3
-
4
- // define an AMD module that relies on 'leaflet'
5
- if (typeof define === 'function' && define.amd) {
6
- define(['leaflet'], factory);
7
-
8
- // define a Common JS module that relies on 'leaflet'
9
- } else if (typeof exports === 'object') {
10
- module.exports = factory(require('leaflet'));
11
- }
12
-
13
- // attach your plugin to the global 'L' variable
14
- if (typeof window !== 'undefined' && window.L) {
15
- window.L.Control.MiniMap = factory(L);
16
- window.L.control.minimap = function (layer, options) {
17
- return new window.L.Control.MiniMap(layer, options);
18
- };
19
- }
20
- }(function (L) {
21
-
22
- var MiniMap = L.Control.extend({
23
-
24
- includes: L.Evented ? L.Evented.prototype : L.Mixin.Events,
25
-
26
- options: {
27
- position: 'bottomright',
28
- toggleDisplay: false,
29
- zoomLevelOffset: -5,
30
- zoomLevelFixed: false,
31
- centerFixed: false,
32
- zoomAnimation: false,
33
- autoToggleDisplay: false,
34
- minimized: false,
35
- width: 150,
36
- height: 150,
37
- collapsedWidth: 19,
38
- collapsedHeight: 19,
39
- aimingRectOptions: {color: '#ff7800', weight: 1, clickable: false},
40
- shadowRectOptions: {color: '#000000', weight: 1, clickable: false, opacity: 0, fillOpacity: 0},
41
- strings: {hideText: 'Hide MiniMap', showText: 'Show MiniMap'},
42
- mapOptions: {} // Allows definition / override of Leaflet map options.
43
- },
44
-
45
- // layer is the map layer to be shown in the minimap
46
- initialize: function (layer, options) {
47
- L.Util.setOptions(this, options);
48
- // Make sure the aiming rects are non-clickable even if the user tries to set them clickable (most likely by forgetting to specify them false)
49
- this.options.aimingRectOptions.clickable = false;
50
- this.options.shadowRectOptions.clickable = false;
51
- this._layer = layer;
52
- },
53
-
54
- onAdd: function (map) {
55
-
56
- this._mainMap = map;
57
-
58
- // Creating the container and stopping events from spilling through to the main map.
59
- this._container = L.DomUtil.create('div', 'leaflet-control-minimap');
60
- this._container.style.width = this.options.width + 'px';
61
- this._container.style.height = this.options.height + 'px';
62
- L.DomEvent.disableClickPropagation(this._container);
63
- L.DomEvent.on(this._container, 'mousewheel', L.DomEvent.stopPropagation);
64
-
65
- var mapOptions = {
66
- attributionControl: false,
67
- dragging: !this.options.centerFixed,
68
- zoomControl: false,
69
- zoomAnimation: this.options.zoomAnimation,
70
- autoToggleDisplay: this.options.autoToggleDisplay,
71
- touchZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
72
- scrollWheelZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
73
- doubleClickZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
74
- boxZoom: !this._isZoomLevelFixed(),
75
- crs: map.options.crs
76
- };
77
- mapOptions = L.Util.extend(this.options.mapOptions, mapOptions); // merge with priority of the local mapOptions object.
78
-
79
- this._miniMap = new L.Map(this._container, mapOptions);
80
-
81
- this._miniMap.addLayer(this._layer);
82
-
83
- // These bools are used to prevent infinite loops of the two maps notifying each other that they've moved.
84
- this._mainMapMoving = false;
85
- this._miniMapMoving = false;
86
-
87
- // Keep a record of this to prevent auto toggling when the user explicitly doesn't want it.
88
- this._userToggledDisplay = false;
89
- this._minimized = false;
90
-
91
- if (this.options.toggleDisplay) {
92
- this._addToggleButton();
93
- }
94
-
95
- this._miniMap.whenReady(L.Util.bind(function () {
96
- this._aimingRect = L.rectangle(this._mainMap.getBounds(), this.options.aimingRectOptions).addTo(this._miniMap);
97
- this._shadowRect = L.rectangle(this._mainMap.getBounds(), this.options.shadowRectOptions).addTo(this._miniMap);
98
- this._mainMap.on('moveend', this._onMainMapMoved, this);
99
- this._mainMap.on('move', this._onMainMapMoving, this);
100
- this._miniMap.on('movestart', this._onMiniMapMoveStarted, this);
101
- this._miniMap.on('move', this._onMiniMapMoving, this);
102
- this._miniMap.on('moveend', this._onMiniMapMoved, this);
103
- }, this));
104
-
105
- return this._container;
106
- },
107
-
108
- addTo: function (map) {
109
- L.Control.prototype.addTo.call(this, map);
110
-
111
- var center = this.options.centerFixed || this._mainMap.getCenter();
112
- this._miniMap.setView(center, this._decideZoom(true));
113
- this._setDisplay(this.options.minimized);
114
- return this;
115
- },
116
-
117
- onRemove: function (map) {
118
- this._mainMap.off('moveend', this._onMainMapMoved, this);
119
- this._mainMap.off('move', this._onMainMapMoving, this);
120
- this._miniMap.off('moveend', this._onMiniMapMoved, this);
121
-
122
- this._miniMap.removeLayer(this._layer);
123
- },
124
-
125
- changeLayer: function (layer) {
126
- this._miniMap.removeLayer(this._layer);
127
- this._layer = layer;
128
- this._miniMap.addLayer(this._layer);
129
- },
130
-
131
- _addToggleButton: function () {
132
- this._toggleDisplayButton = this.options.toggleDisplay ? this._createButton(
133
- '', this._toggleButtonInitialTitleText(), ('leaflet-control-minimap-toggle-display leaflet-control-minimap-toggle-display-' +
134
- this.options.position), this._container, this._toggleDisplayButtonClicked, this) : undefined;
135
-
136
- this._toggleDisplayButton.style.width = this.options.collapsedWidth + 'px';
137
- this._toggleDisplayButton.style.height = this.options.collapsedHeight + 'px';
138
- },
139
-
140
- _toggleButtonInitialTitleText: function () {
141
- if (this.options.minimized) {
142
- return this.options.strings.showText;
143
- } else {
144
- return this.options.strings.hideText;
145
- }
146
- },
147
-
148
- _createButton: function (html, title, className, container, fn, context) {
149
- var link = L.DomUtil.create('a', className, container);
150
- link.innerHTML = html;
151
- link.href = '#';
152
- link.title = title;
153
-
154
- var stop = L.DomEvent.stopPropagation;
155
-
156
- L.DomEvent
157
- .on(link, 'click', stop)
158
- .on(link, 'mousedown', stop)
159
- .on(link, 'dblclick', stop)
160
- .on(link, 'click', L.DomEvent.preventDefault)
161
- .on(link, 'click', fn, context);
162
-
163
- return link;
164
- },
165
-
166
- _toggleDisplayButtonClicked: function () {
167
- this._userToggledDisplay = true;
168
- if (!this._minimized) {
169
- this._minimize();
170
- } else {
171
- this._restore();
172
- }
173
- },
174
-
175
- _setDisplay: function (minimize) {
176
- if (minimize !== this._minimized) {
177
- if (!this._minimized) {
178
- this._minimize();
179
- } else {
180
- this._restore();
181
- }
182
- }
183
- },
184
-
185
- _minimize: function () {
186
- // hide the minimap
187
- if (this.options.toggleDisplay) {
188
- this._container.style.width = this.options.collapsedWidth + 'px';
189
- this._container.style.height = this.options.collapsedHeight + 'px';
190
- this._toggleDisplayButton.className += (' minimized-' + this.options.position);
191
- this._toggleDisplayButton.title = this.options.strings.showText;
192
- } else {
193
- this._container.style.display = 'none';
194
- }
195
- this._minimized = true;
196
- this._onToggle();
197
- },
198
-
199
- _restore: function () {
200
- if (this.options.toggleDisplay) {
201
- this._container.style.width = this.options.width + 'px';
202
- this._container.style.height = this.options.height + 'px';
203
- this._toggleDisplayButton.className = this._toggleDisplayButton.className
204
- .replace('minimized-' + this.options.position, '');
205
- this._toggleDisplayButton.title = this.options.strings.hideText;
206
- } else {
207
- this._container.style.display = 'block';
208
- }
209
- this._minimized = false;
210
- this._onToggle();
211
- },
212
-
213
- _onMainMapMoved: function (e) {
214
- if (!this._miniMapMoving) {
215
- var center = this.options.centerFixed || this._mainMap.getCenter();
216
-
217
- this._mainMapMoving = true;
218
- this._miniMap.setView(center, this._decideZoom(true));
219
- this._setDisplay(this._decideMinimized());
220
- } else {
221
- this._miniMapMoving = false;
222
- }
223
- this._aimingRect.setBounds(this._mainMap.getBounds());
224
- },
225
-
226
- _onMainMapMoving: function (e) {
227
- this._aimingRect.setBounds(this._mainMap.getBounds());
228
- },
229
-
230
- _onMiniMapMoveStarted: function (e) {
231
- if (!this.options.centerFixed) {
232
- var lastAimingRect = this._aimingRect.getBounds();
233
- var sw = this._miniMap.latLngToContainerPoint(lastAimingRect.getSouthWest());
234
- var ne = this._miniMap.latLngToContainerPoint(lastAimingRect.getNorthEast());
235
- this._lastAimingRectPosition = {sw: sw, ne: ne};
236
- }
237
- },
238
-
239
- _onMiniMapMoving: function (e) {
240
- if (!this.options.centerFixed) {
241
- if (!this._mainMapMoving && this._lastAimingRectPosition) {
242
- this._shadowRect.setBounds(new L.LatLngBounds(this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.sw), this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.ne)));
243
- this._shadowRect.setStyle({opacity: 1, fillOpacity: 0.3});
244
- }
245
- }
246
- },
247
-
248
- _onMiniMapMoved: function (e) {
249
- if (!this._mainMapMoving) {
250
- this._miniMapMoving = true;
251
- this._mainMap.setView(this._miniMap.getCenter(), this._decideZoom(false));
252
- this._shadowRect.setStyle({opacity: 0, fillOpacity: 0});
253
- } else {
254
- this._mainMapMoving = false;
255
- }
256
- },
257
-
258
- _isZoomLevelFixed: function () {
259
- var zoomLevelFixed = this.options.zoomLevelFixed;
260
- return this._isDefined(zoomLevelFixed) && this._isInteger(zoomLevelFixed);
261
- },
262
-
263
- _decideZoom: function (fromMaintoMini) {
264
- if (!this._isZoomLevelFixed()) {
265
- if (fromMaintoMini) {
266
- return this._mainMap.getZoom() + this.options.zoomLevelOffset;
267
- } else {
268
- var currentDiff = this._miniMap.getZoom() - this._mainMap.getZoom();
269
- var proposedZoom = this._miniMap.getZoom() - this.options.zoomLevelOffset;
270
- var toRet;
271
-
272
- if (currentDiff > this.options.zoomLevelOffset && this._mainMap.getZoom() < this._miniMap.getMinZoom() - this.options.zoomLevelOffset) {
273
- // This means the miniMap is zoomed out to the minimum zoom level and can't zoom any more.
274
- if (this._miniMap.getZoom() > this._lastMiniMapZoom) {
275
- // This means the user is trying to zoom in by using the minimap, zoom the main map.
276
- toRet = this._mainMap.getZoom() + 1;
277
- // Also we cheat and zoom the minimap out again to keep it visually consistent.
278
- this._miniMap.setZoom(this._miniMap.getZoom() - 1);
279
- } else {
280
- // Either the user is trying to zoom out past the mini map's min zoom or has just panned using it, we can't tell the difference.
281
- // Therefore, we ignore it!
282
- toRet = this._mainMap.getZoom();
283
- }
284
- } else {
285
- // This is what happens in the majority of cases, and always if you configure the min levels + offset in a sane fashion.
286
- toRet = proposedZoom;
287
- }
288
- this._lastMiniMapZoom = this._miniMap.getZoom();
289
- return toRet;
290
- }
291
- } else {
292
- if (fromMaintoMini) {
293
- return this.options.zoomLevelFixed;
294
- } else {
295
- return this._mainMap.getZoom();
296
- }
297
- }
298
- },
299
-
300
- _decideMinimized: function () {
301
- if (this._userToggledDisplay) {
302
- return this._minimized;
303
- }
304
-
305
- if (this.options.autoToggleDisplay) {
306
- if (this._mainMap.getBounds().contains(this._miniMap.getBounds())) {
307
- return true;
308
- }
309
- return false;
310
- }
311
-
312
- return this._minimized;
313
- },
314
-
315
- _isInteger: function (value) {
316
- return typeof value === 'number';
317
- },
318
-
319
- _isDefined: function (value) {
320
- return typeof value !== 'undefined';
321
- },
322
-
323
- _onToggle: function () {
324
- L.Util.requestAnimFrame(function () {
325
- L.DomEvent.on(this._container, 'transitionend', this._fireToggleEvents, this);
326
- if (!L.Browser.any3d) {
327
- L.Util.requestAnimFrame(this._fireToggleEvents, this);
328
- }
329
- }, this);
330
- },
331
-
332
- _fireToggleEvents: function () {
333
- L.DomEvent.off(this._container, 'transitionend', this._fireToggleEvents, this);
334
- var data = { minimized: this._minimized };
335
- this.fire(this._minimized ? 'minimize' : 'restore', data);
336
- this.fire('toggle', data);
337
- }
338
- });
339
-
340
- L.Map.mergeOptions({
341
- miniMapControl: false
342
- });
343
-
344
- L.Map.addInitHook(function () {
345
- if (this.options.miniMapControl) {
346
- this.miniMapControl = (new MiniMap()).addTo(this);
347
- }
348
- });
349
-
350
- return MiniMap;
351
-
352
- }, window));
@@ -1,2 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).toGeoJSON={})}(this,(function(t){"use strict";function e(t,e){return Array.from(t.getElementsByTagName(e))}function n(t){return"#"===t[0]?t:`#${t}`}function o(t){return t?.normalize(),t&&t.textContent||""}function r(t,e,n){const o=t.getElementsByTagName(e),r=o.length?o[0]:null;return r&&n&&n(r),r}function i(t,e,n){const o={};if(!t)return o;const r=t.getElementsByTagName(e),i=r.length?r[0]:null;return i&&n?n(i,o):o}function s(t,e,n){const i=o(r(t,e));return i&&n&&n(i)||{}}function c(t,e,n){const i=parseFloat(o(r(t,e)));if(!isNaN(i))return i&&n&&n(i)||{}}function a(t,e,n){const i=parseFloat(o(r(t,e)));if(!isNaN(i))return n&&n(i),i}function l(t,e){const n={};for(const o of e)s(t,o,(t=>{n[o]=t}));return n}function u(t){return 1===t?.nodeType}function f(t){return i(t,"line",(t=>Object.assign({},s(t,"color",(t=>({stroke:`#${t}`}))),c(t,"opacity",(t=>({"stroke-opacity":t}))),c(t,"width",(t=>({"stroke-width":96*t/25.4}))))))}function p(t){let e=[];if(null===t)return e;for(const n of Array.from(t.childNodes)){if(!u(n))continue;const t=g(n.nodeName);if("gpxtpx:TrackPointExtension"===t)e=e.concat(p(n));else{const r=o(n);e.push([t,d(r)])}}return e}function g(t){return["heart","gpxtpx:hr","hr"].includes(t)?"heart":t}function d(t){const e=parseFloat(t);return isNaN(e)?t:e}function m(t){const e=[parseFloat(t.getAttribute("lon")||""),parseFloat(t.getAttribute("lat")||"")];if(isNaN(e[0])||isNaN(e[1]))return null;a(t,"ele",(t=>{e.push(t)}));const n=r(t,"time");return{coordinates:e,time:n?o(n):null,extendedValues:p(r(t,"extensions"))}}function h(t){const n=l(t,["name","cmt","desc","type","time","keywords"]),r=Array.from(t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*"));for(const e of r)e.parentNode?.parentNode===t&&(n[e.tagName.replace(":","_")]=o(e));const i=e(t,"link");return i.length&&(n.links=i.map((t=>Object.assign({href:t.getAttribute("href")},l(t,["text","type"]))))),n}function y(t,n){const o=e(t,n),r=[],i=[],s={};for(let t=0;t<o.length;t++){const e=m(o[t]);if(e){r.push(e.coordinates),e.time&&i.push(e.time);for(const[n,r]of e.extendedValues){const e="heart"===n?n:n.replace("gpxtpx:","")+"s";s[e]||(s[e]=Array(o.length).fill(null)),s[e][t]=r}}}if(!(r.length<2))return{line:r,times:i,extendedValues:s}}function b(t){const e=y(t,"rtept");if(e)return{type:"Feature",properties:Object.assign({_gpxType:"rte"},h(t),f(r(t,"extensions"))),geometry:{type:"LineString",coordinates:e.line}}}function N(t){const n=e(t,"trkseg"),o=[],i=[],s=[];for(const t of n){const e=y(t,"trkpt");e&&(s.push(e),e.times&&e.times.length&&i.push(e.times))}if(0===s.length)return null;const c=s.length>1,a=Object.assign({_gpxType:"trk"},h(t),f(r(t,"extensions")),i.length?{coordinateProperties:{times:c?i:i[0]}}:{});for(const t of s){o.push(t.line),a.coordinateProperties||(a.coordinateProperties={});const e=a.coordinateProperties,n=Object.entries(t.extendedValues);for(let t=0;t<n.length;t++){const[o,r]=n[t];c?(e[o]||(e[o]=s.map((t=>new Array(t.line.length).fill(null)))),e[o][t]=r):e[o]=r}}return{type:"Feature",properties:a,geometry:c?{type:"MultiLineString",coordinates:o}:{type:"LineString",coordinates:o[0]}}}function x(t){const e=Object.assign(h(t),l(t,["sym"])),n=m(t);return n?{type:"Feature",properties:e,geometry:{type:"Point",coordinates:n.coordinates}}:null}function*k(t){for(const n of e(t,"trk")){const t=N(n);t&&(yield t)}for(const n of e(t,"rte")){const t=b(n);t&&(yield t)}for(const n of e(t,"wpt")){const t=x(n);t&&(yield t)}}const A=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],S=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function v(t,e){const n=[];for(const[i,s]of e){let e=r(t,i);if(!e){const n=t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",i);n.length&&(e=n[0])}const c=parseFloat(o(e));isNaN(c)||n.push([s,c])}return n}function T(t){const e=[a(t,"LongitudeDegrees"),a(t,"LatitudeDegrees")];if(void 0===e[0]||isNaN(e[0])||void 0===e[1]||isNaN(e[1]))return null;const n=r(t,"HeartRateBpm"),i=o(r(t,"Time"));return r(t,"AltitudeMeters",(t=>{const n=parseFloat(o(t));isNaN(n)||e.push(n)})),{coordinates:e,time:i||null,heartRate:n?parseFloat(o(n)):null,extensions:v(t,A)}}function F(t){const n=e(t,"Trackpoint"),o=[],r=[],i=[];if(n.length<2)return null;const s={},c={extendedProperties:s};for(let t=0;t<n.length;t++){const e=T(n[t]);if(null===e)continue;o.push(e.coordinates);const{time:c,heartRate:a,extensions:l}=e;c&&r.push(c),a&&i.push(a);for(const[e,o]of l)s[e]||(s[e]=Array(n.length).fill(null)),s[e][t]=o}return o.length<2?null:Object.assign(c,{line:o,times:r,heartRates:i})}function P(t){const n=e(t,"Track"),r=[],s=[],c=[],a=[];let l;const u=Object.assign(Object.fromEntries(v(t,S)),i(t,"Name",(t=>({name:o(t)}))));for(const t of n)l=F(t),l&&(r.push(l.line),l.times.length&&s.push(l.times),l.heartRates.length&&c.push(l.heartRates),a.push(l.extendedProperties));for(let t=0;t<a.length;t++){const e=a[t];for(const o in e)1===n.length?l&&(u[o]=l.extendedProperties[o]):(u[o]||(u[o]=r.map((t=>Array(t.length).fill(null)))),u[o][t]=e[o])}return 0===r.length?null:((s.length||c.length)&&(u.coordinateProperties=Object.assign(s.length?{times:1===r.length?s[0]:s}:{},c.length?{heart:1===r.length?c[0]:c}:{})),{type:"Feature",properties:u,geometry:1===r.length?{type:"LineString",coordinates:r[0]}:{type:"MultiLineString",coordinates:r}})}function*O(t){for(const n of e(t,"Lap")){const t=P(n);t&&(yield t)}for(const n of e(t,"Courses")){const t=P(n);t&&(yield t)}}function w(t,e){const n={},o="stroke"==e||"fill"===e?e:e+"-color";return"#"===t[0]&&(t=t.substring(1)),6===t.length||3===t.length?n[o]="#"+t:8===t.length&&(n[e+"-opacity"]=parseInt(t.substring(0,2),16)/255,n[o]="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),n}function M(t,e,n){const o={};return a(t,e,(t=>{o[n]=t})),o}function j(t,e){return i(t,"color",(t=>w(o(t),e)))}function L(t){return i(t,"Icon",((t,e)=>(s(t,"href",(t=>{e.icon=t})),e)))}function G(t){return Object.assign({},function(t){return i(t,"PolyStyle",((t,e)=>Object.assign(e,i(t,"color",(t=>w(o(t),"fill"))),s(t,"fill",(t=>{if("0"===t)return{"fill-opacity":0}})),s(t,"outline",(t=>{if("0"===t)return{"stroke-opacity":0}})))))}(t),function(t){return i(t,"LineStyle",(t=>Object.assign(j(t,"stroke"),M(t,"width","stroke-width"))))}(t),function(t){return i(t,"LabelStyle",(t=>Object.assign(j(t,"label"),M(t,"scale","label-scale"))))}(t),function(t){return i(t,"IconStyle",(t=>Object.assign(j(t,"icon"),M(t,"scale","icon-scale"),M(t,"heading","icon-heading"),i(t,"hotSpot",(t=>{const e=parseFloat(t.getAttribute("x")||""),n=parseFloat(t.getAttribute("y")||""),o=t.getAttribute("xunits")||"",r=t.getAttribute("yunits")||"";return isNaN(e)||isNaN(n)?{}:{"icon-offset":[e,n],"icon-offset-units":[o,r]}})),L(t))))}(t))}const R=t=>Number(t),B={string:t=>t,int:R,uint:R,short:R,ushort:R,float:R,double:R,bool:t=>Boolean(t)};function E(t,n){return i(t,"ExtendedData",((t,i)=>{for(const n of e(t,"Data"))i[n.getAttribute("name")||""]=o(r(n,"value"));for(const r of e(t,"SimpleData")){const t=r.getAttribute("name")||"",e=n[t]||B.string;i[t]=e(o(r))}return i}))}function C(t){const e=r(t,"description");for(const t of Array.from(e?.childNodes||[]))if(4===t.nodeType)return{description:{"@type":"html",value:o(t)}};return{}}function D(t){return i(t,"TimeSpan",(t=>({timespan:{begin:o(r(t,"begin")),end:o(r(t,"end"))}})))}function W(t){return i(t,"TimeStamp",(t=>({timestamp:o(r(t,"when"))})))}function H(t,e){return s(t,"styleUrl",(t=>(t=n(t),e[t]?Object.assign({styleUrl:t},e[t]):{styleUrl:t})))}const _=/\s*/g,I=/^\s*|\s*$/g,U=/\s+/;function V(t){return t.replace(_,"").split(",").map(parseFloat).filter((t=>!isNaN(t))).slice(0,3)}function $(t){return t.replace(I,"").split(U).map(V).filter((t=>t.length>=2))}function q(t){let n=e(t,"coord");var r,i,s;0===n.length&&(r=t,i="coord",s="*",n=Array.from(r.getElementsByTagNameNS(s,i)));const c=n.map((t=>o(t).split(" ").map(parseFloat)));return 0===c.length?null:{geometry:c.length>2?{type:"LineString",coordinates:c}:{type:"Point",coordinates:c[0]},times:e(t,"when").map((t=>o(t)))}}function z(t){if(0===t.length)return t;const e=t[0],n=t[t.length-1];let o=!0;for(let t=0;t<Math.max(e.length,n.length);t++)if(e[t]!==n[t]){o=!1;break}return o?t:t.concat([t[0]])}function J(t){return o(r(t,"coordinates"))}function Q(t){let n=[],o=[];for(let r=0;r<t.childNodes.length;r++){const i=t.childNodes.item(r);if(u(i))switch(i.tagName){case"MultiGeometry":case"MultiTrack":case"gx:MultiTrack":{const t=Q(i);n=n.concat(t.geometries),o=o.concat(t.coordTimes);break}case"Point":{const t=V(J(i));t.length>=2&&n.push({type:"Point",coordinates:t});break}case"LinearRing":case"LineString":{const t=$(J(i));t.length>=2&&n.push({type:"LineString",coordinates:t});break}case"Polygon":{const t=[];for(const n of e(i,"LinearRing")){const e=z($(J(n)));e.length>=4&&t.push(e)}t.length&&n.push({type:"Polygon",coordinates:t});break}case"Track":case"gx:Track":{const t=q(i);if(!t)break;const{times:e,geometry:r}=t;n.push(r),e.length&&o.push(e);break}}}return{geometries:n,coordTimes:o}}function K(t,e,n,o){const{coordTimes:r,geometries:i}=Q(t),s=function(t){return 0===t.length?null:1===t.length?t[0]:{type:"GeometryCollection",geometries:t}}(i);if(!s&&o.skipNullGeometry)return null;const c={type:"Feature",geometry:s,properties:Object.assign(l(t,["name","address","visibility","open","phoneNumber","description"]),C(t),H(t,e),G(t),E(t,n),D(t),W(t),r.length?{coordinateProperties:{times:1===r.length?r[0]:r}}:{})};void 0!==c.properties?.visibility&&(c.properties.visibility="0"!==c.properties.visibility);const a=t.getAttribute("id");return null!==a&&""!==a&&(c.id=a),c}function X(t){if(r(t,"gx:LatLonQuad")){return{geometry:{type:"Polygon",coordinates:[z($(J(t)))]}}}return function(t){const e=r(t,"LatLonBox");if(e){const t=a(e,"north"),n=a(e,"west"),o=a(e,"east"),r=a(e,"south"),i=a(e,"rotation");if("number"==typeof t&&"number"==typeof r&&"number"==typeof n&&"number"==typeof o){const e=[n,r,o,t];let s=[[[n,t],[o,t],[o,r],[n,r],[n,t]]];return"number"==typeof i&&(s=function(t,e,n){const o=[(t[0]+t[2])/2,(t[1]+t[3])/2];return[e[0].map((t=>{const e=t[1]-o[1],r=t[0]-o[0],i=Math.sqrt(Math.pow(e,2)+Math.pow(r,2)),s=Math.atan2(e,r)+n*Y;return[o[0]+Math.cos(s)*i,o[1]+Math.sin(s)*i]}))]}(e,s,i)),{bbox:e,geometry:{type:"Polygon",coordinates:s}}}}return null}(t)}const Y=Math.PI/180;function Z(t,e,n,o){const r=X(t),i=r?.geometry||null;if(!i&&o.skipNullGeometry)return null;const s={type:"Feature",geometry:i,properties:Object.assign({"@geometry-type":"groundoverlay"},l(t,["name","address","visibility","open","phoneNumber","description"]),C(t),H(t,e),G(t),L(t),E(t,n),D(t),W(t))};r?.bbox&&(s.bbox=r.bbox),void 0!==s.properties?.visibility&&(s.properties.visibility="0"!==s.properties.visibility);const c=t.getAttribute("id");return null!==c&&""!==c&&(s.id=c),s}function tt(t){let e=t.getAttribute("id");const o=t.parentNode;return!e&&u(o)&&"CascadingStyle"===o.localName&&(e=o.getAttribute("kml:id")||o.getAttribute("id")),n(e||"")}function et(t){const o={};for(const n of e(t,"Style"))o[tt(n)]=G(n);for(const r of e(t,"StyleMap")){const t=n(r.getAttribute("id")||"");s(r,"styleUrl",(e=>{e=n(e),o[e]&&(o[t]=o[e])}))}return o}function nt(t){const n={};for(const o of e(t,"SimpleField"))n[o.getAttribute("name")||""]=B[o.getAttribute("type")||""]||B.string;return n}const ot=["name","visibility","open","address","description","phoneNumber","visibility"];function*rt(t,n={skipNullGeometry:!1}){const o=et(t),r=nt(t);for(const i of e(t,"Placemark")){const t=K(i,o,r,n);t&&(yield t)}for(const i of e(t,"GroundOverlay")){const t=Z(i,o,r,n);t&&(yield t)}}t.gpx=function(t){return{type:"FeatureCollection",features:Array.from(k(t))}},t.gpxGen=k,t.kml=function(t,e={skipNullGeometry:!1}){return{type:"FeatureCollection",features:Array.from(rt(t,e))}},t.kmlGen=rt,t.kmlWithFolders=function(t,e={skipNullGeometry:!1}){const n=et(t),r=nt(t),i={type:"root",children:[]};return function t(e,i,s){if(u(e))switch(e.tagName){case"GroundOverlay":{const t=Z(e,n,r,s);t&&i.children.push(t);break}case"Placemark":{const t=K(e,n,r,s);t&&i.children.push(t);break}case"Folder":{const t=function(t){const e={};for(const n of Array.from(t.childNodes))u(n)&&ot.includes(n.tagName)&&(e[n.tagName]=o(n));return{type:"folder",meta:e,children:[]}}(e);i.children.push(t),i=t;break}}if(e.childNodes)for(let n=0;n<e.childNodes.length;n++)t(e.childNodes[n],i,s)}(t,i,e),i},t.tcx=function(t){return{type:"FeatureCollection",features:Array.from(O(t))}},t.tcxGen=O,Object.defineProperty(t,"__esModule",{value:!0})}));
2
- //# sourceMappingURL=togeojson.umd.js.map