@vcmap/viewshed 2.0.4 → 2.0.5

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,13 @@
1
- var fe = Object.defineProperty;
2
- var ve = (s, e, i) => e in s ? fe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
3
- var Z = (s, e, i) => (ve(s, typeof e != "symbol" ? e + "" : e, i), i);
4
- import { VcsCameraPrimitive as pe, VcsObject as we, VcsEvent as L, AbstractInteraction as me, EventType as D, Projection as I, SessionType as ge, CesiumMap as B, startEditFeaturesSession as _e, startEditGeometrySession as Ce, VectorLayer as Ee, wgs84Projection as ye, maxZIndex as Ve, markVolatile as be, Viewpoint as Te, TransformationMode as Me, Category as Oe, moduleIdSymbol as Se } from "../../../assets/core.js";
5
- import { Color as F, Matrix4 as Pe, Transforms as Ae, Primitive as q, GeometryInstance as Q, SphereGeometry as Ie, ColorGeometryInstanceAttribute as ee, PerInstanceColorAppearance as te, SphereOutlineGeometry as Re, Math as O, Cartesian3 as S, ShadowMap as $e, Camera as Ne, HeightReference as xe } from "../../../assets/cesium.js";
6
- import { shallowRef as U, ref as A, nextTick as De, inject as ie, computed as se, reactive as j, watchEffect as Le, watch as R, onMounted as ke, onUnmounted as Fe } from "../../../assets/vue.js";
7
- import { ol$Observable$unByKey as je, Feature as We, ol$geom$Point as Be, ol$style$Style as ze } from "../../../assets/ol.js";
8
- import { VcsTextField as Ge, VcsSlider as He, VcsLabel as ne, VcsFormSection as re, VcsSelect as ae, VcsFormButton as Ue, VcsFeatureTransforms as Ke, makeEditorCollectionComponentClass as Xe, WindowSlot as Ye, ToolboxType as Je, createListExportAction as Ze, downloadText as qe, createListImportAction as Qe, AbstractConfigEditor as et } from "../../../assets/ui.js";
9
- import { VContainer as le, VRow as ce, VCol as de, VDivider as tt, VColorPicker as it } from "../../../assets/vuetify.js";
10
- const x = [
1
+ var pe = Object.defineProperty;
2
+ var we = (s, e, i) => e in s ? pe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
3
+ var Q = (s, e, i) => (we(s, typeof e != "symbol" ? e + "" : e, i), i);
4
+ import { VcsCameraPrimitive as me, VcsObject as ge, VcsEvent as x, AbstractInteraction as _e, EventType as N, Projection as I, SessionType as Ce, CesiumMap as D, startEditFeaturesSession as Ee, startEditGeometrySession as ye, VectorLayer as Ve, wgs84Projection as be, maxZIndex as Me, markVolatile as Te, Viewpoint as Oe, TransformationMode as Se, Category as Pe, moduleIdSymbol as Ae } from "../../../assets/core.js";
5
+ import { Color as j, Matrix4 as Ie, Transforms as Re, Primitive as ee, GeometryInstance as te, SphereGeometry as $e, ColorGeometryInstanceAttribute as ie, PerInstanceColorAppearance as se, SphereOutlineGeometry as Ne, Math as T, Cartesian3 as O, ShadowMap as xe, Camera as De, HeightReference as Le } from "../../../assets/cesium.js";
6
+ import { shallowRef as K, ref as A, nextTick as ke, inject as oe, computed as ne, reactive as W, watchEffect as Fe, watch as R, onMounted as je, onUnmounted as We } from "../../../assets/vue.js";
7
+ import { ol$Observable$unByKey as Be, Feature as ze, ol$geom$Point as Ge, ol$style$Style as He } from "../../../assets/ol.js";
8
+ import { VcsTextField as Ue, VcsSlider as Ke, VcsLabel as ae, VcsFormSection as le, VcsSelect as ce, VcsFormButton as Xe, VcsFeatureTransforms as Ye, makeEditorCollectionComponentClass as Je, WindowSlot as Ze, ToolboxType as qe, createListExportAction as Qe, downloadText as et, createListImportAction as tt, AbstractConfigEditor as it } from "../../../assets/ui.js";
9
+ import { VContainer as de, VRow as he, VCol as ue, VDivider as st, VColorPicker as ot } from "../../../assets/vuetify.js";
10
+ const $ = [
11
11
  [String, "string"],
12
12
  [Number, "number"],
13
13
  [Boolean, "boolean"],
@@ -15,7 +15,7 @@ const x = [
15
15
  [void 0, "undefined"],
16
16
  [Symbol, "symbol"]
17
17
  ];
18
- function W(s) {
18
+ function B(s) {
19
19
  const e = {};
20
20
  if (!s || e.toString(s) !== "[object Object]")
21
21
  return !1;
@@ -25,7 +25,7 @@ function W(s) {
25
25
  const t = e.hasOwnProperty, o = t.call(i, "constructor") && i.constructor;
26
26
  return typeof o == "function" && t.toString.call(o) === t.toString.call(Object);
27
27
  }
28
- function T(s, e) {
28
+ function b(s, e) {
29
29
  if (s === null)
30
30
  return "null";
31
31
  if (typeof s > "u")
@@ -34,7 +34,7 @@ function T(s, e) {
34
34
  return typeof s;
35
35
  let i;
36
36
  if (Array.isArray(s))
37
- i = `[${s.map((o) => T(o, e)).join(",")}]`;
37
+ i = `[${s.map((o) => b(o, e)).join(",")}]`;
38
38
  else
39
39
  try {
40
40
  i = JSON.stringify(s);
@@ -43,59 +43,59 @@ function T(s, e) {
43
43
  }
44
44
  return i = i || typeof s, i.length > 20 ? `${i.substr(0, 20)}...` : i;
45
45
  }
46
- function st(s, e) {
47
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" ? s === e ? !1 : `Expected ${T(s)} to equal ${e.toString()}` : null;
46
+ function nt(s, e) {
47
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" ? s === e ? !1 : `Expected ${b(s)} to equal ${e.toString()}` : null;
48
48
  }
49
- function ot(s, e, i) {
49
+ function rt(s, e, i) {
50
50
  if (Array.isArray(e)) {
51
51
  if (e.length !== 1)
52
52
  throw new Error("Array patterns may only have on type");
53
53
  if (Array.isArray(s)) {
54
54
  let t = !1;
55
- return s.findIndex((r) => {
55
+ return s.findIndex((n) => {
56
56
  try {
57
- z(r, e[0], i);
57
+ z(n, e[0], i);
58
58
  } catch (a) {
59
59
  t = a.message.replace(/Match failed:\s/, "");
60
60
  }
61
61
  return t;
62
- }) > -1 ? `${t} in ${T(s)}` : !1;
62
+ }) > -1 ? `${t} in ${b(s)}` : !1;
63
63
  }
64
- return `Expected ${T(s)} to be an Array`;
64
+ return `Expected ${b(s)} to be an Array`;
65
65
  }
66
66
  return null;
67
67
  }
68
- function K(s, e, i) {
68
+ function X(s, e, i) {
69
69
  const t = i ? `${i}.` : "";
70
- if (!W(s))
71
- return `Expected ${T(s)} to be a plain Object`;
72
- let r = !1;
73
- const a = Object.keys(e).find((l) => {
74
- const n = s[l];
75
- if (W(e[l]))
76
- r = K(n, e[l], t + l);
70
+ if (!B(s))
71
+ return `Expected ${b(s)} to be a plain Object`;
72
+ let n = !1;
73
+ const a = Object.keys(e).find((c) => {
74
+ const r = s[c];
75
+ if (B(e[c]))
76
+ n = X(r, e[c], t + c);
77
77
  else
78
78
  try {
79
- z(n, e[l]);
80
- } catch (u) {
81
- r = u.message.replace(/Match failed:\s/, "");
79
+ z(r, e[c]);
80
+ } catch (f) {
81
+ n = f.message.replace(/Match failed:\s/, "");
82
82
  }
83
- return r;
83
+ return n;
84
84
  });
85
- return a ? `${r} in object.${t}${a}` : !1;
85
+ return a ? `${n} in object.${t}${a}` : !1;
86
86
  }
87
- function nt(s, e) {
87
+ function at(s, e) {
88
88
  if (e === Number)
89
- return Number.isFinite(s) ? !1 : `expected ${T(s)} to be a number, excluding NaN`;
90
- for (let i = x.length; i--; )
91
- if (e === x[i][0])
92
- return typeof s === x[i][1] ? !1 : `expected ${T(s)} to be a ${x[i][1]}`;
89
+ return Number.isFinite(s) ? !1 : `expected ${b(s)} to be a number, excluding NaN`;
90
+ for (let i = $.length; i--; )
91
+ if (e === $[i][0])
92
+ return typeof s === $[i][1] ? !1 : `expected ${b(s)} to be a ${$[i][1]}`;
93
93
  return null;
94
94
  }
95
- function X(s) {
95
+ function Y(s) {
96
96
  if (s === null)
97
97
  return "null";
98
- const e = x.find((o) => o[0] === s);
98
+ const e = $.find((o) => o[0] === s);
99
99
  if (e)
100
100
  return e[1];
101
101
  let i = s.toString();
@@ -104,10 +104,10 @@ function X(s) {
104
104
  const t = i.match(/function (.*)\(/);
105
105
  if (t && t.length > 1)
106
106
  return t[1];
107
- if (W(s)) {
107
+ if (B(s)) {
108
108
  const o = {};
109
- Object.keys(s).forEach((r) => {
110
- o[r] = X(s[r]);
109
+ Object.keys(s).forEach((n) => {
110
+ o[n] = Y(s[n]);
111
111
  });
112
112
  try {
113
113
  i = `Object of ${JSON.stringify(o)}`;
@@ -117,49 +117,49 @@ function X(s) {
117
117
  }
118
118
  return i;
119
119
  }
120
- function he(s, e, i) {
120
+ function fe(s, e, i) {
121
121
  const t = i ? `${i}.` : "";
122
122
  let o = !1;
123
123
  return Object.keys(s).find((a) => {
124
- if (W(e[a])) {
125
- const l = s[a];
126
- o = he(l, e[a], t + a);
124
+ if (B(e[a])) {
125
+ const c = s[a];
126
+ o = fe(c, e[a], t + a);
127
127
  } else
128
128
  e[a] || (o = `Found additional key ${t}${a}`);
129
129
  return o = o ? o.replace(/\sin.*/, "") : !1, o;
130
- }) ? `${o} in ${T(s)}` : !1;
130
+ }) ? `${o} in ${b(s)}` : !1;
131
131
  }
132
- function rt(s, e, i) {
133
- const t = function(a, l) {
134
- if (l == null)
135
- return a === l ? !1 : `Expected ${T(a)} to be ${l}`;
136
- const n = nt(a, l);
137
- if (n !== null)
138
- return n;
139
- const u = st(a, l);
140
- if (u !== null)
141
- return u;
142
- if (Array.isArray(l))
143
- return ot(a, l, i);
144
- if (l instanceof Function)
145
- return a instanceof l ? !1 : `Expected ${T(a, !0)} to be of Type ${X(l)}`;
146
- if (l === Object)
147
- return K(a, {});
148
- if (typeof l != "object")
149
- throw new Error(`Cannot handler pattern ${l}`);
150
- const c = K(a, l);
151
- return c || (i ? he(a, l) : !1);
132
+ function lt(s, e, i) {
133
+ const t = function(a, c) {
134
+ if (c == null)
135
+ return a === c ? !1 : `Expected ${b(a)} to be ${c}`;
136
+ const r = at(a, c);
137
+ if (r !== null)
138
+ return r;
139
+ const f = nt(a, c);
140
+ if (f !== null)
141
+ return f;
142
+ if (Array.isArray(c))
143
+ return rt(a, c, i);
144
+ if (c instanceof Function)
145
+ return a instanceof c ? !1 : `Expected ${b(a, !0)} to be of Type ${Y(c)}`;
146
+ if (c === Object)
147
+ return X(a, {});
148
+ if (typeof c != "object")
149
+ throw new Error(`Cannot handler pattern ${c}`);
150
+ const h = X(a, c);
151
+ return h || (i ? fe(a, c) : !1);
152
152
  };
153
153
  let o;
154
- return Array.isArray(e) && e.length > 1 ? e.every((a) => t(s, a)) && (o = `Expected ${T(s)} to be a ${e.map((a) => X(a)).join(" or ")}`) : o = t(s, e), o;
154
+ return Array.isArray(e) && e.length > 1 ? e.every((a) => t(s, a)) && (o = `Expected ${b(s)} to be a ${e.map((a) => Y(a)).join(" or ")}`) : o = t(s, e), o;
155
155
  }
156
156
  function z(s, e, i) {
157
- const t = rt(s, e, i);
157
+ const t = lt(s, e, i);
158
158
  if (t)
159
159
  throw new Error(`Match failed: ${t}`);
160
160
  return !1;
161
161
  }
162
- function at(s, e, i) {
162
+ function ct(s, e, i) {
163
163
  if (s != null) {
164
164
  const t = Object.values(e).find((o) => o == s);
165
165
  if (t != null)
@@ -167,8 +167,8 @@ function at(s, e, i) {
167
167
  }
168
168
  return i;
169
169
  }
170
- const lt = new F(), G = new Pe();
171
- class ct extends pe {
170
+ const dt = new j(), H = new Ie();
171
+ class ht extends me {
172
172
  constructor(e) {
173
173
  super(e), this.spot = e.spot;
174
174
  }
@@ -182,48 +182,48 @@ class ct extends pe {
182
182
  super.update(e);
183
183
  else {
184
184
  const i = this._planesPrimitives, t = this._outlinePrimitives;
185
- i.length === 0 && (Ae.eastNorthUpToFixedFrame(
185
+ i.length === 0 && (Re.eastNorthUpToFixedFrame(
186
186
  this._camera.positionWC,
187
187
  void 0,
188
- G
189
- ), i[0] = new q({
188
+ H
189
+ ), i[0] = new ee({
190
190
  allowPicking: this.allowPicking,
191
- geometryInstances: new Q({
192
- geometry: new Ie({
191
+ geometryInstances: new te({
192
+ geometry: new $e({
193
193
  radius: 2
194
194
  }),
195
195
  attributes: {
196
- color: ee.fromColor(
197
- F.fromAlpha(this._color, 0.1, lt)
196
+ color: ie.fromColor(
197
+ j.fromAlpha(this._color, 0.1, dt)
198
198
  )
199
199
  },
200
- modelMatrix: G
200
+ modelMatrix: H
201
201
  }),
202
- appearance: new te({
202
+ appearance: new se({
203
203
  translucent: !0,
204
204
  flat: !0
205
205
  }),
206
206
  asynchronous: !1
207
- }), t[0] = new q({
207
+ }), t[0] = new ee({
208
208
  allowPicking: this.allowPicking,
209
- geometryInstances: new Q({
210
- geometry: new Re({
209
+ geometryInstances: new te({
210
+ geometry: new Ne({
211
211
  radius: 2
212
212
  }),
213
213
  attributes: {
214
- color: ee.fromColor(this._color)
214
+ color: ie.fromColor(this._color)
215
215
  },
216
- modelMatrix: G
216
+ modelMatrix: H
217
217
  }),
218
- appearance: new te({
218
+ appearance: new se({
219
219
  translucent: !1,
220
220
  flat: !0
221
221
  }),
222
222
  asynchronous: !1
223
223
  }));
224
224
  const { length: o } = i;
225
- for (let r = 0; r < o; ++r)
226
- t[r].update(e), i[r].update(e);
225
+ for (let n = 0; n < o; ++n)
226
+ t[n].update(e), i[n].update(e);
227
227
  }
228
228
  }
229
229
  }
@@ -231,14 +231,14 @@ const w = {
231
231
  CONE: "cone",
232
232
  THREESIXTY: "360"
233
233
  };
234
- function dt(s, e) {
235
- const i = new Ne(s), t = (
234
+ function ut(s, e) {
235
+ const i = new De(s), t = (
236
236
  /** @type {import("@vcmap-cesium/engine").PerspectiveFrustum} */
237
237
  i.frustum
238
238
  );
239
239
  return t.fov = e.fov, t.near = e.near, t.aspectRatio = e.aspectRatio, t.far = e.far, i;
240
240
  }
241
- const E = class E extends we {
241
+ const E = class E extends ge {
242
242
  static get className() {
243
243
  return "Viewshed";
244
244
  }
@@ -249,7 +249,7 @@ const E = class E extends we {
249
249
  static getDefaultOptions() {
250
250
  return {
251
251
  frustum: {
252
- fov: O.PI / 3,
252
+ fov: T.PI / 3,
253
253
  near: 1,
254
254
  aspectRatio: 1,
255
255
  far: 300
@@ -266,32 +266,31 @@ const E = class E extends we {
266
266
  }
267
267
  /**
268
268
  * @param {ViewshedOptions} options The options for the viewshed.
269
- * @param {import("@vcmap/core").CesiumMap} [cesiumMap] The cesiumMap the viewshed should be applied to. If this parameter is passed, the viewshed is activated and all other viewsheds are deactivated.
270
269
  */
271
- constructor(e, i) {
272
- var t, o, r, a, l, n;
270
+ constructor(e) {
271
+ var i, t, o, n, a, c;
273
272
  super(e), this._cesiumMap = null, this._shadowCamera = null, this._scene = null, this._frustumOptions = {
274
- fov: ((t = e.frustumOptions) == null ? void 0 : t.fov) || E.getDefaultOptions().frustum.fov,
275
- far: ((o = e.frustumOptions) == null ? void 0 : o.far) || E.getDefaultOptions().frustum.far,
276
- near: ((r = e.frustumOptions) == null ? void 0 : r.near) || E.getDefaultOptions().frustum.near,
277
- aspectRatio: ((a = e.frustumOptions) == null ? void 0 : a.aspectRatio) || E.getDefaultOptions().frustum.aspectRatio
273
+ fov: ((i = e.frustumOptions) == null ? void 0 : i.fov) || E.getDefaultOptions().frustum.fov,
274
+ far: ((t = e.frustumOptions) == null ? void 0 : t.far) || E.getDefaultOptions().frustum.far,
275
+ near: ((o = e.frustumOptions) == null ? void 0 : o.near) || E.getDefaultOptions().frustum.near,
276
+ aspectRatio: ((n = e.frustumOptions) == null ? void 0 : n.aspectRatio) || E.getDefaultOptions().frustum.aspectRatio
278
277
  }, this._headingPitchRollValues = e.orientation || {
279
278
  ...E.getDefaultOptions().orientation
280
- }, this._position = e.position || E.getDefaultOptions().position, this._viewshedType = at(e.viewshedType, w), this._colors = {
281
- visibleColor: F.fromCssColorString(
282
- ((l = e.colorOptions) == null ? void 0 : l.visibleColor) || E.getDefaultOptions().visibleColor
279
+ }, this._position = e.position || E.getDefaultOptions().position, this._viewshedType = ct(e.viewshedType, w), this._colors = {
280
+ visibleColor: j.fromCssColorString(
281
+ ((a = e.colorOptions) == null ? void 0 : a.visibleColor) || E.getDefaultOptions().visibleColor
283
282
  ),
284
- shadowColor: F.fromCssColorString(
285
- ((n = e.colorOptions) == null ? void 0 : n.shadowColor) || E.getDefaultOptions().shadowColor
283
+ shadowColor: j.fromCssColorString(
284
+ ((c = e.colorOptions) == null ? void 0 : c.shadowColor) || E.getDefaultOptions().shadowColor
286
285
  )
287
- }, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this._shadowMapChangedListener = null, this._positionChanged = new L(), i ? this.activate(i) : this._active = !1;
286
+ }, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this._positionChanged = new x(), this._active = !1;
288
287
  }
289
288
  /**
290
289
  * 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.
291
290
  * @param {import("ol/coordinate").Coordinate} coords The new positions coordinates in degrees
292
291
  */
293
292
  set position(e) {
294
- z(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position = S.fromDegrees(
293
+ z(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position = O.fromDegrees(
295
294
  e[0],
296
295
  e[1],
297
296
  e[2] + this._heightOffset
@@ -315,7 +314,7 @@ const E = class E extends we {
315
314
  * @param {number} value the offset that is added to the position height.
316
315
  */
317
316
  set heightOffset(e) {
318
- this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position = S.fromDegrees(
317
+ this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position = O.fromDegrees(
319
318
  this.position[0],
320
319
  this.position[1],
321
320
  this.position[2] + e
@@ -347,23 +346,23 @@ const E = class E extends we {
347
346
  * @param {number} value The field of view in degrees.
348
347
  */
349
348
  set fov(e) {
350
- this._frustumOptions.fov = e * O.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = e * O.RADIANS_PER_DEGREE, this._viewshedType === w.CONE && this._updatePrimitive());
349
+ this._frustumOptions.fov = e * T.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = e * T.RADIANS_PER_DEGREE, this._viewshedType === w.CONE && this._updatePrimitive());
351
350
  }
352
351
  /**
353
352
  * Returns the field of view.
354
353
  * @returns {number} The field of view in degrees.
355
354
  */
356
355
  get fov() {
357
- return this._frustumOptions.fov * O.DEGREES_PER_RADIAN;
356
+ return this._frustumOptions.fov * T.DEGREES_PER_RADIAN;
358
357
  }
359
358
  /**
360
359
  * Sets the heading of a cone viewshed. Does not have impact on 360 viewshed.
361
360
  * @param {number} value Heading in degrees.
362
361
  */
363
362
  set heading(e) {
364
- this._headingPitchRollValues.heading = e * O.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
363
+ this._headingPitchRollValues.heading = e * T.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
365
364
  orientation: {
366
- heading: e * O.RADIANS_PER_DEGREE,
365
+ heading: e * T.RADIANS_PER_DEGREE,
367
366
  pitch: this._shadowCamera.pitch,
368
367
  roll: 0
369
368
  }
@@ -374,15 +373,15 @@ const E = class E extends we {
374
373
  * @returns {number} The heading in degress.
375
374
  */
376
375
  get heading() {
377
- return this._headingPitchRollValues.heading * O.DEGREES_PER_RADIAN;
376
+ return this._headingPitchRollValues.heading * T.DEGREES_PER_RADIAN;
378
377
  }
379
378
  /**
380
379
  * Sets the pitch of a cone viewshed. 0 is horizontal. Does not have impact on 360 viewshed.
381
380
  * @param {number} value The pitch in degrees.
382
381
  */
383
382
  set pitch(e) {
384
- if (this._headingPitchRollValues.pitch = e * O.RADIANS_PER_DEGREE, this._shadowCamera) {
385
- const i = e * O.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
383
+ if (this._headingPitchRollValues.pitch = e * T.RADIANS_PER_DEGREE, this._shadowCamera) {
384
+ const i = e * T.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
386
385
  this._shadowCamera.lookUp(i), this._viewshedType === w.CONE && this._updatePrimitive();
387
386
  }
388
387
  }
@@ -391,7 +390,7 @@ const E = class E extends we {
391
390
  * @returns {number} The pitch in degrees.
392
391
  */
393
392
  get pitch() {
394
- return this._headingPitchRollValues.pitch * O.DEGREES_PER_RADIAN;
393
+ return this._headingPitchRollValues.pitch * T.DEGREES_PER_RADIAN;
395
394
  }
396
395
  /**
397
396
  * Sets whether the primitive of the viewshed should be shown or not.
@@ -408,21 +407,27 @@ const E = class E extends we {
408
407
  return this._showPrimitive;
409
408
  }
410
409
  /**
411
- * Retruns the type of the Viewshed.
410
+ * Returns the type of the Viewshed.
412
411
  * @returns {ViewshedTypes}
413
412
  */
414
413
  get type() {
415
414
  return this._viewshedType;
416
415
  }
417
416
  /**
418
- * Deactivates the viewshed by removing primitve and removing shadowMap.
417
+ * @returns {ShadowMap|null}
418
+ */
419
+ get shadowMap() {
420
+ return this._shadowMap;
421
+ }
422
+ /**
423
+ * Deactivates the viewshed by removing primitive and removing shadowMap.
419
424
  */
420
425
  deactivate() {
421
- var e, i, t, o;
422
- this._active && (this._removePrimitive(), (e = this._shadowMapChangedListener) == null || e.call(this), ((t = (i = this._cesiumMap) == null ? void 0 : i.getScene()) == null ? void 0 : t.shadowMap) === this._shadowMap && this._cesiumMap.setDefaultShadowMap(), (o = this._shadowMap) == null || o.destroy(), this._shadowCamera = null, this._scene = null, this._cesiumMap = null, this._active = !1);
426
+ var e;
427
+ 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);
423
428
  }
424
429
  /**
425
- * Activates viewshed. Sets the CesiumMap and adds shadowMapChanged listener to CesiumMap. If viewshed is active but
430
+ * Activates viewshed.
426
431
  * @param {import("@vcmap/core").CesiumMap} cesiumMap The cesium map to which the shadow map of the viewshed is applied to.
427
432
  */
428
433
  activate(e) {
@@ -430,12 +435,10 @@ const E = class E extends we {
430
435
  this._cesiumMap = e;
431
436
  const i = e.getScene();
432
437
  if (i)
433
- this._shadowCamera = dt(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
438
+ this._shadowCamera = ut(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
434
439
  else
435
440
  throw new Error("CesiumMap contains no scene");
436
- this._updateShadowMap(), this._updatePrimitive(), this._shadowMapChangedListener = this._cesiumMap.shadowMapChanged.addEventListener((t) => {
437
- this._shadowMap !== t && this.deactivate();
438
- });
441
+ this._updateShadowMap(), this._updatePrimitive();
439
442
  }
440
443
  }
441
444
  /**
@@ -443,7 +446,7 @@ const E = class E extends we {
443
446
  */
444
447
  _updateShadowMap() {
445
448
  var e;
446
- !this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((e = this._shadowMap) == null || e.destroy(), this._shadowMap = new $e({
449
+ !this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((e = this._shadowMap) == null || e.destroy(), this._shadowMap = new xe({
447
450
  // @ts-ignore
448
451
  context: this._scene.context,
449
452
  lightCamera: this._shadowCamera,
@@ -458,11 +461,11 @@ const E = class E extends we {
458
461
  }), this._shadowMap.viewshed = this._colors, this._cesiumMap.setShadowMap(this._shadowMap));
459
462
  }
460
463
  _removePrimitive() {
461
- var e;
462
- this._primitive && ((e = this._scene) == null || e.primitives.remove(this._primitive), this._primitive.destroy(), this._primitive = null);
464
+ var e, i, t;
465
+ this._primitive && !((i = (e = this._primitive).isDestroyed) != null && i.call(e)) && ((t = this._scene) == null || t.primitives.remove(this._primitive), this._primitive.destroy(), this._primitive = null);
463
466
  }
464
467
  _updatePrimitive() {
465
- this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new ct({
468
+ this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new ht({
466
469
  camera: this._shadowCamera,
467
470
  allowPicking: !1,
468
471
  spot: this._viewshedType === w.CONE
@@ -475,10 +478,10 @@ const E = class E extends we {
475
478
  lookAt(e) {
476
479
  if (!this._shadowCamera)
477
480
  return;
478
- const i = S.fromDegrees(e[0], e[1], e[2]);
479
- if (this.distance = S.distance(this._shadowCamera.position, i), this.type === w.CONE && !i.equals(this._shadowCamera.position)) {
480
- const t = new S();
481
- S.subtract(i, this._shadowCamera.position, i), S.normalize(i, i), S.normalize(this._shadowCamera.position, t), this._shadowCamera.setView({
481
+ const i = O.fromDegrees(e[0], e[1], e[2]);
482
+ if (this.distance = O.distance(this._shadowCamera.position, i), this.type === w.CONE && !i.equals(this._shadowCamera.position)) {
483
+ const t = new O();
484
+ O.subtract(i, this._shadowCamera.position, i), O.normalize(i, i), O.normalize(this._shadowCamera.position, t), this._shadowCamera.setView({
482
485
  orientation: {
483
486
  direction: i,
484
487
  up: t
@@ -510,18 +513,20 @@ const E = class E extends we {
510
513
  * Destroys the viewshed.
511
514
  */
512
515
  destroy() {
513
- this.deactivate();
516
+ var t;
517
+ const e = this._cesiumMap, i = this._shadowMap;
518
+ this.deactivate(), ((t = e == null ? void 0 : e.getScene()) == null ? void 0 : t.shadowMap) === i && e.setDefaultShadowMap();
514
519
  }
515
520
  };
516
- Z(E, "MIN_DISTANCE", 10);
521
+ Q(E, "MIN_DISTANCE", 10);
517
522
  let M = E;
518
- class ht extends me {
523
+ class ft extends _e {
519
524
  /**
520
525
  *
521
526
  * @param {import("./viewshed").default} viewshed
522
527
  */
523
528
  constructor(e) {
524
- super(D.CLICKMOVE), this._viewshed = e, this._positioned = new L(), this._finished = new L(), this._position = !1, this.setActive();
529
+ super(N.CLICKMOVE), this._viewshed = e, this._positioned = new x(), this._finished = new x(), this._position = !1, this.setActive();
525
530
  }
526
531
  get finished() {
527
532
  return this._finished;
@@ -530,7 +535,7 @@ class ht extends me {
530
535
  return this._positioned;
531
536
  }
532
537
  async pipe(e) {
533
- return e.position && (this._position ? (this._viewshed.lookAt(I.mercatorToWgs84(e.position)), e.type & D.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = I.mercatorToWgs84(e.position), e.type & D.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), e;
538
+ return e.position && (this._position ? (this._viewshed.lookAt(I.mercatorToWgs84(e.position)), e.type & N.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = I.mercatorToWgs84(e.position), e.type & N.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), e;
534
539
  }
535
540
  destroy() {
536
541
  super.destroy(), this._finished.destroy(), this._positioned.destroy();
@@ -539,21 +544,21 @@ class ht extends me {
539
544
  const y = {
540
545
  ABSOLUTE: "absolute",
541
546
  RELATIVE: "relative"
542
- }, g = {
547
+ }, m = {
543
548
  CREATE: "create",
544
549
  VIEW: "view",
545
550
  EDIT: "edit",
546
551
  MOVE: "move",
547
552
  MULTI_SELECT: "multiSelect"
548
- }, oe = 1.8;
549
- function ut(s) {
550
- const e = new Ee({
551
- projection: ye.toJSON(),
552
- zIndex: Ve - 1
553
+ }, re = 1.8;
554
+ function vt(s) {
555
+ const e = new Ve({
556
+ projection: be.toJSON(),
557
+ zIndex: Me - 1
553
558
  });
554
- be(e), e.activate();
555
- const i = new We(new Be(s));
556
- return i.setStyle(new ze({})), e.addFeatures([i]), e.vectorProperties.altitudeMode = xe.NONE, {
559
+ Te(e), e.activate();
560
+ const i = new ze(new Ge(s));
561
+ return i.setStyle(new He({})), e.addFeatures([i]), e.vectorProperties.altitudeMode = Le.NONE, {
557
562
  layer: e,
558
563
  feature: i,
559
564
  destroy() {
@@ -561,119 +566,123 @@ function ut(s) {
561
566
  }
562
567
  };
563
568
  }
564
- function H(s, e) {
565
- const i = e === y.ABSOLUTE ? D.CLICKMOVE : D.NONE;
569
+ function U(s, e) {
570
+ const i = e === y.ABSOLUTE ? N.CLICKMOVE : N.NONE;
566
571
  s.setActive(i), s.pickPosition = i, s.pullPickedPosition = 1.8;
567
572
  }
568
- function ft(s, e, i) {
569
- const t = U(null), o = A(null), r = A(null), a = A(y.ABSOLUTE);
570
- let l = () => {
573
+ function pt(s, e, i) {
574
+ const t = K(null), o = A(null), n = A(null), a = A(y.ABSOLUTE);
575
+ let c = () => {
576
+ };
577
+ const r = K(null);
578
+ let f = () => {
571
579
  };
572
- const n = U(null);
573
- function u(h) {
574
- var f, d;
575
- o.value && t.value ? (t.value.deactivate(), i.setVisibility(t.value.name, !1)) : (f = t.value) == null || f.destroy(), t.value = h, (d = t.value) == null || d.activate(s.maps.activeMap);
580
+ function h() {
581
+ var l;
582
+ o.value && t.value ? (t.value.deactivate(), i.setVisibility(t.value.name, !1)) : (l = t.value) == null || l.destroy();
576
583
  }
577
- function c(h = !0) {
578
- l(), u(null), h && i.clearSelection(), o.value = null, r.value = null;
584
+ function v(l = !0) {
585
+ f(), c(), h(), t.value = null, l && i.clearSelection(), o.value = null, n.value = null;
579
586
  }
580
- async function m(h) {
581
- c(), await De();
582
- const { eventHandler: f } = s.maps, { featureInteraction: d } = f;
583
- t.value = new M(
584
- {
585
- viewshedType: h,
586
- colorOptions: {
587
- visibleColor: e.visibleColor,
588
- shadowColor: e.shadowColor
589
- },
590
- heightOffset: a.value === y.ABSOLUTE ? 0 : oe
587
+ function u(l) {
588
+ f(), h(), s.maps.activeMap instanceof D && (t.value = l, l.activate(s.maps.activeMap), f = s.maps.activeMap.shadowMapChanged.addEventListener((d) => {
589
+ var p;
590
+ d !== ((p = t.value) == null ? void 0 : p.shadowMap) && v(!1);
591
+ }));
592
+ }
593
+ async function _(l) {
594
+ v(), await ke();
595
+ const { eventHandler: d } = s.maps, { featureInteraction: p } = d, g = new M({
596
+ viewshedType: l,
597
+ colorOptions: {
598
+ visibleColor: e.visibleColor,
599
+ shadowColor: e.shadowColor
591
600
  },
592
- /** @type {import("@vcmap/core").CesiumMap} */
593
- s.maps.activeMap
594
- );
595
- const p = new ht(t.value);
596
- p.finished.addEventListener(() => {
597
- l(), t.value ? (t.value.showPrimitive = !0, r.value = g.EDIT) : c();
601
+ heightOffset: a.value === y.ABSOLUTE ? 0 : re
598
602
  });
599
- const C = f.addExclusiveInteraction(
600
- p,
603
+ u(g);
604
+ const C = new ft(t.value);
605
+ C.finished.addEventListener(() => {
606
+ c(), t.value ? (t.value.showPrimitive = !0, n.value = m.EDIT) : v();
607
+ });
608
+ const k = d.addExclusiveInteraction(
609
+ C,
601
610
  () => {
602
- p.destroy();
611
+ C.destroy();
603
612
  }
604
613
  );
605
- H(d, a.value), p.positioned.addEventListener(() => {
606
- H(d, y.ABSOLUTE);
607
- }), l = () => {
608
- C(), p.destroy(), d.setActive(), l = () => {
614
+ U(p, a.value), C.positioned.addEventListener(() => {
615
+ U(p, y.ABSOLUTE);
616
+ }), c = () => {
617
+ k(), C.destroy(), p.setActive(), c = () => {
609
618
  };
610
- }, r.value = g.CREATE;
619
+ }, n.value = m.CREATE;
611
620
  }
612
- function v(h) {
613
- var f;
614
- if (t.value && h) {
615
- l();
621
+ function V(l) {
622
+ var d;
623
+ if (t.value && l) {
624
+ c();
616
625
  const {
617
- layer: d,
618
- feature: p,
626
+ layer: p,
627
+ feature: g,
619
628
  destroy: C
620
- } = ut(t.value.position);
621
- s.layers.add(d), a.value === y.ABSOLUTE ? (n.value = _e(s, d), n.value.setFeatures([p])) : (n.value = Ce(s, d), n.value.setFeature(p)), n.value.stopped.addEventListener(() => {
622
- l();
629
+ } = vt(t.value.position);
630
+ s.layers.add(p), a.value === y.ABSOLUTE ? (r.value = Ee(s, p), r.value.setFeatures([g])) : (r.value = ye(s, p), r.value.setFeature(g)), r.value.stopped.addEventListener(() => {
631
+ c();
623
632
  });
624
- const b = (f = p.getGeometry()) == null ? void 0 : f.on("change", () => {
633
+ const k = (d = g.getGeometry()) == null ? void 0 : d.on("change", () => {
625
634
  t.value ? t.value.position = I.mercatorToWgs84(
626
635
  /** @type {import("ol/geom").Point} */
627
- p.getGeometry().getCoordinates()
628
- ) : c();
636
+ g.getGeometry().getCoordinates()
637
+ ) : v();
629
638
  });
630
- r.value = g.MOVE, l = () => {
631
- var N;
632
- l = () => {
633
- }, b && je(b), (N = n.value) == null || N.stop(), n.value = null, s.layers.remove(d), C(), r.value = g.EDIT;
639
+ n.value = m.MOVE, c = () => {
640
+ var q;
641
+ c = () => {
642
+ }, k && Be(k), (q = r.value) == null || q.stop(), r.value = null, s.layers.remove(p), C(), n.value = m.EDIT;
634
643
  };
635
644
  } else
636
- l();
645
+ c();
637
646
  }
638
- function _(h, f) {
639
- l(), t.value !== f && (u(f), a.value = f.heightOffset ? y.RELATIVE : y.ABSOLUTE), o.value = !!f.properties.title, r.value = h, o.value && i.setVisibility(f.name, !0);
647
+ function P(l, d) {
648
+ c(), t.value !== d && (u(d), a.value = d.heightOffset ? y.RELATIVE : y.ABSOLUTE), o.value = !!d.properties.title, n.value = l, o.value && i.setVisibility(d.name, !0);
640
649
  }
641
- const V = [
650
+ const L = [
642
651
  i.collectionComponent.collection.removed.addEventListener(
643
- (h) => {
644
- var f;
645
- i.remove(h.name), ((f = t.value) == null ? void 0 : f.name) === h.name && c();
652
+ (l) => {
653
+ var d;
654
+ i.remove(l.name), ((d = t.value) == null ? void 0 : d.name) === l.name && v();
646
655
  }
647
656
  ),
648
- i.renamed.addEventListener(({ item: h, title: f }) => {
649
- var p;
650
- const d = s.windowManager.get(
657
+ i.renamed.addEventListener(({ item: l, title: d }) => {
658
+ var g;
659
+ const p = s.windowManager.get(
651
660
  `${i.collectionComponent.id}-editor`
652
661
  );
653
- d && ((p = t.value) == null ? void 0 : p.name) === h.name && (d.state.headerTitle = f);
662
+ p && ((g = t.value) == null ? void 0 : g.name) === l.name && (p.state.headerTitle = d);
654
663
  }),
655
- i.visibilityChanged.addEventListener((h) => {
656
- var d;
657
- const f = ((d = t.value) == null ? void 0 : d.name) === h.name;
658
- f ? c() : (_(g.VIEW, h), i.clearSelection()), i.setVisibility(h.name, !f);
664
+ i.visibilityChanged.addEventListener((l) => {
665
+ var p;
666
+ const d = ((p = t.value) == null ? void 0 : p.name) === l.name;
667
+ d ? v() : (P(m.VIEW, l), i.clearSelection()), i.setVisibility(l.name, !d);
659
668
  })
660
669
  ];
661
- function $(h) {
662
- if (!(h === a.value || !t.value)) {
663
- if (a.value = h, r.value === g.MOVE && l(), r.value === g.CREATE)
664
- H(
670
+ function G(l) {
671
+ if (!(l === a.value || !t.value)) {
672
+ if (a.value = l, n.value === m.MOVE && c(), n.value === m.CREATE)
673
+ U(
665
674
  s.maps.eventHandler.featureInteraction,
666
- h
667
- ), t.value.heightOffset = h === y.ABSOLUTE ? 0 : oe;
668
- else if (r.value === g.EDIT) {
669
- const { position: f, heightOffset: d } = t.value;
670
- h === y.RELATIVE ? s.maps.activeMap.getHeightFromTerrain([I.wgs84ToMercator(f)]).then((p) => {
671
- const C = I.mercatorToWgs84(p[0]);
672
- t.value && (t.value.heightOffset = f[2] - C[2], t.value.position = C);
675
+ l
676
+ ), t.value.heightOffset = l === y.ABSOLUTE ? 0 : re;
677
+ else if (n.value === m.EDIT) {
678
+ const { position: d, heightOffset: p } = t.value;
679
+ l === y.RELATIVE ? s.maps.activeMap.getHeightFromTerrain([I.wgs84ToMercator(d)]).then((g) => {
680
+ const C = I.mercatorToWgs84(g[0]);
681
+ t.value && (t.value.heightOffset = d[2] - C[2], t.value.position = C);
673
682
  }) : (t.value.position = [
674
- f[0],
675
- f[1],
676
- f[2] + d
683
+ d[0],
684
+ d[1],
685
+ d[2] + p
677
686
  ], t.value.heightOffset = 0);
678
687
  }
679
688
  }
@@ -681,86 +690,86 @@ function ft(s, e, i) {
681
690
  return {
682
691
  currentViewshed: t,
683
692
  currentIsPersisted: o,
684
- currentEditSession: n,
685
- createViewshed: m,
686
- viewViewshed(h) {
687
- _(g.VIEW, h);
693
+ currentEditSession: r,
694
+ createViewshed: _,
695
+ viewViewshed(l) {
696
+ P(m.VIEW, l);
688
697
  },
689
- editViewshed(h) {
690
- _(g.EDIT, h), o.value && (i.setSelection(h.name), i.collectionComponent.openEditorWindow(h));
698
+ editViewshed(l) {
699
+ P(m.EDIT, l), o.value && (i.setSelection(l.name), i.collectionComponent.openEditorWindow(l));
691
700
  },
692
701
  persistCurrent() {
693
702
  t.value && (i.add(t.value), o.value = !0, i.setSelection(t.value.name), i.setVisibility(t.value.name, !0));
694
703
  },
695
- moveCurrentViewshed: v,
704
+ moveCurrentViewshed: V,
696
705
  setupMultiSelect() {
697
- l(), r.value = g.MULTI_SELECT, u(null);
706
+ c(), n.value = m.MULTI_SELECT, h(), t.value = null;
698
707
  },
699
- mode: r,
708
+ mode: n,
700
709
  heightMode: a,
701
- changeHeightMode: $,
710
+ changeHeightMode: G,
702
711
  async placeCurrentFeaturesOnTerrain() {
703
- var h, f;
704
- if (t.value && ((h = n.value) == null ? void 0 : h.type) === ge.EDIT_FEATURES && s.maps.activeMap instanceof B) {
705
- const p = (await s.maps.activeMap.getHeightFromTerrain([
706
- I.wgs84ToMercator((f = t.value) == null ? void 0 : f.position)
712
+ var l, d;
713
+ if (t.value && ((l = r.value) == null ? void 0 : l.type) === Ce.EDIT_FEATURES && s.maps.activeMap instanceof D) {
714
+ const g = (await s.maps.activeMap.getHeightFromTerrain([
715
+ I.wgs84ToMercator((d = t.value) == null ? void 0 : d.position)
707
716
  ]))[0][2] - t.value.position[2];
708
- n.value.translate(0, 0, p);
717
+ r.value.translate(0, 0, g);
709
718
  }
710
719
  },
711
- stop: c,
720
+ stop: v,
712
721
  destroy() {
713
- c(), V.forEach((h) => h());
722
+ v(), L.forEach((l) => l());
714
723
  }
715
724
  };
716
725
  }
717
- function ue(s, e, i, t, o, r, a, l) {
718
- var n = typeof s == "function" ? s.options : s;
719
- e && (n.render = e, n.staticRenderFns = i, n._compiled = !0), t && (n.functional = !0), r && (n._scopeId = "data-v-" + r);
720
- var u;
721
- if (a ? (u = function(v) {
722
- v = v || // cached call
726
+ function ve(s, e, i, t, o, n, a, c) {
727
+ var r = typeof s == "function" ? s.options : s;
728
+ e && (r.render = e, r.staticRenderFns = i, r._compiled = !0), t && (r.functional = !0), n && (r._scopeId = "data-v-" + n);
729
+ var f;
730
+ if (a ? (f = function(u) {
731
+ u = u || // cached call
723
732
  this.$vnode && this.$vnode.ssrContext || // stateful
724
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !v && typeof __VUE_SSR_CONTEXT__ < "u" && (v = __VUE_SSR_CONTEXT__), o && o.call(this, v), v && v._registeredComponents && v._registeredComponents.add(a);
725
- }, n._ssrRegister = u) : o && (u = l ? function() {
733
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !u && typeof __VUE_SSR_CONTEXT__ < "u" && (u = __VUE_SSR_CONTEXT__), o && o.call(this, u), u && u._registeredComponents && u._registeredComponents.add(a);
734
+ }, r._ssrRegister = f) : o && (f = c ? function() {
726
735
  o.call(
727
736
  this,
728
- (n.functional ? this.parent : this).$root.$options.shadowRoot
737
+ (r.functional ? this.parent : this).$root.$options.shadowRoot
729
738
  );
730
- } : o), u)
731
- if (n.functional) {
732
- n._injectStyles = u;
733
- var c = n.render;
734
- n.render = function(_, V) {
735
- return u.call(V), c(_, V);
739
+ } : o), f)
740
+ if (r.functional) {
741
+ r._injectStyles = f;
742
+ var h = r.render;
743
+ r.render = function(_, V) {
744
+ return f.call(V), h(_, V);
736
745
  };
737
746
  } else {
738
- var m = n.beforeCreate;
739
- n.beforeCreate = m ? [].concat(m, u) : [u];
747
+ var v = r.beforeCreate;
748
+ r.beforeCreate = v ? [].concat(v, f) : [f];
740
749
  }
741
750
  return {
742
751
  exports: s,
743
- options: n
752
+ options: r
744
753
  };
745
754
  }
746
- const vt = {
755
+ const wt = {
747
756
  distance: [M.MIN_DISTANCE, 2e3],
748
757
  fov: [25, 85],
749
758
  heading: [0, 360],
750
759
  pitch: [-90, 90]
751
- }, pt = {
760
+ }, mt = {
752
761
  components: {
753
- VcsTextField: Ge,
754
- VContainer: le,
755
- VRow: ce,
756
- VCol: de,
757
- VcsSlider: He,
758
- VcsLabel: ne,
759
- VcsFormSection: re,
760
- VDivider: tt,
761
- VcsSelect: ae,
762
- VcsFormButton: Ue,
763
- VcsFeatureTransforms: Ke
762
+ VcsTextField: Ue,
763
+ VContainer: de,
764
+ VRow: he,
765
+ VCol: ue,
766
+ VcsSlider: Ke,
767
+ VcsLabel: ae,
768
+ VcsFormSection: le,
769
+ VDivider: st,
770
+ VcsSelect: ce,
771
+ VcsFormButton: Xe,
772
+ VcsFeatureTransforms: Ye
764
773
  },
765
774
  name: "ViewshedWindow",
766
775
  props: {
@@ -778,87 +787,87 @@ const vt = {
778
787
  setup(s) {
779
788
  const e = (
780
789
  /** @type {import("./viewshedManager.js").ViewshedManager} */
781
- ie("manager")
790
+ oe("manager")
782
791
  ), i = (
783
792
  /** @type {import("@vcmap/ui").VcsUiApp} */
784
- ie("vcsApp")
793
+ oe("vcsApp")
785
794
  ), {
786
795
  currentViewshed: t,
787
796
  mode: o,
788
- currentIsPersisted: r
789
- } = e, a = se(() => s.selection);
790
- let l = () => {
797
+ currentIsPersisted: n
798
+ } = e, a = ne(() => s.selection);
799
+ let c = () => {
791
800
  };
792
- const n = j({
801
+ const r = W({
793
802
  X: void 0,
794
803
  Y: void 0,
795
804
  Z: void 0
796
- }), u = U();
797
- let c = () => {
805
+ }), f = K();
806
+ let h = () => {
798
807
  };
799
- const m = j({
808
+ const v = W({
800
809
  showPrimitive: !1,
801
810
  distance: void 0,
802
811
  fov: void 0,
803
812
  heading: void 0,
804
813
  pitch: void 0
805
- }), v = A();
814
+ }), u = A();
806
815
  function _() {
807
- t.value && (n.X = t.value.position[0], n.Y = t.value.position[1], n.Z = e.heightMode.value === y.ABSOLUTE ? t.value.position[2] : t.value.heightOffset);
816
+ t.value && (r.X = t.value.position[0], r.Y = t.value.position[1], r.Z = e.heightMode.value === y.ABSOLUTE ? t.value.position[2] : t.value.heightOffset);
808
817
  }
809
818
  function V() {
810
- _(), t.value && (m.distance = t.value.distance, m.fov = t.value.fov, m.heading = t.value.heading, m.pitch = t.value.pitch, m.showPrimitive = t.value.showPrimitive, v.value = t.value.type);
819
+ _(), t.value && (v.distance = t.value.distance, v.fov = t.value.fov, v.heading = t.value.heading, v.pitch = t.value.pitch, v.showPrimitive = t.value.showPrimitive, u.value = t.value.type);
811
820
  }
812
- Le(() => {
813
- t.value && o.value !== g.CREATE && V();
821
+ Fe(() => {
822
+ t.value && o.value !== m.CREATE && V();
814
823
  }), R(
815
824
  t,
816
825
  () => {
817
- t.value && (l(), l = t.value.positionChanged.addEventListener(() => {
818
- _(), c();
826
+ t.value && (c(), c = t.value.positionChanged.addEventListener(() => {
827
+ _(), h();
819
828
  }));
820
829
  },
821
830
  { immediate: !0 }
822
831
  );
823
- async function $() {
824
- var C, b;
825
- (C = t.value) == null || C.deactivate();
826
- const d = (
832
+ async function P() {
833
+ var p, g;
834
+ (p = t.value) == null || p.deactivate();
835
+ const l = (
827
836
  /** @type {import("@vcmap/core").CesiumMap} */
828
- (b = i.maps.activeMap.getScene()) == null ? void 0 : b.camera
829
- ), p = d == null ? void 0 : d.changed.addEventListener(() => {
830
- c();
837
+ (g = i.maps.activeMap.getScene()) == null ? void 0 : g.camera
838
+ ), d = l == null ? void 0 : l.changed.addEventListener(() => {
839
+ h();
831
840
  });
832
- c = () => {
833
- var N;
834
- p == null || p(), u.value = null, (N = t.value) == null || N.activate(i.maps.activeMap), c = () => {
841
+ h = () => {
842
+ var C;
843
+ d == null || d(), f.value = null, (C = t.value) == null || C.activate(i.maps.activeMap), h = () => {
835
844
  };
836
845
  };
837
846
  }
838
- ke(() => {
839
- var p;
840
- const d = (p = s.getViewshed) == null ? void 0 : p.call(s);
841
- d && e.editViewshed(d);
842
- }), Fe(() => {
843
- l(), c(), r.value || ((o.value === g.EDIT || o.value === g.MOVE) && t.value ? e.viewViewshed(t.value) : o.value === g.CREATE && e.stop()), a.value && (a.value.length > 1 ? e.setupMultiSelect() : a.value.length === 1 && t.value ? e.viewViewshed(t.value) : (
847
+ je(() => {
848
+ var d;
849
+ const l = (d = s.getViewshed) == null ? void 0 : d.call(s);
850
+ l && e.editViewshed(l);
851
+ }), We(() => {
852
+ c(), h(), n.value || ((o.value === m.EDIT || o.value === m.MOVE) && t.value ? e.viewViewshed(t.value) : o.value === m.CREATE && e.stop()), a.value && (a.value.length > 1 ? e.setupMultiSelect() : a.value.length === 1 && t.value ? e.viewViewshed(t.value) : (
844
853
  // when a persited viewshed is deselected, stops plugin
845
- !a.value.length && o.value === g.EDIT && e.stop(!1)
854
+ !a.value.length && o.value === m.EDIT && e.stop(!1)
846
855
  ));
847
856
  }), V();
848
- function h(d, p) {
849
- c(), t.value && (m[d] = p, t.value[d] = p);
857
+ function L(l, d) {
858
+ h(), t.value && (v[l] = d, t.value[l] = d);
850
859
  }
851
- const f = se(() => {
852
- const d = [];
853
- return v.value === w.CONE && d.push({
860
+ const G = ne(() => {
861
+ const l = [];
862
+ return u.value === w.CONE && l.push({
854
863
  name: "jumpToViewpoint",
855
- title: u.value ? "viewshed.returnToViewpoint" : "viewshed.jumpToViewpoint",
864
+ title: f.value ? "viewshed.returnToViewpoint" : "viewshed.jumpToViewpoint",
856
865
  icon: "mdi-human-male",
857
- active: !!u.value,
866
+ active: !!f.value,
858
867
  async callback() {
859
- var p, C, b;
860
- e.moveCurrentViewshed(!1), t.value && !u.value ? (u.value = await ((p = i.maps.activeMap) == null ? void 0 : p.getViewpoint()), await ((C = i.maps.activeMap) == null ? void 0 : C.gotoViewpoint(
861
- new Te({
868
+ var d, p, g;
869
+ e.moveCurrentViewshed(!1), t.value && !f.value ? (f.value = await ((d = i.maps.activeMap) == null ? void 0 : d.getViewpoint()), await ((p = i.maps.activeMap) == null ? void 0 : p.gotoViewpoint(
870
+ new Oe({
862
871
  groundPosition: [
863
872
  t.value.position[0],
864
873
  t.value.position[1],
@@ -870,71 +879,71 @@ const vt = {
870
879
  animate: !0
871
880
  // if not animate, async does not work and the cameraChanged listener is triggered immediately. alternatively set timeout
872
881
  })
873
- )), $()) : u.value && ((b = i.maps.activeMap) == null || b.gotoViewpoint(u.value), c());
882
+ )), P()) : f.value && ((g = i.maps.activeMap) == null || g.gotoViewpoint(f.value), h());
874
883
  }
875
- }), d.push({
884
+ }), l.push({
876
885
  name: "moveViewshed",
877
886
  title: "viewshed.move",
878
887
  icon: e.heightMode.value === y.RELATIVE ? "$vcsEditVertices" : "mdi-axis-arrow",
879
- active: o.value === g.MOVE,
888
+ active: o.value === m.MOVE,
880
889
  callback() {
881
890
  e.moveCurrentViewshed(
882
- o.value !== g.MOVE
891
+ o.value !== m.MOVE
883
892
  );
884
893
  }
885
- }), d.unshift({
894
+ }), l.unshift({
886
895
  name: "showPrimitive",
887
896
  title: "viewshed.showPrimitive",
888
897
  icon: "mdi-eye",
889
- active: m.showPrimitive,
898
+ active: v.showPrimitive,
890
899
  callback() {
891
- this.active = !this.active, h("showPrimitive", this.active);
900
+ this.active = !this.active, L("showPrimitive", this.active);
892
901
  }
893
- }), d;
902
+ }), l;
894
903
  });
895
904
  return {
896
- position: n,
897
- setPosition(d, p, C) {
898
- if (c(), !!t.value) {
899
- if (C === 2 && e.heightMode.value === y.RELATIVE)
900
- t.value.heightOffset = Number(d);
905
+ position: r,
906
+ setPosition(l, d, p) {
907
+ if (h(), !!t.value) {
908
+ if (p === 2 && e.heightMode.value === y.RELATIVE)
909
+ t.value.heightOffset = Number(l);
901
910
  else {
902
- const b = [...t.value.position];
903
- b[C] = Number(d), t.value.position = b;
911
+ const g = [...t.value.position];
912
+ g[p] = Number(l), t.value.position = g;
904
913
  }
905
- n[p] = Number(d);
914
+ r[d] = Number(l);
906
915
  }
907
916
  },
908
- parameters: m,
909
- setParameter: h,
910
- parameterRanges: vt,
911
- ViewshedPluginModes: g,
917
+ parameters: v,
918
+ setParameter: L,
919
+ parameterRanges: wt,
920
+ ViewshedPluginModes: m,
912
921
  viewshedMode: o,
913
- currentIsPersisted: r,
914
- viewshedType: v,
922
+ currentIsPersisted: n,
923
+ viewshedType: u,
915
924
  ViewshedTypes: w,
916
925
  HeightModes: y,
917
926
  heightMode: e.heightMode,
918
- TransformationMode: Me,
927
+ TransformationMode: Se,
919
928
  changeHeightMode: e.changeHeightMode,
920
929
  async createNewViewshed() {
921
- await e.createViewshed(v.value);
930
+ await e.createViewshed(u.value);
922
931
  },
923
932
  addToMyWorkspace: () => e.persistCurrent(),
924
933
  cancel: () => e.stop(),
925
- headerActions: f
934
+ headerActions: G
926
935
  };
927
936
  }
928
937
  };
929
- var wt = function() {
938
+ var gt = function() {
930
939
  var e = this, i = e._self._c;
931
- return i("div", [e.viewshedMode === e.ViewshedPluginModes.CREATE ? i("div", { staticClass: "px-2 py-1" }, [e.viewshedType === e.ViewshedTypes.CONE ? [e._v(" " + e._s(e.$t("viewshed.createDescription")) + " ")] : e.viewshedType === e.ViewshedTypes.THREESIXTY ? [e._v(" " + e._s(e.$t("viewshed.createThreeSixtyDescription")) + " ")] : e._e()], 2) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("VcsFormSection", { attrs: { "header-actions": e.headerActions, heading: "viewshed.viewpoint", "action-button-list-overflow-count": 3 } }, [i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("span", { staticClass: "px-1 py-0" }, [e._v(e._s(e.$t("viewshed.position")))])]), e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? i("v-row", { attrs: { "no-gutters": "" } }, [i("VcsFeatureTransforms", { attrs: { "transformation-mode": e.TransformationMode.TRANSLATE, "feature-properties": { altitudeMode: "absolute" }, "allow-z-input": !0 } })], 1) : i("v-row", { attrs: { "no-gutters": "" } }, e._l(e.position, function(t, o, r) {
932
- return i("v-col", { key: r, staticClass: "pb-1" }, [i("VcsTextField", { attrs: { value: t, type: "number", prefix: o, "show-spin-buttons": !0, step: o === "Z" ? 1 : 1e-4, unit: o === "Z" ? "m" : "°", decimals: o === "Z" ? 2 : 8, disabled: e.viewshedMode === e.ViewshedPluginModes.MOVE && !(o === "Z" && e.heightMode === e.HeightModes.RELATIVE) }, on: { input: (a) => e.setPosition(a, o, r) } })], 1);
940
+ return i("div", [e.viewshedMode === e.ViewshedPluginModes.CREATE ? i("div", { staticClass: "px-2 py-1" }, [e.viewshedType === e.ViewshedTypes.CONE ? [e._v(" " + e._s(e.$t("viewshed.createDescription")) + " ")] : e.viewshedType === e.ViewshedTypes.THREESIXTY ? [e._v(" " + e._s(e.$t("viewshed.createThreeSixtyDescription")) + " ")] : e._e()], 2) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("VcsFormSection", { attrs: { "header-actions": e.headerActions, heading: "viewshed.viewpoint", "action-button-list-overflow-count": 3 } }, [i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("span", { staticClass: "px-1 py-0" }, [e._v(e._s(e.$t("viewshed.position")))])]), e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? i("v-row", { attrs: { "no-gutters": "" } }, [i("VcsFeatureTransforms", { attrs: { "transformation-mode": e.TransformationMode.TRANSLATE, "feature-properties": { altitudeMode: "absolute" }, "allow-z-input": !0 } })], 1) : i("v-row", { attrs: { "no-gutters": "" } }, e._l(e.position, function(t, o, n) {
941
+ return i("v-col", { key: n, staticClass: "pb-1" }, [i("VcsTextField", { attrs: { value: t, type: "number", prefix: o, "show-spin-buttons": !0, step: o === "Z" ? 1 : 1e-4, unit: o === "Z" ? "m" : "°", decimals: o === "Z" ? 2 : 8, disabled: e.viewshedMode === e.ViewshedPluginModes.MOVE && !(o === "Z" && e.heightMode === e.HeightModes.RELATIVE) }, on: { input: (a) => e.setPosition(a, o, n) } })], 1);
933
942
  }), 1)], 1)], 1) : e._e(), i("v-divider"), i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", [e._v(" " + e._s(e.$t("viewshed.heightMode")) + " ")])], 1), i("v-col", [i("VcsSelect", { attrs: { items: Object.values(e.HeightModes).map((t) => ({
934
943
  value: t,
935
944
  text: `viewshed.${t}`
936
945
  })), value: e.heightMode }, on: { input: e.changeHeightMode } })], 1)], 1)], 1), e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("v-container", { staticClass: "px-1 pt-0 pb-2" }, e._l(e.parameters, function(t, o) {
937
- return i("v-row", { key: o, attrs: { "no-gutters": "" } }, [o === "distance" || e.viewshedType === e.ViewshedTypes.CONE && o !== "showPrimitive" ? i("v-col", [i("v-row", { staticClass: "pr-1", attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": o } }, [e._v(" " + e._s(e.$t(`viewshed.${o}`)) + " ")])], 1), i("v-col", { staticClass: "d-flex justify-end align-center" }, [o === "distance" ? i("span", [e._v(e._s(`${t} m`))]) : i("span", [e._v(e._s(`${t} °`))])])], 1), i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsSlider", { attrs: { id: o, value: t, type: "number", step: "1", min: e.parameterRanges[o][0], max: e.parameterRanges[o][1], height: "15" }, on: { input: (r) => e.setParameter(o, r) } })], 1)], 1)], 1) : e._e()], 1);
946
+ return i("v-row", { key: o, attrs: { "no-gutters": "" } }, [o === "distance" || e.viewshedType === e.ViewshedTypes.CONE && o !== "showPrimitive" ? i("v-col", [i("v-row", { staticClass: "pr-1", attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": o } }, [e._v(" " + e._s(e.$t(`viewshed.${o}`)) + " ")])], 1), i("v-col", { staticClass: "d-flex justify-end align-center" }, [o === "distance" ? i("span", [e._v(e._s(`${t} m`))]) : i("span", [e._v(e._s(`${t} °`))])])], 1), i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsSlider", { attrs: { id: o, value: t, type: "number", step: "1", min: e.parameterRanges[o][0], max: e.parameterRanges[o][1], height: "15" }, on: { input: (n) => e.setParameter(o, n) } })], 1)], 1)], 1) : e._e()], 1);
938
947
  }), 1) : e._e(), i("v-divider"), e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("div", { staticClass: "d-flex w-full justify-space-between px-2 pt-2 pb-1" }, [i("VcsFormButton", { attrs: { tooltip: "viewshed.addToMyWorkspace", icon: "$vcsComponentsPlus", disabled: e.currentIsPersisted || void 0 }, on: { click: function(t) {
939
948
  return e.addToMyWorkspace();
940
949
  } } }), i("VcsFormButton", { attrs: { variant: "filled" }, on: { click: function(t) {
@@ -942,23 +951,23 @@ var wt = function() {
942
951
  } } }, [e._v(" " + e._s(e.$t("viewshed.new")) + " ")])], 1) : e.viewshedMode === e.ViewshedPluginModes.CREATE ? i("div", { staticClass: "d-flex w-full justify-end px-2 pt-2 pb-1" }, [i("VcsFormButton", { attrs: { variant: "filled" }, on: { click: function(t) {
943
952
  return e.cancel();
944
953
  } } }, [e._v(" " + e._s(e.$t("viewshed.cancel")) + " ")])], 1) : e._e()], 1);
945
- }, mt = [], gt = /* @__PURE__ */ ue(
946
- pt,
947
- wt,
954
+ }, _t = [], Ct = /* @__PURE__ */ ve(
948
955
  mt,
956
+ gt,
957
+ _t,
949
958
  !1,
950
959
  null,
951
960
  null,
952
961
  null,
953
962
  null
954
963
  );
955
- const _t = gt.exports, P = "@vcmap/viewshed", Ct = "2.0.4", Et = "^5.1", Y = {
964
+ const Et = Ct.exports, S = "@vcmap/viewshed", yt = "2.0.5", Vt = "^5.1", J = {
956
965
  [w.CONE]: "$vcsViewshed",
957
966
  [w.THREESIXTY]: "$vcsViewshedCone"
958
967
  };
959
- function yt(s, e, i) {
960
- const t = A(), o = A(), r = `${i.id}-editor`, a = {
961
- component: _t,
968
+ function bt(s, e, i) {
969
+ const t = A(), o = A(), n = `${i.id}-editor`, a = {
970
+ component: Et,
962
971
  provides: {
963
972
  manager: s
964
973
  },
@@ -969,17 +978,17 @@ function yt(s, e, i) {
969
978
  infoUrlCallback: e.getHelpUrlCallback("tools/viewshedTool.html")
970
979
  }
971
980
  };
972
- Xe(e, i, {
973
- editor: (v) => ({
981
+ Je(e, i, {
982
+ editor: (u) => ({
974
983
  ...a,
975
984
  props: {
976
985
  selection: i.selection,
977
- getViewshed: () => i.collection.getByKey(v.name)
986
+ getViewshed: () => i.collection.getByKey(u.name)
978
987
  }
979
988
  })
980
989
  });
981
- function l() {
982
- s.currentViewshed.value && (o.value = Y[s.currentViewshed.value.type], s.currentIsPersisted.value ? t.value = s.currentViewshed.value.properties.title : s.mode.value === g.CREATE ? t.value = [
990
+ function c() {
991
+ s.currentViewshed.value && (o.value = J[s.currentViewshed.value.type], s.currentIsPersisted.value ? t.value = s.currentViewshed.value.properties.title : s.mode.value === m.CREATE ? t.value = [
983
992
  "viewshed.create",
984
993
  `viewshed.${s.currentViewshed.value.type}`
985
994
  ] : t.value = [
@@ -987,34 +996,34 @@ function yt(s, e, i) {
987
996
  `viewshed.${s.currentViewshed.value.type}`
988
997
  ]);
989
998
  }
990
- function n() {
991
- l(), s.currentViewshed.value && !s.currentIsPersisted.value && (s.mode.value === g.EDIT || s.mode.value === g.MOVE || s.mode.value === g.CREATE) && (e.windowManager.has(r) || e.windowManager.add(
999
+ function r() {
1000
+ c(), s.currentViewshed.value && !s.currentIsPersisted.value && (s.mode.value === m.EDIT || s.mode.value === m.MOVE || s.mode.value === m.CREATE) && (e.windowManager.has(n) || e.windowManager.add(
992
1001
  {
993
1002
  ...a,
994
- id: r,
1003
+ id: n,
995
1004
  parentId: "category-manager",
996
- slot: Ye.DYNAMIC_LEFT
1005
+ slot: Ze.DYNAMIC_LEFT
997
1006
  },
998
- P
1007
+ S
999
1008
  ));
1000
1009
  }
1001
- const u = R(s.currentViewshed, (v) => {
1002
- v && n();
1003
- }), c = R(s.currentIsPersisted, (v) => {
1004
- v && l();
1005
- }), m = R(s.mode, () => {
1006
- s.mode.value ? n() : e.windowManager.remove(r);
1010
+ const f = R(s.currentViewshed, (u) => {
1011
+ u && r();
1012
+ }), h = R(s.currentIsPersisted, (u) => {
1013
+ u && c();
1014
+ }), v = R(s.mode, () => {
1015
+ s.mode.value ? r() : e.windowManager.remove(n);
1007
1016
  });
1008
1017
  return {
1009
1018
  destroy() {
1010
- e.windowManager.remove(r), u(), m(), c();
1019
+ e.windowManager.remove(n), f(), v(), h();
1011
1020
  }
1012
1021
  };
1013
1022
  }
1014
- function Vt(s, e, i, t) {
1023
+ function Mt(s, e, i, t) {
1015
1024
  const o = {
1016
- type: Je.SELECT,
1017
- action: j({
1025
+ type: qe.SELECT,
1026
+ action: W({
1018
1027
  name: i,
1019
1028
  currentIndex: 0,
1020
1029
  active: !1,
@@ -1024,54 +1033,54 @@ function Vt(s, e, i, t) {
1024
1033
  if (this.active)
1025
1034
  this.background && e.currentViewshed.value ? e.editViewshed(e.currentViewshed.value) : e.stop();
1026
1035
  else {
1027
- const n = this.tools[this.currentIndex].name;
1028
- e.createViewshed(n);
1036
+ const r = this.tools[this.currentIndex].name;
1037
+ e.createViewshed(r);
1029
1038
  }
1030
1039
  },
1031
- selected(n) {
1032
- if (n !== this.currentIndex) {
1033
- this.currentIndex = n;
1034
- const u = this.tools[this.currentIndex].name;
1035
- e.createViewshed(u);
1040
+ selected(r) {
1041
+ if (r !== this.currentIndex) {
1042
+ this.currentIndex = r;
1043
+ const f = this.tools[this.currentIndex].name;
1044
+ e.createViewshed(f);
1036
1045
  }
1037
1046
  },
1038
- tools: t.flatMap((n) => n === w.CONE ? {
1047
+ tools: t.flatMap((r) => r === w.CONE ? {
1039
1048
  name: w.CONE,
1040
- icon: Y[w.CONE],
1049
+ icon: J[w.CONE],
1041
1050
  title: `viewshed.${w.CONE}`
1042
- } : n === w.THREESIXTY ? {
1051
+ } : r === w.THREESIXTY ? {
1043
1052
  name: w.THREESIXTY,
1044
- icon: Y[w.THREESIXTY],
1053
+ icon: J[w.THREESIXTY],
1045
1054
  title: `viewshed.${w.THREESIXTY}`
1046
1055
  } : [])
1047
1056
  })
1048
- }, r = R(e.mode, (n) => {
1049
- n === g.VIEW ? (o.action.background = !0, o.action.active = !0) : n ? (o.action.background = !1, o.action.active = !0) : (o.action.background = !1, o.action.active = !1);
1057
+ }, n = R(e.mode, (r) => {
1058
+ r === m.VIEW ? (o.action.background = !0, o.action.active = !0) : r ? (o.action.background = !1, o.action.active = !0) : (o.action.background = !1, o.action.active = !1);
1050
1059
  }), a = R(
1051
1060
  e.currentViewshed,
1052
- (n) => {
1053
- n && (o.action.currentIndex = o.action.tools.findIndex(
1054
- (u) => u.name === n.type
1061
+ (r) => {
1062
+ r && (o.action.currentIndex = o.action.tools.findIndex(
1063
+ (f) => f.name === r.type
1055
1064
  ));
1056
1065
  }
1057
- ), l = s.maps.mapActivated.addEventListener((n) => {
1058
- n instanceof B ? o.action.disabled = !1 : (o.action.disabled = !0, e.stop());
1066
+ ), c = s.maps.mapActivated.addEventListener((r) => {
1067
+ r instanceof D ? o.action.disabled = !1 : o.action.disabled = !0;
1059
1068
  });
1060
1069
  return {
1061
1070
  destroy() {
1062
- r(), a(), l();
1071
+ n(), a(), c();
1063
1072
  },
1064
1073
  toolbox: o
1065
1074
  };
1066
1075
  }
1067
- function bt(s, e, i, t) {
1076
+ function Tt(s, e, i, t) {
1068
1077
  z(t, [Object.values(w)]);
1069
- const { toolbox: o, destroy: r } = Vt(s, e, i, t), a = s.toolboxManager.add(o, i).id;
1078
+ const { toolbox: o, destroy: n } = Mt(s, e, i, t), a = s.toolboxManager.add(o, i).id;
1070
1079
  return () => {
1071
- s.toolboxManager.remove(a), r();
1080
+ s.toolboxManager.remove(a), n();
1072
1081
  };
1073
1082
  }
1074
- class J extends Oe {
1083
+ class Z extends Pe {
1075
1084
  static get className() {
1076
1085
  return "ViewshedCategory";
1077
1086
  }
@@ -1079,138 +1088,138 @@ class J extends Oe {
1079
1088
  var t;
1080
1089
  const i = (
1081
1090
  /** @type {import("@vcmap/core").CesiumMap | undefined} */
1082
- (t = this._app) == null ? void 0 : t.maps.getByType(B.className)[0]
1091
+ (t = this._app) == null ? void 0 : t.maps.getByType(D.className)[0]
1083
1092
  );
1084
1093
  if (i)
1085
1094
  return new M(e, i);
1086
1095
  throw new Error("No CesiumMap available");
1087
1096
  }
1088
1097
  }
1089
- function Tt(s, e) {
1098
+ function Ot(s, e) {
1090
1099
  let i, t = 0;
1091
1100
  const o = new Set(
1092
- e.filter((r) => r.type === s).map((r) => r.properties.title)
1101
+ e.filter((n) => n.type === s).map((n) => n.properties.title)
1093
1102
  );
1094
1103
  do
1095
1104
  t += 1, o.has(`${s}-${t}`) || (i = `${s}-${t}`);
1096
1105
  while (!i);
1097
1106
  return i;
1098
1107
  }
1099
- async function Mt(s) {
1100
- const e = new L(), i = new L(), { collectionComponent: t, category: o } = await s.categoryManager.requestCategory(
1108
+ async function St(s) {
1109
+ const e = new x(), i = new x(), { collectionComponent: t, category: o } = await s.categoryManager.requestCategory(
1101
1110
  {
1102
- type: J.className,
1111
+ type: Z.className,
1103
1112
  name: "Viewsheds",
1104
1113
  title: "Viewsheds"
1105
1114
  },
1106
- P,
1115
+ S,
1107
1116
  {
1108
1117
  selectable: !0,
1109
1118
  renamable: !0,
1110
1119
  removable: !0
1111
1120
  }
1112
- ), r = (c, m, v) => {
1113
- v.title = c.properties.title, v.titleChanged = (_) => {
1114
- c.properties.title = _, v.title = _, e.raiseEvent({ item: c, title: _ });
1115
- }, v.actions.push(
1116
- j({
1121
+ ), n = (h, v, u) => {
1122
+ u.title = h.properties.title, u.titleChanged = (_) => {
1123
+ h.properties.title = _, u.title = _, e.raiseEvent({ item: h, title: _ });
1124
+ }, u.actions.push(
1125
+ W({
1117
1126
  name: "visibilityAction",
1118
1127
  icon: "$vcsCheckbox",
1119
1128
  callback() {
1120
- i.raiseEvent(c);
1129
+ i.raiseEvent(h);
1121
1130
  }
1122
1131
  })
1123
1132
  );
1124
1133
  };
1125
1134
  s.categoryManager.addMappingFunction(
1126
1135
  () => !0,
1127
- r,
1128
- P,
1136
+ n,
1137
+ S,
1129
1138
  [t.id]
1130
1139
  );
1131
- const { action: a, destroy: l } = Ze(
1140
+ const { action: a, destroy: c } = Qe(
1132
1141
  t.selection,
1133
1142
  () => {
1134
- const c = t.selection.value.map(
1135
- (m) => t.collection.getByKey(m.name)
1143
+ const h = t.selection.value.map(
1144
+ (v) => t.collection.getByKey(v.name)
1136
1145
  );
1137
- qe(JSON.stringify(c), "viewsheds.json");
1146
+ et(JSON.stringify(h), "viewsheds.json");
1138
1147
  },
1139
- P
1140
- ), { action: n, destroy: u } = Qe(
1141
- async (c) => {
1148
+ S
1149
+ ), { action: r, destroy: f } = tt(
1150
+ async (h) => {
1142
1151
  await Promise.all(
1143
- c.map(async (m) => {
1144
- const v = await m.text();
1145
- JSON.parse(v).forEach((V) => {
1146
- const $ = new M(V);
1147
- o.collection.add($);
1152
+ h.map(async (v) => {
1153
+ const u = await v.text();
1154
+ JSON.parse(u).forEach((V) => {
1155
+ const P = new M(V);
1156
+ o.collection.add(P);
1148
1157
  });
1149
1158
  })
1150
1159
  );
1151
1160
  },
1152
1161
  s.windowManager,
1153
- P,
1162
+ S,
1154
1163
  "category-manager"
1155
1164
  );
1156
- return t.addActions([a, n]), {
1165
+ return t.addActions([a, r]), {
1157
1166
  renamed: e,
1158
1167
  visibilityChanged: i,
1159
- setSelection(c) {
1160
- c && (t.selection.value = t.items.value.filter((m) => c === m.name));
1168
+ setSelection(h) {
1169
+ h && (t.selection.value = t.items.value.filter((v) => h === v.name));
1161
1170
  },
1162
1171
  clearSelection() {
1163
1172
  t.selection.value.length && (t.selection.value = []);
1164
1173
  },
1165
- setVisibility(c, m) {
1166
- const v = t.items.value.find(
1167
- (_) => c === _.name
1174
+ setVisibility(h, v) {
1175
+ const u = t.items.value.find(
1176
+ (_) => h === _.name
1168
1177
  );
1169
- if (v) {
1170
- const _ = v.actions.find(
1178
+ if (u) {
1179
+ const _ = u.actions.find(
1171
1180
  (V) => V.name === "visibilityAction"
1172
1181
  );
1173
- _ && (_.icon = m ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1182
+ _ && (_.icon = v ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1174
1183
  }
1175
1184
  },
1176
- add(c) {
1177
- c.properties.title = Tt(
1178
- c.type,
1185
+ add(h) {
1186
+ h.properties.title = Ot(
1187
+ h.type,
1179
1188
  /** @type {import("./viewshed.js").default[]} */
1180
1189
  [
1181
1190
  ...o.collection
1182
1191
  ]
1183
- ), o.collection.add(c);
1192
+ ), o.collection.add(h);
1184
1193
  },
1185
- remove(c) {
1186
- const m = o.collection.getByKey(c);
1187
- m && o.collection.remove(m);
1194
+ remove(h) {
1195
+ const v = o.collection.getByKey(h);
1196
+ v && o.collection.remove(v);
1188
1197
  },
1189
1198
  collectionComponent: t,
1190
1199
  destroy() {
1191
- s.categoryManager.removeOwner(P), e.destroy(), i.destroy(), l(), u();
1200
+ s.categoryManager.removeOwner(S), e.destroy(), i.destroy(), c(), f();
1192
1201
  }
1193
1202
  };
1194
1203
  }
1195
- function k() {
1204
+ function F() {
1196
1205
  return {
1197
1206
  visibleColor: M.getDefaultOptions().visibleColor,
1198
1207
  shadowColor: M.getDefaultOptions().shadowColor,
1199
1208
  tools: [...Object.values(w)]
1200
1209
  };
1201
1210
  }
1202
- const Ot = {
1211
+ const Pt = {
1203
1212
  name: "ViewshedConfigEditor",
1204
1213
  title: "Viewshed Editor",
1205
1214
  components: {
1206
- AbstractConfigEditor: et,
1207
- VcsFormSection: re,
1208
- VContainer: le,
1209
- VRow: ce,
1210
- VCol: de,
1211
- VcsLabel: ne,
1212
- VcsSelect: ae,
1213
- VColorPicker: it
1215
+ AbstractConfigEditor: it,
1216
+ VcsFormSection: le,
1217
+ VContainer: de,
1218
+ VRow: he,
1219
+ VCol: ue,
1220
+ VcsLabel: ae,
1221
+ VcsSelect: ce,
1222
+ VColorPicker: ot
1214
1223
  },
1215
1224
  props: {
1216
1225
  getConfig: {
@@ -1225,7 +1234,7 @@ const Ot = {
1225
1234
  setup(s) {
1226
1235
  const e = A({});
1227
1236
  s.getConfig().then((t) => {
1228
- e.value = Object.assign(k(), t);
1237
+ e.value = Object.assign(F(), t);
1229
1238
  });
1230
1239
  async function i() {
1231
1240
  await s.setConfig(e.value);
@@ -1241,7 +1250,7 @@ const Ot = {
1241
1250
  };
1242
1251
  }
1243
1252
  };
1244
- var St = function() {
1253
+ var At = function() {
1245
1254
  var e = this, i = e._self._c;
1246
1255
  return i("AbstractConfigEditor", e._b({ on: { submit: e.apply } }, "AbstractConfigEditor", { ...e.$attrs, ...e.$props }, !1), [e.localConfig ? i("VcsFormSection", { attrs: { heading: "viewshed.editor.general" } }, [i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": "viewshed-editor-tools" } }, [e._v(e._s(e.$t("viewshed.editor.tools")))])], 1), i("v-col", [i("VcsSelect", { attrs: { id: "viewshed-tools", items: e.toolItems, multiple: !0 }, model: { value: e.localConfig.tools, callback: function(t) {
1247
1256
  e.$set(e.localConfig, "tools", t);
@@ -1250,29 +1259,29 @@ var St = function() {
1250
1259
  }, expression: "localConfig.visibleColor" } })], 1)], 1), i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": "viewshed-editor-shadow-color" } }, [e._v(e._s(e.$t("viewshed.editor.shadowColor")))])], 1), i("v-col", [i("VColorPicker", { attrs: { mode: "rgba" }, model: { value: e.localConfig.shadowColor, callback: function(t) {
1251
1260
  e.$set(e.localConfig, "shadowColor", t);
1252
1261
  }, expression: "localConfig.shadowColor" } })], 1)], 1)], 1)], 1) : e._e()], 1);
1253
- }, Pt = [], At = /* @__PURE__ */ ue(
1254
- Ot,
1255
- St,
1262
+ }, It = [], Rt = /* @__PURE__ */ ve(
1256
1263
  Pt,
1264
+ At,
1265
+ It,
1257
1266
  !1,
1258
1267
  null,
1259
1268
  null,
1260
1269
  null,
1261
1270
  null
1262
1271
  );
1263
- const It = At.exports;
1264
- function Ft(s) {
1272
+ const $t = Rt.exports;
1273
+ function Wt(s) {
1265
1274
  let e, i = () => {
1266
1275
  };
1267
1276
  return {
1268
1277
  get name() {
1269
- return P;
1278
+ return S;
1270
1279
  },
1271
1280
  get version() {
1272
- return Ct;
1281
+ return yt;
1273
1282
  },
1274
1283
  get mapVersion() {
1275
- return Et;
1284
+ return Vt;
1276
1285
  },
1277
1286
  /**
1278
1287
  * @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
@@ -1281,47 +1290,55 @@ function Ft(s) {
1281
1290
  */
1282
1291
  async initialize(t, o) {
1283
1292
  t.categoryClassRegistry.registerClass(
1284
- this[Se],
1285
- J.className,
1286
- J
1293
+ this[Ae],
1294
+ Z.className,
1295
+ Z
1287
1296
  );
1288
- const r = await Mt(t);
1289
- e = ft(
1297
+ const n = await St(t);
1298
+ e = pt(
1290
1299
  t,
1291
1300
  s,
1292
- r
1301
+ n
1293
1302
  );
1294
- const a = bt(
1303
+ const a = Tt(
1295
1304
  t,
1296
1305
  e,
1297
- P,
1298
- s.tools || k().tools
1299
- ), { destroy: l } = yt(
1306
+ S,
1307
+ s.tools || F().tools
1308
+ ), { destroy: c } = bt(
1300
1309
  e,
1301
1310
  t,
1302
- r.collectionComponent
1311
+ n.collectionComponent
1312
+ ), { activeMap: r } = t.maps;
1313
+ function f(u) {
1314
+ if (o != null && o.mode && o.currentViewshed && u instanceof D) {
1315
+ const _ = new M(o.currentViewshed, r);
1316
+ o.mode === m.VIEW ? e.viewViewshed(_) : e.editViewshed(_);
1317
+ }
1318
+ }
1319
+ let h = !1;
1320
+ r && (h = !0, f(r));
1321
+ const v = t.maps.mapActivated.addEventListener(
1322
+ (u) => {
1323
+ e.stop(), h || (f(u), h = !0);
1324
+ }
1303
1325
  );
1304
1326
  i = () => {
1305
- a(), l(), r.destroy();
1327
+ v(), a(), c(), n.destroy(), e.destroy();
1306
1328
  };
1307
- const { activeMap: n } = t.maps;
1308
- if (o != null && o.mode && o.currentViewshed && n instanceof B) {
1309
- const u = new M(o.currentViewshed, n);
1310
- o.mode === g.VIEW ? e.viewViewshed(u) : e.editViewshed(u);
1311
- }
1312
1329
  },
1313
1330
  /**
1314
1331
  * should return all default values of the configuration
1315
1332
  * @returns {ViewshedPluginOptions}
1316
1333
  */
1317
- getDefaultOptions: k,
1334
+ getDefaultOptions: F,
1318
1335
  /**
1319
1336
  * should return the plugin's serialization excluding all default values
1320
1337
  * @returns {ViewshedPluginOptions}
1321
1338
  */
1322
1339
  toJSON() {
1323
1340
  const t = {};
1324
- return s.tools && k().tools.length !== s.tools.length && (t.tools = [...s.tools]), s.shadowColor && s.shadowColor !== M.getDefaultOptions().shadowColor && (t.shadowColor = s.shadowColor), s.visibleColor && s.visibleColor !== M.getDefaultOptions().visibleColor && (t.visibleColor = s.visibleColor), t;
1341
+ return s.tools && F().tools.length !== s.tools.length && (t.tools = [...s.tools]), s.shadowColor && s.shadowColor !== M.getDefaultOptions().shadowColor && (t.shadowColor = s.shadowColor), s.visibleColor && s.visibleColor !== M.getDefaultOptions().visibleColor && (t.visibleColor = s.visibleColor), t;
1325
1342
  },
1326
1343
  /**
1327
1344
  * should return the plugins state
@@ -1339,7 +1356,7 @@ function Ft(s) {
1339
1356
  * @returns {Array<import("@vcmap/ui").PluginConfigEditor>}
1340
1357
  */
1341
1358
  getConfigEditors() {
1342
- return [{ component: It }];
1359
+ return [{ component: $t }];
1343
1360
  },
1344
1361
  destroy: i,
1345
1362
  i18n: {
@@ -1415,5 +1432,5 @@ function Ft(s) {
1415
1432
  };
1416
1433
  }
1417
1434
  export {
1418
- Ft as default
1435
+ Wt as default
1419
1436
  };