@vcmap/viewshed 4.0.0 → 4.1.1

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