@edugis-org/webmapx 0.1.0
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.
- package/README.md +149 -0
- package/dist-lib/WMTS-DCN4zX0-.js +1169 -0
- package/dist-lib/alert-GeHlqlN8.js +310 -0
- package/dist-lib/assets/epsg-lookup.worker-J7TVnHDq.js +1 -0
- package/dist-lib/assets/shapefile.worker-kQfZj6G2.js +4 -0
- package/dist-lib/attribution-format-B4f05_u0.js +62 -0
- package/dist-lib/button-DFdGkRPQ.js +741 -0
- package/dist-lib/cesium-adapter-BHXNytkU.js +1488 -0
- package/dist-lib/checkbox-QoR4S8tV.js +284 -0
- package/dist-lib/chunk-HEgqtunE.js +20 -0
- package/dist-lib/chunk.36O46B5H-B6ZL7Sm1.js +77 -0
- package/dist-lib/chunk.3RPBFEDE-BFO1fHVm.js +138 -0
- package/dist-lib/chunk.5JY5FUCG-DTXsslmx.js +1090 -0
- package/dist-lib/chunk.6CTB5ZDJ-DjZrBd6Y.js +99 -0
- package/dist-lib/chunk.AJ3ENQ5C-Ci7Gm2b6.js +175 -0
- package/dist-lib/chunk.LD4M4QGE-CiCfhE8r.js +8 -0
- package/dist-lib/chunk.NYIIDP5N-BikXIStD.js +99 -0
- package/dist-lib/chunk.RWUUFNUL-DFztA4uV.js +43 -0
- package/dist-lib/chunk.SI4ACBFK-CLb9VfMG.js +61 -0
- package/dist-lib/chunk.YHLNUJ7P-D-kanrCf.js +503 -0
- package/dist-lib/core-CMAlSR68.js +22 -0
- package/dist-lib/decorate-CWgUV1hU.js +1139 -0
- package/dist-lib/decorators-B35AgiCU.js +351 -0
- package/dist-lib/deferred-query-service-BJDcngw6.js +386 -0
- package/dist-lib/dist-Dm6b7XCs.js +12318 -0
- package/dist-lib/dist-Ha9LQCut.js +244 -0
- package/dist-lib/dist-c1PlDAd1.js +2359 -0
- package/dist-lib/dist-kKlmcBXq.js +50 -0
- package/dist-lib/divider-CPm675yY.js +41 -0
- package/dist-lib/dropped-config-C_GyVa8o.js +17 -0
- package/dist-lib/dropped-layer-builder-DAaYgUPk.js +396 -0
- package/dist-lib/epsg-definitions-BZLZWa8Q.js +668 -0
- package/dist-lib/esm-CTuscnN5.js +46 -0
- package/dist-lib/file-sniff-Dhxj3KTF.js +251 -0
- package/dist-lib/geo-calculations-DbFJAUoI.js +30 -0
- package/dist-lib/icon-CEOgWlro.js +9 -0
- package/dist-lib/icon-button-Da_nBTy3.js +408 -0
- package/dist-lib/input-CeGntPlT.js +590 -0
- package/dist-lib/layer-discovery-afWzu5hY.js +2825 -0
- package/dist-lib/leaflet-adapter-D9djjrKv.js +1227 -0
- package/dist-lib/lib-CdHVicAE.js +4074 -0
- package/dist-lib/map-layer-registry-2cmkiRDK.js +62 -0
- package/dist-lib/maplibre-adapter-TFc3e0G9.js +1190 -0
- package/dist-lib/maplibre-expression-evaluator-DCWUcpwf.js +7233 -0
- package/dist-lib/marker-utils-DztWXeop.js +12 -0
- package/dist-lib/ol-tilegrid-9VtyxaLG.js +64 -0
- package/dist-lib/openlayers-adapter-DVW1KCRv.js +13307 -0
- package/dist-lib/option-CBxl1mZP.js +1106 -0
- package/dist-lib/papaparse.min-B7v3c0D7.js +501 -0
- package/dist-lib/rbush-C8k41T4z.js +254 -0
- package/dist-lib/shapefile-SawVY6xg.js +207 -0
- package/dist-lib/spinner-DysxdNG9.js +6 -0
- package/dist-lib/src-CL94RDe3.js +111 -0
- package/dist-lib/throttle-BeneRNYK.js +16 -0
- package/dist-lib/toast-Cm28o9U6.js +15 -0
- package/dist-lib/togeojson.es-DAgiTBvg.js +579 -0
- package/dist-lib/tooltip-Cucn1SiD.js +197 -0
- package/dist-lib/webmapx-3d-tool-D4CTD2gB.js +176 -0
- package/dist-lib/webmapx-base-tool-Dm9NAWLD.js +75 -0
- package/dist-lib/webmapx-config-edit-tool-DCTyxqTk.js +389 -0
- package/dist-lib/webmapx-coordinates-tool-jeWohup9.js +648 -0
- package/dist-lib/webmapx-core-bundle-BDImi1RE.js +8203 -0
- package/dist-lib/webmapx-draw-tool-DooAV8cF.js +4336 -0
- package/dist-lib/webmapx-geolocation-tool-Rw3-Iad1.js +788 -0
- package/dist-lib/webmapx-import-layer-tool-DRYviHd5.js +250 -0
- package/dist-lib/webmapx-info-tool-BJA157cy.js +412 -0
- package/dist-lib/webmapx-language-osmvector-M5y_lwOg.js +489 -0
- package/dist-lib/webmapx-measure-tool-BXhMJFC6.js +590 -0
- package/dist-lib/webmapx-modal-tool-eF6Naluv.js +84 -0
- package/dist-lib/webmapx-plugin-tool-D2Hghf9n.js +45 -0
- package/dist-lib/webmapx-print-tool-ob1bOsR5.js +348 -0
- package/dist-lib/webmapx-search-tool-Cv8BrYvY.js +437 -0
- package/dist-lib/webmapx-settings-DDEJ8aoV.js +479 -0
- package/dist-lib/webmapx-truearea-tool-CMB4Orm-.js +615 -0
- package/dist-lib/webmapx-view-mode-tool-CUpLNjOj.js +106 -0
- package/dist-lib/webmapx.css +2 -0
- package/dist-lib/webmapx.js +1321 -0
- package/dist-lib/wms-feature-info-C0RVMEQC.js +145 -0
- package/dist-lib/wms-url-builder-DIJLQ1v2.js +54 -0
- package/dist-lib/zip.js-DVhmtjxZ.js +3615 -0
- package/package.json +107 -0
- package/public/data/country-epsg-codes.json +297 -0
- package/public/data/world-countries-simplified.topojson +1 -0
- package/src/locales/en/core.json +20 -0
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
import { r as e, t } from "./decorate-CWgUV1hU.js";
|
|
2
|
+
import { t as n } from "./webmapx-base-tool-Dm9NAWLD.js";
|
|
3
|
+
import { a as r, i, o as a } from "./decorators-B35AgiCU.js";
|
|
4
|
+
import "./button-DFdGkRPQ.js";
|
|
5
|
+
import "./input-CeGntPlT.js";
|
|
6
|
+
import "./spinner-DysxdNG9.js";
|
|
7
|
+
import "./icon-button-Da_nBTy3.js";
|
|
8
|
+
import { a as o, i as s, t as c } from "./zip.js-DVhmtjxZ.js";
|
|
9
|
+
import { css as l, html as u } from "lit";
|
|
10
|
+
//#region src/components/webmapx-geolocation-tool.ts
|
|
11
|
+
var d, f = "webmapx-geolocation-tracks", p = "webmapx-geolocation-track-last-id";
|
|
12
|
+
function m() {
|
|
13
|
+
try {
|
|
14
|
+
let e = localStorage.getItem(f);
|
|
15
|
+
if (!e) return [];
|
|
16
|
+
let t = JSON.parse(e);
|
|
17
|
+
return Array.isArray(t) ? t : [];
|
|
18
|
+
} catch {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function h(e) {
|
|
23
|
+
try {
|
|
24
|
+
localStorage.setItem(f, JSON.stringify(e));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.warn("Failed to persist track points to localStorage", e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function g() {
|
|
30
|
+
let e = (Number(localStorage.getItem(p)) || 0) + 1;
|
|
31
|
+
try {
|
|
32
|
+
localStorage.setItem(p, String(e));
|
|
33
|
+
} catch {}
|
|
34
|
+
return e;
|
|
35
|
+
}
|
|
36
|
+
function _(e) {
|
|
37
|
+
let t = [...e].sort((e, t) => e[0] - t[0] || e[1] - t[1]), n = [], r = [], i = null, a = [], o = () => {
|
|
38
|
+
i !== null && a.length >= 2 && r.push({
|
|
39
|
+
type: "Feature",
|
|
40
|
+
geometry: {
|
|
41
|
+
type: "LineString",
|
|
42
|
+
coordinates: a
|
|
43
|
+
},
|
|
44
|
+
properties: { track: i }
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
for (let [e, r, s, c, l, u] of t) n.push({
|
|
48
|
+
type: "Feature",
|
|
49
|
+
geometry: {
|
|
50
|
+
type: "Point",
|
|
51
|
+
coordinates: [c, l]
|
|
52
|
+
},
|
|
53
|
+
properties: {
|
|
54
|
+
track: e,
|
|
55
|
+
order: r,
|
|
56
|
+
timestamp: s,
|
|
57
|
+
precision: u ?? 0
|
|
58
|
+
}
|
|
59
|
+
}), e !== i && (o(), i = e, a = []), a.push([c, l]);
|
|
60
|
+
return o(), {
|
|
61
|
+
points: {
|
|
62
|
+
type: "FeatureCollection",
|
|
63
|
+
features: n
|
|
64
|
+
},
|
|
65
|
+
lines: {
|
|
66
|
+
type: "FeatureCollection",
|
|
67
|
+
features: r
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function v(e, t, n, r) {
|
|
72
|
+
let i = (e) => e * Math.PI / 180, a = i(n - e), o = i(r - t), s = Math.sin(a / 2) ** 2 + Math.cos(i(e)) * Math.cos(i(n)) * Math.sin(o / 2) ** 2;
|
|
73
|
+
return 2 * 6371e3 * Math.asin(Math.sqrt(s));
|
|
74
|
+
}
|
|
75
|
+
function y(e, t, n) {
|
|
76
|
+
if (!e) return t;
|
|
77
|
+
let r = (t.timestamp - e.timestamp) / 1e3;
|
|
78
|
+
if (r <= 0) return null;
|
|
79
|
+
let i = v(e.lat, e.lng, t.lat, t.lng), a = i / r;
|
|
80
|
+
if (i + t.accuracy <= e.accuracy || r > Math.min(30, Math.max(1, e.accuracy / Math.max(n, 1)))) return t;
|
|
81
|
+
let o = t.accuracy / e.accuracy;
|
|
82
|
+
return o > 2.5 ? null : i <= e.accuracy + t.accuracy && o <= 1 ? t : a > Math.max(300, n * 4) ? null : t;
|
|
83
|
+
}
|
|
84
|
+
var b = class extends n {
|
|
85
|
+
static {
|
|
86
|
+
d = this;
|
|
87
|
+
}
|
|
88
|
+
constructor(...e) {
|
|
89
|
+
super(...e), this.toolId = "geolocation", this.watch = !0, this.highAccuracy = !0, this.timeout = 45e3, this.maxAge = 0, this.follow = !1, this.active = !1, this.status = "idle", this.message = "Determining position...", this.lastUpdate = null, this.exportDialogOpen = !1, this.storedPointCount = 0, this.exportFilenameStep = !1, this.exportFilename = "gps-tracks", this.eraseAfterExport = !0, this.mapElement = null, this.flownTo = !1, this.sourceId = "__webmapx-geolocation", this.trailLayerId = "__webmapx-geolocation-trail", this.exportLayerId = "webmapx-geolocation-tracks-export", this.exportLinesSourceId = `${this.exportLayerId}:lines`, this.exportPointsSourceId = `${this.exportLayerId}:points`, this.radiusLayerId = "__webmapx-geolocation-radius", this.pointLayerId = "__webmapx-geolocation-point", this.panelLinked = !1, this.panelElement = null, this.boundHandleToolSelect = (e) => this.handleToolSelect(e), this.boundHandleToolActivated = (e) => this.handleToolActivated(e), this.boundHandlePanelClose = () => this.handlePanelClose();
|
|
90
|
+
}
|
|
91
|
+
static {
|
|
92
|
+
this.mapStates = /* @__PURE__ */ new Map();
|
|
93
|
+
}
|
|
94
|
+
static {
|
|
95
|
+
this.globalWatchId = null;
|
|
96
|
+
}
|
|
97
|
+
static {
|
|
98
|
+
this.globalListeners = /* @__PURE__ */ new Set();
|
|
99
|
+
}
|
|
100
|
+
static {
|
|
101
|
+
this.globalLastPosition = null;
|
|
102
|
+
}
|
|
103
|
+
static {
|
|
104
|
+
this.globalLastError = null;
|
|
105
|
+
}
|
|
106
|
+
static {
|
|
107
|
+
this.wakeLock = null;
|
|
108
|
+
}
|
|
109
|
+
static {
|
|
110
|
+
this.wakeLockListenerAdded = !1;
|
|
111
|
+
}
|
|
112
|
+
static {
|
|
113
|
+
this.boundReacquireWakeLock = () => d.reacquireWakeLockIfNeeded();
|
|
114
|
+
}
|
|
115
|
+
static {
|
|
116
|
+
this.styles = l`
|
|
117
|
+
:host {
|
|
118
|
+
display: block;
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
pointer-events: auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([hidden]) {
|
|
124
|
+
display: none !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.tool-content {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 0.5rem;
|
|
131
|
+
padding: 0.75rem;
|
|
132
|
+
color: var(--color-text-primary);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.title {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: 0.4rem;
|
|
139
|
+
font-weight: 600;
|
|
140
|
+
font-size: 1rem;
|
|
141
|
+
border-bottom: 1px solid var(--color-border-light);
|
|
142
|
+
padding-bottom: 0.5rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.title sl-spinner {
|
|
146
|
+
font-size: 1em;
|
|
147
|
+
--track-width: 2px;
|
|
148
|
+
--indicator-color: var(--sl-color-neutral-900);
|
|
149
|
+
--track-color: var(--sl-color-neutral-300);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.status {
|
|
153
|
+
font-size: 0.875rem;
|
|
154
|
+
color: var(--color-text-secondary);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.meta {
|
|
158
|
+
font-size: 0.75rem;
|
|
159
|
+
color: var(--color-text-secondary);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.follow {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
gap: 0.5rem;
|
|
166
|
+
font-size: 0.875rem;
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
connectedCallback() {
|
|
171
|
+
super.connectedCallback(), this.panelElement = this.closest("webmapx-tool-panel"), this.panelLinked = !!this.panelElement, this.panelElement?.addEventListener("webmapx-panel-close", this.boundHandlePanelClose);
|
|
172
|
+
}
|
|
173
|
+
disconnectedCallback() {
|
|
174
|
+
this.panelElement?.removeEventListener("webmapx-panel-close", this.boundHandlePanelClose), this.panelElement = null, this.panelLinked = !1, super.disconnectedCallback();
|
|
175
|
+
}
|
|
176
|
+
onMapAttached(t) {
|
|
177
|
+
this.adapter = t, this.mapElement = e(this), this.incrementSharedState(), this.panelLinked && this.mapElement && (this.mapElement.addEventListener("webmapx-tool-select", this.boundHandleToolSelect), this.mapElement.addEventListener("webmapx-tool-activated", this.boundHandleToolActivated));
|
|
178
|
+
}
|
|
179
|
+
onMapDetached() {
|
|
180
|
+
this.active && (this.hidden = !0, this.stopTracking()), this.releaseSharedState(), this.mapElement && (this.mapElement.removeEventListener("webmapx-tool-select", this.boundHandleToolSelect), this.mapElement.removeEventListener("webmapx-tool-activated", this.boundHandleToolActivated)), this.adapter = null, this.mapElement = null;
|
|
181
|
+
}
|
|
182
|
+
onStateChanged() {}
|
|
183
|
+
activate() {
|
|
184
|
+
if (this.hidden = !1, !this.active) if (this.flownTo = !1, this.lastUpdate = null, this.status = "locating", this.message = "Determining position...", this.incrementActiveState(), this.startGeolocation(), this.active = !0, d.globalLastPosition && this.mapElement) {
|
|
185
|
+
let e = d.globalLastPosition;
|
|
186
|
+
this.handleSharedPosition(e);
|
|
187
|
+
let t = this.getMapStateIfAny(this.mapElement);
|
|
188
|
+
if (t) {
|
|
189
|
+
let n = t.bestFix ?? {
|
|
190
|
+
lng: e.coords.longitude,
|
|
191
|
+
lat: e.coords.latitude,
|
|
192
|
+
accuracy: e.coords.accuracy,
|
|
193
|
+
timestamp: e.timestamp
|
|
194
|
+
};
|
|
195
|
+
t.bestFix = n, this.updateMapForPosition(n, t);
|
|
196
|
+
let r = this.mapElement.adapter;
|
|
197
|
+
r && this.maybeRecenter(n, t.listeners, r);
|
|
198
|
+
}
|
|
199
|
+
} else d.globalLastError && this.handleSharedError(d.globalLastError);
|
|
200
|
+
}
|
|
201
|
+
deactivate() {
|
|
202
|
+
this.active && (this.hidden = !0, !this.follow && this.stopTracking());
|
|
203
|
+
}
|
|
204
|
+
stopTracking() {
|
|
205
|
+
this.active &&= (this.decrementActiveState(), this.status = "idle", this.message = "Determining position...", this.lastUpdate = null, this.flownTo = !1, !1);
|
|
206
|
+
}
|
|
207
|
+
toggle() {
|
|
208
|
+
this.active ? this.deactivate() : this.activate();
|
|
209
|
+
}
|
|
210
|
+
handleToolSelect(e) {
|
|
211
|
+
if (this.panelLinked) {
|
|
212
|
+
if ((e.detail?.toolId ?? null) === this.toolId) {
|
|
213
|
+
this.activate();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this.active && this.deactivate();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
handleToolActivated(e) {
|
|
220
|
+
if (!this.panelLinked) return;
|
|
221
|
+
let t = e.detail?.toolId ?? null;
|
|
222
|
+
t && t !== this.toolId && this.active && this.deactivate();
|
|
223
|
+
}
|
|
224
|
+
handlePanelClose() {
|
|
225
|
+
this.panelLinked && this.active && this.deactivate();
|
|
226
|
+
}
|
|
227
|
+
startGeolocation() {
|
|
228
|
+
if (!navigator.geolocation) {
|
|
229
|
+
this.status = "error", this.message = "Geolocation is not available in this browser.", this.dispatchEvent(new CustomEvent("webmapx-geolocation-error", {
|
|
230
|
+
detail: { message: this.message },
|
|
231
|
+
bubbles: !0,
|
|
232
|
+
composed: !0
|
|
233
|
+
})), this.deactivate();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this.ensureMapLayers(), this.dispatchEvent(new CustomEvent("webmapx-geolocation-start", {
|
|
237
|
+
detail: { watch: !0 },
|
|
238
|
+
bubbles: !0,
|
|
239
|
+
composed: !0
|
|
240
|
+
})), this.requestSingleFix(), this.updateGlobalWatchState();
|
|
241
|
+
}
|
|
242
|
+
buildOptions() {
|
|
243
|
+
return {
|
|
244
|
+
enableHighAccuracy: this.highAccuracy,
|
|
245
|
+
timeout: this.timeout,
|
|
246
|
+
maximumAge: this.maxAge
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
handleSharedPosition(e) {
|
|
250
|
+
this.status = "watching", this.updateMessage(e), this.lastUpdate = (/* @__PURE__ */ new Date()).toLocaleTimeString(), this.dispatchEvent(new CustomEvent("webmapx-geolocation-success", {
|
|
251
|
+
detail: {
|
|
252
|
+
position: e,
|
|
253
|
+
watch: !0
|
|
254
|
+
},
|
|
255
|
+
bubbles: !0,
|
|
256
|
+
composed: !0
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
handleSharedError(e) {
|
|
260
|
+
let t = [
|
|
261
|
+
`Error: ${{
|
|
262
|
+
1: "Permission denied",
|
|
263
|
+
2: "Position unavailable",
|
|
264
|
+
3: "Timeout"
|
|
265
|
+
}[e.code] || "Unknown error"}`,
|
|
266
|
+
`Code: ${e.code}`,
|
|
267
|
+
e.message ? `Details: ${e.message}` : null
|
|
268
|
+
].filter(Boolean);
|
|
269
|
+
this.message = t.join("\n"), this.status = d.globalWatchId === null ? "error" : "watching", this.dispatchEvent(new CustomEvent("webmapx-geolocation-error", {
|
|
270
|
+
detail: { error: e },
|
|
271
|
+
bubbles: !0,
|
|
272
|
+
composed: !0
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
requestSingleFix() {
|
|
276
|
+
navigator.geolocation.getCurrentPosition((e) => this.handleGlobalUpdate(e), (e) => this.handleGlobalErrorUpdate(e), this.buildOptions());
|
|
277
|
+
}
|
|
278
|
+
async ensureMapLayers(e, t) {
|
|
279
|
+
let n = e ?? this.adapter, r = t ?? this.mapElement;
|
|
280
|
+
if (!n || !r) return;
|
|
281
|
+
let i = this.getMapState(r), a = n.getSource(this.sourceId);
|
|
282
|
+
if (i.layersReady && a) return;
|
|
283
|
+
try {
|
|
284
|
+
a || n.addSource(this.sourceId, {
|
|
285
|
+
type: "geojson",
|
|
286
|
+
data: {
|
|
287
|
+
type: "FeatureCollection",
|
|
288
|
+
features: []
|
|
289
|
+
}
|
|
290
|
+
}), n.suppressBusySignalForSource(this.sourceId);
|
|
291
|
+
} catch {}
|
|
292
|
+
let o = !1;
|
|
293
|
+
try {
|
|
294
|
+
await r.addLayerRequest({
|
|
295
|
+
id: this.trailLayerId,
|
|
296
|
+
type: "line",
|
|
297
|
+
source: this.sourceId,
|
|
298
|
+
metadata: {
|
|
299
|
+
isToolLayer: !0,
|
|
300
|
+
hideFromLegend: !0,
|
|
301
|
+
label: "Geolocation trail"
|
|
302
|
+
},
|
|
303
|
+
paint: {
|
|
304
|
+
"line-color": "rgb(66, 133, 244)",
|
|
305
|
+
"line-width": 3,
|
|
306
|
+
"line-opacity": .8
|
|
307
|
+
},
|
|
308
|
+
filter: [
|
|
309
|
+
"==",
|
|
310
|
+
"$type",
|
|
311
|
+
"LineString"
|
|
312
|
+
]
|
|
313
|
+
}) || (o = !0);
|
|
314
|
+
} catch {
|
|
315
|
+
o = !0;
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
await r.addLayerRequest({
|
|
319
|
+
id: this.radiusLayerId,
|
|
320
|
+
type: "fill",
|
|
321
|
+
source: this.sourceId,
|
|
322
|
+
metadata: {
|
|
323
|
+
isToolLayer: !0,
|
|
324
|
+
hideFromLegend: !0,
|
|
325
|
+
label: "Geolocation precision"
|
|
326
|
+
},
|
|
327
|
+
paint: {
|
|
328
|
+
"fill-color": "rgb(149, 201, 253)",
|
|
329
|
+
"fill-opacity": .5,
|
|
330
|
+
"fill-outline-color": "rgb(66, 133, 244)"
|
|
331
|
+
},
|
|
332
|
+
filter: [
|
|
333
|
+
"==",
|
|
334
|
+
"$type",
|
|
335
|
+
"Polygon"
|
|
336
|
+
]
|
|
337
|
+
}) || (o = !0);
|
|
338
|
+
} catch {
|
|
339
|
+
o = !0;
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
await r.addLayerRequest({
|
|
343
|
+
id: this.pointLayerId,
|
|
344
|
+
type: "circle",
|
|
345
|
+
source: this.sourceId,
|
|
346
|
+
metadata: {
|
|
347
|
+
isToolLayer: !0,
|
|
348
|
+
hideFromLegend: !0,
|
|
349
|
+
label: "Geolocation position"
|
|
350
|
+
},
|
|
351
|
+
paint: {
|
|
352
|
+
"circle-radius": 10,
|
|
353
|
+
"circle-color": "rgb(66, 133, 244)",
|
|
354
|
+
"circle-stroke-color": "#fff",
|
|
355
|
+
"circle-stroke-width": 1
|
|
356
|
+
},
|
|
357
|
+
filter: [
|
|
358
|
+
"==",
|
|
359
|
+
"$type",
|
|
360
|
+
"Point"
|
|
361
|
+
]
|
|
362
|
+
}) || (o = !0);
|
|
363
|
+
} catch {
|
|
364
|
+
o = !0;
|
|
365
|
+
}
|
|
366
|
+
i.layersReady = !o;
|
|
367
|
+
}
|
|
368
|
+
clearMapLayers() {
|
|
369
|
+
if (!this.adapter || !this.mapElement) return;
|
|
370
|
+
let e = this.getMapStateIfAny(this.mapElement);
|
|
371
|
+
if (!(e && !e.layersReady)) {
|
|
372
|
+
try {
|
|
373
|
+
this.mapElement.removeInlineLayer(this.trailLayerId);
|
|
374
|
+
} catch {}
|
|
375
|
+
try {
|
|
376
|
+
this.mapElement.removeInlineLayer(this.radiusLayerId);
|
|
377
|
+
} catch {}
|
|
378
|
+
try {
|
|
379
|
+
this.mapElement.removeInlineLayer(this.pointLayerId);
|
|
380
|
+
} catch {}
|
|
381
|
+
try {
|
|
382
|
+
this.adapter.unsuppressBusySignalForSource(this.sourceId);
|
|
383
|
+
} catch {}
|
|
384
|
+
try {
|
|
385
|
+
this.adapter.removeSource(this.sourceId);
|
|
386
|
+
} catch {}
|
|
387
|
+
e && (e.layersReady = !1);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
clearMapData() {
|
|
391
|
+
if (!this.adapter) return;
|
|
392
|
+
let e = this.adapter.getSource(this.sourceId);
|
|
393
|
+
e && e.setData({
|
|
394
|
+
type: "FeatureCollection",
|
|
395
|
+
features: []
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
incrementSharedState() {
|
|
399
|
+
if (!this.mapElement) return;
|
|
400
|
+
let e = this.getMapState(this.mapElement);
|
|
401
|
+
e.count += 1;
|
|
402
|
+
}
|
|
403
|
+
releaseSharedState() {
|
|
404
|
+
if (!this.mapElement) return;
|
|
405
|
+
let e = this.getMapStateIfAny(this.mapElement);
|
|
406
|
+
e && (--e.count, e.count <= 0 && d.mapStates.delete(this.mapElement));
|
|
407
|
+
}
|
|
408
|
+
getMapState(e) {
|
|
409
|
+
let t = d.mapStates.get(e);
|
|
410
|
+
return t || (t = {
|
|
411
|
+
count: 0,
|
|
412
|
+
activeCount: 0,
|
|
413
|
+
layersReady: !1,
|
|
414
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
415
|
+
mapElement: e,
|
|
416
|
+
bestFix: null,
|
|
417
|
+
recentSpeed: 0,
|
|
418
|
+
trail: [],
|
|
419
|
+
currentTrackId: null,
|
|
420
|
+
trackOrder: 0
|
|
421
|
+
}, d.mapStates.set(e, t)), t;
|
|
422
|
+
}
|
|
423
|
+
getMapStateIfAny(e) {
|
|
424
|
+
return d.mapStates.get(e) ?? null;
|
|
425
|
+
}
|
|
426
|
+
incrementActiveState() {
|
|
427
|
+
if (!this.mapElement) return;
|
|
428
|
+
let e = this.getMapState(this.mapElement);
|
|
429
|
+
e.activeCount += 1, e.listeners.add(this), d.globalListeners.add(this), d.updateWakeLock();
|
|
430
|
+
}
|
|
431
|
+
decrementActiveState() {
|
|
432
|
+
if (!this.mapElement) return;
|
|
433
|
+
let e = this.getMapStateIfAny(this.mapElement);
|
|
434
|
+
e && (e.activeCount = Math.max(0, e.activeCount - 1), e.listeners.delete(this), d.globalListeners.delete(this), d.updateWakeLock(), e.activeCount === 0 && (this.clearMapData(), this.clearMapLayers(), e.bestFix = null, e.recentSpeed = 0, e.trail = []), d.globalListeners.size === 0 && (this.stopGlobalWatch(), d.globalLastPosition = null, d.globalLastError = null), this.updateGlobalWatchState());
|
|
435
|
+
}
|
|
436
|
+
startGlobalWatch() {
|
|
437
|
+
d.globalWatchId === null && (d.globalWatchId = navigator.geolocation.watchPosition((e) => this.handleGlobalUpdate(e), (e) => this.handleGlobalErrorUpdate(e), this.buildOptions()));
|
|
438
|
+
}
|
|
439
|
+
stopGlobalWatch() {
|
|
440
|
+
d.globalWatchId !== null && (navigator.geolocation.clearWatch(d.globalWatchId), d.globalWatchId = null, this.dispatchEvent(new CustomEvent("webmapx-geolocation-stop", {
|
|
441
|
+
bubbles: !0,
|
|
442
|
+
composed: !0
|
|
443
|
+
})));
|
|
444
|
+
}
|
|
445
|
+
static shouldHoldWakeLock() {
|
|
446
|
+
let e = !1;
|
|
447
|
+
return d.globalListeners.forEach((t) => {
|
|
448
|
+
t.follow && (e = !0);
|
|
449
|
+
}), e;
|
|
450
|
+
}
|
|
451
|
+
static ensureWakeLockListener() {
|
|
452
|
+
d.wakeLockListenerAdded || typeof document > "u" || (document.addEventListener("visibilitychange", d.boundReacquireWakeLock), d.wakeLockListenerAdded = !0);
|
|
453
|
+
}
|
|
454
|
+
static reacquireWakeLockIfNeeded() {
|
|
455
|
+
document.visibilityState === "visible" && d.shouldHoldWakeLock() && !d.wakeLock && d.requestWakeLock();
|
|
456
|
+
}
|
|
457
|
+
static async requestWakeLock() {
|
|
458
|
+
if (!(d.wakeLock || !("wakeLock" in navigator))) {
|
|
459
|
+
d.ensureWakeLockListener();
|
|
460
|
+
try {
|
|
461
|
+
let e = await navigator.wakeLock.request("screen");
|
|
462
|
+
e.addEventListener("release", () => {
|
|
463
|
+
d.wakeLock === e && (d.wakeLock = null);
|
|
464
|
+
}), d.wakeLock = e;
|
|
465
|
+
} catch {
|
|
466
|
+
d.wakeLock = null;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
static releaseWakeLock() {
|
|
471
|
+
let e = d.wakeLock;
|
|
472
|
+
e && (d.wakeLock = null, e.release().catch(() => {}));
|
|
473
|
+
}
|
|
474
|
+
static updateWakeLock() {
|
|
475
|
+
d.shouldHoldWakeLock() ? d.requestWakeLock() : d.releaseWakeLock();
|
|
476
|
+
}
|
|
477
|
+
updateGlobalWatchState() {
|
|
478
|
+
if (d.globalListeners.size > 0) {
|
|
479
|
+
this.startGlobalWatch();
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
d.globalWatchId !== null && this.stopGlobalWatch();
|
|
483
|
+
}
|
|
484
|
+
handleGlobalUpdate(e) {
|
|
485
|
+
d.globalLastPosition = e, d.globalLastError = null;
|
|
486
|
+
let t = {
|
|
487
|
+
lng: e.coords.longitude,
|
|
488
|
+
lat: e.coords.latitude,
|
|
489
|
+
accuracy: e.coords.accuracy,
|
|
490
|
+
timestamp: e.timestamp
|
|
491
|
+
};
|
|
492
|
+
d.mapStates.forEach((n) => {
|
|
493
|
+
if (n.activeCount === 0) return;
|
|
494
|
+
let r = y(n.bestFix, t, n.recentSpeed);
|
|
495
|
+
if (r) {
|
|
496
|
+
if (n.bestFix) {
|
|
497
|
+
let e = (r.timestamp - n.bestFix.timestamp) / 1e3;
|
|
498
|
+
if (e > 0) {
|
|
499
|
+
let t = v(n.bestFix.lat, n.bestFix.lng, r.lat, r.lng);
|
|
500
|
+
n.recentSpeed = n.recentSpeed * .7 + t / e * .3;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
n.bestFix = r, d.anyFollowing(n) && (n.trail.push([r.lng, r.lat]), this.persistTrackPoint(n, r)), this.updateMapForPosition(r, n);
|
|
504
|
+
let e = n.mapElement.adapter;
|
|
505
|
+
e && this.maybeRecenter(r, n.listeners, e);
|
|
506
|
+
}
|
|
507
|
+
n.listeners.forEach((t) => t.handleSharedPosition(e));
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
persistTrackPoint(e, t) {
|
|
511
|
+
if (e.currentTrackId === null) return;
|
|
512
|
+
e.trackOrder += 1;
|
|
513
|
+
let n = m();
|
|
514
|
+
n.push([
|
|
515
|
+
e.currentTrackId,
|
|
516
|
+
e.trackOrder,
|
|
517
|
+
t.timestamp,
|
|
518
|
+
t.lng,
|
|
519
|
+
t.lat,
|
|
520
|
+
t.accuracy
|
|
521
|
+
]), h(n);
|
|
522
|
+
}
|
|
523
|
+
static anyFollowing(e) {
|
|
524
|
+
let t = !1;
|
|
525
|
+
return e.listeners.forEach((e) => {
|
|
526
|
+
e.follow && (t = !0);
|
|
527
|
+
}), t;
|
|
528
|
+
}
|
|
529
|
+
handleGlobalErrorUpdate(e) {
|
|
530
|
+
d.globalLastError = e, d.globalLastPosition = null, d.mapStates.forEach((t) => {
|
|
531
|
+
t.listeners.forEach((t) => t.handleSharedError(e));
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
maybeRecenter(e, t, n) {
|
|
535
|
+
let r = !1, i = null;
|
|
536
|
+
if (t.forEach((e) => {
|
|
537
|
+
if (e.follow || !e.flownTo) {
|
|
538
|
+
if (r = !0, !e.flownTo) {
|
|
539
|
+
let t = n.getViewportState().zoom ?? 0, r = typeof e.zoom == "number" ? e.zoom : Math.max(t, 15);
|
|
540
|
+
i = i === null ? r : Math.max(i, r);
|
|
541
|
+
}
|
|
542
|
+
e.flownTo = !0;
|
|
543
|
+
}
|
|
544
|
+
}), !r) return;
|
|
545
|
+
let a = [e.lng, e.lat], o = i ?? n.getViewportState().zoom ?? 0;
|
|
546
|
+
try {
|
|
547
|
+
n.setViewport(a, o);
|
|
548
|
+
} catch (e) {
|
|
549
|
+
console.warn("geolocation setViewport failed", e);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
updateMapForPosition(e, t) {
|
|
553
|
+
let n = t.mapElement, r = n.adapter;
|
|
554
|
+
if (!r) return;
|
|
555
|
+
t.layersReady || this.ensureMapLayers(r, n);
|
|
556
|
+
let i = [];
|
|
557
|
+
t.trail.length >= 2 && i.push(this.createTrailFeature(t.trail)), i.push(this.createAccuracyCircle(e.lng, e.lat, e.accuracy)), i.push(this.createPoint(e.lng, e.lat));
|
|
558
|
+
let a = {
|
|
559
|
+
type: "FeatureCollection",
|
|
560
|
+
features: i
|
|
561
|
+
}, o = r.getSource(this.sourceId);
|
|
562
|
+
o && o.setData(a);
|
|
563
|
+
}
|
|
564
|
+
updateMessage(e) {
|
|
565
|
+
let t = e.coords.accuracy || 0, n = 6 - Math.round(Math.log10(Math.max(t, 1))), r = Math.max(0, Math.min(6, n));
|
|
566
|
+
this.message = `Longitude: ${e.coords.longitude.toFixed(r)}°\nLatitude: ${e.coords.latitude.toFixed(r)}°\nPrecision: ${Math.round(t)} m`;
|
|
567
|
+
}
|
|
568
|
+
handleFollowChange(e) {
|
|
569
|
+
let t = e.target;
|
|
570
|
+
if (t) {
|
|
571
|
+
if (this.follow = t.checked, this.follow && this.mapElement) {
|
|
572
|
+
let e = this.getMapStateIfAny(this.mapElement);
|
|
573
|
+
e && (e.trail = [], e.currentTrackId = g(), e.trackOrder = 0, e.bestFix && (e.trail.push([e.bestFix.lng, e.bestFix.lat]), this.persistTrackPoint(e, e.bestFix)));
|
|
574
|
+
} else if (!this.follow && this.mapElement) {
|
|
575
|
+
let e = this.getMapStateIfAny(this.mapElement);
|
|
576
|
+
e && (e.currentTrackId = null);
|
|
577
|
+
}
|
|
578
|
+
d.updateWakeLock();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
formatStatus() {
|
|
582
|
+
switch (this.status) {
|
|
583
|
+
case "locating": return "Locating";
|
|
584
|
+
case "watching": return "Watching";
|
|
585
|
+
case "success": return "Active";
|
|
586
|
+
case "error": return "Error";
|
|
587
|
+
default: return "Idle";
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
createAccuracyCircle(e, t, n) {
|
|
591
|
+
let r = n / 1e3, i = r / (111.32 * Math.cos(t * Math.PI / 180)), a = r / 110.574, o = [];
|
|
592
|
+
for (let n = 0; n < 64; n += 1) {
|
|
593
|
+
let r = n / 64 * (2 * Math.PI), s = i * Math.cos(r), c = a * Math.sin(r);
|
|
594
|
+
o.push([e + s, t + c]);
|
|
595
|
+
}
|
|
596
|
+
return o.push(o[0]), {
|
|
597
|
+
type: "Feature",
|
|
598
|
+
geometry: {
|
|
599
|
+
type: "Polygon",
|
|
600
|
+
coordinates: [o]
|
|
601
|
+
},
|
|
602
|
+
properties: {}
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
createPoint(e, t) {
|
|
606
|
+
return {
|
|
607
|
+
type: "Feature",
|
|
608
|
+
geometry: {
|
|
609
|
+
type: "Point",
|
|
610
|
+
coordinates: [e, t]
|
|
611
|
+
},
|
|
612
|
+
properties: {}
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
createTrailFeature(e) {
|
|
616
|
+
return {
|
|
617
|
+
type: "Feature",
|
|
618
|
+
geometry: {
|
|
619
|
+
type: "LineString",
|
|
620
|
+
coordinates: e
|
|
621
|
+
},
|
|
622
|
+
properties: {}
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
render() {
|
|
626
|
+
return u`
|
|
627
|
+
<div class="tool-content">
|
|
628
|
+
<div class="title">
|
|
629
|
+
Location
|
|
630
|
+
${this.status === "locating" ? u`<sl-spinner></sl-spinner>` : ""}
|
|
631
|
+
<sl-icon-button
|
|
632
|
+
name="box-arrow-up"
|
|
633
|
+
label="Export tracked points"
|
|
634
|
+
title="Export tracked points"
|
|
635
|
+
style="margin-left: auto;"
|
|
636
|
+
@click=${() => {
|
|
637
|
+
this.storedPointCount = m().length, this.exportDialogOpen = !0;
|
|
638
|
+
}}
|
|
639
|
+
></sl-icon-button>
|
|
640
|
+
</div>
|
|
641
|
+
<div class="status" style="white-space: pre-line;">${this.message}</div>
|
|
642
|
+
<div class="follow">
|
|
643
|
+
<label>
|
|
644
|
+
<input type="checkbox" .checked=${this.follow} @change=${this.handleFollowChange} />
|
|
645
|
+
Track me
|
|
646
|
+
</label>
|
|
647
|
+
</div>
|
|
648
|
+
<div class="meta">
|
|
649
|
+
Status: ${this.formatStatus()}${this.lastUpdate ? ` | Updated: ${this.lastUpdate}` : ""}
|
|
650
|
+
</div>
|
|
651
|
+
</div>
|
|
652
|
+
|
|
653
|
+
<sl-dialog label="Export tracked points" .open=${this.exportDialogOpen}
|
|
654
|
+
@sl-request-close=${() => {
|
|
655
|
+
this.exportDialogOpen = !1, this.exportFilenameStep = !1;
|
|
656
|
+
}}>
|
|
657
|
+
${this.exportFilenameStep ? u`
|
|
658
|
+
<div style="display:flex; align-items:center; gap:0.4rem;">
|
|
659
|
+
<span>Filename</span>
|
|
660
|
+
<sl-input style="flex:1;" size="small" .value=${this.exportFilename} aria-label="Export filename"
|
|
661
|
+
@sl-input=${(e) => {
|
|
662
|
+
this.exportFilename = e.target.value;
|
|
663
|
+
}}>
|
|
664
|
+
<span slot="suffix">.zip</span>
|
|
665
|
+
</sl-input>
|
|
666
|
+
</div>
|
|
667
|
+
<div slot="footer" style="display:flex; gap:0.5rem; flex-wrap:wrap;">
|
|
668
|
+
<sl-button variant="primary" autofocus @click=${() => this.handleExportSaveFiles()}>Download</sl-button>
|
|
669
|
+
<sl-button variant="text" @click=${() => {
|
|
670
|
+
this.exportFilenameStep = !1;
|
|
671
|
+
}}>Back</sl-button>
|
|
672
|
+
</div>
|
|
673
|
+
` : u`
|
|
674
|
+
<p>Save the recorded GPS tracks as GeoJSON, or add them to the map.</p>
|
|
675
|
+
<p>${this.storedPointCount} point(s) stored.</p>
|
|
676
|
+
<label style="display:flex; align-items:center; gap:0.4rem; margin-bottom:0.5rem;">
|
|
677
|
+
<input type="checkbox" .checked=${this.eraseAfterExport}
|
|
678
|
+
@change=${(e) => {
|
|
679
|
+
this.eraseAfterExport = e.target.checked;
|
|
680
|
+
}} />
|
|
681
|
+
<span>Erase from memory</span>
|
|
682
|
+
</label>
|
|
683
|
+
<div slot="footer" style="display:flex; gap:0.5rem; flex-wrap:wrap;">
|
|
684
|
+
<sl-button autofocus .disabled=${this.storedPointCount === 0} @click=${() => this.openExportFilenameStep()}>Save as files</sl-button>
|
|
685
|
+
<sl-button .disabled=${this.storedPointCount === 0} @click=${() => this.handleExportAddToMap()}>Add to map</sl-button>
|
|
686
|
+
<sl-button variant="text" @click=${() => {
|
|
687
|
+
this.exportDialogOpen = !1;
|
|
688
|
+
}}>Cancel</sl-button>
|
|
689
|
+
</div>
|
|
690
|
+
`}
|
|
691
|
+
</sl-dialog>
|
|
692
|
+
`;
|
|
693
|
+
}
|
|
694
|
+
openExportFilenameStep() {
|
|
695
|
+
let e = /* @__PURE__ */ new Date(), t = (/* @__PURE__ */ new Date(e.getTime() - e.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16).replace(":", "");
|
|
696
|
+
this.exportFilename = `gps-tracks-${t}`, this.exportFilenameStep = !0;
|
|
697
|
+
}
|
|
698
|
+
async handleExportSaveFiles() {
|
|
699
|
+
let { points: e, lines: t } = _(m()), n = this.exportFilename.trim() || "gps-tracks", r = new c(new s("application/zip"));
|
|
700
|
+
await r.add("gps-track-points.geojson", new o(JSON.stringify(e, null, 2))), await r.add("gps-track-lines.geojson", new o(JSON.stringify(t, null, 2)));
|
|
701
|
+
let i = this.buildTracksStyleConfig("gps-track-lines.geojson", "gps-track-points.geojson");
|
|
702
|
+
await r.add("style.json", new o(JSON.stringify(i, null, 2))), this.downloadBlob(await r.close(), `${n}.zip`), this.eraseAfterExport && this.eraseStoredTracks(), this.exportFilenameStep = !1, this.exportDialogOpen = !1;
|
|
703
|
+
}
|
|
704
|
+
buildTracksStyleConfig(e, t) {
|
|
705
|
+
return {
|
|
706
|
+
id: this.exportLayerId,
|
|
707
|
+
type: "style",
|
|
708
|
+
version: 8,
|
|
709
|
+
metadata: {
|
|
710
|
+
label: "GPS tracks",
|
|
711
|
+
legendRole: "overlay",
|
|
712
|
+
abstract: "Tracked GPS points and the tracks connecting them, recorded via \"Track me\".",
|
|
713
|
+
properties: [{
|
|
714
|
+
name: "timestamp",
|
|
715
|
+
type: "create-time"
|
|
716
|
+
}]
|
|
717
|
+
},
|
|
718
|
+
sources: {
|
|
719
|
+
lines: {
|
|
720
|
+
type: "geojson",
|
|
721
|
+
data: e
|
|
722
|
+
},
|
|
723
|
+
points: {
|
|
724
|
+
type: "geojson",
|
|
725
|
+
data: t
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
layers: [{
|
|
729
|
+
id: "gps-tracks-lines",
|
|
730
|
+
type: "line",
|
|
731
|
+
source: "lines",
|
|
732
|
+
metadata: { label: "GPS tracks" },
|
|
733
|
+
paint: {
|
|
734
|
+
"line-color": "rgb(66, 133, 244)",
|
|
735
|
+
"line-width": 3,
|
|
736
|
+
"line-opacity": .8
|
|
737
|
+
}
|
|
738
|
+
}, {
|
|
739
|
+
id: "gps-tracks-points",
|
|
740
|
+
type: "circle",
|
|
741
|
+
source: "points",
|
|
742
|
+
metadata: { label: "GPS points" },
|
|
743
|
+
paint: {
|
|
744
|
+
"circle-radius": 3,
|
|
745
|
+
"circle-color": "#ffffff",
|
|
746
|
+
"circle-stroke-color": "rgb(66, 133, 244)",
|
|
747
|
+
"circle-stroke-width": 1
|
|
748
|
+
}
|
|
749
|
+
}]
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
eraseStoredTracks() {
|
|
753
|
+
if (h([]), this.storedPointCount = 0, this.mapElement) {
|
|
754
|
+
let e = this.getMapStateIfAny(this.mapElement);
|
|
755
|
+
e && (e.trail = [], e.trackOrder = 0);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
async handleExportAddToMap() {
|
|
759
|
+
if (this.exportDialogOpen = !1, !this.adapter || !this.mapElement) return;
|
|
760
|
+
let e = this.adapter, { points: t, lines: n } = _(m());
|
|
761
|
+
t.features.length !== 0 && (e.hasLayer(this.exportLayerId) ? (e.getSource(this.exportLinesSourceId)?.setData(n), e.getSource(this.exportPointsSourceId)?.setData(t)) : await this.mapElement.addLayerRequest(this.buildTracksStyleConfig(n, t)), this.eraseAfterExport && this.eraseStoredTracks());
|
|
762
|
+
}
|
|
763
|
+
downloadBlob(e, t) {
|
|
764
|
+
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
765
|
+
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
t([r({
|
|
769
|
+
type: Boolean,
|
|
770
|
+
attribute: "watch"
|
|
771
|
+
})], b.prototype, "watch", void 0), t([r({
|
|
772
|
+
type: Boolean,
|
|
773
|
+
attribute: "high-accuracy"
|
|
774
|
+
})], b.prototype, "highAccuracy", void 0), t([r({
|
|
775
|
+
type: Number,
|
|
776
|
+
attribute: "timeout"
|
|
777
|
+
})], b.prototype, "timeout", void 0), t([r({
|
|
778
|
+
type: Number,
|
|
779
|
+
attribute: "max-age"
|
|
780
|
+
})], b.prototype, "maxAge", void 0), t([r({ type: Number })], b.prototype, "zoom", void 0), t([r({
|
|
781
|
+
type: Boolean,
|
|
782
|
+
attribute: "follow"
|
|
783
|
+
})], b.prototype, "follow", void 0), t([r({
|
|
784
|
+
type: Boolean,
|
|
785
|
+
reflect: !0
|
|
786
|
+
})], b.prototype, "active", void 0), t([i()], b.prototype, "status", void 0), t([i()], b.prototype, "message", void 0), t([i()], b.prototype, "lastUpdate", void 0), t([i()], b.prototype, "exportDialogOpen", void 0), t([i()], b.prototype, "storedPointCount", void 0), t([i()], b.prototype, "exportFilenameStep", void 0), t([i()], b.prototype, "exportFilename", void 0), t([i()], b.prototype, "eraseAfterExport", void 0), b = d = t([a("webmapx-geolocation-tool")], b);
|
|
787
|
+
//#endregion
|
|
788
|
+
export { b as WebmapxGeolocationTool, y as evaluateGeolocationFix };
|