@vcmap/viewshed 3.0.5 → 4.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/dist/index.js CHANGED
@@ -1,13 +1,119 @@
1
- var Ie = Object.defineProperty;
2
- var Pe = (i, e, o) => e in i ? Ie(i, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[e] = o;
3
- var de = (i, e, o) => Pe(i, typeof e != "symbol" ? e + "" : e, o);
4
- import { VcsCameraPrimitive as Ae, VcsObject as Re, VcsEvent as X, AbstractInteraction as Ne, EventType as Y, Projection as z, SessionType as De, CesiumMap as U, startEditFeaturesSession as ke, startEditGeometrySession as xe, VectorLayer as Le, wgs84Projection as Fe, maxZIndex as je, markVolatile as We, Viewpoint as Be, TransformationMode as Ue, Category as $e, moduleIdSymbol as He } from "../../../assets/core.js";
5
- import { Color as ee, Matrix4 as ze, Transforms as Ge, Primitive as ce, GeometryInstance as ue, SphereGeometry as Ke, ColorGeometryInstanceAttribute as he, PerInstanceColorAppearance as fe, SphereOutlineGeometry as Ye, Math as k, Cartesian3 as W, ShadowMap as Xe, Camera as Je, HeightReference as Ze } from "../../../assets/cesium.js";
6
- import { shallowRef as q, ref as $, nextTick as qe, inject as me, computed as ve, reactive as J, watchEffect as Qe, watch as G, onMounted as et, onUnmounted as tt, resolveComponent as b, openBlock as M, createElementBlock as B, createBlock as N, withCtx as h, createTextVNode as F, toDisplayString as A, createCommentVNode as H, createVNode as p, createElementVNode as it, Fragment as pe, renderList as we, mergeProps as ot } from "../../../assets/vue.js";
7
- import { ol$Observable$unByKey as st, Feature as nt, ol$geom$Point as at, ol$style$Style as rt } from "../../../assets/ol.js";
8
- import { VcsTextField as lt, VcsSlider as dt, VcsLabel as Ce, VcsFormSection as Ee, VcsSelect as ye, VcsFormButton as ct, VcsFeatureTransforms as ut, VcsHelp as ht, makeEditorCollectionComponentClass as ft, WindowSlot as mt, ToolboxType as ge, createSupportedMapMappingFunction as vt, createListExportAction as pt, downloadText as wt, createListImportAction as gt, NotificationType as Z, AbstractConfigEditor as _t } from "../../../assets/ui.js";
9
- import { VContainer as Ve, VRow as be, VCol as Me, VDivider as Ct, VColorPicker as Et } from "../../../assets/vuetify.js";
10
- const Te = Symbol("isMatcher"), yt = Symbol("Integer"), Vt = Symbol("NonEmptyString"), re = /* @__PURE__ */ new Map();
1
+ var ze = Object.defineProperty;
2
+ var He = (e, o, t) => o in e ? ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
+ var C = (e, o, t) => He(e, typeof o != "symbol" ? o + "" : o, t);
4
+ import { VcsCameraPrimitive as Ke, VcsObject as Ye, VcsEvent as se, AbstractInteraction as Xe, EventType as oe, Projection as Z, SessionType as Je, CesiumMap as H, startEditFeaturesSession as Ze, startEditGeometrySession as qe, VectorLayer as Qe, maxZIndex as et, wgs84Projection as tt, markVolatile as it, Viewpoint as ot, TransformationMode as st, Category as nt, moduleIdSymbol as ee } from "../../../assets/core.js";
5
+ import { shallowRef as le, ref as K, nextTick as at, defineComponent as Ae, inject as me, reactive as Q, watchEffect as rt, watch as q, onMounted as lt, onUnmounted as ct, computed as dt, resolveComponent as V, openBlock as N, createElementBlock as te, createCommentVNode as Y, createBlock as W, withCtx as v, createTextVNode as z, toDisplayString as j, createVNode as m, createElementVNode as ut, Fragment as Ve, renderList as Se, toRaw as ht, mergeProps as ft } from "../../../assets/vue.js";
6
+ import { Color as ne, Matrix4 as pt, Transforms as mt, Primitive as Oe, PerInstanceColorAppearance as Te, GeometryInstance as Re, SphereGeometry as vt, ColorGeometryInstanceAttribute as Me, SphereOutlineGeometry as wt, Math as F, Cartesian3 as x, ShadowMap as gt, Camera as Ct, HeightReference as _t } from "../../../assets/cesium.js";
7
+ import { ol$Observable$unByKey as Et, Feature as yt, ol$geom$Point as bt, ol$style$Style as Vt } from "../../../assets/ol.js";
8
+ import { VcsWorkspaceWrapper as St, VcsTextField as Ot, VcsSelect as ke, VcsLabeledSlider as Tt, VcsLabel as De, VcsHelp as Rt, VcsFormSection as $e, VcsFeatureTransforms as Mt, VcsFormButton as Nt, makeEditorCollectionComponentClass as It, WindowSlot as Pt, ToolboxType as Ne, createSupportedMapMappingFunction as At, createListExportAction as kt, downloadText as Dt, createListImportAction as $t, NotificationType as re, AbstractConfigEditor as Lt, VcsCallback as Le } from "../../../assets/ui.js";
9
+ import { VRow as Fe, VDivider as Ft, VCol as We, VColorPicker as Wt, VContainer as jt } from "../../../assets/vuetify.js";
10
+ const b = {
11
+ ERROR: 2,
12
+ WARN: 4,
13
+ INFO: 8,
14
+ DEBUG: 16
15
+ }, G = {
16
+ ERROR: 0,
17
+ WARN: 0,
18
+ INFO: 0,
19
+ DEBUG: 0
20
+ };
21
+ G.ERROR = b.ERROR | b.WARN | b.INFO | b.DEBUG;
22
+ G.WARN = b.WARN | b.INFO | b.DEBUG;
23
+ G.INFO = b.INFO | b.DEBUG;
24
+ G.DEBUG = b.DEBUG;
25
+ const ie = {
26
+ logLevel: b.INFO
27
+ }, ae = /* @__PURE__ */ new Map();
28
+ ae.set(b.ERROR, "error");
29
+ ae.set(b.WARN, "warn");
30
+ ae.set(b.INFO, "info");
31
+ ae.set(b.DEBUG, "log");
32
+ class je {
33
+ /**
34
+ * @param {string=} className
35
+ */
36
+ constructor(o) {
37
+ this.className = o, this.deprecations = /* @__PURE__ */ new Map();
38
+ }
39
+ /**
40
+ * Logs an error message
41
+ * @param {string} msg The message to log.
42
+ * @param {...any} optArgs
43
+ */
44
+ error(o, ...t) {
45
+ ie.logLevel & G.ERROR && this._log(String(o), b.ERROR, t);
46
+ }
47
+ /**
48
+ * Logs a warning message
49
+ * @param {string} msg The message to log.
50
+ * @param {...any} optArgs
51
+ */
52
+ warning(o, ...t) {
53
+ ie.logLevel & G.WARN && this._log(String(o), b.WARN, t);
54
+ }
55
+ /**
56
+ * Deprecate a function. deprecations are stored on the logger
57
+ * @param {string} functionName
58
+ * @param {string=} alternativeFunctionName
59
+ */
60
+ deprecate(o, t) {
61
+ const i = String(o), s = t ? String(t) : null;
62
+ if (!this.deprecations.has(i)) {
63
+ this.deprecations.set(i, s || null);
64
+ let n = `${i} has been deprecated and will be removed`;
65
+ s && (n = `${n}. ${s}`), this.warning(n);
66
+ }
67
+ }
68
+ /**
69
+ * Logs an info message
70
+ * @param {string} msg The message to log.
71
+ * @param {...any} optArgs
72
+ */
73
+ info(o, ...t) {
74
+ ie.logLevel & G.INFO && this._log(String(o), b.INFO, t);
75
+ }
76
+ /**
77
+ * Logs a debug message
78
+ * @param {string} msg The message to log.
79
+ * @param {...any} optArgs
80
+ */
81
+ debug(o, ...t) {
82
+ ie.logLevel & G.DEBUG && this._log(String(o), b.DEBUG, t);
83
+ }
84
+ /**
85
+ * Alias for debug
86
+ * @param {string} msg The message to log.
87
+ * @param {...any} optArgs
88
+ */
89
+ log(o, ...t) {
90
+ ie.logLevel & G.DEBUG && this._log(String(o), b.DEBUG, t);
91
+ }
92
+ /**
93
+ * Logs a message
94
+ * @param {string} msg The message to log.
95
+ * @param {LOG_LEVEL} level
96
+ * @param {Array} optArgs
97
+ * @private
98
+ */
99
+ _log(o, t, i) {
100
+ let s = o;
101
+ this.className && (s = `[${this.className}] ${s}`), console[ae.get(t)](s, ...i), t & b.ERROR && (console.group(), console.trace(), console.groupEnd());
102
+ }
103
+ }
104
+ const ve = /* @__PURE__ */ new Map();
105
+ let ce;
106
+ function Gt() {
107
+ return ce || (ce = new je()), ce;
108
+ }
109
+ function Bt(e) {
110
+ const o = new je(e);
111
+ return ve.set(e, o), o;
112
+ }
113
+ function X(e) {
114
+ return e ? ve.has(e) ? ve.get(e) : Bt(e) : Gt();
115
+ }
116
+ const Ge = Symbol("isMatcher"), Ut = Symbol("Integer"), xt = Symbol("NonEmptyString"), Ee = /* @__PURE__ */ new Map();
11
117
  [
12
118
  [String, "string"],
13
119
  [Number, "number"],
@@ -15,397 +121,389 @@ const Te = Symbol("isMatcher"), yt = Symbol("Integer"), Vt = Symbol("NonEmptyStr
15
121
  [Function, "function"],
16
122
  [void 0, "undefined"],
17
123
  [Symbol, "symbol"]
18
- ].forEach(([i, e]) => {
19
- re.set(i, e);
124
+ ].forEach(([e, o]) => {
125
+ Ee.set(e, o);
20
126
  });
21
- function bt(i) {
22
- return i == null ? void 0 : i[Te];
127
+ function zt(e) {
128
+ return e == null ? void 0 : e[Ge];
23
129
  }
24
- function oe(i) {
25
- if (!i || String(i) !== "[object Object]")
130
+ function we(e) {
131
+ if (!e || String(e) !== "[object Object]")
26
132
  return !1;
27
- const e = Object.getPrototypeOf(i);
28
- if (!e)
133
+ const o = Object.getPrototypeOf(e);
134
+ if (!o)
29
135
  return !0;
30
- const t = {}.hasOwnProperty.call(e, "constructor") && e.constructor;
31
- return typeof t == "function" && String(t) === String(Object);
136
+ const i = {}.hasOwnProperty.call(o, "constructor") && o.constructor;
137
+ return typeof i == "function" && String(i) === String(Object);
32
138
  }
33
- function R(i, e) {
34
- if (i === null)
139
+ function A(e, o) {
140
+ if (e === null)
35
141
  return "null";
36
- if (typeof i > "u")
142
+ if (typeof e > "u")
37
143
  return "undefined";
38
- if (e)
39
- return typeof i;
40
- let o;
41
- if (Array.isArray(i))
42
- o = `[${i.map((s) => R(s, e)).join(",")}]`;
144
+ if (o)
145
+ return typeof e;
146
+ let t;
147
+ if (Array.isArray(e))
148
+ t = `[${e.map((s) => A(s, o)).join(",")}]`;
43
149
  else
44
150
  try {
45
- o = JSON.stringify(i);
151
+ t = JSON.stringify(e);
46
152
  } catch {
47
- o = typeof i;
153
+ t = typeof e;
48
154
  }
49
- return o = o || typeof i, o.length > 20 ? `${o.substring(0, 20)}...` : o;
155
+ return t = t || typeof e, t.length > 20 ? `${t.substring(0, 20)}...` : t;
50
156
  }
51
- function Mt(i, e) {
52
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" ? i === e ? !1 : `Expected ${R(i)} to equal ${e.toString()}` : null;
157
+ function Ht(e, o) {
158
+ return typeof o == "string" || typeof o == "number" || typeof o == "boolean" || typeof o == "symbol" ? e === o ? !1 : `Expected ${A(e)} to equal ${o.toString()}` : null;
53
159
  }
54
- function Tt(i, e, o) {
55
- if (Array.isArray(e)) {
56
- if (e.length !== 1)
160
+ function Kt(e, o, t) {
161
+ if (Array.isArray(o)) {
162
+ if (o.length !== 1)
57
163
  throw new Error("Array patterns may only have one type");
58
- if (Array.isArray(i)) {
59
- let t = !1;
60
- return i.findIndex((n) => (t = o(n, e[0]), t)) > -1 ? `${String(t)} in ${R(i)}` : !1;
164
+ if (Array.isArray(e)) {
165
+ let i = !1;
166
+ return e.findIndex((n) => (i = t(n, o[0]), i)) > -1 ? `${String(i)} in ${A(e)}` : !1;
61
167
  }
62
- return `Expected ${R(i)} to be an Array`;
168
+ return `Expected ${A(e)} to be an Array`;
63
169
  }
64
170
  return null;
65
171
  }
66
- function se(i, e, o, t) {
67
- const s = t ? `${t}.` : "";
68
- if (!oe(i))
69
- return `Expected ${R(i)} to be a plain Object`;
70
- let r = !1;
71
- const l = Object.keys(e).find((w) => {
72
- const c = i[w];
73
- return oe(e[w]) ? r = se(c, e[w], o, s + w) : r = o(c, e[w]), r;
172
+ function ge(e, o, t, i) {
173
+ const s = i ? `${i}.` : "";
174
+ if (!we(e))
175
+ return `Expected ${A(e)} to be a plain Object`;
176
+ let d = !1;
177
+ const r = Object.keys(o).find((u) => {
178
+ const l = e[u];
179
+ return we(o[u]) ? d = ge(l, o[u], t, s + u) : d = t(l, o[u]), d;
74
180
  });
75
- return l ? `${String(r)} in object.${s}${l}` : !1;
181
+ return r ? `${String(d)} in object.${s}${r}` : !1;
76
182
  }
77
- function St(i, e) {
78
- if (e === Number)
79
- return Number.isFinite(i) ? !1 : `expected ${R(i)} to be a number, excluding NaN`;
80
- if (e === yt)
81
- return Number.isInteger(i) ? !1 : `expected ${R(i)} to be an integer number`;
82
- if (e === Vt)
83
- return typeof i == "string" && i.length > 0 ? !1 : `expected ${R(i)} to be a non-empty string`;
84
- const o = re.get(e);
85
- return o ? typeof i === o ? !1 : `expected ${R(i)} to be a ${String(o)}` : null;
183
+ function Yt(e, o) {
184
+ if (o === Number)
185
+ return Number.isFinite(e) ? !1 : `expected ${A(e)} to be a number, excluding NaN`;
186
+ if (o === Ut)
187
+ return Number.isInteger(e) ? !1 : `expected ${A(e)} to be an integer number`;
188
+ if (o === xt)
189
+ return typeof e == "string" && e.length > 0 ? !1 : `expected ${A(e)} to be a non-empty string`;
190
+ const t = Ee.get(o);
191
+ return t ? typeof e === t ? !1 : `expected ${A(e)} to be a ${String(t)}` : null;
86
192
  }
87
- function Se(i) {
88
- if (i === null)
193
+ function Be(e) {
194
+ if (e === null)
89
195
  return "null";
90
- const e = re.get(i);
91
- if (e)
92
- return e;
93
- const o = i == null ? void 0 : i.className;
196
+ const o = Ee.get(e);
94
197
  if (o)
95
198
  return o;
96
- let t = String(i);
97
- const s = t.match(/function (.*)\(/);
199
+ const t = e == null ? void 0 : e.className;
200
+ if (t)
201
+ return t;
202
+ let i = String(e);
203
+ const s = i.match(/function (.*)\(/);
98
204
  if (s && s.length > 1) {
99
- const n = i == null ? void 0 : i.name;
205
+ const n = e == null ? void 0 : e.name;
100
206
  return n || s[1].substring(0, 20);
101
207
  }
102
- if (oe(i)) {
208
+ if (we(e)) {
103
209
  const n = {};
104
- Object.keys(i).forEach((r) => {
105
- n[r] = Se(i[r]);
210
+ Object.keys(e).forEach((d) => {
211
+ n[d] = Be(e[d]);
106
212
  });
107
213
  try {
108
- t = `Object of ${JSON.stringify(n)}`;
214
+ i = `Object of ${JSON.stringify(n)}`;
109
215
  } catch {
110
- t = "Object";
216
+ i = "Object";
111
217
  }
112
218
  }
113
- return t;
219
+ return i;
114
220
  }
115
- function Ot(i, e) {
116
- const o = (t, s) => {
117
- if (bt(s))
118
- return s(t);
221
+ function Xt(e, o) {
222
+ const t = (i, s) => {
223
+ if (zt(s))
224
+ return s(i);
119
225
  if (s == null)
120
- return t === s ? !1 : `Expected ${R(t)} to be ${String(s)}`;
121
- const n = St(t, s);
226
+ return i === s ? !1 : `Expected ${A(i)} to be ${String(s)}`;
227
+ const n = Yt(i, s);
122
228
  if (n !== null)
123
229
  return n;
124
- const r = Mt(t, s);
125
- if (r !== null)
126
- return r;
230
+ const d = Ht(i, s);
231
+ if (d !== null)
232
+ return d;
127
233
  if (Array.isArray(s))
128
- return Tt(t, s, o);
234
+ return Kt(i, s, t);
129
235
  if (s === Object)
130
- return se(t, {}, o);
236
+ return ge(i, {}, t);
131
237
  if (s instanceof Function)
132
- return t instanceof s ? !1 : `Expected ${R(t, !0)} to be of Type ${Se(s)}`;
238
+ return i instanceof s ? !1 : `Expected ${A(i, !0)} to be of Type ${Be(s)}`;
133
239
  if (typeof s == "object") {
134
- const l = se(t, s, o);
135
- return l || !1;
240
+ const r = ge(i, s, t);
241
+ return r || !1;
136
242
  }
137
243
  throw new Error(`Cannot handle pattern ${String(s)}`);
138
244
  };
139
- return o(i, e);
245
+ return t(e, o);
140
246
  }
141
- let It = Error;
142
- function le(i, e) {
143
- const o = Ot(i, e);
144
- if (o)
145
- throw new It(`Match failed: ${o}`);
247
+ let Jt = Error;
248
+ function ye(e, o) {
249
+ const t = Xt(e, o);
250
+ if (t)
251
+ throw new Jt(`Match failed: ${t}`);
146
252
  }
147
- function Pt(i) {
148
- le(i, Object);
149
- const e = Object.values(i), o = (t) => e.includes(t) ? !1 : `expected ${R(t)} to be of enum: ${e.join(", ")}`;
150
- return o[Te] = !0, o;
253
+ function Zt(e, o) {
254
+ ye(e, Object);
255
+ let t = Object.values(e);
256
+ const i = (s) => t.includes(s) ? !1 : `expected ${A(s)} to be of enum: ${t.join(", ")}`;
257
+ return i[Ge] = !0, i;
151
258
  }
152
- function At(i, e, o) {
153
- if (i != null) {
154
- const t = Object.values(e).find((s) => s == i);
155
- if (t != null)
156
- return t;
259
+ function Ue(e, o, t) {
260
+ if (e != null) {
261
+ const i = Object.values(o).find((s) => s == e);
262
+ if (i != null)
263
+ return i;
157
264
  }
158
- return o;
265
+ return t;
159
266
  }
160
- const Rt = new ee(), te = new ze();
161
- class Nt extends Ae {
162
- constructor(e) {
163
- super(e), this.spot = e.spot;
267
+ const qt = new ne(), de = new pt();
268
+ class Qt extends Ke {
269
+ constructor(t) {
270
+ super(t);
271
+ C(this, "spot");
272
+ C(this, "_allowPicking");
273
+ C(this, "_color", ne.WHITE);
274
+ C(this, "_camera");
275
+ C(this, "_planesPrimitives", []);
276
+ C(this, "_outlinePrimitives", []);
277
+ this.spot = t.spot, this._camera = t.camera, this._allowPicking = t.allowPicking;
164
278
  }
165
- /**
166
- * Updates the camera primitive.
167
- * @param {unknown} frameState
168
- */
169
- update(e) {
279
+ static get className() {
280
+ return "ViewshedCameraPrimitive";
281
+ }
282
+ update(t) {
170
283
  if (this.show)
171
284
  if (this.spot)
172
- super.update(e);
285
+ super.update(t);
173
286
  else {
174
- const o = this._planesPrimitives, t = this._outlinePrimitives;
175
- o.length === 0 && (Ge.eastNorthUpToFixedFrame(
287
+ const i = this._planesPrimitives, s = this._outlinePrimitives;
288
+ i.length === 0 && (mt.eastNorthUpToFixedFrame(
176
289
  this._camera.positionWC,
177
290
  void 0,
178
- te
179
- ), o[0] = new ce({
180
- allowPicking: this.allowPicking,
181
- geometryInstances: new ue({
182
- geometry: new Ke({
291
+ de
292
+ ), i[0] = new Oe({
293
+ allowPicking: this._allowPicking,
294
+ geometryInstances: new Re({
295
+ geometry: new vt({
183
296
  radius: 2
184
297
  }),
185
298
  attributes: {
186
- color: he.fromColor(
187
- ee.fromAlpha(this._color, 0.1, Rt)
299
+ color: Me.fromColor(
300
+ ne.fromAlpha(this._color, 0.1, qt)
188
301
  )
189
302
  },
190
- modelMatrix: te
303
+ modelMatrix: de
191
304
  }),
192
- appearance: new fe({
305
+ appearance: new Te({
193
306
  translucent: !0,
194
307
  flat: !0
195
308
  }),
196
309
  asynchronous: !1
197
- }), t[0] = new ce({
198
- allowPicking: this.allowPicking,
199
- geometryInstances: new ue({
200
- geometry: new Ye({
310
+ }), s[0] = new Oe({
311
+ allowPicking: this._allowPicking,
312
+ geometryInstances: new Re({
313
+ geometry: new wt({
201
314
  radius: 2
202
315
  }),
203
316
  attributes: {
204
- color: he.fromColor(this._color)
317
+ color: Me.fromColor(this._color)
205
318
  },
206
- modelMatrix: te
319
+ modelMatrix: de
207
320
  }),
208
- appearance: new fe({
321
+ appearance: new Te({
209
322
  translucent: !1,
210
323
  flat: !0
211
324
  }),
212
325
  asynchronous: !1
213
326
  }));
214
- const { length: s } = o;
215
- for (let n = 0; n < s; ++n)
216
- t[n].update(e), o[n].update(e);
327
+ const { length: n } = i;
328
+ for (let d = 0; d < n; ++d)
329
+ s[d].update(t), i[d].update(t);
217
330
  }
218
331
  }
219
332
  }
220
- const g = {
221
- CONE: "cone",
222
- THREESIXTY: "360"
223
- };
224
- function Dt(i, e) {
225
- const o = new Je(i), t = (
226
- /** @type {import("@vcmap-cesium/engine").PerspectiveFrustum} */
227
- o.frustum
228
- );
229
- return t.fov = e.fov, t.near = e.near, t.aspectRatio = e.aspectRatio, t.far = e.far, o;
333
+ var _ = /* @__PURE__ */ ((e) => (e.CONE = "cone", e.THREESIXTY = "360", e))(_ || {});
334
+ function ei(e, o) {
335
+ const t = new Ct(e), i = t.frustum;
336
+ return i.fov = o.fov, i.near = o.near, i.aspectRatio = o.aspectRatio, i.far = o.far, t;
230
337
  }
231
- const I = class I extends Re {
338
+ const P = class P extends Ye {
339
+ constructor(t) {
340
+ var i, s, n, d, r, u;
341
+ super(t);
342
+ C(this, "_cesiumMap", null);
343
+ C(this, "_shadowCamera", null);
344
+ C(this, "_scene", null);
345
+ C(this, "_frustumOptions");
346
+ C(this, "_headingPitchRollValues");
347
+ /**
348
+ * The viewsheds position, excluding height offset, in lat/lon degrees.
349
+ */
350
+ C(this, "_position");
351
+ C(this, "_viewshedType");
352
+ C(this, "_colors");
353
+ C(this, "_heightOffset");
354
+ C(this, "_shadowMap", null);
355
+ C(this, "_primitive", null);
356
+ C(this, "_showPrimitive");
357
+ C(this, "_positionChanged", new se());
358
+ C(this, "_active", !1);
359
+ this._frustumOptions = {
360
+ fov: ((i = t.frustumOptions) == null ? void 0 : i.fov) || P.getDefaultOptions().frustumOptions.fov,
361
+ far: ((s = t.frustumOptions) == null ? void 0 : s.far) || P.getDefaultOptions().frustumOptions.far,
362
+ near: ((n = t.frustumOptions) == null ? void 0 : n.near) || P.getDefaultOptions().frustumOptions.near,
363
+ aspectRatio: ((d = t.frustumOptions) == null ? void 0 : d.aspectRatio) || P.getDefaultOptions().frustumOptions.aspectRatio
364
+ }, this._headingPitchRollValues = t.orientation || {
365
+ ...P.getDefaultOptions().orientation
366
+ }, this._position = t.position || P.getDefaultOptions().position, this._viewshedType = Ue(
367
+ t.viewshedType,
368
+ _,
369
+ "cone"
370
+ /* CONE */
371
+ ), this._colors = {
372
+ visibleColor: ne.fromCssColorString(
373
+ ((r = t.colorOptions) == null ? void 0 : r.visibleColor) || P.getDefaultOptions().colorOptions.visibleColor
374
+ ),
375
+ shadowColor: ne.fromCssColorString(
376
+ ((u = t.colorOptions) == null ? void 0 : u.shadowColor) || P.getDefaultOptions().colorOptions.shadowColor
377
+ )
378
+ }, this._heightOffset = t.heightOffset || 0, this._showPrimitive = !!t.showPrimitive;
379
+ }
232
380
  static get className() {
233
381
  return "Viewshed";
234
382
  }
235
- /**
236
- * Returns the default viewshed options.
237
- * @returns {{frustum: ShadowFrustumOptions, shadowColor: string, visibleColor: string, orientation: import("@vcmap-cesium/engine").HeadingPitchRollValues, position: import("ol/coordinate").Coordinate}}
238
- */
239
383
  static getDefaultOptions() {
240
384
  return {
241
- frustum: {
242
- fov: k.PI / 3,
385
+ colorOptions: { shadowColor: "#3333331A", visibleColor: "#FF990080" },
386
+ frustumOptions: {
387
+ fov: F.PI / 3,
243
388
  near: 1,
244
389
  aspectRatio: 1,
245
390
  far: 300
246
391
  },
247
- shadowColor: "#3333331A",
248
- visibleColor: "#FF990080",
249
- orientation: {
250
- heading: 0,
251
- pitch: 0,
252
- roll: 0
253
- },
392
+ orientation: { heading: 0, pitch: 0, roll: 0 },
254
393
  position: [0, 0, 0]
255
394
  };
256
395
  }
257
- /**
258
- * @param {ViewshedOptions} options The options for the viewshed.
259
- */
260
- constructor(e) {
261
- var o, t, s, n, r, l;
262
- super(e), this._cesiumMap = null, this._shadowCamera = null, this._scene = null, this._frustumOptions = {
263
- fov: ((o = e.frustumOptions) == null ? void 0 : o.fov) || I.getDefaultOptions().frustum.fov,
264
- far: ((t = e.frustumOptions) == null ? void 0 : t.far) || I.getDefaultOptions().frustum.far,
265
- near: ((s = e.frustumOptions) == null ? void 0 : s.near) || I.getDefaultOptions().frustum.near,
266
- aspectRatio: ((n = e.frustumOptions) == null ? void 0 : n.aspectRatio) || I.getDefaultOptions().frustum.aspectRatio
267
- }, this._headingPitchRollValues = e.orientation || {
268
- ...I.getDefaultOptions().orientation
269
- }, this._position = e.position || I.getDefaultOptions().position, this._viewshedType = At(e.viewshedType, g), this._colors = {
270
- visibleColor: ee.fromCssColorString(
271
- ((r = e.colorOptions) == null ? void 0 : r.visibleColor) || I.getDefaultOptions().visibleColor
272
- ),
273
- shadowColor: ee.fromCssColorString(
274
- ((l = e.colorOptions) == null ? void 0 : l.shadowColor) || I.getDefaultOptions().shadowColor
275
- )
276
- }, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this._positionChanged = new X(), this._active = !1;
277
- }
278
396
  /**
279
397
  * Sets a new position for the shadow map. If no shadow map was created yet, due to missing position, this method triggers the creation of a shadow map.
280
- * @param {import("ol/coordinate").Coordinate} coords The new positions coordinates in degrees
398
+ * @param coords The new positions coordinates in degrees
281
399
  */
282
- set position(e) {
283
- le(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position = W.fromDegrees(
284
- e[0],
285
- e[1],
286
- e[2] + this._heightOffset
287
- ), this._shadowCamera.setView({ orientation: this._headingPitchRollValues }), this._updatePrimitive()), this._positionChanged.raiseEvent(e);
400
+ set position(t) {
401
+ ye(t, [Number]), this._position = t, this._shadowCamera && (this._shadowCamera.position = x.fromDegrees(
402
+ t[0],
403
+ t[1],
404
+ t[2] + this._heightOffset
405
+ ), this._shadowCamera.setView({ orientation: this._headingPitchRollValues }), this._updatePrimitive()), this._positionChanged.raiseEvent(t);
288
406
  }
289
407
  /**
290
- * @returns {import("ol/coordinate").Coordinate} The current position of the viewshed source.
408
+ * @returns The current position of the viewshed source.
291
409
  */
292
410
  get position() {
293
411
  return [...this._position];
294
412
  }
295
413
  /**
296
414
  * Getter for Event that is triggered each time the position is changed.
297
- * @returns {import("@vcmap/core").VcsEvent<number[]>} The new position
415
+ * @returns The new position
298
416
  */
299
417
  get positionChanged() {
300
418
  return this._positionChanged;
301
419
  }
302
420
  /**
303
421
  * Sets the height offset of the viewshed.
304
- * @param {number} value the offset that is added to the position height.
422
+ * @param value the offset that is added to the position height.
305
423
  */
306
- set heightOffset(e) {
307
- this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position = W.fromDegrees(
424
+ set heightOffset(t) {
425
+ this._heightOffset = t, this._shadowCamera && (this._shadowCamera.position = x.fromDegrees(
308
426
  this.position[0],
309
427
  this.position[1],
310
- this.position[2] + e
428
+ this.position[2] + t
311
429
  ), this._updatePrimitive());
312
430
  }
313
- /**
314
- * Getter for height offset.
315
- * @returns {number}
316
- */
317
431
  get heightOffset() {
318
432
  return this._heightOffset;
319
433
  }
320
434
  /**
321
435
  * Sets the reach of the viewshed.
322
- * @param {number} value The distance in meters.
436
+ * @param value The distance in meters.
323
437
  */
324
- set distance(e) {
325
- this._frustumOptions.far = e > I.MIN_DISTANCE ? e : I.MIN_DISTANCE, this._shadowCamera && (this._shadowCamera.frustum.far = this._frustumOptions.far, this._viewshedType === g.THREESIXTY && this._updateShadowMap(), this._viewshedType === g.CONE && this._updatePrimitive());
438
+ set distance(t) {
439
+ this._frustumOptions.far = t > P.MIN_DISTANCE ? t : P.MIN_DISTANCE, this._shadowCamera && (this._shadowCamera.frustum.far = this._frustumOptions.far, this._viewshedType === "360" && this._updateShadowMap(), this._viewshedType === "cone" && this._updatePrimitive());
326
440
  }
327
441
  /**
328
442
  * Returns the reach of the viewshed.
329
- * @returns {number} The distance in meters.
443
+ * @returns The distance in meters.
330
444
  */
331
445
  get distance() {
332
446
  return this._frustumOptions.far;
333
447
  }
334
448
  /**
335
449
  * Sets the field of view of a cone viewshed. Does not have a impact on 360 viewshed.
336
- * @param {number} value The field of view in degrees.
450
+ * @param value The field of view in degrees.
337
451
  */
338
- set fov(e) {
339
- this._frustumOptions.fov = e * k.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = e * k.RADIANS_PER_DEGREE, this._viewshedType === g.CONE && (this._updateShadowMap(), this._updatePrimitive()));
452
+ set fov(t) {
453
+ this._frustumOptions.fov = t * F.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = t * F.RADIANS_PER_DEGREE, this._viewshedType === "cone" && (this._updateShadowMap(), this._updatePrimitive()));
340
454
  }
341
455
  /**
342
456
  * Returns the field of view.
343
- * @returns {number} The field of view in degrees.
457
+ * @returns The field of view in degrees.
344
458
  */
345
459
  get fov() {
346
- return this._frustumOptions.fov * k.DEGREES_PER_RADIAN;
460
+ return this._frustumOptions.fov * F.DEGREES_PER_RADIAN;
347
461
  }
348
462
  /**
349
463
  * Sets the heading of a cone viewshed. Does not have impact on 360 viewshed.
350
- * @param {number} value Heading in degrees.
464
+ * @param value Heading in degrees.
351
465
  */
352
- set heading(e) {
353
- this._headingPitchRollValues.heading = e * k.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
466
+ set heading(t) {
467
+ this._headingPitchRollValues.heading = t * F.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
354
468
  orientation: {
355
- heading: e * k.RADIANS_PER_DEGREE,
469
+ heading: t * F.RADIANS_PER_DEGREE,
356
470
  pitch: this._shadowCamera.pitch,
357
471
  roll: 0
358
472
  }
359
- }), this._viewshedType === g.CONE && this._updatePrimitive());
473
+ }), this._viewshedType === "cone" && this._updatePrimitive());
360
474
  }
361
- /**
362
- * Getter for the heading of a cone viewshed.
363
- * @returns {number} The heading in degress.
364
- */
365
475
  get heading() {
366
- return this._headingPitchRollValues.heading * k.DEGREES_PER_RADIAN;
476
+ return this._headingPitchRollValues.heading * F.DEGREES_PER_RADIAN;
367
477
  }
368
478
  /**
369
479
  * Sets the pitch of a cone viewshed. 0 is horizontal. Does not have impact on 360 viewshed.
370
- * @param {number} value The pitch in degrees.
480
+ * @param value The pitch in degrees.
371
481
  */
372
- set pitch(e) {
373
- if (this._headingPitchRollValues.pitch = e * k.RADIANS_PER_DEGREE, this._shadowCamera) {
374
- const o = e * k.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
375
- this._shadowCamera.lookUp(o), this._viewshedType === g.CONE && this._updatePrimitive();
482
+ set pitch(t) {
483
+ if (this._headingPitchRollValues.pitch = t * F.RADIANS_PER_DEGREE, this._shadowCamera) {
484
+ const i = t * F.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
485
+ this._shadowCamera.lookUp(i), this._viewshedType === "cone" && this._updatePrimitive();
376
486
  }
377
487
  }
378
- /**
379
- * Getter for the pitch of a cone viewshed.
380
- * @returns {number} The pitch in degrees.
381
- */
382
488
  get pitch() {
383
- return this._headingPitchRollValues.pitch * k.DEGREES_PER_RADIAN;
489
+ return this._headingPitchRollValues.pitch * F.DEGREES_PER_RADIAN;
384
490
  }
385
491
  /**
386
492
  * Sets whether the primitive of the viewshed should be shown or not.
387
- * @param {boolean} value
493
+ * @param value
388
494
  */
389
- set showPrimitive(e) {
390
- this._showPrimitive = e, this._updatePrimitive();
495
+ set showPrimitive(t) {
496
+ this._showPrimitive = t, this._updatePrimitive();
391
497
  }
392
498
  /**
393
499
  * Gets if the primitive of the viewshed is shown or not.
394
- * @returns {boolean}
395
500
  */
396
501
  get showPrimitive() {
397
502
  return this._showPrimitive;
398
503
  }
399
- /**
400
- * Returns the type of the Viewshed.
401
- * @returns {ViewshedTypes}
402
- */
403
504
  get type() {
404
505
  return this._viewshedType;
405
506
  }
406
- /**
407
- * @returns {ShadowMap|null}
408
- */
409
507
  get shadowMap() {
410
508
  return this._shadowMap;
411
509
  }
@@ -413,19 +511,19 @@ const I = class I extends Re {
413
511
  * Deactivates the viewshed by removing primitive and removing shadowMap.
414
512
  */
415
513
  deactivate() {
416
- var e;
417
- this._active && (this._removePrimitive(), this._shadowMap.enabled = !1, (e = this._shadowMap) == null || e.destroy(), this._shadowCamera = null, this._scene = null, this._cesiumMap = null, this._shadowMap = null, this._active = !1);
514
+ var t;
515
+ this._active && (this._removePrimitive(), this._shadowMap.enabled = !1, (t = this._shadowMap) == null || t.destroy(), this._shadowCamera = null, this._scene = null, this._cesiumMap = null, this._shadowMap = null, this._active = !1);
418
516
  }
419
517
  /**
420
518
  * Activates viewshed.
421
- * @param {import("@vcmap/core").CesiumMap} cesiumMap The cesium map to which the shadow map of the viewshed is applied to.
519
+ * @param The cesium map to which the shadow map of the viewshed is applied to.
422
520
  */
423
- activate(e) {
424
- if (this._active || (this._active = !0), e !== this._cesiumMap) {
425
- this._cesiumMap = e;
426
- const o = e.getScene();
427
- if (o)
428
- this._shadowCamera = Dt(o, this._frustumOptions), this._position && (this.position = this._position), this._scene = o;
521
+ activate(t) {
522
+ if (this._active || (this._active = !0), t !== this._cesiumMap) {
523
+ this._cesiumMap = t;
524
+ const i = t.getScene();
525
+ if (i)
526
+ this._shadowCamera = ei(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
429
527
  else
430
528
  throw new Error("CesiumMap contains no scene");
431
529
  this._updateShadowMap(), this._updatePrimitive();
@@ -435,13 +533,12 @@ const I = class I extends Re {
435
533
  * Updates the shadow map by creating a new one and applying all the current parameters.
436
534
  */
437
535
  _updateShadowMap() {
438
- var e;
439
- !this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((e = this._shadowMap) == null || e.destroy(), this._shadowMap = new Xe({
440
- // @ts-ignore
536
+ var t;
537
+ !this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((t = this._shadowMap) == null || t.destroy(), this._shadowMap = new gt({
441
538
  context: this._scene.context,
442
539
  lightCamera: this._shadowCamera,
443
540
  enabled: !0,
444
- isPointLight: this._viewshedType === g.THREESIXTY,
541
+ isPointLight: this._viewshedType === "360",
445
542
  softShadows: !0,
446
543
  fromLightSource: !0,
447
544
  cascadesEnabled: !1,
@@ -451,30 +548,31 @@ const I = class I extends Re {
451
548
  }), this._shadowMap.viewshed = this._colors, this._cesiumMap.setShadowMap(this._shadowMap));
452
549
  }
453
550
  _removePrimitive() {
454
- var e;
455
- this._primitive && !this._primitive.isDestroyed() && ((e = this._scene) == null || e.primitives.remove(this._primitive), this._primitive.destroy(), this._primitive = null);
551
+ var t;
552
+ this._primitive && !this._primitive.isDestroyed() && ((t = this._scene) == null || t.primitives.remove(this._primitive), this._primitive.destroy(), this._primitive = null);
456
553
  }
457
554
  _updatePrimitive() {
458
- this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new Nt({
555
+ this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new Qt({
459
556
  camera: this._shadowCamera,
460
557
  allowPicking: !1,
461
- spot: this._viewshedType === g.CONE
558
+ spot: this._viewshedType === "cone"
559
+ /* CONE */
462
560
  }), this._scene.primitives.add(this._primitive)) : this._removePrimitive();
463
561
  }
464
562
  /**
465
563
  * Sets distance and, in case of cone viewsheds, also heading and pitch. Only works when viewshed is **active**.
466
- * @param {number[]} target Point to calculate distance, heading and pitch from.
564
+ * @param target Point to calculate distance, heading and pitch from.
467
565
  */
468
- lookAt(e) {
566
+ lookAt(t) {
469
567
  if (!this._shadowCamera)
470
568
  return;
471
- const o = W.fromDegrees(e[0], e[1], e[2]);
472
- if (this.distance = W.distance(this._shadowCamera.position, o), this.type === g.CONE && !o.equals(this._shadowCamera.position)) {
473
- const t = new W();
474
- W.subtract(o, this._shadowCamera.position, o), W.normalize(o, o), W.normalize(this._shadowCamera.position, t), this._shadowCamera.setView({
569
+ const i = x.fromDegrees(t[0], t[1], t[2]);
570
+ if (this.distance = x.distance(this._shadowCamera.position, i), this.type === "cone" && !i.equals(this._shadowCamera.position)) {
571
+ const s = new x();
572
+ x.subtract(i, this._shadowCamera.position, i), x.normalize(i, i), x.normalize(this._shadowCamera.position, s), this._shadowCamera.setView({
475
573
  orientation: {
476
- direction: o,
477
- up: t
574
+ direction: i,
575
+ up: s
478
576
  }
479
577
  }), this._headingPitchRollValues.heading = this._shadowCamera.heading, this._headingPitchRollValues.pitch = this._shadowCamera.pitch;
480
578
  }
@@ -482,7 +580,6 @@ const I = class I extends Re {
482
580
  }
483
581
  /**
484
582
  * Returns an object with all the settings of a viewshed instance.
485
- * @returns {ViewshedOptions}
486
583
  */
487
584
  toJSON() {
488
585
  return {
@@ -499,24 +596,26 @@ const I = class I extends Re {
499
596
  heightOffset: this.heightOffset
500
597
  };
501
598
  }
502
- /**
503
- * Destroys the viewshed.
504
- */
505
599
  destroy() {
506
- var t;
507
- const e = this._cesiumMap, o = this._shadowMap;
508
- this.deactivate(), ((t = e == null ? void 0 : e.getScene()) == null ? void 0 : t.shadowMap) === o && e.setDefaultShadowMap();
600
+ var s;
601
+ const t = this._cesiumMap, i = this._shadowMap;
602
+ this.deactivate(), ((s = t == null ? void 0 : t.getScene()) == null ? void 0 : s.shadowMap) === i && t.setDefaultShadowMap();
509
603
  }
510
604
  };
511
- de(I, "MIN_DISTANCE", 10);
512
- let D = I;
513
- class kt extends Ne {
514
- /**
515
- *
516
- * @param {import("./viewshed").default} viewshed
517
- */
518
- constructor(e) {
519
- super(Y.CLICKMOVE), this._viewshed = e, this._positioned = new X(), this._finished = new X(), this._position = !1, this.setActive();
605
+ C(P, "MIN_DISTANCE", 10);
606
+ let B = P;
607
+ const T = "@vcmap/viewshed", ti = "4.1.0", ii = "^6.3";
608
+ class oi extends Xe {
609
+ constructor(t) {
610
+ super(oe.CLICKMOVE);
611
+ C(this, "_viewshed");
612
+ C(this, "_positioned", new se());
613
+ C(this, "_finished", new se());
614
+ C(this, "_position", !1);
615
+ this._viewshed = t, this.setActive();
616
+ }
617
+ static get className() {
618
+ return "ViewshedInteraction";
520
619
  }
521
620
  get finished() {
522
621
  return this._finished;
@@ -524,442 +623,514 @@ class kt extends Ne {
524
623
  get positioned() {
525
624
  return this._positioned;
526
625
  }
527
- async pipe(e) {
528
- return e.position && (this._position ? (this._viewshed.lookAt(z.mercatorToWgs84(e.position)), e.type & Y.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = z.mercatorToWgs84(e.position), e.type & Y.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), e;
626
+ async pipe(t) {
627
+ return t.position && (this._position ? (this._viewshed.lookAt(Z.mercatorToWgs84(t.position)), t.type & oe.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = Z.mercatorToWgs84(t.position), t.type & oe.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), Promise.resolve(t);
529
628
  }
530
629
  destroy() {
531
630
  super.destroy(), this._finished.destroy(), this._positioned.destroy();
532
631
  }
533
632
  }
534
- const P = {
535
- ABSOLUTE: "absolute",
536
- RELATIVE: "relative"
537
- }, E = {
538
- CREATE: "create",
539
- VIEW: "view",
540
- EDIT: "edit",
541
- MOVE: "move",
542
- MULTI_SELECT: "multiSelect"
543
- }, _e = 1.8;
544
- function xt(i) {
545
- const e = new Le({
546
- projection: Fe.toJSON(),
547
- zIndex: je - 1
633
+ var J = /* @__PURE__ */ ((e) => (e.ABSOLUTE = "absolute", e.RELATIVE = "relative", e))(J || {}), O = /* @__PURE__ */ ((e) => (e.CREATE = "create", e.VIEW = "view", e.EDIT = "edit", e.MOVE = "move", e.MULTI_SELECT = "multiSelect", e))(O || {});
634
+ const Ie = 1.8;
635
+ function si(e) {
636
+ const o = new Qe({
637
+ projection: tt.toJSON(),
638
+ zIndex: et - 1
639
+ });
640
+ it(o), o.activate().catch((i) => {
641
+ X(T).error("Failed to activate layer", String(i));
548
642
  });
549
- We(e), e.activate();
550
- const o = new nt(new at(i));
551
- return o.setStyle(new rt({})), e.addFeatures([o]), e.vectorProperties.altitudeMode = Ze.NONE, {
552
- layer: e,
553
- feature: o,
643
+ const t = new yt(new bt(e));
644
+ return t.setStyle(new Vt({})), o.addFeatures([t]), o.vectorProperties.altitudeMode = _t.NONE, {
645
+ layer: o,
646
+ feature: t,
554
647
  destroy() {
555
- o.dispose(), e.destroy();
648
+ t.dispose(), o.destroy();
556
649
  }
557
650
  };
558
651
  }
559
- function ie(i, e) {
560
- const o = e === P.ABSOLUTE ? Y.CLICKMOVE : Y.NONE;
561
- i.setActive(o), i.pickPosition = o, i.pullPickedPosition = 1.8;
652
+ function ue(e, o) {
653
+ const t = o === "absolute" ? oe.CLICKMOVE : oe.NONE;
654
+ e.setActive(t), e.pickPosition = t, e.pullPickedPosition = 1.8;
562
655
  }
563
- function Lt(i, e, o) {
564
- const t = q(null), s = $(null), n = $(null), r = $(P.ABSOLUTE);
565
- let l = () => {
656
+ function ni(e, o, t) {
657
+ const i = le(null), s = K(null), n = K(null), d = K(
658
+ "absolute"
659
+ /* ABSOLUTE */
660
+ ), r = le(null);
661
+ let u = () => {
566
662
  };
567
- const w = q(null), c = q([]);
568
- let d = () => {
663
+ const l = le([]);
664
+ let c = () => {
569
665
  };
570
666
  function f() {
571
667
  var a;
572
- s.value && t.value ? (t.value.deactivate(), o.setVisibility(t.value.name, !1)) : (a = t.value) == null || a.destroy();
668
+ s.value && i.value ? (i.value.deactivate(), t.setVisibility(i.value.name, !1)) : (a = i.value) == null || a.destroy();
573
669
  }
574
- function m(a = !0) {
575
- d(), l(), f(), t.value = null, a && o.clearSelection(), s.value = null, n.value = null;
670
+ function h(a = !0) {
671
+ c(), u(), f(), i.value = null, a && t.clearSelection(), s.value = null, n.value = null;
576
672
  }
577
- function _(a) {
578
- d(), f(), i.maps.activeMap instanceof U && (t.value = a, a.activate(i.maps.activeMap), d = i.maps.activeMap.shadowMapChanged.addEventListener((v) => {
579
- var u;
580
- v !== ((u = t.value) == null ? void 0 : u.shadowMap) && m(!1);
673
+ function g(a) {
674
+ c(), f(), e.maps.activeMap instanceof H && (i.value = a, a.activate(e.maps.activeMap), c = e.maps.activeMap.shadowMapChanged.addEventListener((p) => {
675
+ var E;
676
+ p !== ((E = i.value) == null ? void 0 : E.shadowMap) && h(!1);
581
677
  }));
582
678
  }
583
679
  async function y(a) {
584
- m(), await qe();
585
- const { eventHandler: v } = i.maps, { featureInteraction: u } = v, C = new D({
680
+ h(), await at();
681
+ const { eventHandler: p } = e.maps, { featureInteraction: E } = p, S = new B({
586
682
  viewshedType: a,
587
683
  colorOptions: {
588
- visibleColor: e.visibleColor,
589
- shadowColor: e.shadowColor
684
+ visibleColor: o.visibleColor,
685
+ shadowColor: o.shadowColor
590
686
  },
591
- heightOffset: r.value === P.ABSOLUTE ? 0 : _e
687
+ heightOffset: d.value === "absolute" ? 0 : Ie
592
688
  });
593
- _(C);
594
- const V = new kt(t.value);
595
- V.finished.addEventListener(() => {
596
- l(), t.value ? (t.value.showPrimitive = !0, n.value = E.EDIT) : m();
689
+ g(S);
690
+ const I = new oi(i.value);
691
+ I.finished.addEventListener(() => {
692
+ u(), i.value ? (i.value.showPrimitive = !0, n.value = "edit") : h();
597
693
  });
598
- const O = v.addExclusiveInteraction(
599
- V,
694
+ const w = p.addExclusiveInteraction(
695
+ I,
600
696
  () => {
601
- V.destroy();
697
+ I.destroy();
602
698
  }
603
699
  );
604
- ie(u, r.value), V.positioned.addEventListener(() => {
605
- ie(u, P.ABSOLUTE);
606
- }), l = () => {
607
- O(), V.destroy(), u.setActive(), l = () => {
700
+ ue(E, d.value), I.positioned.addEventListener(() => {
701
+ ue(
702
+ E,
703
+ "absolute"
704
+ /* ABSOLUTE */
705
+ );
706
+ }), u = () => {
707
+ w(), I.destroy(), E.setActive(), u = () => {
608
708
  };
609
- }, n.value = E.CREATE;
709
+ }, n.value = "create";
610
710
  }
611
- function x(a) {
612
- var v;
613
- if (t.value && a) {
614
- l();
711
+ function k(a) {
712
+ var p;
713
+ if (i.value && a) {
714
+ u();
615
715
  const {
616
- layer: u,
617
- feature: C,
618
- destroy: V
619
- } = xt(t.value.position);
620
- i.layers.add(u), c.value = [C], r.value === P.ABSOLUTE ? (w.value = ke(i, u), w.value.setFeatures([C])) : (w.value = xe(i, u), w.value.setFeature(C)), w.value.stopped.addEventListener(() => {
621
- l();
716
+ layer: E,
717
+ feature: S,
718
+ destroy: I
719
+ } = si(i.value.position);
720
+ e.layers.add(E), l.value = [S], d.value === "absolute" ? (r.value = Ze(e, E), r.value.setFeatures([S])) : (r.value = qe(e, E), r.value.setFeature(S)), r.value.stopped.addEventListener(() => {
721
+ u();
622
722
  });
623
- const O = (v = C.getGeometry()) == null ? void 0 : v.on("change", () => {
624
- t.value ? t.value.position = z.mercatorToWgs84(
625
- /** @type {import("ol/geom").Point} */
626
- C.getGeometry().getCoordinates()
627
- ) : m();
723
+ const w = (p = S.getGeometry()) == null ? void 0 : p.on("change", () => {
724
+ i.value ? i.value.position = Z.mercatorToWgs84(
725
+ S.getGeometry().getCoordinates()
726
+ ) : h();
628
727
  });
629
- n.value = E.MOVE, l = () => {
630
- var K;
631
- l = () => {
632
- }, O && st(O), (K = w.value) == null || K.stop(), w.value = null, c.value = [], i.layers.remove(u), V(), n.value = E.EDIT;
728
+ n.value = "move", u = () => {
729
+ var R;
730
+ u = () => {
731
+ }, w && Et(w), (R = r.value) == null || R.stop(), r.value = null, l.value = [], e.layers.remove(E), I(), n.value = "edit";
633
732
  };
634
733
  } else
635
- l();
734
+ u();
636
735
  }
637
- function S(a, v) {
638
- l(), t.value !== v && (_(v), r.value = v.heightOffset ? P.RELATIVE : P.ABSOLUTE), s.value = !!v.properties.title, n.value = a, s.value && o.setVisibility(v.name, !0);
736
+ function M(a, p) {
737
+ u(), i.value !== p && (g(p), d.value = p.heightOffset ? "relative" : "absolute"), s.value = !!p.properties.title, n.value = a, s.value && t.setVisibility(p.name, !0);
639
738
  }
640
- const L = [
641
- o.collectionComponent.collection.removed.addEventListener(
739
+ const U = [
740
+ t.collectionComponent.collection.removed.addEventListener(
642
741
  (a) => {
643
- var v;
644
- o.remove(a.name), ((v = t.value) == null ? void 0 : v.name) === a.name && m();
742
+ var p;
743
+ t.remove(a.name), ((p = i.value) == null ? void 0 : p.name) === a.name && h();
645
744
  }
646
745
  ),
647
- o.renamed.addEventListener(({ item: a, title: v }) => {
648
- var C;
649
- const u = i.windowManager.get(
650
- `${o.collectionComponent.id}-editor`
746
+ t.renamed.addEventListener(({ item: a, title: p }) => {
747
+ var S;
748
+ const E = e.windowManager.get(
749
+ `${t.collectionComponent.id}-editor`
651
750
  );
652
- u && ((C = t.value) == null ? void 0 : C.name) === a.name && (u.state.headerTitle = v);
751
+ E && ((S = i.value) == null ? void 0 : S.name) === a.name && (E.state.headerTitle = p);
653
752
  }),
654
- o.visibilityChanged.addEventListener((a) => {
655
- var u;
656
- const v = ((u = t.value) == null ? void 0 : u.name) === a.name;
657
- v ? m() : (S(E.VIEW, a), o.clearSelection()), o.setVisibility(a.name, !v);
753
+ t.visibilityChanged.addEventListener(({ item: a }) => {
754
+ var E;
755
+ const p = ((E = i.value) == null ? void 0 : E.name) === a.name;
756
+ p ? h() : (M("view", a), t.clearSelection()), t.setVisibility(a.name, !p);
658
757
  })
659
758
  ];
660
- function T(a) {
661
- if (!(a === r.value || !t.value)) {
662
- if (r.value = a, n.value === E.MOVE && l(), n.value === E.CREATE)
663
- ie(
664
- i.maps.eventHandler.featureInteraction,
759
+ function $(a) {
760
+ if (!(a === d.value || !i.value)) {
761
+ if (d.value = a, n.value === "move" && u(), n.value === "create")
762
+ ue(
763
+ e.maps.eventHandler.featureInteraction,
665
764
  a
666
- ), t.value.heightOffset = a === P.ABSOLUTE ? 0 : _e;
667
- else if (n.value === E.EDIT) {
668
- const { position: v, heightOffset: u } = t.value;
669
- a === P.RELATIVE ? i.maps.activeMap.getHeightFromTerrain([z.wgs84ToMercator(v)]).then((C) => {
670
- const V = z.mercatorToWgs84(C[0]);
671
- t.value && (t.value.heightOffset = v[2] - V[2], t.value.position = V);
672
- }) : (t.value.position = [
673
- v[0],
674
- v[1],
675
- v[2] + u
676
- ], t.value.heightOffset = 0);
765
+ ), i.value.heightOffset = a === "absolute" ? 0 : Ie;
766
+ else if (n.value === "edit") {
767
+ const { position: p, heightOffset: E } = i.value;
768
+ a === "relative" ? e.maps.activeMap.getHeightFromTerrain([Z.wgs84ToMercator(p)]).then((S) => {
769
+ const I = Z.mercatorToWgs84(S[0]);
770
+ i.value && (i.value.heightOffset = p[2] - I[2], i.value.position = I);
771
+ }).catch((S) => {
772
+ X(T).error(
773
+ "Failed to get height from terrain",
774
+ String(S)
775
+ );
776
+ }) : (i.value.position = [
777
+ p[0],
778
+ p[1],
779
+ p[2] + E
780
+ ], i.value.heightOffset = 0);
677
781
  }
678
782
  }
679
783
  }
680
784
  return {
681
- currentViewshed: t,
785
+ currentViewshed: i,
682
786
  currentIsPersisted: s,
683
- currentEditSession: w,
684
- currentFeatures: c,
787
+ currentEditSession: r,
788
+ currentFeatures: l,
685
789
  createViewshed: y,
686
790
  viewViewshed(a) {
687
- S(E.VIEW, a);
791
+ M("view", a);
688
792
  },
689
793
  editViewshed(a) {
690
- S(E.EDIT, a), s.value && (o.setSelection(a.name), o.collectionComponent.openEditorWindow(a));
794
+ M("edit", a), s.value && t.setSelection(a.name);
691
795
  },
692
796
  persistCurrent() {
693
- t.value && (o.add(t.value), s.value = !0, o.setSelection(t.value.name), o.setVisibility(t.value.name, !0));
797
+ i.value && (t.add(i.value), s.value = !0, t.setSelection(i.value.name), t.setVisibility(i.value.name, !0));
694
798
  },
695
- moveCurrentViewshed: x,
799
+ moveCurrentViewshed: k,
696
800
  setupMultiSelect() {
697
- l(), n.value = E.MULTI_SELECT, f(), t.value = null;
801
+ u(), n.value = "multiSelect", f(), i.value = null;
698
802
  },
699
803
  mode: n,
700
- heightMode: r,
701
- changeHeightMode: T,
804
+ heightMode: d,
805
+ changeHeightMode: $,
702
806
  async placeCurrentFeaturesOnTerrain() {
703
- var a, v;
704
- if (t.value && ((a = w.value) == null ? void 0 : a.type) === De.EDIT_FEATURES && i.maps.activeMap instanceof U) {
705
- const C = (await i.maps.activeMap.getHeightFromTerrain([
706
- z.wgs84ToMercator((v = t.value) == null ? void 0 : v.position)
707
- ]))[0][2] - t.value.position[2];
708
- w.value.translate(0, 0, C);
807
+ var a, p;
808
+ if (i.value && ((a = r.value) == null ? void 0 : a.type) === Je.EDIT_FEATURES && e.maps.activeMap instanceof H) {
809
+ const S = (await e.maps.activeMap.getHeightFromTerrain([
810
+ Z.wgs84ToMercator((p = i.value) == null ? void 0 : p.position)
811
+ ]))[0][2] - i.value.position[2];
812
+ r.value.translate(0, 0, S);
709
813
  }
710
814
  },
711
- stop: m,
815
+ stop: h,
712
816
  destroy() {
713
- m(), L.forEach((a) => a());
817
+ h(), U.forEach((a) => {
818
+ a();
819
+ });
714
820
  }
715
821
  };
716
822
  }
717
- const Oe = (i, e) => {
718
- const o = i.__vccOpts || i;
719
- for (const [t, s] of e)
720
- o[t] = s;
721
- return o;
722
- }, Ft = {
723
- distance: [D.MIN_DISTANCE, 2e3],
823
+ const ai = {
824
+ distance: [B.MIN_DISTANCE, 2e3],
724
825
  fov: [25, 85],
725
826
  heading: [0, 360],
726
827
  pitch: [-90, 90]
727
- }, jt = {
828
+ }, ri = Ae({
829
+ name: "ViewshedWindow",
728
830
  components: {
729
- VcsTextField: lt,
730
- VContainer: Ve,
731
- VRow: be,
732
- VCol: Me,
733
- VcsSlider: dt,
734
- VcsLabel: Ce,
735
- VcsFormSection: Ee,
736
- VDivider: Ct,
737
- VcsSelect: ye,
738
- VcsFormButton: ct,
739
- VcsFeatureTransforms: ut,
740
- VcsHelp: ht
831
+ VCol: We,
832
+ VDivider: Ft,
833
+ VRow: Fe,
834
+ VcsFormButton: Nt,
835
+ VcsFeatureTransforms: Mt,
836
+ VcsFormSection: $e,
837
+ VcsHelp: Rt,
838
+ VcsLabel: De,
839
+ VcsLabeledSlider: Tt,
840
+ VcsSelect: ke,
841
+ VcsTextField: Ot,
842
+ VcsWorkspaceWrapper: St
741
843
  },
742
- name: "ViewshedWindow",
743
844
  props: {
744
845
  getViewshed: {
745
846
  type: Function,
746
- required: !1,
747
- default: void 0
847
+ default: () => {
848
+ }
748
849
  },
749
850
  selection: {
750
851
  type: Object,
751
- required: !1,
752
- default: void 0
852
+ default: () => {
853
+ }
753
854
  }
754
855
  },
755
- setup(i) {
756
- var v;
757
- const e = (
758
- /** @type {import("./viewshedManager.js").ViewshedManager} */
759
- me("manager")
760
- ), o = (
761
- /** @type {import("@vcmap/ui").VcsUiApp} */
762
- me("vcsApp")
763
- ), {
764
- currentViewshed: t,
856
+ setup(e) {
857
+ var a, p, E, S, I;
858
+ const o = me("manager"), t = me("vcsApp"), {
859
+ currentViewshed: i,
765
860
  mode: s,
766
861
  currentIsPersisted: n
767
- } = e, r = $(
768
- ((v = o.maps.activeMap) == null ? void 0 : v.movementApiCallsDisabled) ?? !1
862
+ } = o, d = K(
863
+ ((a = t.maps.activeMap) == null ? void 0 : a.movementApiCallsDisabled) ?? !1
769
864
  );
770
- let l = () => {
771
- };
772
- const w = ve(() => i.selection);
773
- let c = () => {
865
+ let r, u = () => {
774
866
  };
775
- const d = J({
867
+ const l = Q({
776
868
  X: void 0,
777
869
  Y: void 0,
778
870
  Z: void 0
779
- }), f = q();
780
- let m = () => {
871
+ }), c = le();
872
+ let f = () => {
781
873
  };
782
- const _ = J({
874
+ const h = Q({
783
875
  showPrimitive: !1,
784
- distance: void 0,
785
- fov: void 0,
786
- heading: void 0,
787
- pitch: void 0
788
- }), y = $();
789
- function x() {
790
- t.value && (d.X = t.value.position[0], d.Y = t.value.position[1], d.Z = e.heightMode.value === P.ABSOLUTE ? t.value.position[2] : t.value.heightOffset);
876
+ distance: ((p = i.value) == null ? void 0 : p.distance) || 0,
877
+ fov: ((E = i.value) == null ? void 0 : E.fov) || 0,
878
+ heading: ((S = i.value) == null ? void 0 : S.heading) || 0,
879
+ pitch: ((I = i.value) == null ? void 0 : I.pitch) || 0
880
+ }), g = K();
881
+ function y() {
882
+ i.value && (l.X = i.value.position[0], l.Y = i.value.position[1], l.Z = o.heightMode.value === J.ABSOLUTE ? i.value.position[2] : i.value.heightOffset);
791
883
  }
792
- function S() {
793
- x(), t.value && (_.distance = t.value.distance, _.fov = t.value.fov, _.heading = t.value.heading, _.pitch = t.value.pitch, _.showPrimitive = t.value.showPrimitive, y.value = t.value.type);
884
+ function k() {
885
+ y(), i.value && (h.distance = i.value.distance, h.fov = i.value.fov, h.heading = i.value.heading, h.pitch = i.value.pitch, h.showPrimitive = i.value.showPrimitive, g.value = i.value.type);
794
886
  }
795
- Qe(() => {
796
- t.value && s.value !== E.CREATE && S();
797
- }), G(
798
- t,
887
+ rt(() => {
888
+ i.value && s.value !== O.CREATE && k();
889
+ }), q(
890
+ i,
799
891
  () => {
800
- t.value && (c(), c = t.value.positionChanged.addEventListener(() => {
801
- x(), m();
892
+ i.value && (u(), u = i.value.positionChanged.addEventListener(() => {
893
+ y(), f();
802
894
  }));
803
895
  },
804
896
  { immediate: !0 }
805
897
  );
806
- async function L() {
807
- var V, O;
808
- (V = t.value) == null || V.deactivate();
809
- const u = (
810
- /** @type {import("@vcmap/core").CesiumMap} */
811
- (O = o.maps.activeMap.getScene()) == null ? void 0 : O.camera
812
- ), C = u == null ? void 0 : u.changed.addEventListener(() => {
813
- m();
814
- });
815
- m = () => {
816
- var K;
817
- C == null || C(), f.value = null, (K = t.value) == null || K.activate(o.maps.activeMap), m = () => {
898
+ function M() {
899
+ var D, L;
900
+ (D = i.value) == null || D.deactivate();
901
+ const w = (L = t.maps.activeMap.getScene()) == null ? void 0 : L.camera, R = w == null ? void 0 : w.changed.addEventListener(
902
+ f
903
+ );
904
+ f = () => {
905
+ var be;
906
+ R == null || R(), c.value = null, (be = i.value) == null || be.activate(t.maps.activeMap), f = () => {
818
907
  };
819
908
  };
820
909
  }
821
- et(() => {
822
- var C, V;
823
- const u = (C = i.getViewshed) == null ? void 0 : C.call(i);
824
- u && e.editViewshed(u), l = (V = o.maps.activeMap) == null ? void 0 : V.movementDisabledChanged.addEventListener(
825
- (O) => {
826
- r.value = O.apiCalls;
910
+ lt(() => {
911
+ var R, D;
912
+ const w = (R = e.getViewshed) == null ? void 0 : R.call(e);
913
+ w && o.editViewshed(w), r = (D = t.maps.activeMap) == null ? void 0 : D.movementDisabledChanged.addEventListener(
914
+ (L) => {
915
+ d.value = L.apiCalls;
827
916
  }
828
917
  );
829
- }), tt(() => {
830
- c(), m(), l(), n.value || ((s.value === E.EDIT || s.value === E.MOVE) && t.value ? e.viewViewshed(t.value) : s.value === E.CREATE && e.stop()), w.value && (w.value.length > 1 ? e.setupMultiSelect() : w.value.length === 1 && t.value ? e.viewViewshed(t.value) : (
918
+ }), ct(() => {
919
+ var w;
920
+ u(), f(), r == null || r(), n.value || ((s.value === O.EDIT || s.value === O.MOVE) && i.value ? o.viewViewshed(i.value) : s.value === O.CREATE && o.stop()), (w = e.selection) != null && w.value && (e.selection.value.length > 1 ? o.setupMultiSelect() : e.selection.value.length === 1 && i.value ? o.viewViewshed(i.value) : (
831
921
  // when a persited viewshed is deselected, stops plugin
832
- !w.value.length && s.value === E.EDIT && e.stop(!1)
922
+ !e.selection.value.length && s.value === O.EDIT && o.stop(!1)
833
923
  ));
834
- }), S();
835
- function T(u, C) {
836
- m(), t.value && (_[u] = C, t.value[u] = C);
924
+ }), k();
925
+ function U(w, R) {
926
+ f(), i.value && (h[w] = R, i.value[w] = R);
837
927
  }
838
- const a = ve(() => {
839
- const u = [];
840
- return y.value === g.CONE && u.push({
928
+ const $ = dt(() => {
929
+ const w = [];
930
+ return g.value === _.CONE && w.push({
841
931
  name: "jumpToViewpoint",
842
- title: f.value ? "viewshed.returnToViewpoint" : "viewshed.jumpToViewpoint",
932
+ title: c.value ? "viewshed.returnToViewpoint" : "viewshed.jumpToViewpoint",
843
933
  icon: "mdi-human-male",
844
- active: !!f.value,
845
- disabled: r.value,
934
+ active: !!c.value,
935
+ disabled: d.value,
846
936
  async callback() {
847
- var C, V, O;
848
- e.moveCurrentViewshed(!1), t.value && !f.value ? (f.value = await ((C = o.maps.activeMap) == null ? void 0 : C.getViewpoint()), await ((V = o.maps.activeMap) == null ? void 0 : V.gotoViewpoint(
849
- new Be({
937
+ var R, D, L;
938
+ o.moveCurrentViewshed(!1), i.value && !c.value ? (c.value = await ((R = t.maps.activeMap) == null ? void 0 : R.getViewpoint()), await ((D = t.maps.activeMap) == null ? void 0 : D.gotoViewpoint(
939
+ new ot({
850
940
  groundPosition: [
851
- t.value.position[0],
852
- t.value.position[1],
853
- t.value.position[2] + t.value.heightOffset
941
+ i.value.position[0],
942
+ i.value.position[1],
943
+ i.value.position[2] + i.value.heightOffset
854
944
  ],
855
- heading: t.value.heading,
856
- pitch: t.value.pitch,
945
+ heading: i.value.heading,
946
+ pitch: i.value.pitch,
857
947
  distance: 0,
858
948
  animate: !0
859
949
  // if not animate, async does not work and the cameraChanged listener is triggered immediately. alternatively set timeout
860
950
  })
861
- )), L()) : f.value && ((O = o.maps.activeMap) == null || O.gotoViewpoint(f.value), m());
951
+ )), M()) : c.value && (await ((L = t.maps.activeMap) == null ? void 0 : L.gotoViewpoint(c.value)), f());
862
952
  }
863
- }), u.push({
953
+ }), w.push({
864
954
  name: "moveViewshed",
865
955
  title: "viewshed.move",
866
- icon: e.heightMode.value === P.RELATIVE ? "$vcsEditVertices" : "mdi-axis-arrow",
867
- active: s.value === E.MOVE,
956
+ icon: o.heightMode.value === J.RELATIVE ? "$vcsEditVertices" : "mdi-axis-arrow",
957
+ active: s.value === O.MOVE,
868
958
  callback() {
869
- e.moveCurrentViewshed(
870
- s.value !== E.MOVE
959
+ o.moveCurrentViewshed(
960
+ s.value !== O.MOVE
871
961
  );
872
962
  }
873
- }), u.unshift({
963
+ }), w.unshift({
874
964
  name: "showPrimitive",
875
965
  title: "viewshed.showPrimitive",
876
966
  icon: "mdi-eye",
877
- active: _.showPrimitive,
967
+ active: h.showPrimitive,
878
968
  callback() {
879
- this.active = !this.active, T("showPrimitive", this.active);
969
+ this.active = !this.active, U("showPrimitive", this.active);
880
970
  }
881
- }), u;
971
+ }), w;
882
972
  });
883
973
  return {
884
- position: d,
885
- setPosition(u, C, V) {
886
- if (m(), !!t.value) {
887
- if (V === 2 && e.heightMode.value === P.RELATIVE)
888
- t.value.heightOffset = Number(u);
974
+ position: l,
975
+ setPosition(w, R, D) {
976
+ if (f(), !!i.value) {
977
+ if (D === 2 && o.heightMode.value === J.RELATIVE)
978
+ i.value.heightOffset = Number(w);
889
979
  else {
890
- const O = [...t.value.position];
891
- O[V] = Number(u), t.value.position = O;
980
+ const L = [...i.value.position];
981
+ L[D] = Number(w), i.value.position = L;
892
982
  }
893
- d[C] = Number(u);
983
+ l[R] = Number(w);
894
984
  }
895
985
  },
896
- parameters: _,
897
- setParameter: T,
898
- parameterRanges: Ft,
899
- ViewshedPluginModes: E,
986
+ parameters: h,
987
+ setParameter: U,
988
+ parameterRanges: ai,
989
+ ViewshedPluginModes: O,
900
990
  viewshedMode: s,
901
991
  currentIsPersisted: n,
902
- viewshedType: y,
903
- ViewshedTypes: g,
904
- HeightModes: P,
905
- heightMode: e.heightMode,
906
- TransformationMode: Ue,
907
- changeHeightMode: e.changeHeightMode,
992
+ viewshedType: g,
993
+ ViewshedTypes: _,
994
+ HeightModes: J,
995
+ heightMode: o.heightMode,
996
+ heightModes: Object.values(J).map((w) => ({
997
+ value: w,
998
+ title: `viewshed.${w}`
999
+ })),
1000
+ TransformationMode: st,
1001
+ changeHeightMode: (w) => {
1002
+ o.changeHeightMode(w);
1003
+ },
908
1004
  async createNewViewshed() {
909
- await e.createViewshed(y.value);
1005
+ await o.createViewshed(g.value);
910
1006
  },
911
- addToMyWorkspace: () => e.persistCurrent(),
912
- cancel: () => e.stop(),
913
- headerActions: a
1007
+ addToMyWorkspace: () => {
1008
+ o.persistCurrent();
1009
+ },
1010
+ cancel: () => {
1011
+ o.stop();
1012
+ },
1013
+ headerActions: $
914
1014
  };
915
1015
  }
916
- }, Wt = { key: 0 }, Bt = { class: "px-1 py-0" }, Ut = { key: 0 }, $t = { key: 1 }, Ht = {
917
- key: 3,
918
- class: "d-flex w-full justify-space-between px-2 pt-2 pb-1"
919
- }, zt = {
920
- key: 4,
921
- class: "d-flex w-full justify-end px-2 pt-2 pb-1"
922
- };
923
- function Gt(i, e, o, t, s, n) {
924
- const r = b("VcsHelp"), l = b("v-row"), w = b("VcsFeatureTransforms"), c = b("VcsTextField"), d = b("v-col"), f = b("v-container"), m = b("VcsFormSection"), _ = b("v-divider"), y = b("VcsLabel"), x = b("VcsSelect"), S = b("VcsSlider"), L = b("VcsFormButton");
925
- return M(), B("div", null, [
926
- t.viewshedMode === t.ViewshedPluginModes.CREATE ? (M(), B("div", Wt, [
927
- t.viewshedType === t.ViewshedTypes.CONE ? (M(), N(r, { key: 0 }, {
928
- default: h(() => [
929
- F(
930
- A(i.$t("viewshed.createDescription")),
1016
+ }), xe = (e, o) => {
1017
+ const t = e.__vccOpts || e;
1018
+ for (const [i, s] of o)
1019
+ t[i] = s;
1020
+ return t;
1021
+ }, li = { key: 0 }, ci = { class: "px-1" };
1022
+ function di(e, o, t, i, s, n) {
1023
+ const d = V("VcsHelp"), r = V("VcsLabel"), u = V("v-col"), l = V("VcsSelect"), c = V("v-row"), f = V("v-divider"), h = V("VcsFormButton"), g = V("VcsFeatureTransforms"), y = V("VcsTextField"), k = V("VcsFormSection"), M = V("VcsLabeledSlider"), U = V("VcsWorkspaceWrapper");
1024
+ return N(), te("div", null, [
1025
+ Y(" CREATE "),
1026
+ e.viewshedMode === e.ViewshedPluginModes.CREATE ? (N(), te("div", li, [
1027
+ e.viewshedType === e.ViewshedTypes.CONE ? (N(), W(d, { key: 0 }, {
1028
+ default: v(() => [
1029
+ z(
1030
+ j(e.$t("viewshed.createDescription")),
931
1031
  1
932
1032
  /* TEXT */
933
1033
  )
934
1034
  ]),
935
1035
  _: 1
936
1036
  /* STABLE */
937
- })) : t.viewshedType === t.ViewshedTypes.THREESIXTY ? (M(), N(r, { key: 1 }, {
938
- default: h(() => [
939
- F(
940
- A(i.$t("viewshed.createThreeSixtyDescription")),
1037
+ })) : e.viewshedType === e.ViewshedTypes.THREESIXTY ? (N(), W(d, { key: 1 }, {
1038
+ default: v(() => [
1039
+ z(
1040
+ j(e.$t("viewshed.createThreeSixtyDescription")),
941
1041
  1
942
1042
  /* TEXT */
943
1043
  )
944
1044
  ]),
945
1045
  _: 1
946
1046
  /* STABLE */
947
- })) : H("v-if", !0)
948
- ])) : t.viewshedMode === t.ViewshedPluginModes.EDIT || t.viewshedMode === t.ViewshedPluginModes.MOVE ? (M(), N(m, {
1047
+ })) : Y("v-if", !0),
1048
+ m(c, {
1049
+ "no-gutters": "",
1050
+ class: "px-1"
1051
+ }, {
1052
+ default: v(() => [
1053
+ m(u, null, {
1054
+ default: v(() => [
1055
+ m(r, { "html-for": "heightMode" }, {
1056
+ default: v(() => [
1057
+ z(
1058
+ j(e.$t("viewshed.heightMode")),
1059
+ 1
1060
+ /* TEXT */
1061
+ )
1062
+ ]),
1063
+ _: 1
1064
+ /* STABLE */
1065
+ })
1066
+ ]),
1067
+ _: 1
1068
+ /* STABLE */
1069
+ }),
1070
+ m(u, null, {
1071
+ default: v(() => [
1072
+ m(l, {
1073
+ id: "heightMode",
1074
+ items: e.heightModes,
1075
+ "model-value": e.heightMode,
1076
+ "onUpdate:modelValue": e.changeHeightMode
1077
+ }, null, 8, ["items", "model-value", "onUpdate:modelValue"])
1078
+ ]),
1079
+ _: 1
1080
+ /* STABLE */
1081
+ })
1082
+ ]),
1083
+ _: 1
1084
+ /* STABLE */
1085
+ }),
1086
+ m(f),
1087
+ m(c, {
1088
+ "no-gutters": "",
1089
+ class: "px-2 pt-2 pb-1 d-flex justify-end"
1090
+ }, {
1091
+ default: v(() => [
1092
+ m(h, {
1093
+ onClick: o[0] || (o[0] = ($) => e.cancel())
1094
+ }, {
1095
+ default: v(() => [
1096
+ z(
1097
+ j(e.$t("viewshed.cancel")),
1098
+ 1
1099
+ /* TEXT */
1100
+ )
1101
+ ]),
1102
+ _: 1
1103
+ /* STABLE */
1104
+ })
1105
+ ]),
1106
+ _: 1
1107
+ /* STABLE */
1108
+ })
1109
+ ])) : Y("v-if", !0),
1110
+ Y(" EDIT AND MOVE "),
1111
+ e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (N(), W(U, {
949
1112
  key: 1,
950
- "header-actions": t.headerActions,
951
- heading: "viewshed.viewpoint",
952
- "action-button-list-overflow-count": 3
1113
+ "disable-add": e.currentIsPersisted,
1114
+ class: "wrapper",
1115
+ onAddClicked: e.addToMyWorkspace,
1116
+ onNewClicked: e.createNewViewshed
953
1117
  }, {
954
- default: h(() => [
955
- p(f, { class: "px-1 py-0" }, {
956
- default: h(() => [
957
- p(l, { "no-gutters": "" }, {
958
- default: h(() => [
959
- it(
1118
+ default: v(() => [
1119
+ m(k, {
1120
+ "header-actions": e.headerActions,
1121
+ heading: "viewshed.viewpoint",
1122
+ "action-button-list-overflow-count": 3
1123
+ }, {
1124
+ default: v(() => [
1125
+ m(c, {
1126
+ "no-gutters": "",
1127
+ class: "px-1"
1128
+ }, {
1129
+ default: v(() => [
1130
+ ut(
960
1131
  "span",
961
- Bt,
962
- A(i.$t("viewshed.position")),
1132
+ ci,
1133
+ j(e.$t("viewshed.position")),
963
1134
  1
964
1135
  /* TEXT */
965
1136
  )
@@ -967,13 +1138,14 @@ function Gt(i, e, o, t, s, n) {
967
1138
  _: 1
968
1139
  /* STABLE */
969
1140
  }),
970
- t.viewshedMode === t.ViewshedPluginModes.MOVE && t.heightMode === t.HeightModes.ABSOLUTE ? (M(), N(l, {
1141
+ e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? (N(), W(c, {
971
1142
  key: 0,
972
- "no-gutters": ""
1143
+ "no-gutters": "",
1144
+ class: "px-1"
973
1145
  }, {
974
- default: h(() => [
975
- p(w, {
976
- "transformation-mode": t.TransformationMode.TRANSLATE,
1146
+ default: v(() => [
1147
+ m(g, {
1148
+ "transformation-mode": e.TransformationMode.TRANSLATE,
977
1149
  "feature-properties": { altitudeMode: "absolute" },
978
1150
  "allow-z-input": !0,
979
1151
  class: "w-100"
@@ -981,33 +1153,34 @@ function Gt(i, e, o, t, s, n) {
981
1153
  ]),
982
1154
  _: 1
983
1155
  /* STABLE */
984
- })) : (M(), N(l, {
1156
+ })) : (N(), W(c, {
985
1157
  key: 1,
986
- "no-gutters": ""
1158
+ "no-gutters": "",
1159
+ class: "px-1"
987
1160
  }, {
988
- default: h(() => [
989
- (M(!0), B(
990
- pe,
1161
+ default: v(() => [
1162
+ (N(!0), te(
1163
+ Ve,
991
1164
  null,
992
- we(t.position, (T, a, v) => (M(), N(
993
- d,
1165
+ Se(e.position, ($, a, p) => (N(), W(
1166
+ u,
994
1167
  {
995
- key: v,
1168
+ key: p,
996
1169
  class: "pb-1"
997
1170
  },
998
1171
  {
999
- default: h(() => [
1000
- p(c, {
1001
- "model-value": T,
1002
- "onUpdate:modelValue": (u) => t.setPosition(u, a, v),
1172
+ default: v(() => [
1173
+ m(y, {
1174
+ "model-value": $,
1003
1175
  type: "number",
1004
1176
  prefix: a,
1005
1177
  step: a === "Z" ? 1 : 1e-4,
1006
1178
  unit: a === "Z" ? "m" : "°",
1007
1179
  decimals: a === "Z" ? 2 : 8,
1008
- disabled: t.viewshedMode === t.ViewshedPluginModes.MOVE && !(a === "Z" && t.heightMode === t.HeightModes.RELATIVE),
1009
- "hide-spin-buttons": !0
1010
- }, null, 8, ["model-value", "onUpdate:modelValue", "prefix", "step", "unit", "decimals", "disabled"])
1180
+ disabled: e.viewshedMode === e.ViewshedPluginModes.MOVE && !(a === "Z" && e.heightMode === e.HeightModes.RELATIVE),
1181
+ "hide-spin-buttons": !0,
1182
+ "onUpdate:modelValue": (E) => e.setPosition(E, a, p)
1183
+ }, null, 8, ["model-value", "prefix", "step", "unit", "decimals", "disabled", "onUpdate:modelValue"])
1011
1184
  ]),
1012
1185
  _: 2
1013
1186
  /* DYNAMIC */
@@ -1025,22 +1198,19 @@ function Gt(i, e, o, t, s, n) {
1025
1198
  ]),
1026
1199
  _: 1
1027
1200
  /* STABLE */
1028
- })
1029
- ]),
1030
- _: 1
1031
- /* STABLE */
1032
- }, 8, ["header-actions"])) : H("v-if", !0),
1033
- p(_),
1034
- p(f, { class: "px-1 py-0" }, {
1035
- default: h(() => [
1036
- p(l, { "no-gutters": "" }, {
1037
- default: h(() => [
1038
- p(d, null, {
1039
- default: h(() => [
1040
- p(y, { "html-for": "heightMode" }, {
1041
- default: h(() => [
1042
- F(
1043
- A(i.$t("viewshed.heightMode")),
1201
+ }, 8, ["header-actions"]),
1202
+ m(f),
1203
+ m(c, {
1204
+ "no-gutters": "",
1205
+ class: "px-1"
1206
+ }, {
1207
+ default: v(() => [
1208
+ m(u, null, {
1209
+ default: v(() => [
1210
+ m(r, { "html-for": "heightMode" }, {
1211
+ default: v(() => [
1212
+ z(
1213
+ j(e.$t("viewshed.heightMode")),
1044
1214
  1
1045
1215
  /* TEXT */
1046
1216
  )
@@ -1052,16 +1222,13 @@ function Gt(i, e, o, t, s, n) {
1052
1222
  _: 1
1053
1223
  /* STABLE */
1054
1224
  }),
1055
- p(d, null, {
1056
- default: h(() => [
1057
- p(x, {
1225
+ m(u, null, {
1226
+ default: v(() => [
1227
+ m(l, {
1058
1228
  id: "heightMode",
1059
- items: Object.values(t.HeightModes).map((T) => ({
1060
- value: T,
1061
- title: `viewshed.${T}`
1062
- })),
1063
- "model-value": t.heightMode,
1064
- "onUpdate:modelValue": t.changeHeightMode
1229
+ items: e.heightModes,
1230
+ "model-value": e.heightMode,
1231
+ "onUpdate:modelValue": e.changeHeightMode
1065
1232
  }, null, 8, ["items", "model-value", "onUpdate:modelValue"])
1066
1233
  ]),
1067
1234
  _: 1
@@ -1070,498 +1237,323 @@ function Gt(i, e, o, t, s, n) {
1070
1237
  ]),
1071
1238
  _: 1
1072
1239
  /* STABLE */
1073
- })
1074
- ]),
1075
- _: 1
1076
- /* STABLE */
1077
- }),
1078
- t.viewshedMode === t.ViewshedPluginModes.EDIT || t.viewshedMode === t.ViewshedPluginModes.MOVE ? (M(), N(f, {
1079
- key: 2,
1080
- class: "px-1 pt-0 pb-2"
1081
- }, {
1082
- default: h(() => [
1083
- (M(!0), B(
1084
- pe,
1240
+ }),
1241
+ (N(!0), te(
1242
+ Ve,
1085
1243
  null,
1086
- we(t.parameters, (T, a) => (M(), N(
1087
- l,
1088
- {
1089
- "no-gutters": "",
1090
- key: a
1091
- },
1092
- {
1093
- default: h(() => [
1094
- a === "distance" || t.viewshedType === t.ViewshedTypes.CONE && a !== "showPrimitive" ? (M(), N(
1095
- d,
1096
- { key: 0 },
1097
- {
1098
- default: h(() => [
1099
- p(
1100
- l,
1101
- {
1102
- "no-gutters": "",
1103
- class: "px-1"
1104
- },
1105
- {
1106
- default: h(() => [
1107
- p(
1108
- d,
1109
- null,
1110
- {
1111
- default: h(() => [
1112
- p(y, {
1113
- "html-for": a,
1114
- class: "py-0"
1115
- }, {
1116
- default: h(() => [
1117
- F(
1118
- A(i.$t(`viewshed.${a}`)),
1119
- 1
1120
- /* TEXT */
1121
- )
1122
- ]),
1123
- _: 2
1124
- /* DYNAMIC */
1125
- }, 1032, ["html-for"])
1126
- ]),
1127
- _: 2
1128
- /* DYNAMIC */
1129
- },
1130
- 1024
1131
- /* DYNAMIC_SLOTS */
1132
- ),
1133
- p(
1134
- d,
1135
- { class: "d-flex justify-end align-center" },
1136
- {
1137
- default: h(() => [
1138
- a === "distance" ? (M(), B(
1139
- "span",
1140
- Ut,
1141
- A(`${Math.round(T)} m`),
1142
- 1
1143
- /* TEXT */
1144
- )) : (M(), B(
1145
- "span",
1146
- $t,
1147
- A(`${Math.round(T)} °`),
1148
- 1
1149
- /* TEXT */
1150
- ))
1151
- ]),
1152
- _: 2
1153
- /* DYNAMIC */
1154
- },
1155
- 1024
1156
- /* DYNAMIC_SLOTS */
1157
- )
1158
- ]),
1159
- _: 2
1160
- /* DYNAMIC */
1161
- },
1162
- 1024
1163
- /* DYNAMIC_SLOTS */
1164
- ),
1165
- p(
1166
- l,
1167
- { "no-gutters": "" },
1168
- {
1169
- default: h(() => [
1170
- p(
1171
- d,
1172
- null,
1173
- {
1174
- default: h(() => [
1175
- p(S, {
1176
- id: a,
1177
- class: "pa-0",
1178
- "model-value": T,
1179
- "onUpdate:modelValue": (v) => t.setParameter(a, v),
1180
- type: "number",
1181
- step: "1",
1182
- min: t.parameterRanges[a][0],
1183
- max: t.parameterRanges[a][1]
1184
- }, null, 8, ["id", "model-value", "onUpdate:modelValue", "min", "max"])
1185
- ]),
1186
- _: 2
1187
- /* DYNAMIC */
1188
- },
1189
- 1024
1190
- /* DYNAMIC_SLOTS */
1191
- )
1192
- ]),
1193
- _: 2
1194
- /* DYNAMIC */
1195
- },
1196
- 1024
1197
- /* DYNAMIC_SLOTS */
1198
- )
1199
- ]),
1200
- _: 2
1201
- /* DYNAMIC */
1202
- },
1203
- 1024
1204
- /* DYNAMIC_SLOTS */
1205
- )) : H("v-if", !0)
1206
- ]),
1207
- _: 2
1208
- /* DYNAMIC */
1209
- },
1210
- 1024
1211
- /* DYNAMIC_SLOTS */
1212
- ))),
1244
+ Se(e.parameters, ($, a) => (N(), te("div", {
1245
+ key: a,
1246
+ class: "px-1"
1247
+ }, [
1248
+ a === "distance" || e.viewshedType === e.ViewshedTypes.CONE && a !== "showPrimitive" ? (N(), W(M, {
1249
+ key: 0,
1250
+ class: "pa-0",
1251
+ label: `viewshed.${a}`,
1252
+ unit: a === "distance" ? "m" : "°",
1253
+ min: e.parameterRanges[a][0],
1254
+ max: e.parameterRanges[a][1],
1255
+ step: 1,
1256
+ "text-input-cols": 3,
1257
+ "allow-text-input": "",
1258
+ "hide-spin-buttons": "",
1259
+ "model-value": Math.round(Number($)),
1260
+ "onUpdate:modelValue": (p) => e.setParameter(a, p)
1261
+ }, null, 8, ["label", "unit", "min", "max", "model-value", "onUpdate:modelValue"])) : Y("v-if", !0)
1262
+ ]))),
1213
1263
  128
1214
1264
  /* KEYED_FRAGMENT */
1215
1265
  ))
1216
1266
  ]),
1217
1267
  _: 1
1218
1268
  /* STABLE */
1219
- })) : H("v-if", !0),
1220
- p(_),
1221
- t.viewshedMode === t.ViewshedPluginModes.EDIT || t.viewshedMode === t.ViewshedPluginModes.MOVE ? (M(), B("div", Ht, [
1222
- p(L, {
1223
- onClick: e[0] || (e[0] = (T) => t.addToMyWorkspace()),
1224
- tooltip: "viewshed.addToMyWorkspace",
1225
- icon: "$vcsComponentsPlus",
1226
- disabled: t.currentIsPersisted || void 0
1227
- }, null, 8, ["disabled"]),
1228
- p(L, {
1229
- onClick: e[1] || (e[1] = (T) => t.createNewViewshed()),
1230
- variant: "filled"
1231
- }, {
1232
- default: h(() => [
1233
- F(
1234
- A(i.$t("viewshed.new")),
1235
- 1
1236
- /* TEXT */
1237
- )
1238
- ]),
1239
- _: 1
1240
- /* STABLE */
1241
- })
1242
- ])) : t.viewshedMode === t.ViewshedPluginModes.CREATE ? (M(), B("div", zt, [
1243
- p(L, {
1244
- onClick: e[2] || (e[2] = (T) => t.cancel()),
1245
- variant: "outlined"
1246
- }, {
1247
- default: h(() => [
1248
- F(
1249
- A(i.$t("viewshed.cancel")),
1250
- 1
1251
- /* TEXT */
1252
- )
1253
- ]),
1254
- _: 1
1255
- /* STABLE */
1256
- })
1257
- ])) : H("v-if", !0)
1269
+ }, 8, ["disable-add", "onAddClicked", "onNewClicked"])) : Y("v-if", !0)
1258
1270
  ]);
1259
1271
  }
1260
- const Kt = /* @__PURE__ */ Oe(jt, [["render", Gt]]), j = "@vcmap/viewshed", Yt = "3.0.5", Xt = "^6.0", ne = {
1261
- [g.CONE]: "$vcsViewshed",
1262
- [g.THREESIXTY]: "$vcsViewshedCone"
1272
+ const ui = /* @__PURE__ */ xe(ri, [["render", di]]), Ce = {
1273
+ [_.CONE]: "$vcsViewshed",
1274
+ [_.THREESIXTY]: "$vcsViewshedCone"
1263
1275
  };
1264
- function Jt(i, e, o) {
1265
- const t = $(), s = $(), n = `${o.id}-editor`, r = {
1266
- component: Kt,
1267
- provides: {
1268
- manager: i
1269
- },
1276
+ function hi(e, o, t) {
1277
+ const i = K(""), s = K(), n = `${t.id}-editor`, d = {
1278
+ component: ui,
1279
+ provides: { manager: e },
1270
1280
  state: {
1271
- headerTitle: t,
1281
+ headerTitle: i,
1272
1282
  headerIcon: s,
1273
1283
  styles: { width: "280px", height: "auto" },
1274
- infoUrlCallback: e.getHelpUrlCallback("tools/viewshed.html")
1284
+ infoUrlCallback: o.getHelpUrlCallback("tools/viewshed.html")
1275
1285
  }
1276
1286
  };
1277
- ft(e, o, {
1278
- editor: (m) => ({
1279
- ...r,
1287
+ It(o, t, {
1288
+ editor: (h) => ({
1289
+ ...d,
1280
1290
  props: {
1281
- selection: o.selection,
1282
- getViewshed: () => o.collection.getByKey(m.name)
1291
+ selection: t.selection,
1292
+ getViewshed: () => t.collection.getByKey(h.name)
1283
1293
  }
1284
1294
  })
1285
1295
  });
1286
- function l() {
1287
- i.currentViewshed.value && (s.value = ne[i.currentViewshed.value.type], i.currentIsPersisted.value ? t.value = i.currentViewshed.value.properties.title : i.mode.value === E.CREATE ? t.value = `viewshed.create.${i.currentViewshed.value.type}` : t.value = [
1296
+ function r() {
1297
+ e.currentViewshed.value && (s.value = Ce[e.currentViewshed.value.type], e.currentIsPersisted.value ? i.value = e.currentViewshed.value.properties.title : e.mode.value === O.CREATE ? i.value = `viewshed.create.${e.currentViewshed.value.type}` : i.value = [
1288
1298
  "viewshed.temporary",
1289
- `viewshed.${i.currentViewshed.value.type}`
1299
+ `viewshed.${e.currentViewshed.value.type}`
1290
1300
  ]);
1291
1301
  }
1292
- function w() {
1293
- l(), i.currentViewshed.value && !i.currentIsPersisted.value && (i.mode.value === E.EDIT || i.mode.value === E.MOVE || i.mode.value === E.CREATE) && (e.windowManager.has(n) || e.windowManager.add(
1302
+ function u() {
1303
+ r(), e.currentViewshed.value && !e.currentIsPersisted.value && (e.mode.value === O.EDIT || e.mode.value === O.MOVE || e.mode.value === O.CREATE) && (o.windowManager.has(n) || o.windowManager.add(
1294
1304
  {
1295
- ...r,
1305
+ ...d,
1296
1306
  id: n,
1297
1307
  parentId: "category-manager",
1298
- slot: mt.DYNAMIC_CHILD
1308
+ slot: Pt.DYNAMIC_CHILD
1299
1309
  },
1300
- j
1310
+ T
1301
1311
  ));
1302
1312
  }
1303
- const c = G(i.currentViewshed, (m) => {
1304
- m && w();
1305
- }), d = G(i.currentIsPersisted, (m) => {
1306
- m && l();
1307
- }), f = G(i.mode, () => {
1308
- i.mode.value ? w() : e.windowManager.remove(n);
1313
+ const l = q(e.currentViewshed, (h) => {
1314
+ h && u();
1315
+ }), c = q(e.currentIsPersisted, (h) => {
1316
+ h && r();
1317
+ }), f = q(e.mode, () => {
1318
+ e.mode.value ? u() : o.windowManager.remove(n);
1309
1319
  });
1310
1320
  return {
1311
1321
  destroy() {
1312
- e.windowManager.remove(n), c(), f(), d();
1322
+ o.windowManager.remove(n), l(), f(), c();
1313
1323
  }
1314
1324
  };
1315
1325
  }
1316
- function Zt(i, e, o, t) {
1317
- function s(c) {
1318
- return c === g.CONE ? {
1319
- name: g.CONE,
1320
- icon: ne[g.CONE],
1321
- title: `viewshed.create.${g.CONE}`
1322
- } : c === g.THREESIXTY ? {
1323
- name: g.THREESIXTY,
1324
- icon: ne[g.THREESIXTY],
1325
- title: `viewshed.create.${g.THREESIXTY}`
1326
+ function fi(e, o, t, i) {
1327
+ function s(l) {
1328
+ return l === _.CONE ? {
1329
+ name: _.CONE,
1330
+ icon: Ce[_.CONE],
1331
+ title: `viewshed.create.${_.CONE}`
1332
+ } : l === _.THREESIXTY ? {
1333
+ name: _.THREESIXTY,
1334
+ icon: Ce[_.THREESIXTY],
1335
+ title: `viewshed.create.${_.THREESIXTY}`
1326
1336
  } : void 0;
1327
1337
  }
1328
- let n, r;
1329
- if (t.length === 1) {
1330
- const c = s(t[0]);
1338
+ let n, d;
1339
+ if (i.length === 1) {
1340
+ const l = s(i[0]);
1331
1341
  n = {
1332
- type: ge.SINGLE,
1333
- action: J({
1334
- ...c,
1342
+ type: Ne.SINGLE,
1343
+ action: Q({
1344
+ ...l,
1335
1345
  active: !1,
1336
1346
  background: !1,
1337
- disabled: !(i.maps.activeMap instanceof U),
1338
- callback() {
1339
- this.active ? this.background && e.currentViewshed.value ? e.editViewshed(e.currentViewshed.value) : e.stop() : e.createViewshed(c.name);
1347
+ disabled: !(e.maps.activeMap instanceof H),
1348
+ async callback() {
1349
+ this.active ? this.background && o.currentViewshed.value ? o.editViewshed(o.currentViewshed.value) : o.stop() : l && await o.createViewshed(l.name);
1340
1350
  }
1341
1351
  })
1342
1352
  };
1343
1353
  } else
1344
1354
  n = {
1345
- type: ge.SELECT,
1346
- action: J({
1347
- name: o,
1355
+ type: Ne.SELECT,
1356
+ action: Q({
1357
+ name: t,
1348
1358
  currentIndex: 0,
1349
1359
  active: !1,
1350
1360
  background: !1,
1351
- disabled: !(i.maps.activeMap instanceof U),
1352
- callback() {
1361
+ disabled: !(e.maps.activeMap instanceof H),
1362
+ async callback() {
1353
1363
  if (this.active)
1354
- this.background && e.currentViewshed.value ? e.editViewshed(e.currentViewshed.value) : e.stop();
1364
+ this.background && o.currentViewshed.value ? o.editViewshed(o.currentViewshed.value) : o.stop();
1355
1365
  else {
1356
- const c = this.tools[this.currentIndex].name;
1357
- e.createViewshed(c);
1366
+ const l = this.tools[this.currentIndex].name;
1367
+ await o.createViewshed(l);
1358
1368
  }
1359
1369
  },
1360
- selected(c) {
1361
- c !== this.currentIndex && (this.currentIndex = c);
1362
- const d = this.tools[this.currentIndex].name;
1363
- e.createViewshed(d);
1370
+ async selected(l) {
1371
+ l !== this.currentIndex && (this.currentIndex = l);
1372
+ const c = this.tools[this.currentIndex].name;
1373
+ await o.createViewshed(c);
1364
1374
  },
1365
- tools: t.flatMap(s)
1375
+ tools: i.flatMap((l) => s(l))
1366
1376
  })
1367
- }, r = G(
1368
- e.currentViewshed,
1369
- (c) => {
1370
- c && (n.action.currentIndex = n.action.tools.findIndex(
1371
- (d) => d.name === c.type
1377
+ }, d = q(
1378
+ o.currentViewshed,
1379
+ (l) => {
1380
+ l && (n.action.currentIndex = n.action.tools.findIndex(
1381
+ (c) => c.name === l.type
1372
1382
  ));
1373
1383
  }
1374
1384
  );
1375
- const l = G(e.mode, (c) => {
1376
- c === E.VIEW ? (n.action.background = !0, n.action.active = !0) : c ? (n.action.background = !1, n.action.active = !0) : (n.action.background = !1, n.action.active = !1);
1377
- }), w = i.maps.mapActivated.addEventListener((c) => {
1378
- c instanceof U ? n.action.disabled = !1 : n.action.disabled = !0;
1385
+ const r = q(o.mode, (l) => {
1386
+ l === O.VIEW ? (n.action.background = !0, n.action.active = !0) : l ? (n.action.background = !1, n.action.active = !0) : (n.action.background = !1, n.action.active = !1);
1387
+ }), u = e.maps.mapActivated.addEventListener((l) => {
1388
+ l instanceof H ? n.action.disabled = !1 : n.action.disabled = !0;
1379
1389
  });
1380
1390
  return {
1391
+ toolbox: n,
1381
1392
  destroy() {
1382
- l(), r == null || r(), w();
1383
- },
1384
- toolbox: n
1393
+ r(), d == null || d(), u();
1394
+ }
1385
1395
  };
1386
1396
  }
1387
- function qt(i, e, o, t) {
1388
- le(t, [Pt(g)]);
1389
- const { toolbox: s, destroy: n } = Zt(i, e, o, t), r = i.toolboxManager.add(s, o).id;
1397
+ function pi(e, o, t, i) {
1398
+ ye(i, [Zt(_)]);
1399
+ const { toolbox: s, destroy: n } = fi(e, o, t, i), d = e.toolboxManager.add(s, t).id;
1390
1400
  return () => {
1391
- i.toolboxManager.remove(r), n();
1401
+ e.toolboxManager.remove(d), n();
1392
1402
  };
1393
1403
  }
1394
- class ae extends $e {
1404
+ class _e extends nt {
1395
1405
  static get className() {
1396
1406
  return "ViewshedCategory";
1397
1407
  }
1398
- async _deserializeItem(e) {
1399
- var t;
1400
- if (
1401
- /** @type {import("@vcmap/core").CesiumMap | undefined} */
1402
- (t = this._app) == null ? void 0 : t.maps.getByType(U.className)[0]
1403
- )
1404
- return new D(e);
1408
+ async _deserializeItem(o) {
1409
+ var i;
1410
+ if ((i = this._app) == null ? void 0 : i.maps.getByType(H.className)[0])
1411
+ return Promise.resolve(new B(o));
1405
1412
  throw new Error("No CesiumMap available");
1406
1413
  }
1407
1414
  }
1408
- function Qt(i, e) {
1409
- let o, t = 0;
1415
+ function mi(e, o) {
1416
+ let t, i = 0;
1410
1417
  const s = new Set(
1411
- e.filter((n) => n.type === i).map((n) => n.properties.title)
1418
+ o.filter((n) => n.type === e).map((n) => n.properties.title)
1412
1419
  );
1413
1420
  do
1414
- t += 1, s.has(`${i}-${t}`) || (o = `${i}-${t}`);
1415
- while (!o);
1416
- return o;
1421
+ i += 1, s.has(`${e}-${i}`) || (t = `${e}-${i}`);
1422
+ while (!t);
1423
+ return t;
1417
1424
  }
1418
- async function ei(i) {
1419
- const e = new X(), o = new X(), { collectionComponent: t, category: s } = await i.categoryManager.requestCategory(
1425
+ async function vi(e) {
1426
+ const o = new se(), t = new se(), { collectionComponent: i, category: s } = await e.categoryManager.requestCategory(
1420
1427
  {
1421
- type: ae.className,
1428
+ type: _e.className,
1422
1429
  name: "Viewsheds",
1423
1430
  title: "viewshed.viewshedCategory"
1424
1431
  },
1425
- j,
1426
- {
1427
- selectable: !0,
1428
- renamable: !0,
1429
- removable: !0
1430
- }
1432
+ T,
1433
+ { selectable: !0, renamable: !0, removable: !0 }
1431
1434
  );
1432
- t.addItemMapping({
1433
- mappingFunction: vt(
1434
- [U.className],
1435
- i.maps
1435
+ i.addItemMapping({
1436
+ mappingFunction: At(
1437
+ [H.className],
1438
+ e.maps
1436
1439
  ),
1437
- owner: j
1440
+ owner: T
1438
1441
  });
1439
- const n = (d, f, m) => {
1440
- m.title = d.properties.title, m.titleChanged = (_) => {
1441
- d.properties.title = _, m.title = _, e.raiseEvent({ item: d, title: _ });
1442
- }, m.actions.push(
1443
- J({
1442
+ const n = (c, f, h) => {
1443
+ h.title = c.properties.title, h.titleChanged = (g) => {
1444
+ c.properties.title = g, h.title = g, o.raiseEvent({ item: c, title: g });
1445
+ }, h.actions.push(
1446
+ Q({
1444
1447
  name: "visibilityAction",
1445
1448
  icon: "$vcsCheckbox",
1446
1449
  callback() {
1447
- o.raiseEvent(d);
1450
+ t.raiseEvent({ item: c, visible: !!h.visible });
1448
1451
  }
1449
1452
  })
1450
1453
  );
1451
1454
  };
1452
- i.categoryManager.addMappingFunction(
1455
+ e.categoryManager.addMappingFunction(
1453
1456
  () => !0,
1454
1457
  n,
1455
- j,
1456
- [t.id]
1458
+ T,
1459
+ [i.id]
1457
1460
  );
1458
- const { action: r, destroy: l } = pt(
1459
- t.selection,
1461
+ const { action: d, destroy: r } = kt(
1462
+ i.selection,
1460
1463
  () => {
1461
- const d = t.selection.value.map(
1462
- (f) => t.collection.getByKey(f.name)
1464
+ const c = i.selection.value.map(
1465
+ (f) => i.collection.getByKey(f.name)
1463
1466
  );
1464
- wt(JSON.stringify(d), "viewsheds.json");
1467
+ Dt(JSON.stringify(c), "viewsheds.json");
1465
1468
  },
1466
- j
1467
- ), { action: w, destroy: c } = gt(
1468
- async (d) => {
1469
- const { vueI18n: f } = i, _ = (await Promise.all(
1470
- d.map(async (S) => {
1471
- const L = await S.text();
1469
+ T
1470
+ ), { action: u, destroy: l } = $t(
1471
+ async (c) => {
1472
+ const { vueI18n: f } = e, g = (await Promise.all(
1473
+ c.map(async (M) => {
1474
+ const U = await M.text();
1472
1475
  try {
1473
- return JSON.parse(L).map((a) => new D(a));
1476
+ return JSON.parse(U).map((a) => new B(a));
1474
1477
  } catch {
1475
- i.notifier.add({
1476
- type: Z.ERROR,
1478
+ e.notifier.add({
1479
+ type: re.ERROR,
1477
1480
  message: f.t("components.import.failure", {
1478
- fileName: S.name
1481
+ fileName: M.name
1479
1482
  })
1480
1483
  });
1481
1484
  }
1482
1485
  return [];
1483
1486
  })
1484
- )).flat(), y = _.map((S) => s.collection.add(S)).filter((S) => S != null), x = _.length - y.length;
1485
- if (x > 0)
1486
- return i.notifier.add({
1487
- type: Z.WARNING,
1488
- message: f.t("components.import.addFailure", [x])
1487
+ )).flat(), y = g.map((M) => s.collection.add(M)).filter((M) => M != null), k = g.length - y.length;
1488
+ if (k > 0)
1489
+ return e.notifier.add({
1490
+ type: re.WARNING,
1491
+ message: f.t("components.import.addFailure", [k])
1489
1492
  }), !1;
1490
1493
  if (y.length > 0)
1491
- i.notifier.add({
1492
- type: Z.SUCCESS,
1494
+ e.notifier.add({
1495
+ type: re.SUCCESS,
1493
1496
  message: f.t("components.import.featuresAdded", [
1494
1497
  y.length
1495
1498
  ])
1496
1499
  });
1497
1500
  else
1498
- return i.notifier.add({
1499
- type: Z.ERROR,
1501
+ return e.notifier.add({
1502
+ type: re.ERROR,
1500
1503
  message: f.t("components.import.nothingAdded")
1501
1504
  }), !1;
1502
1505
  return !0;
1503
1506
  },
1504
- i.windowManager,
1505
- j,
1507
+ e.windowManager,
1508
+ T,
1506
1509
  "category-manager"
1507
1510
  );
1508
- return t.addActions([r, w]), {
1509
- renamed: e,
1510
- visibilityChanged: o,
1511
- setSelection(d) {
1512
- d && (t.selection.value = t.items.value.filter((f) => d === f.name));
1511
+ return i.addActions([d, u]), {
1512
+ renamed: o,
1513
+ visibilityChanged: t,
1514
+ setSelection(c) {
1515
+ c && (i.selection.value = i.items.value.filter((f) => c === f.name));
1513
1516
  },
1514
1517
  clearSelection() {
1515
- t.selection.value.length && (t.selection.value = []);
1518
+ i.selection.value.length && (i.selection.value = []);
1516
1519
  },
1517
- setVisibility(d, f) {
1518
- const m = t.items.value.find(
1519
- (_) => d === _.name
1520
+ setVisibility(c, f) {
1521
+ const h = i.items.value.find(
1522
+ (g) => c === g.name
1520
1523
  );
1521
- if (m) {
1522
- const _ = m.actions.find(
1524
+ if (h) {
1525
+ const g = h.actions.find(
1523
1526
  (y) => y.name === "visibilityAction"
1524
1527
  );
1525
- _ && (_.icon = f ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1528
+ g && (g.icon = f ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1526
1529
  }
1527
1530
  },
1528
- add(d) {
1529
- d.properties.title = Qt(
1530
- d.type,
1531
- /** @type {import("./viewshed.js").default[]} */
1532
- [
1533
- ...s.collection
1534
- ]
1535
- ), s.collection.add(d);
1531
+ add(c) {
1532
+ c.properties.title = mi(c.type, [
1533
+ ...s.collection
1534
+ ]), s.collection.add(c);
1536
1535
  },
1537
- remove(d) {
1538
- const f = s.collection.getByKey(d);
1536
+ remove(c) {
1537
+ const f = s.collection.getByKey(c);
1539
1538
  f && s.collection.remove(f);
1540
1539
  },
1541
- collectionComponent: t,
1540
+ collectionComponent: i,
1542
1541
  destroy() {
1543
- i.categoryManager.removeOwner(j), e.destroy(), o.destroy(), l(), c();
1542
+ e.categoryManager.removeOwner(T), o.destroy(), t.destroy(), r(), l();
1544
1543
  }
1545
1544
  };
1546
1545
  }
1547
- function Q() {
1548
- return {
1549
- visibleColor: D.getDefaultOptions().visibleColor,
1550
- shadowColor: D.getDefaultOptions().shadowColor,
1551
- tools: [...Object.values(g)]
1552
- };
1553
- }
1554
- const ti = {
1546
+ const wi = Ae({
1555
1547
  name: "ViewshedConfigEditor",
1556
1548
  components: {
1557
- AbstractConfigEditor: _t,
1558
- VcsFormSection: Ee,
1559
- VContainer: Ve,
1560
- VRow: be,
1561
- VCol: Me,
1562
- VcsLabel: Ce,
1563
- VcsSelect: ye,
1564
- VColorPicker: Et
1549
+ AbstractConfigEditor: Lt,
1550
+ VcsFormSection: $e,
1551
+ VContainer: jt,
1552
+ VRow: Fe,
1553
+ VCol: We,
1554
+ VcsLabel: De,
1555
+ VcsSelect: ke,
1556
+ VColorPicker: Wt
1565
1557
  },
1566
1558
  props: {
1567
1559
  getConfig: {
@@ -1573,41 +1565,46 @@ const ti = {
1573
1565
  required: !0
1574
1566
  }
1575
1567
  },
1576
- setup(i) {
1577
- const e = i.getConfig(), o = $({ ...Q(), ...e });
1578
- function t() {
1579
- i.setConfig(o.value);
1568
+ setup(e) {
1569
+ const o = me("vcsUiApp"), { getDefaultOptions: t } = o.plugins.getByKey(
1570
+ T
1571
+ ), i = K({
1572
+ ...t == null ? void 0 : t(),
1573
+ ...e.getConfig()
1574
+ });
1575
+ function s() {
1576
+ e.setConfig(structuredClone(ht(i.value)));
1580
1577
  }
1581
1578
  return {
1582
- localConfig: o,
1583
- ViewshedTypes: g,
1584
- apply: t,
1585
- toolItems: Object.values(g).map((s) => ({
1586
- value: s,
1587
- title: `viewshed.${s}`
1579
+ localConfig: i,
1580
+ ViewshedTypes: _,
1581
+ apply: s,
1582
+ toolItems: Object.values(_).map((n) => ({
1583
+ value: n,
1584
+ title: `viewshed.${n}`
1588
1585
  }))
1589
1586
  };
1590
1587
  }
1591
- };
1592
- function ii(i, e, o, t, s, n) {
1593
- const r = b("VcsLabel"), l = b("v-col"), w = b("VcsSelect"), c = b("v-row"), d = b("VColorPicker"), f = b("v-container"), m = b("VcsFormSection"), _ = b("AbstractConfigEditor");
1594
- return M(), N(_, ot({ onSubmit: t.apply }, { ...i.$attrs, ...i.$props }), {
1595
- default: h(() => [
1596
- t.localConfig ? (M(), N(m, {
1588
+ });
1589
+ function gi(e, o, t, i, s, n) {
1590
+ const d = V("VcsLabel"), r = V("v-col"), u = V("VcsSelect"), l = V("v-row"), c = V("VColorPicker"), f = V("v-container"), h = V("VcsFormSection"), g = V("AbstractConfigEditor");
1591
+ return N(), W(g, ft({ ...e.$attrs, ...e.$props }, { onSubmit: e.apply }), {
1592
+ default: v(() => [
1593
+ e.localConfig ? (N(), W(h, {
1597
1594
  key: 0,
1598
1595
  heading: "viewshed.editor.general"
1599
1596
  }, {
1600
- default: h(() => [
1601
- p(f, { class: "px-1 py-0" }, {
1602
- default: h(() => [
1603
- p(c, { "no-gutters": "" }, {
1604
- default: h(() => [
1605
- p(l, null, {
1606
- default: h(() => [
1607
- p(r, { "html-for": "viewshed-editor-tools" }, {
1608
- default: h(() => [
1609
- F(
1610
- A(i.$t("viewshed.editor.tools")),
1597
+ default: v(() => [
1598
+ m(f, { class: "px-1 py-0" }, {
1599
+ default: v(() => [
1600
+ m(l, { "no-gutters": "" }, {
1601
+ default: v(() => [
1602
+ m(r, null, {
1603
+ default: v(() => [
1604
+ m(d, { "html-for": "viewshed-editor-tools" }, {
1605
+ default: v(() => [
1606
+ z(
1607
+ j(e.$t("viewshed.editor.tools")),
1611
1608
  1
1612
1609
  /* TEXT */
1613
1610
  )
@@ -1619,15 +1616,15 @@ function ii(i, e, o, t, s, n) {
1619
1616
  _: 1
1620
1617
  /* STABLE */
1621
1618
  }),
1622
- p(l, null, {
1623
- default: h(() => [
1624
- p(w, {
1619
+ m(r, null, {
1620
+ default: v(() => [
1621
+ m(u, {
1625
1622
  id: "viewshed-tools",
1626
- items: t.toolItems,
1627
- modelValue: t.localConfig.tools,
1628
- "onUpdate:modelValue": e[0] || (e[0] = (y) => t.localConfig.tools = y),
1623
+ modelValue: e.localConfig.tools,
1624
+ "onUpdate:modelValue": o[0] || (o[0] = (y) => e.localConfig.tools = y),
1625
+ items: e.toolItems,
1629
1626
  multiple: !0
1630
- }, null, 8, ["items", "modelValue"])
1627
+ }, null, 8, ["modelValue", "items"])
1631
1628
  ]),
1632
1629
  _: 1
1633
1630
  /* STABLE */
@@ -1636,14 +1633,14 @@ function ii(i, e, o, t, s, n) {
1636
1633
  _: 1
1637
1634
  /* STABLE */
1638
1635
  }),
1639
- p(c, { "no-gutters": "" }, {
1640
- default: h(() => [
1641
- p(l, null, {
1642
- default: h(() => [
1643
- p(r, { "html-for": "viewshed-editor-visible-color" }, {
1644
- default: h(() => [
1645
- F(
1646
- A(i.$t("viewshed.editor.visibleColor")),
1636
+ m(l, { "no-gutters": "" }, {
1637
+ default: v(() => [
1638
+ m(r, null, {
1639
+ default: v(() => [
1640
+ m(d, { "html-for": "viewshed-editor-visible-color" }, {
1641
+ default: v(() => [
1642
+ z(
1643
+ j(e.$t("viewshed.editor.visibleColor")),
1647
1644
  1
1648
1645
  /* TEXT */
1649
1646
  )
@@ -1655,11 +1652,11 @@ function ii(i, e, o, t, s, n) {
1655
1652
  _: 1
1656
1653
  /* STABLE */
1657
1654
  }),
1658
- p(l, null, {
1659
- default: h(() => [
1660
- p(d, {
1661
- modelValue: t.localConfig.visibleColor,
1662
- "onUpdate:modelValue": e[1] || (e[1] = (y) => t.localConfig.visibleColor = y),
1655
+ m(r, null, {
1656
+ default: v(() => [
1657
+ m(c, {
1658
+ modelValue: e.localConfig.visibleColor,
1659
+ "onUpdate:modelValue": o[1] || (o[1] = (y) => e.localConfig.visibleColor = y),
1663
1660
  mode: "rgba"
1664
1661
  }, null, 8, ["modelValue"])
1665
1662
  ]),
@@ -1670,14 +1667,14 @@ function ii(i, e, o, t, s, n) {
1670
1667
  _: 1
1671
1668
  /* STABLE */
1672
1669
  }),
1673
- p(c, { "no-gutters": "" }, {
1674
- default: h(() => [
1675
- p(l, null, {
1676
- default: h(() => [
1677
- p(r, { "html-for": "viewshed-editor-shadow-color" }, {
1678
- default: h(() => [
1679
- F(
1680
- A(i.$t("viewshed.editor.shadowColor")),
1670
+ m(l, { "no-gutters": "" }, {
1671
+ default: v(() => [
1672
+ m(r, null, {
1673
+ default: v(() => [
1674
+ m(d, { "html-for": "viewshed-editor-shadow-color" }, {
1675
+ default: v(() => [
1676
+ z(
1677
+ j(e.$t("viewshed.editor.shadowColor")),
1681
1678
  1
1682
1679
  /* TEXT */
1683
1680
  )
@@ -1689,11 +1686,11 @@ function ii(i, e, o, t, s, n) {
1689
1686
  _: 1
1690
1687
  /* STABLE */
1691
1688
  }),
1692
- p(l, null, {
1693
- default: h(() => [
1694
- p(d, {
1695
- modelValue: t.localConfig.shadowColor,
1696
- "onUpdate:modelValue": e[2] || (e[2] = (y) => t.localConfig.shadowColor = y),
1689
+ m(r, null, {
1690
+ default: v(() => [
1691
+ m(c, {
1692
+ modelValue: e.localConfig.shadowColor,
1693
+ "onUpdate:modelValue": o[2] || (o[2] = (y) => e.localConfig.shadowColor = y),
1697
1694
  mode: "rgba"
1698
1695
  }, null, 8, ["modelValue"])
1699
1696
  ]),
@@ -1711,101 +1708,162 @@ function ii(i, e, o, t, s, n) {
1711
1708
  ]),
1712
1709
  _: 1
1713
1710
  /* STABLE */
1714
- })) : H("v-if", !0)
1711
+ })) : Y("v-if", !0)
1715
1712
  ]),
1716
1713
  _: 1
1717
1714
  /* STABLE */
1718
1715
  }, 16, ["onSubmit"]);
1719
1716
  }
1720
- const oi = /* @__PURE__ */ Oe(ti, [["render", ii]]);
1721
- function ui(i) {
1722
- let e, o, t = () => {
1717
+ const Ci = /* @__PURE__ */ xe(wi, [["render", gi]]);
1718
+ class he extends Le {
1719
+ constructor(t, i) {
1720
+ super(t, i);
1721
+ C(this, "_mode");
1722
+ C(this, "_viewshedOptions");
1723
+ this._mode = Ue(
1724
+ t.m,
1725
+ O,
1726
+ O.CREATE
1727
+ ), this._viewshedOptions = t.cv || null;
1728
+ }
1729
+ static get className() {
1730
+ return "ActivateViewshedCallback";
1731
+ }
1732
+ callback() {
1733
+ const t = this._app.plugins.getByKey(T);
1734
+ if (!t) {
1735
+ X("ActivateViewshedCallback").warning(
1736
+ `Plugin ${T} not found`
1737
+ );
1738
+ return;
1739
+ }
1740
+ t.state.m = this._mode, t.state.cv = this._viewshedOptions, t.activate();
1741
+ }
1742
+ toJSON() {
1743
+ const t = super.toJSON();
1744
+ return this._mode && (t.m = this._mode), this._viewshedOptions && (t.cv = structuredClone(this._viewshedOptions)), t;
1745
+ }
1746
+ }
1747
+ class fe extends Le {
1748
+ static get className() {
1749
+ return "DeactivateViewshedCallback";
1750
+ }
1751
+ callback() {
1752
+ const o = this._app.plugins.getByKey(T);
1753
+ if (!o) {
1754
+ X("DeactivateShadowCallback").warning(
1755
+ `Plugin ${T} not found`
1756
+ );
1757
+ return;
1758
+ }
1759
+ o.deactivate();
1760
+ }
1761
+ }
1762
+ function Pe() {
1763
+ return {
1764
+ visibleColor: B.getDefaultOptions().colorOptions.visibleColor,
1765
+ shadowColor: B.getDefaultOptions().colorOptions.shadowColor,
1766
+ tools: [...Object.values(_)]
1723
1767
  };
1768
+ }
1769
+ function pe(e, o, t) {
1770
+ var i;
1771
+ if (!(!(t != null && t.m) || !(e instanceof H))) {
1772
+ if (t.m === O.CREATE) {
1773
+ const s = ((i = t.cv) == null ? void 0 : i.viewshedType) ?? _.CONE;
1774
+ o == null || o.createViewshed(s).catch((n) => {
1775
+ X(T).error("Failed to create viewshed", String(n));
1776
+ });
1777
+ } else if (t.cv) {
1778
+ const s = new B(t.cv);
1779
+ t.m === O.VIEW ? o == null || o.viewViewshed(s) : o == null || o.editViewshed(s);
1780
+ }
1781
+ }
1782
+ }
1783
+ function Ti(e) {
1784
+ let o, t, i = () => {
1785
+ };
1786
+ const s = Pe(), n = { ...s, ...e }, d = Q({});
1724
1787
  return {
1725
1788
  get name() {
1726
- return j;
1789
+ return T;
1727
1790
  },
1728
1791
  get version() {
1729
- return Yt;
1792
+ return ti;
1730
1793
  },
1731
1794
  get mapVersion() {
1732
- return Xt;
1795
+ return ii;
1733
1796
  },
1734
- /**
1735
- * @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
1736
- * @param {ViewshedPluginState=} state
1737
- * @returns {Promise<void>}
1738
- */
1739
- async initialize(s, n) {
1740
- o = s, s.categoryClassRegistry.registerClass(
1741
- this[He],
1742
- ae.className,
1743
- ae
1797
+ getDefaultOptions: Pe,
1798
+ state: d,
1799
+ async initialize(r, u) {
1800
+ o = r, o.callbackClassRegistry.registerClass(
1801
+ this[ee],
1802
+ he.className,
1803
+ he
1804
+ ), o.callbackClassRegistry.registerClass(
1805
+ this[ee],
1806
+ fe.className,
1807
+ fe
1808
+ ), r.categoryClassRegistry.registerClass(
1809
+ this[ee],
1810
+ _e.className,
1811
+ _e
1744
1812
  );
1745
- const r = await ei(s);
1746
- e = Lt(
1747
- s,
1748
- i,
1749
- r
1813
+ const l = await vi(r);
1814
+ t = ni(
1815
+ r,
1816
+ n,
1817
+ l
1750
1818
  );
1751
- const l = qt(
1752
- s,
1753
- e,
1754
- j,
1755
- i.tools || Q().tools
1756
- ), { destroy: w } = Jt(
1757
- e,
1758
- s,
1759
- r.collectionComponent
1760
- ), { activeMap: c } = s.maps;
1761
- function d(_) {
1762
- if (n != null && n.m && n.cv && _ instanceof U) {
1763
- const y = new D(n.cv);
1764
- n.m === E.VIEW ? e.viewViewshed(y) : e.editViewshed(y);
1765
- }
1766
- }
1767
- let f = !1;
1768
- c && (f = !0, d(c));
1769
- const m = s.maps.mapActivated.addEventListener(
1770
- (_) => {
1771
- e.stop(), f || (d(_), f = !0);
1819
+ const c = pi(
1820
+ r,
1821
+ t,
1822
+ T,
1823
+ n.tools || s.tools
1824
+ ), { destroy: f } = hi(
1825
+ t,
1826
+ r,
1827
+ l.collectionComponent
1828
+ ), { activeMap: h } = r.maps;
1829
+ let g = !1;
1830
+ h && (g = !0, pe(h, t, u));
1831
+ const y = r.maps.mapActivated.addEventListener(
1832
+ (k) => {
1833
+ t == null || t.stop(), g || (pe(k, t, u), g = !0);
1772
1834
  }
1773
1835
  );
1774
- t = () => {
1775
- m(), l(), w(), r.destroy(), e.destroy();
1836
+ i = () => {
1837
+ y(), c(), f(), l == null || l.destroy(), t == null || t.destroy();
1776
1838
  };
1777
1839
  },
1778
- /**
1779
- * should return all default values of the configuration
1780
- * @returns {ViewshedPluginOptions}
1781
- */
1782
- getDefaultOptions: Q,
1783
- /**
1784
- * should return the plugin's serialization excluding all default values
1785
- * @returns {ViewshedPluginOptions}
1786
- */
1840
+ activate() {
1841
+ if (!t || !o) {
1842
+ X(T).error("Cannot activate plugin before initialization");
1843
+ return;
1844
+ }
1845
+ if (!o.maps.activeMap) {
1846
+ X(T).error("Cannot activate plugin without an active map");
1847
+ return;
1848
+ }
1849
+ pe(o.maps.activeMap, t, this.state);
1850
+ },
1851
+ deactivate() {
1852
+ t == null || t.stop();
1853
+ },
1787
1854
  toJSON() {
1788
- const s = {};
1789
- return i.tools && Q().tools.length !== i.tools.length && (s.tools = [...i.tools]), i.shadowColor && i.shadowColor !== D.getDefaultOptions().shadowColor && (s.shadowColor = i.shadowColor), i.visibleColor && i.visibleColor !== D.getDefaultOptions().visibleColor && (s.visibleColor = i.visibleColor), s;
1855
+ const r = {};
1856
+ return n.tools && s.tools.length !== n.tools.length && (r.tools = [...n.tools]), n.shadowColor && n.shadowColor !== s.shadowColor && (r.shadowColor = n.shadowColor), n.visibleColor && n.visibleColor !== s.visibleColor && (r.visibleColor = n.visibleColor), r;
1790
1857
  },
1791
- /**
1792
- * should return the plugins state
1793
- * @param {boolean} forUrl
1794
- * @returns {ViewshedPluginState}
1795
- */
1796
- getState(s) {
1797
- var w, c;
1798
- const n = {}, r = e.mode.value, l = (w = e.currentViewshed.value) == null ? void 0 : w.toJSON();
1799
- return r !== null && r !== "create" && l && (n.m = r, n.cv = l, s && ((c = n.cv.properties) != null && c.title) && (Object.keys(n.properties).length === 1 ? delete n.cv.properties : delete n.cv.properties.title)), n;
1858
+ getState(r) {
1859
+ var f, h, g, y;
1860
+ const u = {}, l = t == null ? void 0 : t.mode.value, c = (f = t == null ? void 0 : t.currentViewshed.value) == null ? void 0 : f.toJSON();
1861
+ return l !== null && l !== O.CREATE && c && (u.m = l, u.cv = c, r && ((g = (h = u.cv) == null ? void 0 : h.properties) != null && g.title) && (Object.keys((y = u.cv) == null ? void 0 : y.properties).length === 1 ? delete u.cv.properties : delete u.cv.properties.title)), u;
1800
1862
  },
1801
- /**
1802
- * components for configuring the plugin and/ or custom items defined by the plugin
1803
- * @returns {Array<import("@vcmap/ui").PluginConfigEditor>}
1804
- */
1805
1863
  getConfigEditors() {
1806
1864
  return [
1807
1865
  {
1808
- component: oi,
1866
+ component: Ci,
1809
1867
  title: "viewshed.editor.title",
1810
1868
  infoUrlCallback: o == null ? void 0 : o.getHelpUrlCallback(
1811
1869
  "/components/plugins/viewshedToolConfig.html",
@@ -1814,7 +1872,6 @@ function ui(i) {
1814
1872
  }
1815
1873
  ];
1816
1874
  },
1817
- destroy: () => t(),
1818
1875
  i18n: {
1819
1876
  en: {
1820
1877
  viewshed: {
@@ -1829,15 +1886,13 @@ function ui(i) {
1829
1886
  heightMode: "Height mode",
1830
1887
  relative: "Relative to ground",
1831
1888
  absolute: "Absolute",
1832
- new: "New",
1833
1889
  cancel: "Cancel",
1834
- [g.CONE]: "Cone viewshed analysis",
1835
- [g.THREESIXTY]: "360° viewshed analysis",
1890
+ [_.CONE]: "Cone viewshed analysis",
1891
+ [_.THREESIXTY]: "360° viewshed analysis",
1836
1892
  create: {
1837
- [g.CONE]: "Create cone viewshed analysis",
1838
- [g.THREESIXTY]: "Create 360° viewshed analysis"
1893
+ [_.CONE]: "Create cone viewshed analysis",
1894
+ [_.THREESIXTY]: "Create 360° viewshed analysis"
1839
1895
  },
1840
- addToMyWorkspace: "Add to My Workspace",
1841
1896
  temporary: "Temporary",
1842
1897
  jumpToViewpoint: "Jump to viewpoint",
1843
1898
  returnToViewpoint: "Return to previous viewpoint",
@@ -1867,15 +1922,13 @@ function ui(i) {
1867
1922
  heightMode: "Höhenmodus",
1868
1923
  relative: "Relativ zum Gelände",
1869
1924
  absolute: "Absolut",
1870
- new: "Neu",
1871
1925
  cancel: "Abbrechen",
1872
- [g.CONE]: "Sichtkegelanalyse",
1873
- [g.THREESIXTY]: "360° Sichtsanalyse",
1926
+ [_.CONE]: "Sichtkegelanalyse",
1927
+ [_.THREESIXTY]: "360° Sichtsanalyse",
1874
1928
  create: {
1875
- [g.CONE]: "Sichtkegelanalyse erstellen",
1876
- [g.THREESIXTY]: "360° Sichtanalyse erstellen"
1929
+ [_.CONE]: "Sichtkegelanalyse erstellen",
1930
+ [_.THREESIXTY]: "360° Sichtanalyse erstellen"
1877
1931
  },
1878
- addToMyWorkspace: "Zu Mein Arbeitsbereich hinzufügen",
1879
1932
  temporary: "Temporäre",
1880
1933
  jumpToViewpoint: "Zu Standpunkt springen",
1881
1934
  returnToViewpoint: "Zu vorherigem Standpunkt zurück springen",
@@ -1892,9 +1945,19 @@ function ui(i) {
1892
1945
  }
1893
1946
  }
1894
1947
  }
1948
+ },
1949
+ destroy() {
1950
+ o && (o.callbackClassRegistry.unregisterClass(
1951
+ this[ee],
1952
+ he.className
1953
+ ), o.callbackClassRegistry.unregisterClass(
1954
+ this[ee],
1955
+ fe.className
1956
+ )), i();
1895
1957
  }
1896
1958
  };
1897
1959
  }
1898
1960
  export {
1899
- ui as default
1961
+ Ti as default,
1962
+ Pe as getDefaultOptions
1900
1963
  };