@vcmap/viewshed 2.0.5 → 2.0.7

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
1
  var pe = Object.defineProperty;
2
2
  var we = (s, e, i) => e in s ? pe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
3
3
  var Q = (s, e, i) => (we(s, typeof e != "symbol" ? e + "" : e, i), i);
4
- import { VcsCameraPrimitive as me, VcsObject as ge, VcsEvent as x, AbstractInteraction as _e, EventType as N, Projection as I, SessionType as Ce, CesiumMap as D, startEditFeaturesSession as Ee, startEditGeometrySession as ye, VectorLayer as Ve, wgs84Projection as be, maxZIndex as Me, markVolatile as Te, Viewpoint as Oe, TransformationMode as Se, Category as Pe, moduleIdSymbol as Ae } from "../../../assets/core.js";
5
- import { Color as j, Matrix4 as Ie, Transforms as Re, Primitive as ee, GeometryInstance as te, SphereGeometry as $e, ColorGeometryInstanceAttribute as ie, PerInstanceColorAppearance as se, SphereOutlineGeometry as Ne, Math as T, Cartesian3 as O, ShadowMap as xe, Camera as De, HeightReference as Le } from "../../../assets/cesium.js";
6
- import { shallowRef as K, ref as A, nextTick as ke, inject as oe, computed as ne, reactive as W, watchEffect as Fe, watch as R, onMounted as je, onUnmounted as We } from "../../../assets/vue.js";
4
+ import { VcsCameraPrimitive as me, VcsObject as ge, VcsEvent as D, AbstractInteraction as _e, EventType as x, Projection as I, SessionType as Ce, CesiumMap as $, startEditFeaturesSession as Ee, startEditGeometrySession as ye, VectorLayer as Ve, wgs84Projection as be, maxZIndex as Me, markVolatile as Te, Viewpoint as Oe, TransformationMode as Se, Category as Pe, moduleIdSymbol as Ae } from "../../../assets/core.js";
5
+ import { Color as j, Matrix4 as Ie, Transforms as Re, Primitive as ee, GeometryInstance as te, SphereGeometry as $e, ColorGeometryInstanceAttribute as ie, PerInstanceColorAppearance as se, SphereOutlineGeometry as Ne, Math as T, Cartesian3 as S, ShadowMap as xe, Camera as De, HeightReference as Le } from "../../../assets/cesium.js";
6
+ import { shallowRef as K, ref as A, nextTick as Fe, inject as oe, computed as ne, reactive as W, watchEffect as ke, watch as R, onMounted as je, onUnmounted as We } from "../../../assets/vue.js";
7
7
  import { ol$Observable$unByKey as Be, Feature as ze, ol$geom$Point as Ge, ol$style$Style as He } from "../../../assets/ol.js";
8
- import { VcsTextField as Ue, VcsSlider as Ke, VcsLabel as ae, VcsFormSection as le, VcsSelect as ce, VcsFormButton as Xe, VcsFeatureTransforms as Ye, makeEditorCollectionComponentClass as Je, WindowSlot as Ze, ToolboxType as qe, createListExportAction as Qe, downloadText as et, createListImportAction as tt, AbstractConfigEditor as it } from "../../../assets/ui.js";
9
- import { VContainer as de, VRow as he, VCol as ue, VDivider as st, VColorPicker as ot } from "../../../assets/vuetify.js";
10
- const $ = [
8
+ import { VcsTextField as Ue, VcsSlider as Ke, VcsLabel as ae, VcsFormSection as le, VcsSelect as ce, VcsFormButton as Xe, VcsFeatureTransforms as Ye, makeEditorCollectionComponentClass as Je, WindowSlot as Ze, ToolboxType as qe, createSupportedMapMappingFunction as Qe, createListExportAction as et, downloadText as tt, createListImportAction as it, AbstractConfigEditor as st } from "../../../assets/ui.js";
9
+ import { VContainer as de, VRow as he, VCol as ue, VDivider as ot, VColorPicker as nt } from "../../../assets/vuetify.js";
10
+ const N = [
11
11
  [String, "string"],
12
12
  [Number, "number"],
13
13
  [Boolean, "boolean"],
@@ -43,10 +43,10 @@ function b(s, e) {
43
43
  }
44
44
  return i = i || typeof s, i.length > 20 ? `${i.substr(0, 20)}...` : i;
45
45
  }
46
- function nt(s, e) {
46
+ function rt(s, e) {
47
47
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" ? s === e ? !1 : `Expected ${b(s)} to equal ${e.toString()}` : null;
48
48
  }
49
- function rt(s, e, i) {
49
+ function at(s, e, i) {
50
50
  if (Array.isArray(e)) {
51
51
  if (e.length !== 1)
52
52
  throw new Error("Array patterns may only have on type");
@@ -84,18 +84,18 @@ function X(s, e, i) {
84
84
  });
85
85
  return a ? `${n} in object.${t}${a}` : !1;
86
86
  }
87
- function at(s, e) {
87
+ function lt(s, e) {
88
88
  if (e === Number)
89
89
  return Number.isFinite(s) ? !1 : `expected ${b(s)} to be a number, excluding NaN`;
90
- for (let i = $.length; i--; )
91
- if (e === $[i][0])
92
- return typeof s === $[i][1] ? !1 : `expected ${b(s)} to be a ${$[i][1]}`;
90
+ for (let i = N.length; i--; )
91
+ if (e === N[i][0])
92
+ return typeof s === N[i][1] ? !1 : `expected ${b(s)} to be a ${N[i][1]}`;
93
93
  return null;
94
94
  }
95
95
  function Y(s) {
96
96
  if (s === null)
97
97
  return "null";
98
- const e = $.find((o) => o[0] === s);
98
+ const e = N.find((o) => o[0] === s);
99
99
  if (e)
100
100
  return e[1];
101
101
  let i = s.toString();
@@ -129,18 +129,18 @@ function fe(s, e, i) {
129
129
  return o = o ? o.replace(/\sin.*/, "") : !1, o;
130
130
  }) ? `${o} in ${b(s)}` : !1;
131
131
  }
132
- function lt(s, e, i) {
132
+ function ct(s, e, i) {
133
133
  const t = function(a, c) {
134
134
  if (c == null)
135
135
  return a === c ? !1 : `Expected ${b(a)} to be ${c}`;
136
- const r = at(a, c);
136
+ const r = lt(a, c);
137
137
  if (r !== null)
138
138
  return r;
139
- const f = nt(a, c);
139
+ const f = rt(a, c);
140
140
  if (f !== null)
141
141
  return f;
142
142
  if (Array.isArray(c))
143
- return rt(a, c, i);
143
+ return at(a, c, i);
144
144
  if (c instanceof Function)
145
145
  return a instanceof c ? !1 : `Expected ${b(a, !0)} to be of Type ${Y(c)}`;
146
146
  if (c === Object)
@@ -154,12 +154,12 @@ function lt(s, e, i) {
154
154
  return Array.isArray(e) && e.length > 1 ? e.every((a) => t(s, a)) && (o = `Expected ${b(s)} to be a ${e.map((a) => Y(a)).join(" or ")}`) : o = t(s, e), o;
155
155
  }
156
156
  function z(s, e, i) {
157
- const t = lt(s, e, i);
157
+ const t = ct(s, e, i);
158
158
  if (t)
159
159
  throw new Error(`Match failed: ${t}`);
160
160
  return !1;
161
161
  }
162
- function ct(s, e, i) {
162
+ function dt(s, e, i) {
163
163
  if (s != null) {
164
164
  const t = Object.values(e).find((o) => o == s);
165
165
  if (t != null)
@@ -167,8 +167,8 @@ function ct(s, e, i) {
167
167
  }
168
168
  return i;
169
169
  }
170
- const dt = new j(), H = new Ie();
171
- class ht extends me {
170
+ const ht = new j(), H = new Ie();
171
+ class ut extends me {
172
172
  constructor(e) {
173
173
  super(e), this.spot = e.spot;
174
174
  }
@@ -194,7 +194,7 @@ class ht extends me {
194
194
  }),
195
195
  attributes: {
196
196
  color: ie.fromColor(
197
- j.fromAlpha(this._color, 0.1, dt)
197
+ j.fromAlpha(this._color, 0.1, ht)
198
198
  )
199
199
  },
200
200
  modelMatrix: H
@@ -231,7 +231,7 @@ const w = {
231
231
  CONE: "cone",
232
232
  THREESIXTY: "360"
233
233
  };
234
- function ut(s, e) {
234
+ function ft(s, e) {
235
235
  const i = new De(s), t = (
236
236
  /** @type {import("@vcmap-cesium/engine").PerspectiveFrustum} */
237
237
  i.frustum
@@ -276,21 +276,21 @@ const E = class E extends ge {
276
276
  aspectRatio: ((n = e.frustumOptions) == null ? void 0 : n.aspectRatio) || E.getDefaultOptions().frustum.aspectRatio
277
277
  }, this._headingPitchRollValues = e.orientation || {
278
278
  ...E.getDefaultOptions().orientation
279
- }, this._position = e.position || E.getDefaultOptions().position, this._viewshedType = ct(e.viewshedType, w), this._colors = {
279
+ }, this._position = e.position || E.getDefaultOptions().position, this._viewshedType = dt(e.viewshedType, w), this._colors = {
280
280
  visibleColor: j.fromCssColorString(
281
281
  ((a = e.colorOptions) == null ? void 0 : a.visibleColor) || E.getDefaultOptions().visibleColor
282
282
  ),
283
283
  shadowColor: j.fromCssColorString(
284
284
  ((c = e.colorOptions) == null ? void 0 : c.shadowColor) || E.getDefaultOptions().shadowColor
285
285
  )
286
- }, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this._positionChanged = new x(), this._active = !1;
286
+ }, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this._positionChanged = new D(), this._active = !1;
287
287
  }
288
288
  /**
289
289
  * Sets a new position for the shadow map. If no shadow map was created yet, due to missing position, this method triggers the creation of a shadow map.
290
290
  * @param {import("ol/coordinate").Coordinate} coords The new positions coordinates in degrees
291
291
  */
292
292
  set position(e) {
293
- z(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position = O.fromDegrees(
293
+ z(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position = S.fromDegrees(
294
294
  e[0],
295
295
  e[1],
296
296
  e[2] + this._heightOffset
@@ -314,7 +314,7 @@ const E = class E extends ge {
314
314
  * @param {number} value the offset that is added to the position height.
315
315
  */
316
316
  set heightOffset(e) {
317
- this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position = O.fromDegrees(
317
+ this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position = S.fromDegrees(
318
318
  this.position[0],
319
319
  this.position[1],
320
320
  this.position[2] + e
@@ -435,7 +435,7 @@ const E = class E extends ge {
435
435
  this._cesiumMap = e;
436
436
  const i = e.getScene();
437
437
  if (i)
438
- this._shadowCamera = ut(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
438
+ this._shadowCamera = ft(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
439
439
  else
440
440
  throw new Error("CesiumMap contains no scene");
441
441
  this._updateShadowMap(), this._updatePrimitive();
@@ -465,7 +465,7 @@ const E = class E extends ge {
465
465
  this._primitive && !((i = (e = this._primitive).isDestroyed) != null && i.call(e)) && ((t = this._scene) == null || t.primitives.remove(this._primitive), this._primitive.destroy(), this._primitive = null);
466
466
  }
467
467
  _updatePrimitive() {
468
- this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new ht({
468
+ this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new ut({
469
469
  camera: this._shadowCamera,
470
470
  allowPicking: !1,
471
471
  spot: this._viewshedType === w.CONE
@@ -478,10 +478,10 @@ const E = class E extends ge {
478
478
  lookAt(e) {
479
479
  if (!this._shadowCamera)
480
480
  return;
481
- const i = O.fromDegrees(e[0], e[1], e[2]);
482
- if (this.distance = O.distance(this._shadowCamera.position, i), this.type === w.CONE && !i.equals(this._shadowCamera.position)) {
483
- const t = new O();
484
- O.subtract(i, this._shadowCamera.position, i), O.normalize(i, i), O.normalize(this._shadowCamera.position, t), this._shadowCamera.setView({
481
+ const i = S.fromDegrees(e[0], e[1], e[2]);
482
+ if (this.distance = S.distance(this._shadowCamera.position, i), this.type === w.CONE && !i.equals(this._shadowCamera.position)) {
483
+ const t = new S();
484
+ S.subtract(i, this._shadowCamera.position, i), S.normalize(i, i), S.normalize(this._shadowCamera.position, t), this._shadowCamera.setView({
485
485
  orientation: {
486
486
  direction: i,
487
487
  up: t
@@ -520,13 +520,13 @@ const E = class E extends ge {
520
520
  };
521
521
  Q(E, "MIN_DISTANCE", 10);
522
522
  let M = E;
523
- class ft extends _e {
523
+ class vt extends _e {
524
524
  /**
525
525
  *
526
526
  * @param {import("./viewshed").default} viewshed
527
527
  */
528
528
  constructor(e) {
529
- super(N.CLICKMOVE), this._viewshed = e, this._positioned = new x(), this._finished = new x(), this._position = !1, this.setActive();
529
+ super(x.CLICKMOVE), this._viewshed = e, this._positioned = new D(), this._finished = new D(), this._position = !1, this.setActive();
530
530
  }
531
531
  get finished() {
532
532
  return this._finished;
@@ -535,7 +535,7 @@ class ft extends _e {
535
535
  return this._positioned;
536
536
  }
537
537
  async pipe(e) {
538
- return e.position && (this._position ? (this._viewshed.lookAt(I.mercatorToWgs84(e.position)), e.type & N.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = I.mercatorToWgs84(e.position), e.type & N.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), e;
538
+ return e.position && (this._position ? (this._viewshed.lookAt(I.mercatorToWgs84(e.position)), e.type & x.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = I.mercatorToWgs84(e.position), e.type & x.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), e;
539
539
  }
540
540
  destroy() {
541
541
  super.destroy(), this._finished.destroy(), this._positioned.destroy();
@@ -551,7 +551,7 @@ const y = {
551
551
  MOVE: "move",
552
552
  MULTI_SELECT: "multiSelect"
553
553
  }, re = 1.8;
554
- function vt(s) {
554
+ function pt(s) {
555
555
  const e = new Ve({
556
556
  projection: be.toJSON(),
557
557
  zIndex: Me - 1
@@ -567,10 +567,10 @@ function vt(s) {
567
567
  };
568
568
  }
569
569
  function U(s, e) {
570
- const i = e === y.ABSOLUTE ? N.CLICKMOVE : N.NONE;
570
+ const i = e === y.ABSOLUTE ? x.CLICKMOVE : x.NONE;
571
571
  s.setActive(i), s.pickPosition = i, s.pullPickedPosition = 1.8;
572
572
  }
573
- function pt(s, e, i) {
573
+ function wt(s, e, i) {
574
574
  const t = K(null), o = A(null), n = A(null), a = A(y.ABSOLUTE);
575
575
  let c = () => {
576
576
  };
@@ -585,13 +585,13 @@ function pt(s, e, i) {
585
585
  f(), c(), h(), t.value = null, l && i.clearSelection(), o.value = null, n.value = null;
586
586
  }
587
587
  function u(l) {
588
- f(), h(), s.maps.activeMap instanceof D && (t.value = l, l.activate(s.maps.activeMap), f = s.maps.activeMap.shadowMapChanged.addEventListener((d) => {
588
+ f(), h(), s.maps.activeMap instanceof $ && (t.value = l, l.activate(s.maps.activeMap), f = s.maps.activeMap.shadowMapChanged.addEventListener((d) => {
589
589
  var p;
590
590
  d !== ((p = t.value) == null ? void 0 : p.shadowMap) && v(!1);
591
591
  }));
592
592
  }
593
593
  async function _(l) {
594
- v(), await ke();
594
+ v(), await Fe();
595
595
  const { eventHandler: d } = s.maps, { featureInteraction: p } = d, g = new M({
596
596
  viewshedType: l,
597
597
  colorOptions: {
@@ -601,11 +601,11 @@ function pt(s, e, i) {
601
601
  heightOffset: a.value === y.ABSOLUTE ? 0 : re
602
602
  });
603
603
  u(g);
604
- const C = new ft(t.value);
604
+ const C = new vt(t.value);
605
605
  C.finished.addEventListener(() => {
606
606
  c(), t.value ? (t.value.showPrimitive = !0, n.value = m.EDIT) : v();
607
607
  });
608
- const k = d.addExclusiveInteraction(
608
+ const F = d.addExclusiveInteraction(
609
609
  C,
610
610
  () => {
611
611
  C.destroy();
@@ -614,7 +614,7 @@ function pt(s, e, i) {
614
614
  U(p, a.value), C.positioned.addEventListener(() => {
615
615
  U(p, y.ABSOLUTE);
616
616
  }), c = () => {
617
- k(), C.destroy(), p.setActive(), c = () => {
617
+ F(), C.destroy(), p.setActive(), c = () => {
618
618
  };
619
619
  }, n.value = m.CREATE;
620
620
  }
@@ -626,11 +626,11 @@ function pt(s, e, i) {
626
626
  layer: p,
627
627
  feature: g,
628
628
  destroy: C
629
- } = vt(t.value.position);
629
+ } = pt(t.value.position);
630
630
  s.layers.add(p), a.value === y.ABSOLUTE ? (r.value = Ee(s, p), r.value.setFeatures([g])) : (r.value = ye(s, p), r.value.setFeature(g)), r.value.stopped.addEventListener(() => {
631
631
  c();
632
632
  });
633
- const k = (d = g.getGeometry()) == null ? void 0 : d.on("change", () => {
633
+ const F = (d = g.getGeometry()) == null ? void 0 : d.on("change", () => {
634
634
  t.value ? t.value.position = I.mercatorToWgs84(
635
635
  /** @type {import("ol/geom").Point} */
636
636
  g.getGeometry().getCoordinates()
@@ -639,7 +639,7 @@ function pt(s, e, i) {
639
639
  n.value = m.MOVE, c = () => {
640
640
  var q;
641
641
  c = () => {
642
- }, k && Be(k), (q = r.value) == null || q.stop(), r.value = null, s.layers.remove(p), C(), n.value = m.EDIT;
642
+ }, F && Be(F), (q = r.value) == null || q.stop(), r.value = null, s.layers.remove(p), C(), n.value = m.EDIT;
643
643
  };
644
644
  } else
645
645
  c();
@@ -710,7 +710,7 @@ function pt(s, e, i) {
710
710
  changeHeightMode: G,
711
711
  async placeCurrentFeaturesOnTerrain() {
712
712
  var l, d;
713
- if (t.value && ((l = r.value) == null ? void 0 : l.type) === Ce.EDIT_FEATURES && s.maps.activeMap instanceof D) {
713
+ if (t.value && ((l = r.value) == null ? void 0 : l.type) === Ce.EDIT_FEATURES && s.maps.activeMap instanceof $) {
714
714
  const g = (await s.maps.activeMap.getHeightFromTerrain([
715
715
  I.wgs84ToMercator((d = t.value) == null ? void 0 : d.position)
716
716
  ]))[0][2] - t.value.position[2];
@@ -752,12 +752,12 @@ function ve(s, e, i, t, o, n, a, c) {
752
752
  options: r
753
753
  };
754
754
  }
755
- const wt = {
755
+ const mt = {
756
756
  distance: [M.MIN_DISTANCE, 2e3],
757
757
  fov: [25, 85],
758
758
  heading: [0, 360],
759
759
  pitch: [-90, 90]
760
- }, mt = {
760
+ }, gt = {
761
761
  components: {
762
762
  VcsTextField: Ue,
763
763
  VContainer: de,
@@ -766,7 +766,7 @@ const wt = {
766
766
  VcsSlider: Ke,
767
767
  VcsLabel: ae,
768
768
  VcsFormSection: le,
769
- VDivider: st,
769
+ VDivider: ot,
770
770
  VcsSelect: ce,
771
771
  VcsFormButton: Xe,
772
772
  VcsFeatureTransforms: Ye
@@ -818,7 +818,7 @@ const wt = {
818
818
  function V() {
819
819
  _(), t.value && (v.distance = t.value.distance, v.fov = t.value.fov, v.heading = t.value.heading, v.pitch = t.value.pitch, v.showPrimitive = t.value.showPrimitive, u.value = t.value.type);
820
820
  }
821
- Fe(() => {
821
+ ke(() => {
822
822
  t.value && o.value !== m.CREATE && V();
823
823
  }), R(
824
824
  t,
@@ -916,7 +916,7 @@ const wt = {
916
916
  },
917
917
  parameters: v,
918
918
  setParameter: L,
919
- parameterRanges: wt,
919
+ parameterRanges: mt,
920
920
  ViewshedPluginModes: m,
921
921
  viewshedMode: o,
922
922
  currentIsPersisted: n,
@@ -935,7 +935,7 @@ const wt = {
935
935
  };
936
936
  }
937
937
  };
938
- var gt = function() {
938
+ var _t = function() {
939
939
  var e = this, i = e._self._c;
940
940
  return i("div", [e.viewshedMode === e.ViewshedPluginModes.CREATE ? i("div", { staticClass: "px-2 py-1" }, [e.viewshedType === e.ViewshedTypes.CONE ? [e._v(" " + e._s(e.$t("viewshed.createDescription")) + " ")] : e.viewshedType === e.ViewshedTypes.THREESIXTY ? [e._v(" " + e._s(e.$t("viewshed.createThreeSixtyDescription")) + " ")] : e._e()], 2) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("VcsFormSection", { attrs: { "header-actions": e.headerActions, heading: "viewshed.viewpoint", "action-button-list-overflow-count": 3 } }, [i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("span", { staticClass: "px-1 py-0" }, [e._v(e._s(e.$t("viewshed.position")))])]), e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? i("v-row", { attrs: { "no-gutters": "" } }, [i("VcsFeatureTransforms", { attrs: { "transformation-mode": e.TransformationMode.TRANSLATE, "feature-properties": { altitudeMode: "absolute" }, "allow-z-input": !0 } })], 1) : i("v-row", { attrs: { "no-gutters": "" } }, e._l(e.position, function(t, o, n) {
941
941
  return i("v-col", { key: n, staticClass: "pb-1" }, [i("VcsTextField", { attrs: { value: t, type: "number", prefix: o, "show-spin-buttons": !0, step: o === "Z" ? 1 : 1e-4, unit: o === "Z" ? "m" : "°", decimals: o === "Z" ? 2 : 8, disabled: e.viewshedMode === e.ViewshedPluginModes.MOVE && !(o === "Z" && e.heightMode === e.HeightModes.RELATIVE) }, on: { input: (a) => e.setPosition(a, o, n) } })], 1);
@@ -951,23 +951,23 @@ var gt = function() {
951
951
  } } }, [e._v(" " + e._s(e.$t("viewshed.new")) + " ")])], 1) : e.viewshedMode === e.ViewshedPluginModes.CREATE ? i("div", { staticClass: "d-flex w-full justify-end px-2 pt-2 pb-1" }, [i("VcsFormButton", { attrs: { variant: "filled" }, on: { click: function(t) {
952
952
  return e.cancel();
953
953
  } } }, [e._v(" " + e._s(e.$t("viewshed.cancel")) + " ")])], 1) : e._e()], 1);
954
- }, _t = [], Ct = /* @__PURE__ */ ve(
955
- mt,
954
+ }, Ct = [], Et = /* @__PURE__ */ ve(
956
955
  gt,
957
956
  _t,
957
+ Ct,
958
958
  !1,
959
959
  null,
960
960
  null,
961
961
  null,
962
962
  null
963
963
  );
964
- const Et = Ct.exports, S = "@vcmap/viewshed", yt = "2.0.5", Vt = "^5.1", J = {
964
+ const yt = Et.exports, O = "@vcmap/viewshed", Vt = "2.0.7", bt = "^5.1", J = {
965
965
  [w.CONE]: "$vcsViewshed",
966
966
  [w.THREESIXTY]: "$vcsViewshedCone"
967
967
  };
968
- function bt(s, e, i) {
968
+ function Mt(s, e, i) {
969
969
  const t = A(), o = A(), n = `${i.id}-editor`, a = {
970
- component: Et,
970
+ component: yt,
971
971
  provides: {
972
972
  manager: s
973
973
  },
@@ -1004,7 +1004,7 @@ function bt(s, e, i) {
1004
1004
  parentId: "category-manager",
1005
1005
  slot: Ze.DYNAMIC_LEFT
1006
1006
  },
1007
- S
1007
+ O
1008
1008
  ));
1009
1009
  }
1010
1010
  const f = R(s.currentViewshed, (u) => {
@@ -1020,7 +1020,7 @@ function bt(s, e, i) {
1020
1020
  }
1021
1021
  };
1022
1022
  }
1023
- function Mt(s, e, i, t) {
1023
+ function Tt(s, e, i, t) {
1024
1024
  const o = {
1025
1025
  type: qe.SELECT,
1026
1026
  action: W({
@@ -1064,7 +1064,7 @@ function Mt(s, e, i, t) {
1064
1064
  ));
1065
1065
  }
1066
1066
  ), c = s.maps.mapActivated.addEventListener((r) => {
1067
- r instanceof D ? o.action.disabled = !1 : o.action.disabled = !0;
1067
+ r instanceof $ ? o.action.disabled = !1 : o.action.disabled = !0;
1068
1068
  });
1069
1069
  return {
1070
1070
  destroy() {
@@ -1073,9 +1073,9 @@ function Mt(s, e, i, t) {
1073
1073
  toolbox: o
1074
1074
  };
1075
1075
  }
1076
- function Tt(s, e, i, t) {
1076
+ function Ot(s, e, i, t) {
1077
1077
  z(t, [Object.values(w)]);
1078
- const { toolbox: o, destroy: n } = Mt(s, e, i, t), a = s.toolboxManager.add(o, i).id;
1078
+ const { toolbox: o, destroy: n } = Tt(s, e, i, t), a = s.toolboxManager.add(o, i).id;
1079
1079
  return () => {
1080
1080
  s.toolboxManager.remove(a), n();
1081
1081
  };
@@ -1088,14 +1088,14 @@ class Z extends Pe {
1088
1088
  var t;
1089
1089
  const i = (
1090
1090
  /** @type {import("@vcmap/core").CesiumMap | undefined} */
1091
- (t = this._app) == null ? void 0 : t.maps.getByType(D.className)[0]
1091
+ (t = this._app) == null ? void 0 : t.maps.getByType($.className)[0]
1092
1092
  );
1093
1093
  if (i)
1094
1094
  return new M(e, i);
1095
1095
  throw new Error("No CesiumMap available");
1096
1096
  }
1097
1097
  }
1098
- function Ot(s, e) {
1098
+ function St(s, e) {
1099
1099
  let i, t = 0;
1100
1100
  const o = new Set(
1101
1101
  e.filter((n) => n.type === s).map((n) => n.properties.title)
@@ -1105,20 +1105,28 @@ function Ot(s, e) {
1105
1105
  while (!i);
1106
1106
  return i;
1107
1107
  }
1108
- async function St(s) {
1109
- const e = new x(), i = new x(), { collectionComponent: t, category: o } = await s.categoryManager.requestCategory(
1108
+ async function Pt(s) {
1109
+ const e = new D(), i = new D(), { collectionComponent: t, category: o } = await s.categoryManager.requestCategory(
1110
1110
  {
1111
1111
  type: Z.className,
1112
1112
  name: "Viewsheds",
1113
1113
  title: "Viewsheds"
1114
1114
  },
1115
- S,
1115
+ O,
1116
1116
  {
1117
1117
  selectable: !0,
1118
1118
  renamable: !0,
1119
1119
  removable: !0
1120
1120
  }
1121
- ), n = (h, v, u) => {
1121
+ );
1122
+ t.addItemMapping({
1123
+ mappingFunction: Qe(
1124
+ [$.className],
1125
+ s.maps
1126
+ ),
1127
+ owner: O
1128
+ });
1129
+ const n = (h, v, u) => {
1122
1130
  u.title = h.properties.title, u.titleChanged = (_) => {
1123
1131
  h.properties.title = _, u.title = _, e.raiseEvent({ item: h, title: _ });
1124
1132
  }, u.actions.push(
@@ -1134,19 +1142,19 @@ async function St(s) {
1134
1142
  s.categoryManager.addMappingFunction(
1135
1143
  () => !0,
1136
1144
  n,
1137
- S,
1145
+ O,
1138
1146
  [t.id]
1139
1147
  );
1140
- const { action: a, destroy: c } = Qe(
1148
+ const { action: a, destroy: c } = et(
1141
1149
  t.selection,
1142
1150
  () => {
1143
1151
  const h = t.selection.value.map(
1144
1152
  (v) => t.collection.getByKey(v.name)
1145
1153
  );
1146
- et(JSON.stringify(h), "viewsheds.json");
1154
+ tt(JSON.stringify(h), "viewsheds.json");
1147
1155
  },
1148
- S
1149
- ), { action: r, destroy: f } = tt(
1156
+ O
1157
+ ), { action: r, destroy: f } = it(
1150
1158
  async (h) => {
1151
1159
  await Promise.all(
1152
1160
  h.map(async (v) => {
@@ -1159,7 +1167,7 @@ async function St(s) {
1159
1167
  );
1160
1168
  },
1161
1169
  s.windowManager,
1162
- S,
1170
+ O,
1163
1171
  "category-manager"
1164
1172
  );
1165
1173
  return t.addActions([a, r]), {
@@ -1183,7 +1191,7 @@ async function St(s) {
1183
1191
  }
1184
1192
  },
1185
1193
  add(h) {
1186
- h.properties.title = Ot(
1194
+ h.properties.title = St(
1187
1195
  h.type,
1188
1196
  /** @type {import("./viewshed.js").default[]} */
1189
1197
  [
@@ -1197,29 +1205,29 @@ async function St(s) {
1197
1205
  },
1198
1206
  collectionComponent: t,
1199
1207
  destroy() {
1200
- s.categoryManager.removeOwner(S), e.destroy(), i.destroy(), c(), f();
1208
+ s.categoryManager.removeOwner(O), e.destroy(), i.destroy(), c(), f();
1201
1209
  }
1202
1210
  };
1203
1211
  }
1204
- function F() {
1212
+ function k() {
1205
1213
  return {
1206
1214
  visibleColor: M.getDefaultOptions().visibleColor,
1207
1215
  shadowColor: M.getDefaultOptions().shadowColor,
1208
1216
  tools: [...Object.values(w)]
1209
1217
  };
1210
1218
  }
1211
- const Pt = {
1219
+ const At = {
1212
1220
  name: "ViewshedConfigEditor",
1213
1221
  title: "Viewshed Editor",
1214
1222
  components: {
1215
- AbstractConfigEditor: it,
1223
+ AbstractConfigEditor: st,
1216
1224
  VcsFormSection: le,
1217
1225
  VContainer: de,
1218
1226
  VRow: he,
1219
1227
  VCol: ue,
1220
1228
  VcsLabel: ae,
1221
1229
  VcsSelect: ce,
1222
- VColorPicker: ot
1230
+ VColorPicker: nt
1223
1231
  },
1224
1232
  props: {
1225
1233
  getConfig: {
@@ -1234,7 +1242,7 @@ const Pt = {
1234
1242
  setup(s) {
1235
1243
  const e = A({});
1236
1244
  s.getConfig().then((t) => {
1237
- e.value = Object.assign(F(), t);
1245
+ e.value = Object.assign(k(), t);
1238
1246
  });
1239
1247
  async function i() {
1240
1248
  await s.setConfig(e.value);
@@ -1250,7 +1258,7 @@ const Pt = {
1250
1258
  };
1251
1259
  }
1252
1260
  };
1253
- var At = function() {
1261
+ var It = function() {
1254
1262
  var e = this, i = e._self._c;
1255
1263
  return i("AbstractConfigEditor", e._b({ on: { submit: e.apply } }, "AbstractConfigEditor", { ...e.$attrs, ...e.$props }, !1), [e.localConfig ? i("VcsFormSection", { attrs: { heading: "viewshed.editor.general" } }, [i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": "viewshed-editor-tools" } }, [e._v(e._s(e.$t("viewshed.editor.tools")))])], 1), i("v-col", [i("VcsSelect", { attrs: { id: "viewshed-tools", items: e.toolItems, multiple: !0 }, model: { value: e.localConfig.tools, callback: function(t) {
1256
1264
  e.$set(e.localConfig, "tools", t);
@@ -1259,29 +1267,29 @@ var At = function() {
1259
1267
  }, expression: "localConfig.visibleColor" } })], 1)], 1), i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": "viewshed-editor-shadow-color" } }, [e._v(e._s(e.$t("viewshed.editor.shadowColor")))])], 1), i("v-col", [i("VColorPicker", { attrs: { mode: "rgba" }, model: { value: e.localConfig.shadowColor, callback: function(t) {
1260
1268
  e.$set(e.localConfig, "shadowColor", t);
1261
1269
  }, expression: "localConfig.shadowColor" } })], 1)], 1)], 1)], 1) : e._e()], 1);
1262
- }, It = [], Rt = /* @__PURE__ */ ve(
1263
- Pt,
1270
+ }, Rt = [], $t = /* @__PURE__ */ ve(
1264
1271
  At,
1265
1272
  It,
1273
+ Rt,
1266
1274
  !1,
1267
1275
  null,
1268
1276
  null,
1269
1277
  null,
1270
1278
  null
1271
1279
  );
1272
- const $t = Rt.exports;
1273
- function Wt(s) {
1280
+ const Nt = $t.exports;
1281
+ function Bt(s) {
1274
1282
  let e, i = () => {
1275
1283
  };
1276
1284
  return {
1277
1285
  get name() {
1278
- return S;
1286
+ return O;
1279
1287
  },
1280
1288
  get version() {
1281
- return yt;
1289
+ return Vt;
1282
1290
  },
1283
1291
  get mapVersion() {
1284
- return Vt;
1292
+ return bt;
1285
1293
  },
1286
1294
  /**
1287
1295
  * @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
@@ -1294,24 +1302,24 @@ function Wt(s) {
1294
1302
  Z.className,
1295
1303
  Z
1296
1304
  );
1297
- const n = await St(t);
1298
- e = pt(
1305
+ const n = await Pt(t);
1306
+ e = wt(
1299
1307
  t,
1300
1308
  s,
1301
1309
  n
1302
1310
  );
1303
- const a = Tt(
1311
+ const a = Ot(
1304
1312
  t,
1305
1313
  e,
1306
- S,
1307
- s.tools || F().tools
1308
- ), { destroy: c } = bt(
1314
+ O,
1315
+ s.tools || k().tools
1316
+ ), { destroy: c } = Mt(
1309
1317
  e,
1310
1318
  t,
1311
1319
  n.collectionComponent
1312
1320
  ), { activeMap: r } = t.maps;
1313
1321
  function f(u) {
1314
- if (o != null && o.mode && o.currentViewshed && u instanceof D) {
1322
+ if (o != null && o.mode && o.currentViewshed && u instanceof $) {
1315
1323
  const _ = new M(o.currentViewshed, r);
1316
1324
  o.mode === m.VIEW ? e.viewViewshed(_) : e.editViewshed(_);
1317
1325
  }
@@ -1331,14 +1339,14 @@ function Wt(s) {
1331
1339
  * should return all default values of the configuration
1332
1340
  * @returns {ViewshedPluginOptions}
1333
1341
  */
1334
- getDefaultOptions: F,
1342
+ getDefaultOptions: k,
1335
1343
  /**
1336
1344
  * should return the plugin's serialization excluding all default values
1337
1345
  * @returns {ViewshedPluginOptions}
1338
1346
  */
1339
1347
  toJSON() {
1340
1348
  const t = {};
1341
- return s.tools && F().tools.length !== s.tools.length && (t.tools = [...s.tools]), s.shadowColor && s.shadowColor !== M.getDefaultOptions().shadowColor && (t.shadowColor = s.shadowColor), s.visibleColor && s.visibleColor !== M.getDefaultOptions().visibleColor && (t.visibleColor = s.visibleColor), t;
1349
+ return s.tools && k().tools.length !== s.tools.length && (t.tools = [...s.tools]), s.shadowColor && s.shadowColor !== M.getDefaultOptions().shadowColor && (t.shadowColor = s.shadowColor), s.visibleColor && s.visibleColor !== M.getDefaultOptions().visibleColor && (t.visibleColor = s.visibleColor), t;
1342
1350
  },
1343
1351
  /**
1344
1352
  * should return the plugins state
@@ -1356,7 +1364,7 @@ function Wt(s) {
1356
1364
  * @returns {Array<import("@vcmap/ui").PluginConfigEditor>}
1357
1365
  */
1358
1366
  getConfigEditors() {
1359
- return [{ component: $t }];
1367
+ return [{ component: Nt }];
1360
1368
  },
1361
1369
  destroy: i,
1362
1370
  i18n: {
@@ -1432,5 +1440,5 @@ function Wt(s) {
1432
1440
  };
1433
1441
  }
1434
1442
  export {
1435
- Wt as default
1443
+ Bt as default
1436
1444
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/viewshed",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Tool to simulate a \"viewer\" and their field of vision from a certain standpoint in the map. It allows the user to see which areas and buildings can or can't be seen from a specific standpoint, regarding different viewing distances, viewers' sizes and orientations.Th",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -48,18 +48,14 @@
48
48
  "prettier": "@vcsuite/eslint-config/prettier.js",
49
49
  "peerDependencies": {
50
50
  "@vcmap-cesium/engine": "^4.0.3",
51
- "@vcmap/core": "^5.1.0-rc.2",
52
- "@vcmap/ui": "^5.1.0-rc.1",
51
+ "@vcmap/core": "^5.1.0",
52
+ "@vcmap/ui": "^5.1.0",
53
53
  "ol": "^7.5.2",
54
54
  "vue": "~2.7.3",
55
55
  "vuetify": "~2.6.7"
56
56
  },
57
- "overrides": {
58
- "@vcmap/core": "^5.1.0-rc.2",
59
- "@vcmap/ui": "^5.1.0-rc.1"
60
- },
61
57
  "devDependencies": {
62
- "@vcmap/plugin-cli": "^2.1.16",
58
+ "@vcmap/plugin-cli": "^3.0.0",
63
59
  "@vcsuite/eslint-config": "^3.0.5",
64
60
  "@vitest/coverage-v8": "^0.34.6",
65
61
  "jest-canvas-mock": "^2.5.2",
@@ -3,6 +3,7 @@ import { Category, CesiumMap, VcsEvent } from '@vcmap/core';
3
3
  import {
4
4
  createListExportAction,
5
5
  createListImportAction,
6
+ createSupportedMapMappingFunction,
6
7
  downloadText,
7
8
  } from '@vcmap/ui';
8
9
  import { name } from '../package.json';
@@ -91,6 +92,14 @@ export async function createCategory(app) {
91
92
  },
92
93
  );
93
94
 
95
+ collectionComponent.addItemMapping({
96
+ mappingFunction: createSupportedMapMappingFunction(
97
+ [CesiumMap.className],
98
+ app.maps,
99
+ ),
100
+ owner: name,
101
+ });
102
+
94
103
  const itemMappingFunction = (item, c, listItem) => {
95
104
  listItem.title = item.properties.title;
96
105