@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,197 @@
|
|
|
1
|
+
import { a as e, n as t } from "./decorators-B35AgiCU.js";
|
|
2
|
+
import { a as n, i as r, n as i, o as a, s as o, t as s } from "./chunk.AJ3ENQ5C-Ci7Gm2b6.js";
|
|
3
|
+
import { d as c, f as l, l as u, u as d } from "./chunk.YHLNUJ7P-D-kanrCf.js";
|
|
4
|
+
import { a as f } from "./chunk.NYIIDP5N-BikXIStD.js";
|
|
5
|
+
import { t as p } from "./chunk.6CTB5ZDJ-DjZrBd6Y.js";
|
|
6
|
+
import { t as m } from "./chunk.5JY5FUCG-DTXsslmx.js";
|
|
7
|
+
import { css as h, html as g } from "lit";
|
|
8
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.HF7GESMZ.js
|
|
9
|
+
function _(e, t, n) {
|
|
10
|
+
return ((e) => Object.is(e, -0) ? 0 : e)(e < t ? t : e > n ? n : e);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.FW7UWQXB.js
|
|
14
|
+
var v = h`
|
|
15
|
+
:host {
|
|
16
|
+
--max-width: 20rem;
|
|
17
|
+
--hide-delay: 0ms;
|
|
18
|
+
--show-delay: 150ms;
|
|
19
|
+
|
|
20
|
+
display: contents;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tooltip {
|
|
24
|
+
--arrow-size: var(--sl-tooltip-arrow-size);
|
|
25
|
+
--arrow-color: var(--sl-tooltip-background-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tooltip::part(popup) {
|
|
29
|
+
z-index: var(--sl-z-index-tooltip);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tooltip[placement^='top']::part(popup) {
|
|
33
|
+
transform-origin: bottom;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.tooltip[placement^='bottom']::part(popup) {
|
|
37
|
+
transform-origin: top;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tooltip[placement^='left']::part(popup) {
|
|
41
|
+
transform-origin: right;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.tooltip[placement^='right']::part(popup) {
|
|
45
|
+
transform-origin: left;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tooltip__body {
|
|
49
|
+
display: block;
|
|
50
|
+
width: max-content;
|
|
51
|
+
max-width: var(--max-width);
|
|
52
|
+
border-radius: var(--sl-tooltip-border-radius);
|
|
53
|
+
background-color: var(--sl-tooltip-background-color);
|
|
54
|
+
font-family: var(--sl-tooltip-font-family);
|
|
55
|
+
font-size: var(--sl-tooltip-font-size);
|
|
56
|
+
font-weight: var(--sl-tooltip-font-weight);
|
|
57
|
+
line-height: var(--sl-tooltip-line-height);
|
|
58
|
+
text-align: start;
|
|
59
|
+
white-space: normal;
|
|
60
|
+
color: var(--sl-tooltip-color);
|
|
61
|
+
padding: var(--sl-tooltip-padding);
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
user-select: none;
|
|
64
|
+
-webkit-user-select: none;
|
|
65
|
+
}
|
|
66
|
+
`, y = class extends u {
|
|
67
|
+
constructor() {
|
|
68
|
+
super(), this.localize = new p(this), this.content = "", this.placement = "top", this.disabled = !1, this.distance = 8, this.open = !1, this.skidding = 0, this.trigger = "hover focus", this.hoist = !1, this.handleBlur = () => {
|
|
69
|
+
this.hasTrigger("focus") && this.hide();
|
|
70
|
+
}, this.handleClick = () => {
|
|
71
|
+
this.hasTrigger("click") && (this.open ? this.hide() : this.show());
|
|
72
|
+
}, this.handleFocus = () => {
|
|
73
|
+
this.hasTrigger("focus") && this.show();
|
|
74
|
+
}, this.handleDocumentKeyDown = (e) => {
|
|
75
|
+
e.key === "Escape" && (e.stopPropagation(), this.hide());
|
|
76
|
+
}, this.handleMouseOver = () => {
|
|
77
|
+
if (this.hasTrigger("hover")) {
|
|
78
|
+
let e = i(getComputedStyle(this).getPropertyValue("--show-delay"));
|
|
79
|
+
clearTimeout(this.hoverTimeout), this.hoverTimeout = window.setTimeout(() => this.show(), e);
|
|
80
|
+
}
|
|
81
|
+
}, this.handleMouseOut = () => {
|
|
82
|
+
if (this.hasTrigger("hover")) {
|
|
83
|
+
let e = i(getComputedStyle(this).getPropertyValue("--hide-delay"));
|
|
84
|
+
clearTimeout(this.hoverTimeout), this.hoverTimeout = window.setTimeout(() => this.hide(), e);
|
|
85
|
+
}
|
|
86
|
+
}, this.addEventListener("blur", this.handleBlur, !0), this.addEventListener("focus", this.handleFocus, !0), this.addEventListener("click", this.handleClick), this.addEventListener("mouseover", this.handleMouseOver), this.addEventListener("mouseout", this.handleMouseOut);
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
var e;
|
|
90
|
+
super.disconnectedCallback(), (e = this.closeWatcher) == null || e.destroy(), document.removeEventListener("keydown", this.handleDocumentKeyDown);
|
|
91
|
+
}
|
|
92
|
+
firstUpdated() {
|
|
93
|
+
this.body.hidden = !this.open, this.open && (this.popup.active = !0, this.popup.reposition());
|
|
94
|
+
}
|
|
95
|
+
hasTrigger(e) {
|
|
96
|
+
return this.trigger.split(" ").includes(e);
|
|
97
|
+
}
|
|
98
|
+
async handleOpenChange() {
|
|
99
|
+
var e, t;
|
|
100
|
+
if (this.open) {
|
|
101
|
+
if (this.disabled) return;
|
|
102
|
+
this.emit("sl-show"), "CloseWatcher" in window ? ((e = this.closeWatcher) == null || e.destroy(), this.closeWatcher = new CloseWatcher(), this.closeWatcher.onclose = () => {
|
|
103
|
+
this.hide();
|
|
104
|
+
}) : document.addEventListener("keydown", this.handleDocumentKeyDown), await r(this.body), this.body.hidden = !1, this.popup.active = !0;
|
|
105
|
+
let { keyframes: t, options: n } = a(this, "tooltip.show", { dir: this.localize.dir() });
|
|
106
|
+
await s(this.popup.popup, t, n), this.popup.reposition(), this.emit("sl-after-show");
|
|
107
|
+
} else {
|
|
108
|
+
this.emit("sl-hide"), (t = this.closeWatcher) == null || t.destroy(), document.removeEventListener("keydown", this.handleDocumentKeyDown), await r(this.body);
|
|
109
|
+
let { keyframes: e, options: n } = a(this, "tooltip.hide", { dir: this.localize.dir() });
|
|
110
|
+
await s(this.popup.popup, e, n), this.popup.active = !1, this.body.hidden = !0, this.emit("sl-after-hide");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async handleOptionsChange() {
|
|
114
|
+
this.hasUpdated && (await this.updateComplete, this.popup.reposition());
|
|
115
|
+
}
|
|
116
|
+
handleDisabledChange() {
|
|
117
|
+
this.disabled && this.open && this.hide();
|
|
118
|
+
}
|
|
119
|
+
async show() {
|
|
120
|
+
if (!this.open) return this.open = !0, n(this, "sl-after-show");
|
|
121
|
+
}
|
|
122
|
+
async hide() {
|
|
123
|
+
if (this.open) return this.open = !1, n(this, "sl-after-hide");
|
|
124
|
+
}
|
|
125
|
+
render() {
|
|
126
|
+
return g`
|
|
127
|
+
<sl-popup
|
|
128
|
+
part="base"
|
|
129
|
+
exportparts="
|
|
130
|
+
popup:base__popup,
|
|
131
|
+
arrow:base__arrow
|
|
132
|
+
"
|
|
133
|
+
class=${f({
|
|
134
|
+
tooltip: !0,
|
|
135
|
+
"tooltip--open": this.open
|
|
136
|
+
})}
|
|
137
|
+
placement=${this.placement}
|
|
138
|
+
distance=${this.distance}
|
|
139
|
+
skidding=${this.skidding}
|
|
140
|
+
strategy=${this.hoist ? "fixed" : "absolute"}
|
|
141
|
+
flip
|
|
142
|
+
shift
|
|
143
|
+
arrow
|
|
144
|
+
hover-bridge
|
|
145
|
+
>
|
|
146
|
+
${""}
|
|
147
|
+
<slot slot="anchor" aria-describedby="tooltip"></slot>
|
|
148
|
+
|
|
149
|
+
${""}
|
|
150
|
+
<div part="body" id="tooltip" class="tooltip__body" role="tooltip" aria-live=${this.open ? "polite" : "off"}>
|
|
151
|
+
<slot name="content">${this.content}</slot>
|
|
152
|
+
</div>
|
|
153
|
+
</sl-popup>
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.URTPIBTY.js
|
|
159
|
+
y.styles = [d, v], y.dependencies = { "sl-popup": m }, l([t("slot:not([name])")], y.prototype, "defaultSlot", 2), l([t(".tooltip__body")], y.prototype, "body", 2), l([t("sl-popup")], y.prototype, "popup", 2), l([e()], y.prototype, "content", 2), l([e()], y.prototype, "placement", 2), l([e({
|
|
160
|
+
type: Boolean,
|
|
161
|
+
reflect: !0
|
|
162
|
+
})], y.prototype, "disabled", 2), l([e({ type: Number })], y.prototype, "distance", 2), l([e({
|
|
163
|
+
type: Boolean,
|
|
164
|
+
reflect: !0
|
|
165
|
+
})], y.prototype, "open", 2), l([e({ type: Number })], y.prototype, "skidding", 2), l([e()], y.prototype, "trigger", 2), l([e({ type: Boolean })], y.prototype, "hoist", 2), l([c("open", { waitUntilFirstUpdate: !0 })], y.prototype, "handleOpenChange", 1), l([c([
|
|
166
|
+
"content",
|
|
167
|
+
"distance",
|
|
168
|
+
"hoist",
|
|
169
|
+
"placement",
|
|
170
|
+
"skidding"
|
|
171
|
+
])], y.prototype, "handleOptionsChange", 1), l([c("disabled")], y.prototype, "handleDisabledChange", 1), o("tooltip.show", {
|
|
172
|
+
keyframes: [{
|
|
173
|
+
opacity: 0,
|
|
174
|
+
scale: .8
|
|
175
|
+
}, {
|
|
176
|
+
opacity: 1,
|
|
177
|
+
scale: 1
|
|
178
|
+
}],
|
|
179
|
+
options: {
|
|
180
|
+
duration: 150,
|
|
181
|
+
easing: "ease"
|
|
182
|
+
}
|
|
183
|
+
}), o("tooltip.hide", {
|
|
184
|
+
keyframes: [{
|
|
185
|
+
opacity: 1,
|
|
186
|
+
scale: 1
|
|
187
|
+
}, {
|
|
188
|
+
opacity: 0,
|
|
189
|
+
scale: .8
|
|
190
|
+
}],
|
|
191
|
+
options: {
|
|
192
|
+
duration: 150,
|
|
193
|
+
easing: "ease"
|
|
194
|
+
}
|
|
195
|
+
}), y.define("sl-tooltip");
|
|
196
|
+
//#endregion
|
|
197
|
+
export { _ as t };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { t as e } from "./decorate-CWgUV1hU.js";
|
|
2
|
+
import { t } from "./webmapx-base-tool-Dm9NAWLD.js";
|
|
3
|
+
import { i as n, o as r } from "./decorators-B35AgiCU.js";
|
|
4
|
+
import { css as i, html as a } from "lit";
|
|
5
|
+
//#region src/components/webmapx-3d-tool.ts
|
|
6
|
+
var o, s = [
|
|
7
|
+
0,
|
|
8
|
+
30,
|
|
9
|
+
60
|
|
10
|
+
], c = class extends t {
|
|
11
|
+
static {
|
|
12
|
+
o = this;
|
|
13
|
+
}
|
|
14
|
+
constructor(...e) {
|
|
15
|
+
super(...e), this.pitch = 0, this.terrainEnabled = !1, this.terrainSupported = !1, this.pitchSupported = !0;
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.styles = i`
|
|
19
|
+
:host { display: block; padding: var(--webmapx-tool-padding, 0); font-size: 0.875rem; }
|
|
20
|
+
.unsupported { color: var(--sl-color-neutral-500, #888); font-style: italic; }
|
|
21
|
+
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
|
|
22
|
+
.pitch-buttons { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
|
|
23
|
+
.pitch-buttons button {
|
|
24
|
+
flex: 1; padding: 0.35rem 0; border: 1px solid var(--color-border, #d7dce3);
|
|
25
|
+
border-radius: 4px; background: var(--color-background, #fff); cursor: pointer; font-size: 0.875rem;
|
|
26
|
+
}
|
|
27
|
+
.pitch-buttons button.active {
|
|
28
|
+
background: var(--color-primary, #0f62fe); color: #fff; border-color: var(--color-primary, #0f62fe);
|
|
29
|
+
}
|
|
30
|
+
.pitch-hint { font-size: 0.8rem; color: var(--sl-color-neutral-600, #555); margin-bottom: 0.5rem; line-height: 1.5; }
|
|
31
|
+
.terrain-row { display: flex; align-items: center; gap: 0.5rem; }
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
onMapAttached() {
|
|
35
|
+
this.syncFromAdapter();
|
|
36
|
+
}
|
|
37
|
+
onStateChanged(e) {
|
|
38
|
+
this.syncFromAdapter();
|
|
39
|
+
}
|
|
40
|
+
syncFromAdapter() {
|
|
41
|
+
if (!this.adapter) return;
|
|
42
|
+
let e = this.adapter.getNavigationCapabilities();
|
|
43
|
+
this.pitchSupported = e?.pitch !== !1, this.pitch = this.adapter.getPitch();
|
|
44
|
+
let t = this.adapter.isTerrainEnabled();
|
|
45
|
+
this.terrainSupported = t !== null, this.terrainEnabled = t === !0;
|
|
46
|
+
}
|
|
47
|
+
setPitch(e) {
|
|
48
|
+
this.adapter && (this.adapter.setPitch(e), this.pitch = e);
|
|
49
|
+
}
|
|
50
|
+
getToolAttr(e) {
|
|
51
|
+
let t = this.getAttribute("tool-id"), n = this.toolsConfig ? Object.values(this.toolsConfig) : [];
|
|
52
|
+
for (let r of n) {
|
|
53
|
+
let n = Array.isArray(r?.items) ? r.items : [];
|
|
54
|
+
for (let r of n) if (r?.id === t && typeof r[e] == "string") return r[e];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
getMaplibreTerrainSource() {
|
|
58
|
+
let e = this.layerDataConfig?.sources?.find((e) => e?.type === "raster-dem");
|
|
59
|
+
if (e) return e;
|
|
60
|
+
for (let e of this.layerDataConfig?.layers ?? []) {
|
|
61
|
+
let t = e?.sources;
|
|
62
|
+
if (!(!t || typeof t != "object")) {
|
|
63
|
+
for (let [n, r] of Object.entries(t)) if (r?.type === "raster-dem") {
|
|
64
|
+
let t = e?.id;
|
|
65
|
+
return {
|
|
66
|
+
...r,
|
|
67
|
+
id: t ? `${t}:${n}` : n
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let t = this.getToolAttr("maplibre-terrain-fallback-url");
|
|
73
|
+
if (t) return {
|
|
74
|
+
type: "raster-dem",
|
|
75
|
+
tiles: [t],
|
|
76
|
+
tileSize: 256,
|
|
77
|
+
encoding: "terrarium",
|
|
78
|
+
maxzoom: 15
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
getCesiumTerrainUrl() {
|
|
82
|
+
let e = this.layerDataConfig?.layers?.find((e) => e?.type === "terrain" || e?.type === "cesium-terrain");
|
|
83
|
+
return e?.url ?? e?.source?.url ?? this.getToolAttr("cesium-terrain-fallback-url");
|
|
84
|
+
}
|
|
85
|
+
static {
|
|
86
|
+
this.TERRAIN_LAYER_ID = "webmapx-terrain-hillshade";
|
|
87
|
+
}
|
|
88
|
+
findActiveHillshadeSource() {
|
|
89
|
+
let e = this.store?.getState().mapLayers ?? {};
|
|
90
|
+
for (let [t, n] of Object.entries(e)) {
|
|
91
|
+
if (n?.layerType !== "hillshade") continue;
|
|
92
|
+
let e = n?.sourceId;
|
|
93
|
+
if (e) {
|
|
94
|
+
let t = this.layerDataConfig?.sources?.find((t) => t?.id === e);
|
|
95
|
+
if (t) return t;
|
|
96
|
+
if (this.adapter?.getSource(e)) return {
|
|
97
|
+
id: e,
|
|
98
|
+
type: "raster-dem"
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
let r = n?.sublayers;
|
|
102
|
+
if (r) for (let e of r) {
|
|
103
|
+
if (e?.type !== "hillshade") continue;
|
|
104
|
+
let n = `${t}:${typeof e.source == "string" ? e.source : "source"}`;
|
|
105
|
+
if (this.adapter?.getSource(n)) return {
|
|
106
|
+
id: n,
|
|
107
|
+
type: "raster-dem"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async toggleTerrain() {
|
|
113
|
+
if (!this.adapter) return;
|
|
114
|
+
if (this.mapConfig?.type === "cesium") {
|
|
115
|
+
let e = !this.terrainEnabled;
|
|
116
|
+
this.adapter.setTerrainEnabled(e, this.getCesiumTerrainUrl()) && (this.terrainEnabled = e);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (this.terrainEnabled) {
|
|
120
|
+
this.adapter.setTerrainEnabled(!1), this.terrainEnabled = !1;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
let e = this.findActiveHillshadeSource();
|
|
124
|
+
if (!e) {
|
|
125
|
+
let t = this.getMaplibreTerrainSource();
|
|
126
|
+
if (!t) return;
|
|
127
|
+
let n = t.id ?? "webmapx-terrain-source", r = this.layerDataConfig?.layers?.find((e) => e?.sources?.[n.split(":").pop() ?? ""]?.type === "raster-dem" || e?.id && n.startsWith(e.id))?.title ?? "Terrain (hillshade)", i = {
|
|
128
|
+
id: o.TERRAIN_LAYER_ID,
|
|
129
|
+
type: "hillshade",
|
|
130
|
+
source: n,
|
|
131
|
+
title: r,
|
|
132
|
+
paint: { "hillshade-exaggeration": .2 },
|
|
133
|
+
sources: { [n]: {
|
|
134
|
+
...t,
|
|
135
|
+
id: n
|
|
136
|
+
} }
|
|
137
|
+
};
|
|
138
|
+
if (!await this.adapter.addLayer(i)) return;
|
|
139
|
+
e = {
|
|
140
|
+
...t,
|
|
141
|
+
id: n
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
this.adapter.setTerrainEnabled(!0, e) && (this.terrainEnabled = !0);
|
|
145
|
+
}
|
|
146
|
+
render() {
|
|
147
|
+
if (!this.pitchSupported && !this.terrainSupported) return a`<div class="unsupported">3D view is not supported by this engine.</div>`;
|
|
148
|
+
let e = Math.round(this.pitch), t = s.includes(e) ? e : -1, n = t < 0 && e > 0 && e < 60 ? `${e}°` : "30°", r = t < 0 && e > 60 ? `${e}°` : "60°", i = t < 0 && e > 0 && e <= 60, o = t < 0 && e > 60;
|
|
149
|
+
return a`
|
|
150
|
+
${this.pitchSupported ? a`
|
|
151
|
+
<label>3D terrain and viewing angle</label>
|
|
152
|
+
<div class="pitch-buttons">
|
|
153
|
+
<button class=${t === 0 ? "active" : ""} @click=${() => this.setPitch(0)}>0°</button>
|
|
154
|
+
<button class=${t === 30 || i ? "active" : ""} @click=${() => this.setPitch(30)}>${n}</button>
|
|
155
|
+
<button class=${t === 60 || o ? "active" : ""} @click=${() => this.setPitch(60)}>${r}</button>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="pitch-hint">
|
|
158
|
+
Choose a different viewing angle above,<br>
|
|
159
|
+
or use CTRL + mouse button,<br>
|
|
160
|
+
or drag the compass needle at the bottom left of the map,<br>
|
|
161
|
+
or use 2 fingers on a touch screen.
|
|
162
|
+
</div>
|
|
163
|
+
` : ""}
|
|
164
|
+
${this.terrainSupported ? a`
|
|
165
|
+
<div class="terrain-row">
|
|
166
|
+
<input type="checkbox" id="webmapx-3d-terrain" .checked=${this.terrainEnabled}
|
|
167
|
+
@change=${() => this.toggleTerrain()}>
|
|
168
|
+
<label for="webmapx-3d-terrain" style="margin:0;font-weight:normal;">Show terrain in 3D</label>
|
|
169
|
+
</div>
|
|
170
|
+
` : ""}
|
|
171
|
+
`;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
e([n()], c.prototype, "pitch", void 0), e([n()], c.prototype, "terrainEnabled", void 0), e([n()], c.prototype, "terrainSupported", void 0), e([n()], c.prototype, "pitchSupported", void 0), c = o = e([r("webmapx-3d-tool")], c);
|
|
175
|
+
//#endregion
|
|
176
|
+
export { c as Webmapx3dTool };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { n as e, r as t } from "./decorate-CWgUV1hU.js";
|
|
2
|
+
import { LitElement as n } from "lit";
|
|
3
|
+
//#region src/components/webmapx-base-tool.ts
|
|
4
|
+
var r = class extends n {
|
|
5
|
+
constructor(...e) {
|
|
6
|
+
super(...e), this.adapter = null, this.store = null, this.unsubscribe = null, this.configReadyHandler = null, this.mapReadyHandler = null, this.isSettingValue = !1;
|
|
7
|
+
}
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
if (super.connectedCallback(), !this.hasAttribute("aria-label") && !this.hasAttribute("aria-labelledby")) {
|
|
10
|
+
let e = this.getAttribute("label") ?? this.label, t = this.toolId ?? this.getAttribute("tool-id") ?? void 0, n = e ?? (t ? t.replace(/-/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) : void 0);
|
|
11
|
+
n && this.setAttribute("aria-label", n);
|
|
12
|
+
}
|
|
13
|
+
this.bindToMap();
|
|
14
|
+
}
|
|
15
|
+
disconnectedCallback() {
|
|
16
|
+
this.unsubscribeFromConfig(), this.releaseStore(), super.disconnectedCallback();
|
|
17
|
+
}
|
|
18
|
+
bindToMap() {
|
|
19
|
+
this.releaseStore();
|
|
20
|
+
let t = e(this);
|
|
21
|
+
if (!t) {
|
|
22
|
+
this.subscribeToMapReady();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.adapter = t, this.store = t.store, this.unsubscribe = this.store.subscribe(this.handleStateChange.bind(this)), this.onMapAttached(t), this.onStateChanged(this.store.getState());
|
|
26
|
+
}
|
|
27
|
+
releaseStore() {
|
|
28
|
+
this.unsubscribeFromMapReady(), this.unsubscribe &&= (this.unsubscribe(), null), this.store = null, this.adapter = null, this.onMapDetached();
|
|
29
|
+
}
|
|
30
|
+
subscribeToMapReady() {
|
|
31
|
+
if (this.mapReadyHandler) return;
|
|
32
|
+
let e = t(this);
|
|
33
|
+
e && (this.mapReadyHandler = () => {
|
|
34
|
+
this.unsubscribeFromMapReady(), this.bindToMap();
|
|
35
|
+
}, e.addEventListener("webmapx-map-ready", this.mapReadyHandler));
|
|
36
|
+
}
|
|
37
|
+
unsubscribeFromMapReady() {
|
|
38
|
+
this.mapReadyHandler &&= (t(this)?.removeEventListener("webmapx-map-ready", this.mapReadyHandler), null);
|
|
39
|
+
}
|
|
40
|
+
handleStateChange(e, t) {
|
|
41
|
+
t === "UI" && this.isSettingValue || this.onStateChanged(e);
|
|
42
|
+
}
|
|
43
|
+
onMapAttached(e) {}
|
|
44
|
+
onMapDetached() {}
|
|
45
|
+
get mapHost() {
|
|
46
|
+
return this.closest("webmapx-map");
|
|
47
|
+
}
|
|
48
|
+
get config() {
|
|
49
|
+
return this.mapHost?.config ?? null;
|
|
50
|
+
}
|
|
51
|
+
get mapConfig() {
|
|
52
|
+
return this.config?.map;
|
|
53
|
+
}
|
|
54
|
+
get layerDataConfig() {
|
|
55
|
+
return this.config?.layerData ?? this.config?.catalog;
|
|
56
|
+
}
|
|
57
|
+
get catalogConfig() {
|
|
58
|
+
return this.config?.catalog;
|
|
59
|
+
}
|
|
60
|
+
get toolsConfig() {
|
|
61
|
+
return this.config?.tools;
|
|
62
|
+
}
|
|
63
|
+
subscribeToConfig() {
|
|
64
|
+
this.unsubscribeFromConfig(), this.config && this.onConfigReady(this.config), this.configReadyHandler = (e) => {
|
|
65
|
+
let t = e.detail;
|
|
66
|
+
this.onConfigReady(t.config);
|
|
67
|
+
}, this.mapHost?.addEventListener("webmapx-config-ready", this.configReadyHandler);
|
|
68
|
+
}
|
|
69
|
+
unsubscribeFromConfig() {
|
|
70
|
+
this.configReadyHandler &&= (this.mapHost?.removeEventListener("webmapx-config-ready", this.configReadyHandler), null);
|
|
71
|
+
}
|
|
72
|
+
onConfigReady(e) {}
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { r as t };
|