@vcmap/viewshed 3.0.5 → 4.0.0

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