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