@vcmap/viewshed 3.0.3 → 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 Oe = Object.defineProperty;
2
- var Ie = (i, t, o) => t in i ? Oe(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
3
- var de = (i, t, o) => Ie(i, typeof t != "symbol" ? t + "" : t, o);
4
- import { VcsCameraPrimitive as Pe, VcsObject as Ae, VcsEvent as X, AbstractInteraction as Re, EventType as Y, Projection as z, SessionType as Ne, CesiumMap as $, startEditFeaturesSession as De, startEditGeometrySession as xe, VectorLayer as ke, wgs84Projection as Le, maxZIndex as Fe, markVolatile as je, Viewpoint as We, TransformationMode as Be, Category as Ue, moduleIdSymbol as $e } from "../../../assets/core.js";
5
- import { Color as Q, Matrix4 as He, Transforms as ze, Primitive as ce, GeometryInstance as ue, SphereGeometry as Ge, ColorGeometryInstanceAttribute as he, PerInstanceColorAppearance as fe, SphereOutlineGeometry as Ke, Math as x, Cartesian3 as W, ShadowMap as Ye, Camera as Xe, HeightReference as Je } from "../../../assets/cesium.js";
6
- import { shallowRef as Z, ref as U, nextTick as Ze, inject as me, computed as ve, reactive as ee, watchEffect as qe, watch as G, onMounted as Qe, onUnmounted as et, 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 tt, Fragment as pe, renderList as we, mergeProps as it } from "../../../assets/vue.js";
7
- import { ol$Observable$unByKey as ot, Feature as st, ol$geom$Point as nt, ol$style$Style as at } from "../../../assets/ol.js";
8
- import { VcsTextField as rt, VcsSlider as lt, VcsLabel as _e, VcsFormSection as Ce, VcsSelect as Ee, VcsFormButton as dt, VcsFeatureTransforms as ct, VcsHelp as ut, makeEditorCollectionComponentClass as ht, WindowSlot as ft, ToolboxType as mt, createSupportedMapMappingFunction as vt, createListExportAction as pt, downloadText as wt, createListImportAction as gt, NotificationType as J, AbstractConfigEditor as _t } from "../../../assets/ui.js";
9
- import { VContainer as ye, VRow as Ve, VCol as be, VDivider as Ct, VColorPicker as Et } from "../../../assets/vuetify.js";
10
- const Me = Symbol("isMatcher"), yt = Symbol("Integer"), Vt = Symbol("NonEmptyString"), 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 Me = Symbol("isMatcher"), yt = Symbol("Integer"), Vt = Symbol("NonEmptyStr
15
15
  [Function, "function"],
16
16
  [void 0, "undefined"],
17
17
  [Symbol, "symbol"]
18
- ].forEach(([i, t]) => {
19
- re.set(i, t);
18
+ ].forEach(([e, o]) => {
19
+ ve.set(e, o);
20
20
  });
21
- function bt(i) {
22
- return i == null ? void 0 : i[Me];
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 t = Object.getPrototypeOf(i);
28
- if (!t)
27
+ const o = Object.getPrototypeOf(e);
28
+ if (!o)
29
29
  return !0;
30
- const e = {}.hasOwnProperty.call(t, "constructor") && t.constructor;
31
- return typeof e == "function" && String(e) === 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, t) {
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 (t)
39
- return typeof i;
40
- let o;
41
- if (Array.isArray(i))
42
- o = `[${i.map((s) => R(s, t)).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, t) {
52
- return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || typeof t == "symbol" ? i === t ? !1 : `Expected ${R(i)} to equal ${t.toString()}` : null;
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, t, o) {
55
- if (Array.isArray(t)) {
56
- if (t.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 e = !1;
60
- return i.findIndex((n) => (e = o(n, t[0]), e)) > -1 ? `${String(e)} 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, t, o, e) {
67
- const s = e ? `${e}.` : "";
68
- if (!oe(i))
69
- return `Expected ${R(i)} to be a plain Object`;
70
- let d = !1;
71
- const r = Object.keys(t).find((l) => {
72
- const _ = i[l];
73
- return oe(t[l]) ? d = se(_, t[l], o, s + l) : d = o(_, t[l]), d;
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 r ? `${String(d)} in object.${s}${r}` : !1;
75
+ return l ? `${String(a)} in object.${s}${l}` : !1;
76
76
  }
77
- function St(i, t) {
78
- if (t === Number)
79
- return Number.isFinite(i) ? !1 : `expected ${R(i)} to be a number, excluding NaN`;
80
- if (t === yt)
81
- return Number.isInteger(i) ? !1 : `expected ${R(i)} to be an integer number`;
82
- if (t === Vt)
83
- return typeof i == "string" && i.length > 0 ? !1 : `expected ${R(i)} to be a non-empty string`;
84
- const o = re.get(t);
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 Te(i) {
88
- if (i === null)
87
+ function $e(e) {
88
+ if (e === null)
89
89
  return "null";
90
- const t = re.get(i);
91
- if (t)
92
- return t;
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 e = String(i);
97
- const s = e.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((d) => {
105
- n[d] = Te(i[d]);
104
+ Object.keys(e).forEach((a) => {
105
+ n[a] = $e(e[a]);
106
106
  });
107
107
  try {
108
- e = `Object of ${JSON.stringify(n)}`;
108
+ i = `Object of ${JSON.stringify(n)}`;
109
109
  } catch {
110
- e = "Object";
110
+ i = "Object";
111
111
  }
112
112
  }
113
- return e;
113
+ return i;
114
114
  }
115
- function Ot(i, t) {
116
- const o = (e, s) => {
117
- if (bt(s))
118
- return s(e);
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 e === s ? !1 : `Expected ${R(e)} to be ${String(s)}`;
121
- const n = St(e, 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 d = Mt(e, s);
125
- if (d !== null)
126
- return d;
124
+ const a = Lt(i, s);
125
+ if (a !== null)
126
+ return a;
127
127
  if (Array.isArray(s))
128
- return Tt(e, s, o);
128
+ return Ft(i, s, t);
129
129
  if (s === Object)
130
- return se(e, {}, o);
130
+ return ue(i, {}, t);
131
131
  if (s instanceof Function)
132
- return e instanceof s ? !1 : `Expected ${R(e, !0)} to be of Type ${Te(s)}`;
132
+ return i instanceof s ? !1 : `Expected ${$(i, !0)} to be of Type ${$e(s)}`;
133
133
  if (typeof s == "object") {
134
- const r = se(e, s, o);
135
- return r || !1;
134
+ const l = ue(i, s, t);
135
+ return l || !1;
136
136
  }
137
137
  throw new Error(`Cannot handle pattern ${String(s)}`);
138
138
  };
139
- return o(i, t);
139
+ return t(e, o);
140
140
  }
141
- let It = Error;
142
- function le(i, t) {
143
- const o = Ot(i, t);
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 t = Object.values(i), o = (e) => t.includes(e) ? !1 : `expected ${R(e)} to be of enum: ${t.join(", ")}`;
150
- return o[Me] = !0, o;
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, t, o) {
153
- if (i != null) {
154
- const e = Object.values(t).find((s) => s == i);
155
- if (e != null)
156
- return e;
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 Q(), te = new He();
161
- class Nt extends Pe {
161
+ const xt = new ie(), re = new Qe();
162
+ class Ht extends We {
162
163
  constructor(t) {
163
- super(t), this.spot = t.spot;
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;
172
+ }
173
+ static get className() {
174
+ return "ViewshedCameraPrimitive";
164
175
  }
165
- /**
166
- * Updates the camera primitive.
167
- * @param {unknown} frameState
168
- */
169
176
  update(t) {
170
177
  if (this.show)
171
178
  if (this.spot)
172
179
  super.update(t);
173
180
  else {
174
- const o = this._planesPrimitives, e = this._outlinePrimitives;
175
- o.length === 0 && (ze.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 Ge({
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
- Q.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
- }), e[0] = new ce({
198
- allowPicking: this.allowPicking,
199
- geometryInstances: new ue({
200
- geometry: new Ke({
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
- e[n].update(t), o[n].update(t);
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 w = {
221
- CONE: "cone",
222
- THREESIXTY: "360"
223
- };
224
- function Dt(i, t) {
225
- const o = new Xe(i), e = (
226
- /** @type {import("@vcmap-cesium/engine").PerspectiveFrustum} */
227
- o.frustum
228
- );
229
- return e.fov = t.fov, e.near = t.near, e.aspectRatio = t.aspectRatio, e.far = t.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 Ae {
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: x.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(t) {
261
- var o, e, s, n, d, r;
262
- super(t), this._cesiumMap = null, this._shadowCamera = null, this._scene = null, this._frustumOptions = {
263
- fov: ((o = t.frustumOptions) == null ? void 0 : o.fov) || I.getDefaultOptions().frustum.fov,
264
- far: ((e = t.frustumOptions) == null ? void 0 : e.far) || I.getDefaultOptions().frustum.far,
265
- near: ((s = t.frustumOptions) == null ? void 0 : s.near) || I.getDefaultOptions().frustum.near,
266
- aspectRatio: ((n = t.frustumOptions) == null ? void 0 : n.aspectRatio) || I.getDefaultOptions().frustum.aspectRatio
267
- }, this._headingPitchRollValues = t.orientation || {
268
- ...I.getDefaultOptions().orientation
269
- }, this._position = t.position || I.getDefaultOptions().position, this._viewshedType = At(t.viewshedType, w), this._colors = {
270
- visibleColor: Q.fromCssColorString(
271
- ((d = t.colorOptions) == null ? void 0 : d.visibleColor) || I.getDefaultOptions().visibleColor
272
- ),
273
- shadowColor: Q.fromCssColorString(
274
- ((r = t.colorOptions) == null ? void 0 : r.shadowColor) || I.getDefaultOptions().shadowColor
275
- )
276
- }, this._heightOffset = t.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!t.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
294
  set position(t) {
283
- le(t, [Number]), this._position = t, this._shadowCamera && (this._shadowCamera.position = W.fromDegrees(
295
+ me(t, [Number]), this._position = t, this._shadowCamera && (this._shadowCamera.position = x.fromDegrees(
284
296
  t[0],
285
297
  t[1],
286
298
  t[2] + this._heightOffset
287
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
318
  set heightOffset(t) {
307
- this._heightOffset = t, this._shadowCamera && (this._shadowCamera.position = W.fromDegrees(
319
+ this._heightOffset = t, this._shadowCamera && (this._shadowCamera.position = x.fromDegrees(
308
320
  this.position[0],
309
321
  this.position[1],
310
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
332
  set distance(t) {
325
- this._frustumOptions.far = t > I.MIN_DISTANCE ? t : I.MIN_DISTANCE, this._shadowCamera && (this._shadowCamera.frustum.far = this._frustumOptions.far, this._viewshedType === w.THREESIXTY && this._updateShadowMap(), this._viewshedType === w.CONE && this._updatePrimitive());
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
346
  set fov(t) {
339
- this._frustumOptions.fov = t * x.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = t * x.RADIANS_PER_DEGREE, this._viewshedType === w.CONE && (this._updateShadowMap(), this._updatePrimitive()));
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 * x.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
360
  set heading(t) {
353
- this._headingPitchRollValues.heading = t * x.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
361
+ this._headingPitchRollValues.heading = t * F.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
354
362
  orientation: {
355
- heading: t * x.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 === w.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 * x.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
376
  set pitch(t) {
373
- if (this._headingPitchRollValues.pitch = t * x.RADIANS_PER_DEGREE, this._shadowCamera) {
374
- const o = t * x.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
375
- this._shadowCamera.lookUp(o), this._viewshedType === w.CONE && this._updatePrimitive();
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 * x.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
389
  set showPrimitive(t) {
390
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
  }
@@ -418,14 +410,14 @@ const I = class I extends Ae {
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
415
  activate(t) {
424
416
  if (this._active || (this._active = !0), t !== this._cesiumMap) {
425
417
  this._cesiumMap = t;
426
- const o = t.getScene();
427
- if (o)
428
- this._shadowCamera = Dt(o, this._frustumOptions), this._position && (this.position = this._position), this._scene = o;
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();
@@ -436,12 +428,11 @@ const I = class I extends Ae {
436
428
  */
437
429
  _updateShadowMap() {
438
430
  var t;
439
- !this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((t = this._shadowMap) == null || t.destroy(), this._shadowMap = new Ye({
440
- // @ts-ignore
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 === w.THREESIXTY,
435
+ isPointLight: this._viewshedType === "360",
445
436
  softShadows: !0,
446
437
  fromLightSource: !0,
447
438
  cascadesEnabled: !1,
@@ -455,26 +446,27 @@ const I = class I extends Ae {
455
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 === w.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
460
  lookAt(t) {
469
461
  if (!this._shadowCamera)
470
462
  return;
471
- const o = W.fromDegrees(t[0], t[1], t[2]);
472
- if (this.distance = W.distance(this._shadowCamera.position, o), this.type === w.CONE && !o.equals(this._shadowCamera.position)) {
473
- const e = new W();
474
- W.subtract(o, this._shadowCamera.position, o), W.normalize(o, o), W.normalize(this._shadowCamera.position, e), this._shadowCamera.setView({
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: e
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 Ae {
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 Ae {
499
490
  heightOffset: this.heightOffset
500
491
  };
501
492
  }
502
- /**
503
- * Destroys the viewshed.
504
- */
505
493
  destroy() {
506
- var e;
507
- const t = this._cesiumMap, o = this._shadowMap;
508
- this.deactivate(), ((e = t == null ? void 0 : t.getScene()) == null ? void 0 : e.shadowMap) === o && t.setDefaultShadowMap();
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 xt extends Re {
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 {
524
+ /**
525
+ * @param {string=} className
526
+ */
527
+ constructor(o) {
528
+ this.className = o, this.deprecations = /* @__PURE__ */ new Map();
529
+ }
514
530
  /**
515
- *
516
- * @param {import("./viewshed").default} viewshed
531
+ * Logs an error message
532
+ * @param {string} msg The message to log.
533
+ * @param {...any} optArgs
517
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 {
518
605
  constructor(t) {
519
- super(Y.CLICKMOVE), this._viewshed = t, this._positioned = new X(), this._finished = new X(), this._position = !1, this.setActive();
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;
@@ -525,441 +620,513 @@ class xt extends Re {
525
620
  return this._positioned;
526
621
  }
527
622
  async pipe(t) {
528
- return t.position && (this._position ? (this._viewshed.lookAt(z.mercatorToWgs84(t.position)), t.type & Y.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = z.mercatorToWgs84(t.position), t.type & Y.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), 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
- }, ge = 1.8;
544
- function kt(i) {
545
- const t = new ke({
546
- projection: Le.toJSON(),
547
- zIndex: Fe - 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
- je(t), t.activate();
550
- const o = new st(new nt(i));
551
- return o.setStyle(new at({})), t.addFeatures([o]), t.vectorProperties.altitudeMode = Je.NONE, {
552
- layer: t,
553
- feature: o,
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(), t.destroy();
644
+ t.dispose(), o.destroy();
556
645
  }
557
646
  };
558
647
  }
559
- function ie(i, t) {
560
- const o = t === 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, t, o) {
564
- const e = Z(null), s = U(null), n = U(null), d = U(P.ABSOLUTE);
565
- let r = () => {
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 l = Z(null), _ = Z([]);
659
+ const d = ae([]);
568
660
  let c = () => {
569
661
  };
570
662
  function f() {
571
- var a;
572
- s.value && e.value ? (e.value.deactivate(), o.setVisibility(e.value.name, !1)) : (a = e.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
- c(), r(), f(), e.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 g(a) {
578
- c(), f(), i.maps.activeMap instanceof $ && (e.value = a, a.activate(i.maps.activeMap), c = i.maps.activeMap.shadowMapChanged.addEventListener((v) => {
579
- var u;
580
- v !== ((u = e.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 Ze();
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: t.visibleColor,
589
- shadowColor: t.shadowColor
680
+ visibleColor: o.visibleColor,
681
+ shadowColor: o.shadowColor
590
682
  },
591
- heightOffset: d.value === P.ABSOLUTE ? 0 : ge
683
+ heightOffset: a.value === "absolute" ? 0 : Se
592
684
  });
593
- g(C);
594
- const V = new xt(e.value);
595
- V.finished.addEventListener(() => {
596
- r(), e.value ? (e.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, d.value), V.positioned.addEventListener(() => {
605
- ie(u, P.ABSOLUTE);
606
- }), r = () => {
607
- O(), V.destroy(), u.setActive(), r = () => {
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 k(a) {
612
- var v;
613
- if (e.value && a) {
614
- r();
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
- } = kt(e.value.position);
620
- i.layers.add(u), _.value = [C], d.value === P.ABSOLUTE ? (l.value = De(i, u), l.value.setFeatures([C])) : (l.value = xe(i, u), l.value.setFeature(C)), l.value.stopped.addEventListener(() => {
621
- r();
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
- e.value ? e.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, r = () => {
630
- var K;
631
- r = () => {
632
- }, O && ot(O), (K = l.value) == null || K.stop(), l.value = null, _.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
- r();
730
+ u();
636
731
  }
637
- function S(a, v) {
638
- r(), e.value !== v && (g(v), d.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 = e.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 = e.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 = e.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 === d.value || !e.value)) {
662
- if (d.value = a, n.value === E.MOVE && r(), n.value === E.CREATE)
663
- ie(
664
- i.maps.eventHandler.featureInteraction,
665
- a
666
- ), e.value.heightOffset = a === P.ABSOLUTE ? 0 : ge;
667
- else if (n.value === E.EDIT) {
668
- const { position: v, heightOffset: u } = e.value;
669
- a === P.RELATIVE ? i.maps.activeMap.getHeightFromTerrain([z.wgs84ToMercator(v)]).then((C) => {
670
- const V = z.mercatorToWgs84(C[0]);
671
- e.value && (e.value.heightOffset = v[2] - V[2], e.value.position = V);
672
- }) : (e.value.position = [
673
- v[0],
674
- v[1],
675
- v[2] + u
676
- ], e.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: e,
781
+ currentViewshed: i,
682
782
  currentIsPersisted: s,
683
783
  currentEditSession: l,
684
- currentFeatures: _,
685
- createViewshed: y,
686
- viewViewshed(a) {
687
- S(E.VIEW, a);
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
- e.value && (o.add(e.value), s.value = !0, o.setSelection(e.value.name), o.setVisibility(e.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: k,
795
+ moveCurrentViewshed: N,
696
796
  setupMultiSelect() {
697
- r(), n.value = E.MULTI_SELECT, f(), e.value = null;
797
+ u(), n.value = "multiSelect", f(), i.value = null;
698
798
  },
699
799
  mode: n,
700
- heightMode: d,
701
- changeHeightMode: T,
800
+ heightMode: a,
801
+ changeHeightMode: k,
702
802
  async placeCurrentFeaturesOnTerrain() {
703
- var a, v;
704
- if (e.value && ((a = l.value) == null ? void 0 : a.type) === Ne.EDIT_FEATURES && i.maps.activeMap instanceof $) {
705
- const C = (await i.maps.activeMap.getHeightFromTerrain([
706
- z.wgs84ToMercator((v = e.value) == null ? void 0 : v.position)
707
- ]))[0][2] - e.value.position[2];
708
- l.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 Se = (i, t) => {
718
- const o = i.__vccOpts || i;
719
- for (const [e, s] of t)
720
- o[e] = 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: rt,
730
- VContainer: ye,
731
- VRow: Ve,
732
- VCol: be,
733
- VcsSlider: lt,
734
- VcsLabel: _e,
735
- VcsFormSection: Ce,
736
- VDivider: Ct,
737
- VcsSelect: Ee,
738
- VcsFormButton: dt,
739
- VcsFeatureTransforms: ct,
740
- VcsHelp: ut
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 t = (
758
- /** @type {import("./viewshedManager.js").ViewshedManager} */
759
- me("manager")
760
- ), o = (
761
- /** @type {import("@vcmap/ui").VcsUiApp} */
762
- me("vcsApp")
763
- ), {
764
- currentViewshed: e,
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
- } = t, d = U(
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 r = () => {
771
- };
772
- const l = ve(() => i.selection);
773
- let _ = () => {
861
+ let l, u = () => {
774
862
  };
775
- const c = ee({
863
+ const d = oe({
776
864
  X: void 0,
777
865
  Y: void 0,
778
866
  Z: void 0
779
- }), f = Z();
780
- let m = () => {
867
+ }), c = ae();
868
+ let f = () => {
781
869
  };
782
- const g = ee({
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 = U();
789
- function k() {
790
- e.value && (c.X = e.value.position[0], c.Y = e.value.position[1], c.Z = t.heightMode.value === P.ABSOLUTE ? e.value.position[2] : e.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
- k(), e.value && (g.distance = e.value.distance, g.fov = e.value.fov, g.heading = e.value.heading, g.pitch = e.value.pitch, g.showPrimitive = e.value.showPrimitive, y.value = e.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
- e.value && s.value !== E.CREATE && S();
797
- }), G(
798
- e,
883
+ rt(() => {
884
+ i.value && s.value !== T.CREATE && N();
885
+ }), Z(
886
+ i,
799
887
  () => {
800
- e.value && (_(), _ = e.value.positionChanged.addEventListener(() => {
801
- k(), 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 = e.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 = e.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
- Qe(() => {
822
- var C, V;
823
- const u = (C = i.getViewshed) == null ? void 0 : C.call(i);
824
- u && t.editViewshed(u), r = (V = o.maps.activeMap) == null ? void 0 : V.movementDisabledChanged.addEventListener(
825
- (O) => {
826
- d.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
- }), et(() => {
830
- _(), m(), r(), n.value || ((s.value === E.EDIT || s.value === E.MOVE) && e.value ? t.viewViewshed(e.value) : s.value === E.CREATE && t.stop()), l.value && (l.value.length > 1 ? t.setupMultiSelect() : l.value.length === 1 && e.value ? t.viewViewshed(e.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
- !l.value.length && s.value === E.EDIT && t.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(), e.value && (g[u] = C, e.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 === w.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: d.value,
930
+ active: !!c.value,
931
+ disabled: a.value,
846
932
  async callback() {
847
- var C, V, O;
848
- t.moveCurrentViewshed(!1), e.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 We({
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
- e.value.position[0],
852
- e.value.position[1],
853
- e.value.position[2] + e.value.heightOffset
937
+ i.value.position[0],
938
+ i.value.position[1],
939
+ i.value.position[2] + i.value.heightOffset
854
940
  ],
855
- heading: e.value.heading,
856
- pitch: e.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: t.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
- t.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: g.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
- position: c,
885
- setPosition(u, C, V) {
886
- if (m(), !!e.value) {
887
- if (V === 2 && t.heightMode.value === P.RELATIVE)
888
- e.value.heightOffset = Number(u);
970
+ position: d,
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 = [...e.value.position];
891
- O[V] = Number(u), e.value.position = O;
976
+ const L = [...i.value.position];
977
+ L[D] = Number(w), i.value.position = L;
892
978
  }
893
- c[C] = Number(u);
979
+ d[M] = Number(w);
894
980
  }
895
981
  },
896
- parameters: g,
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: w,
904
- HeightModes: P,
905
- heightMode: t.heightMode,
906
- TransformationMode: Be,
907
- changeHeightMode: t.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 t.createViewshed(y.value);
1001
+ await o.createViewshed(g.value);
1002
+ },
1003
+ addToMyWorkspace: () => {
1004
+ o.persistCurrent();
910
1005
  },
911
- addToMyWorkspace: () => t.persistCurrent(),
912
- cancel: () => t.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, t, o, e, s, n) {
924
- const d = b("VcsHelp"), r = b("v-row"), l = b("VcsFeatureTransforms"), _ = b("VcsTextField"), c = b("v-col"), f = b("v-container"), m = b("VcsFormSection"), g = b("v-divider"), y = b("VcsLabel"), k = b("VcsSelect"), S = b("VcsSlider"), L = b("VcsFormButton");
925
- return M(), B("div", null, [
926
- e.viewshedMode === e.ViewshedPluginModes.CREATE ? (M(), B("div", Wt, [
927
- e.viewshedType === e.ViewshedTypes.CONE ? (M(), N(d, { 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
- })) : e.viewshedType === e.ViewshedTypes.THREESIXTY ? (M(), N(d, { 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
- ])) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.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": e.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(r, { "no-gutters": "" }, {
958
- default: h(() => [
959
- tt(
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,12 +1134,13 @@ function Gt(i, t, o, e, s, n) {
967
1134
  _: 1
968
1135
  /* STABLE */
969
1136
  }),
970
- e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? (M(), N(r, {
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(l, {
1142
+ default: m(() => [
1143
+ v(g, {
976
1144
  "transformation-mode": e.TransformationMode.TRANSLATE,
977
1145
  "feature-properties": { altitudeMode: "absolute" },
978
1146
  "allow-z-input": !0,
@@ -981,33 +1149,34 @@ function Gt(i, t, o, e, s, n) {
981
1149
  ]),
982
1150
  _: 1
983
1151
  /* STABLE */
984
- })) : (M(), N(r, {
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(e.position, (T, a, v) => (M(), N(
993
- c,
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(_, {
1001
- "model-value": T,
1002
- "onUpdate:modelValue": (u) => e.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: e.viewshedMode === e.ViewshedPluginModes.MOVE && !(a === "Z" && e.heightMode === e.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, t, o, e, 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(g),
1034
- p(f, { class: "px-1 py-0" }, {
1035
- default: h(() => [
1036
- p(r, { "no-gutters": "" }, {
1037
- default: h(() => [
1038
- p(c, 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,14 +1218,11 @@ function Gt(i, t, o, e, s, n) {
1052
1218
  _: 1
1053
1219
  /* STABLE */
1054
1220
  }),
1055
- p(c, null, {
1056
- default: h(() => [
1057
- p(k, {
1221
+ v(u, null, {
1222
+ default: m(() => [
1223
+ v(d, {
1058
1224
  id: "heightMode",
1059
- items: Object.values(e.HeightModes).map((T) => ({
1060
- value: T,
1061
- title: `viewshed.${T}`
1062
- })),
1225
+ items: e.heightModes,
1063
1226
  "model-value": e.heightMode,
1064
1227
  "onUpdate:modelValue": e.changeHeightMode
1065
1228
  }, null, 8, ["items", "model-value", "onUpdate:modelValue"])
@@ -1070,478 +1233,323 @@ function Gt(i, t, o, e, s, n) {
1070
1233
  ]),
1071
1234
  _: 1
1072
1235
  /* STABLE */
1073
- })
1074
- ]),
1075
- _: 1
1076
- /* STABLE */
1077
- }),
1078
- e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.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(e.parameters, (T, a) => (M(), N(
1087
- r,
1088
- {
1089
- "no-gutters": "",
1090
- key: a
1091
- },
1092
- {
1093
- default: h(() => [
1094
- a === "distance" || e.viewshedType === e.ViewshedTypes.CONE && a !== "showPrimitive" ? (M(), N(
1095
- c,
1096
- { key: 0 },
1097
- {
1098
- default: h(() => [
1099
- p(
1100
- r,
1101
- {
1102
- "no-gutters": "",
1103
- class: "px-1"
1104
- },
1105
- {
1106
- default: h(() => [
1107
- p(
1108
- c,
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
- c,
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
- r,
1167
- { "no-gutters": "" },
1168
- {
1169
- default: h(() => [
1170
- p(
1171
- c,
1172
- null,
1173
- {
1174
- default: h(() => [
1175
- p(S, {
1176
- id: a,
1177
- class: "pa-0",
1178
- "model-value": T,
1179
- "onUpdate:modelValue": (v) => e.setParameter(a, v),
1180
- type: "number",
1181
- step: "1",
1182
- min: e.parameterRanges[a][0],
1183
- max: e.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(g),
1221
- e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (M(), B("div", Ht, [
1222
- p(L, {
1223
- onClick: t[0] || (t[0] = (T) => e.addToMyWorkspace()),
1224
- tooltip: "viewshed.addToMyWorkspace",
1225
- icon: "$vcsComponentsPlus",
1226
- disabled: e.currentIsPersisted || void 0
1227
- }, null, 8, ["disabled"]),
1228
- p(L, {
1229
- onClick: t[1] || (t[1] = (T) => e.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
- ])) : e.viewshedMode === e.ViewshedPluginModes.CREATE ? (M(), B("div", zt, [
1243
- p(L, {
1244
- onClick: t[2] || (t[2] = (T) => e.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__ */ Se(jt, [["render", Gt]]), j = "@vcmap/viewshed", Yt = "3.0.3", Xt = "^6.0", ne = {
1261
- [w.CONE]: "$vcsViewshed",
1262
- [w.THREESIXTY]: "$vcsViewshedCone"
1268
+ const ni = /* @__PURE__ */ ke(ti, [["render", si]]), fe = {
1269
+ [_.CONE]: "$vcsViewshed",
1270
+ [_.THREESIXTY]: "$vcsViewshedCone"
1263
1271
  };
1264
- function Jt(i, t, o) {
1265
- const e = U(), s = U(), n = `${o.id}-editor`, d = {
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: e,
1277
+ headerTitle: i,
1272
1278
  headerIcon: s,
1273
1279
  styles: { width: "280px", height: "auto" },
1274
- infoUrlCallback: t.getHelpUrlCallback("tools/viewshed.html")
1280
+ infoUrlCallback: o.getHelpUrlCallback("tools/viewshed.html")
1275
1281
  }
1276
1282
  };
1277
- ht(t, o, {
1278
- editor: (m) => ({
1279
- ...d,
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
- function r() {
1287
- i.currentViewshed.value && (s.value = ne[i.currentViewshed.value.type], i.currentIsPersisted.value ? e.value = i.currentViewshed.value.properties.title : i.mode.value === E.CREATE ? e.value = `viewshed.create.${i.currentViewshed.value.type}` : e.value = [
1292
+ function l() {
1293
+ e.currentViewshed.value && (s.value = fe[e.currentViewshed.value.type], e.currentIsPersisted.value ? i.value = e.currentViewshed.value.properties.title : e.mode.value === T.CREATE ? i.value = `viewshed.create.${e.currentViewshed.value.type}` : i.value = [
1288
1294
  "viewshed.temporary",
1289
- `viewshed.${i.currentViewshed.value.type}`
1295
+ `viewshed.${e.currentViewshed.value.type}`
1290
1296
  ]);
1291
1297
  }
1292
- function l() {
1293
- r(), i.currentViewshed.value && !i.currentIsPersisted.value && (i.mode.value === E.EDIT || i.mode.value === E.MOVE || i.mode.value === E.CREATE) && (t.windowManager.has(n) || t.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
- ...d,
1301
+ ...a,
1296
1302
  id: n,
1297
1303
  parentId: "category-manager",
1298
- slot: ft.DYNAMIC_CHILD
1304
+ slot: St.DYNAMIC_CHILD
1299
1305
  },
1300
- j
1306
+ A
1301
1307
  ));
1302
1308
  }
1303
- const _ = G(i.currentViewshed, (m) => {
1304
- m && l();
1305
- }), c = G(i.currentIsPersisted, (m) => {
1306
- m && r();
1307
- }), f = G(i.mode, () => {
1308
- i.mode.value ? l() : t.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
- t.windowManager.remove(n), _(), f(), c();
1318
+ o.windowManager.remove(n), d(), f(), c();
1313
1319
  }
1314
1320
  };
1315
1321
  }
1316
- function Zt(i, t, o, e) {
1317
- const s = {
1318
- type: mt.SELECT,
1319
- action: ee({
1320
- name: o,
1321
- currentIndex: 0,
1322
- active: !1,
1323
- background: !1,
1324
- disabled: !(i.maps.activeMap instanceof $),
1325
- callback() {
1326
- if (this.active)
1327
- this.background && t.currentViewshed.value ? t.editViewshed(t.currentViewshed.value) : t.stop();
1328
- else {
1329
- const l = this.tools[this.currentIndex].name;
1330
- t.createViewshed(l);
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}`
1332
+ } : void 0;
1333
+ }
1334
+ let n, a;
1335
+ if (i.length === 1) {
1336
+ const d = s(i[0]);
1337
+ n = {
1338
+ type: Ve.SINGLE,
1339
+ action: oe({
1340
+ ...d,
1341
+ active: !1,
1342
+ background: !1,
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);
1331
1346
  }
1332
- },
1333
- selected(l) {
1334
- l !== this.currentIndex && (this.currentIndex = l);
1335
- const _ = this.tools[this.currentIndex].name;
1336
- t.createViewshed(_);
1337
- },
1338
- tools: e.flatMap((l) => l === w.CONE ? {
1339
- name: w.CONE,
1340
- icon: ne[w.CONE],
1341
- title: `viewshed.create.${w.CONE}`
1342
- } : l === w.THREESIXTY ? {
1343
- name: w.THREESIXTY,
1344
- icon: ne[w.THREESIXTY],
1345
- title: `viewshed.create.${w.THREESIXTY}`
1346
- } : [])
1347
- })
1348
- }, n = G(t.mode, (l) => {
1349
- l === E.VIEW ? (s.action.background = !0, s.action.active = !0) : l ? (s.action.background = !1, s.action.active = !0) : (s.action.background = !1, s.action.active = !1);
1350
- }), d = G(
1351
- t.currentViewshed,
1352
- (l) => {
1353
- l && (s.action.currentIndex = s.action.tools.findIndex(
1354
- (_) => _.name === l.type
1355
- ));
1356
- }
1357
- ), r = i.maps.mapActivated.addEventListener((l) => {
1358
- l instanceof $ ? s.action.disabled = !1 : s.action.disabled = !0;
1347
+ })
1348
+ };
1349
+ } else
1350
+ n = {
1351
+ type: Ve.SELECT,
1352
+ action: oe({
1353
+ name: t,
1354
+ currentIndex: 0,
1355
+ active: !1,
1356
+ background: !1,
1357
+ disabled: !(e.maps.activeMap instanceof z),
1358
+ async callback() {
1359
+ if (this.active)
1360
+ this.background && o.currentViewshed.value ? o.editViewshed(o.currentViewshed.value) : o.stop();
1361
+ else {
1362
+ const d = this.tools[this.currentIndex].name;
1363
+ await o.createViewshed(d);
1364
+ }
1365
+ },
1366
+ async selected(d) {
1367
+ d !== this.currentIndex && (this.currentIndex = d);
1368
+ const c = this.tools[this.currentIndex].name;
1369
+ await o.createViewshed(c);
1370
+ },
1371
+ tools: i.flatMap((d) => s(d))
1372
+ })
1373
+ }, a = Z(
1374
+ o.currentViewshed,
1375
+ (d) => {
1376
+ d && (n.action.currentIndex = n.action.tools.findIndex(
1377
+ (c) => c.name === d.type
1378
+ ));
1379
+ }
1380
+ );
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;
1359
1385
  });
1360
1386
  return {
1387
+ toolbox: n,
1361
1388
  destroy() {
1362
- n(), d(), r();
1363
- },
1364
- toolbox: s
1389
+ l(), a == null || a(), u();
1390
+ }
1365
1391
  };
1366
1392
  }
1367
- function qt(i, t, o, e) {
1368
- le(e, [Pt(w)]);
1369
- const { toolbox: s, destroy: n } = Zt(i, t, o, e), d = 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;
1370
1396
  return () => {
1371
- i.toolboxManager.remove(d), n();
1397
+ e.toolboxManager.remove(a), n();
1372
1398
  };
1373
1399
  }
1374
- class ae extends Ue {
1400
+ class pe extends Ze {
1375
1401
  static get className() {
1376
1402
  return "ViewshedCategory";
1377
1403
  }
1378
- async _deserializeItem(t) {
1379
- var e;
1380
- if (
1381
- /** @type {import("@vcmap/core").CesiumMap | undefined} */
1382
- (e = this._app) == null ? void 0 : e.maps.getByType($.className)[0]
1383
- )
1384
- return new D(t);
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));
1385
1408
  throw new Error("No CesiumMap available");
1386
1409
  }
1387
1410
  }
1388
- function Qt(i, t) {
1389
- let o, e = 0;
1411
+ function ci(e, o) {
1412
+ let t, i = 0;
1390
1413
  const s = new Set(
1391
- t.filter((n) => n.type === i).map((n) => n.properties.title)
1414
+ o.filter((n) => n.type === e).map((n) => n.properties.title)
1392
1415
  );
1393
1416
  do
1394
- e += 1, s.has(`${i}-${e}`) || (o = `${i}-${e}`);
1395
- while (!o);
1396
- return o;
1417
+ i += 1, s.has(`${e}-${i}`) || (t = `${e}-${i}`);
1418
+ while (!t);
1419
+ return t;
1397
1420
  }
1398
- async function ei(i) {
1399
- const t = new X(), o = new X(), { collectionComponent: e, 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(
1400
1423
  {
1401
- type: ae.className,
1424
+ type: pe.className,
1402
1425
  name: "Viewsheds",
1403
1426
  title: "viewshed.viewshedCategory"
1404
1427
  },
1405
- j,
1406
- {
1407
- selectable: !0,
1408
- renamable: !0,
1409
- removable: !0
1410
- }
1428
+ A,
1429
+ { selectable: !0, renamable: !0, removable: !0 }
1411
1430
  );
1412
- e.addItemMapping({
1413
- mappingFunction: vt(
1414
- [$.className],
1415
- i.maps
1431
+ i.addItemMapping({
1432
+ mappingFunction: Ot(
1433
+ [z.className],
1434
+ e.maps
1416
1435
  ),
1417
- owner: j
1436
+ owner: A
1418
1437
  });
1419
- const n = (c, f, m) => {
1420
- m.title = c.properties.title, m.titleChanged = (g) => {
1421
- c.properties.title = g, m.title = g, t.raiseEvent({ item: c, title: g });
1422
- }, m.actions.push(
1423
- ee({
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({
1424
1443
  name: "visibilityAction",
1425
1444
  icon: "$vcsCheckbox",
1426
1445
  callback() {
1427
- o.raiseEvent(c);
1446
+ t.raiseEvent({ item: c, visible: !!h.visible });
1428
1447
  }
1429
1448
  })
1430
1449
  );
1431
1450
  };
1432
- i.categoryManager.addMappingFunction(
1451
+ e.categoryManager.addMappingFunction(
1433
1452
  () => !0,
1434
1453
  n,
1435
- j,
1436
- [e.id]
1454
+ A,
1455
+ [i.id]
1437
1456
  );
1438
- const { action: d, destroy: r } = pt(
1439
- e.selection,
1457
+ const { action: a, destroy: l } = Mt(
1458
+ i.selection,
1440
1459
  () => {
1441
- const c = e.selection.value.map(
1442
- (f) => e.collection.getByKey(f.name)
1460
+ const c = i.selection.value.map(
1461
+ (f) => i.collection.getByKey(f.name)
1443
1462
  );
1444
- wt(JSON.stringify(c), "viewsheds.json");
1463
+ Tt(JSON.stringify(c), "viewsheds.json");
1445
1464
  },
1446
- j
1447
- ), { action: l, destroy: _ } = gt(
1465
+ A
1466
+ ), { action: u, destroy: d } = Rt(
1448
1467
  async (c) => {
1449
- const { vueI18n: f } = i, g = (await Promise.all(
1450
- c.map(async (S) => {
1451
- const L = await S.text();
1468
+ const { vueI18n: f } = e, g = (await Promise.all(
1469
+ c.map(async (O) => {
1470
+ const U = await O.text();
1452
1471
  try {
1453
- return JSON.parse(L).map((a) => new D(a));
1472
+ return JSON.parse(U).map((r) => new B(r));
1454
1473
  } catch {
1455
- i.notifier.add({
1456
- type: J.ERROR,
1474
+ e.notifier.add({
1475
+ type: ne.ERROR,
1457
1476
  message: f.t("components.import.failure", {
1458
- fileName: S.name
1477
+ fileName: O.name
1459
1478
  })
1460
1479
  });
1461
1480
  }
1462
1481
  return [];
1463
1482
  })
1464
- )).flat(), y = g.map((S) => s.collection.add(S)).filter((S) => S != null), k = g.length - y.length;
1465
- if (k > 0)
1466
- return i.notifier.add({
1467
- type: J.WARNING,
1468
- message: f.t("components.import.addFailure", [k])
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])
1469
1488
  }), !1;
1470
- if (y.length > 0)
1471
- i.notifier.add({
1472
- type: J.SUCCESS,
1489
+ if (b.length > 0)
1490
+ e.notifier.add({
1491
+ type: ne.SUCCESS,
1473
1492
  message: f.t("components.import.featuresAdded", [
1474
- y.length
1493
+ b.length
1475
1494
  ])
1476
1495
  });
1477
1496
  else
1478
- return i.notifier.add({
1479
- type: J.ERROR,
1497
+ return e.notifier.add({
1498
+ type: ne.ERROR,
1480
1499
  message: f.t("components.import.nothingAdded")
1481
1500
  }), !1;
1482
1501
  return !0;
1483
1502
  },
1484
- i.windowManager,
1485
- j,
1503
+ e.windowManager,
1504
+ A,
1486
1505
  "category-manager"
1487
1506
  );
1488
- return e.addActions([d, l]), {
1489
- renamed: t,
1490
- visibilityChanged: o,
1507
+ return i.addActions([a, u]), {
1508
+ renamed: o,
1509
+ visibilityChanged: t,
1491
1510
  setSelection(c) {
1492
- c && (e.selection.value = e.items.value.filter((f) => c === f.name));
1511
+ c && (i.selection.value = i.items.value.filter((f) => c === f.name));
1493
1512
  },
1494
1513
  clearSelection() {
1495
- e.selection.value.length && (e.selection.value = []);
1514
+ i.selection.value.length && (i.selection.value = []);
1496
1515
  },
1497
1516
  setVisibility(c, f) {
1498
- const m = e.items.value.find(
1517
+ const h = i.items.value.find(
1499
1518
  (g) => c === g.name
1500
1519
  );
1501
- if (m) {
1502
- const g = m.actions.find(
1503
- (y) => y.name === "visibilityAction"
1520
+ if (h) {
1521
+ const g = h.actions.find(
1522
+ (b) => b.name === "visibilityAction"
1504
1523
  );
1505
1524
  g && (g.icon = f ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1506
1525
  }
1507
1526
  },
1508
1527
  add(c) {
1509
- c.properties.title = Qt(
1510
- c.type,
1511
- /** @type {import("./viewshed.js").default[]} */
1512
- [
1513
- ...s.collection
1514
- ]
1515
- ), s.collection.add(c);
1528
+ c.properties.title = ci(c.type, [
1529
+ ...s.collection
1530
+ ]), s.collection.add(c);
1516
1531
  },
1517
1532
  remove(c) {
1518
1533
  const f = s.collection.getByKey(c);
1519
1534
  f && s.collection.remove(f);
1520
1535
  },
1521
- collectionComponent: e,
1536
+ collectionComponent: i,
1522
1537
  destroy() {
1523
- i.categoryManager.removeOwner(j), t.destroy(), o.destroy(), r(), _();
1538
+ e.categoryManager.removeOwner(A), o.destroy(), t.destroy(), l(), d();
1524
1539
  }
1525
1540
  };
1526
1541
  }
1527
- function q() {
1528
- return {
1529
- visibleColor: D.getDefaultOptions().visibleColor,
1530
- shadowColor: D.getDefaultOptions().shadowColor,
1531
- tools: [...Object.values(w)]
1532
- };
1533
- }
1534
- const ti = {
1542
+ const ui = Me({
1535
1543
  name: "ViewshedConfigEditor",
1536
1544
  components: {
1537
- AbstractConfigEditor: _t,
1538
- VcsFormSection: Ce,
1539
- VContainer: ye,
1540
- VRow: Ve,
1541
- VCol: be,
1542
- VcsLabel: _e,
1543
- VcsSelect: Ee,
1544
- 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
1545
1553
  },
1546
1554
  props: {
1547
1555
  getConfig: {
@@ -1553,41 +1561,46 @@ const ti = {
1553
1561
  required: !0
1554
1562
  }
1555
1563
  },
1556
- setup(i) {
1557
- const t = i.getConfig(), o = U({ ...q(), ...t });
1558
- function e() {
1559
- 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)));
1560
1573
  }
1561
1574
  return {
1562
- localConfig: o,
1563
- ViewshedTypes: w,
1564
- apply: e,
1565
- toolItems: Object.values(w).map((s) => ({
1566
- value: s,
1567
- title: `viewshed.${s}`
1575
+ localConfig: i,
1576
+ ViewshedTypes: _,
1577
+ apply: s,
1578
+ toolItems: Object.values(_).map((n) => ({
1579
+ value: n,
1580
+ title: `viewshed.${n}`
1568
1581
  }))
1569
1582
  };
1570
1583
  }
1571
- };
1572
- function ii(i, t, o, e, s, n) {
1573
- const d = b("VcsLabel"), r = b("v-col"), l = b("VcsSelect"), _ = b("v-row"), c = b("VColorPicker"), f = b("v-container"), m = b("VcsFormSection"), g = b("AbstractConfigEditor");
1574
- return M(), N(g, it({ onSubmit: e.apply }, { ...i.$attrs, ...i.$props }), {
1575
- default: h(() => [
1576
- e.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, {
1577
1590
  key: 0,
1578
1591
  heading: "viewshed.editor.general"
1579
1592
  }, {
1580
- default: h(() => [
1581
- p(f, { class: "px-1 py-0" }, {
1582
- default: h(() => [
1583
- p(_, { "no-gutters": "" }, {
1584
- default: h(() => [
1585
- p(r, null, {
1586
- default: h(() => [
1587
- p(d, { "html-for": "viewshed-editor-tools" }, {
1588
- default: h(() => [
1589
- F(
1590
- 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")),
1591
1604
  1
1592
1605
  /* TEXT */
1593
1606
  )
@@ -1599,15 +1612,15 @@ function ii(i, t, o, e, s, n) {
1599
1612
  _: 1
1600
1613
  /* STABLE */
1601
1614
  }),
1602
- p(r, null, {
1603
- default: h(() => [
1604
- p(l, {
1615
+ v(l, null, {
1616
+ default: m(() => [
1617
+ v(u, {
1605
1618
  id: "viewshed-tools",
1606
- items: e.toolItems,
1607
1619
  modelValue: e.localConfig.tools,
1608
- "onUpdate:modelValue": t[0] || (t[0] = (y) => e.localConfig.tools = y),
1620
+ "onUpdate:modelValue": o[0] || (o[0] = (b) => e.localConfig.tools = b),
1621
+ items: e.toolItems,
1609
1622
  multiple: !0
1610
- }, null, 8, ["items", "modelValue"])
1623
+ }, null, 8, ["modelValue", "items"])
1611
1624
  ]),
1612
1625
  _: 1
1613
1626
  /* STABLE */
@@ -1616,14 +1629,14 @@ function ii(i, t, o, e, s, n) {
1616
1629
  _: 1
1617
1630
  /* STABLE */
1618
1631
  }),
1619
- p(_, { "no-gutters": "" }, {
1620
- default: h(() => [
1621
- p(r, null, {
1622
- default: h(() => [
1623
- p(d, { "html-for": "viewshed-editor-visible-color" }, {
1624
- default: h(() => [
1625
- F(
1626
- 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")),
1627
1640
  1
1628
1641
  /* TEXT */
1629
1642
  )
@@ -1635,11 +1648,11 @@ function ii(i, t, o, e, s, n) {
1635
1648
  _: 1
1636
1649
  /* STABLE */
1637
1650
  }),
1638
- p(r, null, {
1639
- default: h(() => [
1640
- p(c, {
1651
+ v(l, null, {
1652
+ default: m(() => [
1653
+ v(c, {
1641
1654
  modelValue: e.localConfig.visibleColor,
1642
- "onUpdate:modelValue": t[1] || (t[1] = (y) => e.localConfig.visibleColor = y),
1655
+ "onUpdate:modelValue": o[1] || (o[1] = (b) => e.localConfig.visibleColor = b),
1643
1656
  mode: "rgba"
1644
1657
  }, null, 8, ["modelValue"])
1645
1658
  ]),
@@ -1650,14 +1663,14 @@ function ii(i, t, o, e, s, n) {
1650
1663
  _: 1
1651
1664
  /* STABLE */
1652
1665
  }),
1653
- p(_, { "no-gutters": "" }, {
1654
- default: h(() => [
1655
- p(r, null, {
1656
- default: h(() => [
1657
- p(d, { "html-for": "viewshed-editor-shadow-color" }, {
1658
- default: h(() => [
1659
- F(
1660
- 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")),
1661
1674
  1
1662
1675
  /* TEXT */
1663
1676
  )
@@ -1669,11 +1682,11 @@ function ii(i, t, o, e, s, n) {
1669
1682
  _: 1
1670
1683
  /* STABLE */
1671
1684
  }),
1672
- p(r, null, {
1673
- default: h(() => [
1674
- p(c, {
1685
+ v(l, null, {
1686
+ default: m(() => [
1687
+ v(c, {
1675
1688
  modelValue: e.localConfig.shadowColor,
1676
- "onUpdate:modelValue": t[2] || (t[2] = (y) => e.localConfig.shadowColor = y),
1689
+ "onUpdate:modelValue": o[2] || (o[2] = (b) => e.localConfig.shadowColor = b),
1677
1690
  mode: "rgba"
1678
1691
  }, null, 8, ["modelValue"])
1679
1692
  ]),
@@ -1691,101 +1704,87 @@ function ii(i, t, o, e, s, n) {
1691
1704
  ]),
1692
1705
  _: 1
1693
1706
  /* STABLE */
1694
- })) : H("v-if", !0)
1707
+ })) : Y("v-if", !0)
1695
1708
  ]),
1696
1709
  _: 1
1697
1710
  /* STABLE */
1698
1711
  }, 16, ["onSubmit"]);
1699
1712
  }
1700
- const oi = /* @__PURE__ */ Se(ti, [["render", ii]]);
1701
- function ui(i) {
1702
- let t, o, e = () => {
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 = () => {
1703
1723
  };
1724
+ const s = Oe(), n = { ...s, ...e };
1704
1725
  return {
1705
1726
  get name() {
1706
- return j;
1727
+ return A;
1707
1728
  },
1708
1729
  get version() {
1709
- return Yt;
1730
+ return Xt;
1710
1731
  },
1711
1732
  get mapVersion() {
1712
- return Xt;
1733
+ return Jt;
1713
1734
  },
1714
- /**
1715
- * @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
1716
- * @param {ViewshedPluginState=} state
1717
- * @returns {Promise<void>}
1718
- */
1719
- async initialize(s, n) {
1720
- o = s, s.categoryClassRegistry.registerClass(
1721
- this[$e],
1722
- ae.className,
1723
- ae
1735
+ async initialize(a, l) {
1736
+ o = a, a.categoryClassRegistry.registerClass(
1737
+ this[qe],
1738
+ pe.className,
1739
+ pe
1724
1740
  );
1725
- const d = await ei(s);
1726
- t = Lt(
1727
- s,
1728
- i,
1729
- d
1741
+ const u = await di(a);
1742
+ t = Qt(
1743
+ a,
1744
+ n,
1745
+ u
1730
1746
  );
1731
- const r = qt(
1732
- s,
1747
+ const d = li(
1748
+ a,
1733
1749
  t,
1734
- j,
1735
- i.tools || q().tools
1736
- ), { destroy: l } = Jt(
1750
+ A,
1751
+ n.tools || s.tools
1752
+ ), { destroy: c } = ai(
1737
1753
  t,
1738
- s,
1739
- d.collectionComponent
1740
- ), { activeMap: _ } = s.maps;
1741
- function c(g) {
1742
- if (n != null && n.m && n.cv && g instanceof $) {
1743
- const y = new D(n.cv);
1744
- n.m === E.VIEW ? t.viewViewshed(y) : t.editViewshed(y);
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);
1745
1761
  }
1746
1762
  }
1747
- let f = !1;
1748
- _ && (f = !0, c(_));
1749
- const m = s.maps.mapActivated.addEventListener(
1750
- (g) => {
1751
- t.stop(), f || (c(g), 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);
1752
1768
  }
1753
1769
  );
1754
- e = () => {
1755
- m(), r(), l(), d.destroy(), t.destroy();
1770
+ i = () => {
1771
+ b(), d(), c(), u.destroy(), t.destroy();
1756
1772
  };
1757
1773
  },
1758
- /**
1759
- * should return all default values of the configuration
1760
- * @returns {ViewshedPluginOptions}
1761
- */
1762
- getDefaultOptions: q,
1763
- /**
1764
- * should return the plugin's serialization excluding all default values
1765
- * @returns {ViewshedPluginOptions}
1766
- */
1774
+ getDefaultOptions: Oe,
1767
1775
  toJSON() {
1768
- const s = {};
1769
- 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;
1770
1778
  },
1771
- /**
1772
- * should return the plugins state
1773
- * @param {boolean} forUrl
1774
- * @returns {ViewshedPluginState}
1775
- */
1776
- getState(s) {
1777
- var l, _;
1778
- const n = {}, d = t.mode.value, r = (l = t.currentViewshed.value) == null ? void 0 : l.toJSON();
1779
- return d !== null && d !== "create" && r && (n.m = d, n.cv = r, s && ((_ = n.cv.properties) != null && _.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;
1780
1783
  },
1781
- /**
1782
- * components for configuring the plugin and/ or custom items defined by the plugin
1783
- * @returns {Array<import("@vcmap/ui").PluginConfigEditor>}
1784
- */
1785
1784
  getConfigEditors() {
1786
1785
  return [
1787
1786
  {
1788
- component: oi,
1787
+ component: fi,
1789
1788
  title: "viewshed.editor.title",
1790
1789
  infoUrlCallback: o == null ? void 0 : o.getHelpUrlCallback(
1791
1790
  "/components/plugins/viewshedToolConfig.html",
@@ -1794,7 +1793,9 @@ function ui(i) {
1794
1793
  }
1795
1794
  ];
1796
1795
  },
1797
- destroy: () => e(),
1796
+ destroy: () => {
1797
+ i();
1798
+ },
1798
1799
  i18n: {
1799
1800
  en: {
1800
1801
  viewshed: {
@@ -1809,15 +1810,13 @@ function ui(i) {
1809
1810
  heightMode: "Height mode",
1810
1811
  relative: "Relative to ground",
1811
1812
  absolute: "Absolute",
1812
- new: "New",
1813
1813
  cancel: "Cancel",
1814
- [w.CONE]: "Cone viewshed analysis",
1815
- [w.THREESIXTY]: "360° viewshed analysis",
1814
+ [_.CONE]: "Cone viewshed analysis",
1815
+ [_.THREESIXTY]: "360° viewshed analysis",
1816
1816
  create: {
1817
- [w.CONE]: "Create cone viewshed analysis",
1818
- [w.THREESIXTY]: "Create 360° viewshed analysis"
1817
+ [_.CONE]: "Create cone viewshed analysis",
1818
+ [_.THREESIXTY]: "Create 360° viewshed analysis"
1819
1819
  },
1820
- addToMyWorkspace: "Add to My Workspace",
1821
1820
  temporary: "Temporary",
1822
1821
  jumpToViewpoint: "Jump to viewpoint",
1823
1822
  returnToViewpoint: "Return to previous viewpoint",
@@ -1847,15 +1846,13 @@ function ui(i) {
1847
1846
  heightMode: "Höhenmodus",
1848
1847
  relative: "Relativ zum Gelände",
1849
1848
  absolute: "Absolut",
1850
- new: "Neu",
1851
1849
  cancel: "Abbrechen",
1852
- [w.CONE]: "Sichtkegelanalyse",
1853
- [w.THREESIXTY]: "360° Sichtsanalyse",
1850
+ [_.CONE]: "Sichtkegelanalyse",
1851
+ [_.THREESIXTY]: "360° Sichtsanalyse",
1854
1852
  create: {
1855
- [w.CONE]: "Sichtkegelanalyse erstellen",
1856
- [w.THREESIXTY]: "360° Sichtanalyse erstellen"
1853
+ [_.CONE]: "Sichtkegelanalyse erstellen",
1854
+ [_.THREESIXTY]: "360° Sichtanalyse erstellen"
1857
1855
  },
1858
- addToMyWorkspace: "Zu Mein Arbeitsbereich hinzufügen",
1859
1856
  temporary: "Temporäre",
1860
1857
  jumpToViewpoint: "Zu Standpunkt springen",
1861
1858
  returnToViewpoint: "Zu vorherigem Standpunkt zurück springen",
@@ -1876,5 +1873,6 @@ function ui(i) {
1876
1873
  };
1877
1874
  }
1878
1875
  export {
1879
- ui as default
1876
+ Ei as default,
1877
+ Oe as getDefaultOptions
1880
1878
  };