@vcmap/viewshed 3.0.0 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v3.0.2
2
+
3
+ - fixes bug where the tool was active for unsupported maps
4
+
1
5
  # v3.0.0
2
6
 
3
7
  - updates @vcmap/core and @vcmap/ui to 6.x
@@ -9,7 +13,7 @@
9
13
 
10
14
  - fix link to help document
11
15
 
12
- # v2.0.8
16
+ # v2.0.9
13
17
 
14
18
  - add upload feedback
15
19
 
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var Oe = Object.defineProperty;
2
2
  var Ie = (i, t, o) => t in i ? Oe(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
3
3
  var de = (i, t, o) => Ie(i, typeof t != "symbol" ? t + "" : t, o);
4
- import { VcsCameraPrimitive as Pe, VcsObject as Ae, VcsEvent as Y, AbstractInteraction as Re, EventType as K, Projection as H, SessionType as Ne, CesiumMap as G, startEditFeaturesSession as De, startEditGeometrySession as xe, VectorLayer as ke, wgs84Projection as Le, maxZIndex as Fe, markVolatile as je, Viewpoint as We, TransformationMode as Be, Category as Ue, moduleIdSymbol as $e } from "../../../assets/core.js";
4
+ import { VcsCameraPrimitive as Pe, VcsObject as Ae, VcsEvent as Y, AbstractInteraction as Re, EventType as K, 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
5
  import { Color as Z, Matrix4 as He, Transforms as ze, Primitive as ce, GeometryInstance as ue, SphereGeometry as Ge, ColorGeometryInstanceAttribute as he, PerInstanceColorAppearance as fe, SphereOutlineGeometry as Ke, Math as k, Cartesian3 as W, ShadowMap as Ye, Camera as Xe, HeightReference as Je } from "../../../assets/cesium.js";
6
- import { shallowRef as te, ref as U, nextTick as Ze, inject as me, computed as ve, reactive as q, watchEffect as qe, watch as z, onMounted as Qe, onUnmounted as et, resolveComponent as b, openBlock as M, createElementBlock as B, createBlock as D, withCtx as f, createTextVNode as F, toDisplayString as A, createCommentVNode as $, createVNode as m, createElementVNode as tt, Fragment as pe, renderList as we, mergeProps as it } from "../../../assets/vue.js";
6
+ import { shallowRef as te, ref as U, nextTick as Ze, inject as me, computed as ve, reactive as q, watchEffect as qe, watch as G, onMounted as Qe, onUnmounted as et, resolveComponent as b, openBlock as M, createElementBlock as B, createBlock as D, withCtx as f, createTextVNode as F, toDisplayString as A, createCommentVNode as H, createVNode as m, createElementVNode as tt, Fragment as pe, renderList as we, mergeProps as it } from "../../../assets/vue.js";
7
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
8
  import { VcsTextField as rt, VcsSlider as lt, VcsLabel as _e, VcsFormSection as Ce, VcsSelect as Ee, VcsFormButton as dt, VcsFeatureTransforms as ct, VcsHelp as ut, makeEditorCollectionComponentClass as ht, WindowSlot as ft, ToolboxType as mt, createSupportedMapMappingFunction as vt, createListExportAction as pt, downloadText as wt, createListImportAction as gt, NotificationType as X, AbstractConfigEditor as _t } from "../../../assets/ui.js";
9
9
  import { VContainer as ye, VRow as Ve, VCol as be, VDivider as Ct, VColorPicker as Et } from "../../../assets/vuetify.js";
@@ -217,7 +217,7 @@ class Nt extends Pe {
217
217
  }
218
218
  }
219
219
  }
220
- const g = {
220
+ const p = {
221
221
  CONE: "cone",
222
222
  THREESIXTY: "360"
223
223
  };
@@ -266,7 +266,7 @@ const I = class I extends Ae {
266
266
  aspectRatio: ((n = t.frustumOptions) == null ? void 0 : n.aspectRatio) || I.getDefaultOptions().frustum.aspectRatio
267
267
  }, this._headingPitchRollValues = t.orientation || {
268
268
  ...I.getDefaultOptions().orientation
269
- }, this._position = t.position || I.getDefaultOptions().position, this._viewshedType = At(t.viewshedType, g), this._colors = {
269
+ }, this._position = t.position || I.getDefaultOptions().position, this._viewshedType = At(t.viewshedType, p), this._colors = {
270
270
  visibleColor: Z.fromCssColorString(
271
271
  ((d = t.colorOptions) == null ? void 0 : d.visibleColor) || I.getDefaultOptions().visibleColor
272
272
  ),
@@ -322,7 +322,7 @@ const I = class I extends Ae {
322
322
  * @param {number} value The distance in meters.
323
323
  */
324
324
  set distance(t) {
325
- this._frustumOptions.far = t > I.MIN_DISTANCE ? t : I.MIN_DISTANCE, this._shadowCamera && (this._shadowCamera.frustum.far = this._frustumOptions.far, this._viewshedType === g.THREESIXTY && this._updateShadowMap(), this._viewshedType === g.CONE && this._updatePrimitive());
325
+ this._frustumOptions.far = t > I.MIN_DISTANCE ? t : I.MIN_DISTANCE, this._shadowCamera && (this._shadowCamera.frustum.far = this._frustumOptions.far, this._viewshedType === p.THREESIXTY && this._updateShadowMap(), this._viewshedType === p.CONE && this._updatePrimitive());
326
326
  }
327
327
  /**
328
328
  * Returns the reach of the viewshed.
@@ -336,7 +336,7 @@ const I = class I extends Ae {
336
336
  * @param {number} value The field of view in degrees.
337
337
  */
338
338
  set fov(t) {
339
- this._frustumOptions.fov = t * k.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = t * k.RADIANS_PER_DEGREE, this._viewshedType === g.CONE && (this._updateShadowMap(), this._updatePrimitive()));
339
+ this._frustumOptions.fov = t * k.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = t * k.RADIANS_PER_DEGREE, this._viewshedType === p.CONE && (this._updateShadowMap(), this._updatePrimitive()));
340
340
  }
341
341
  /**
342
342
  * Returns the field of view.
@@ -356,7 +356,7 @@ const I = class I extends Ae {
356
356
  pitch: this._shadowCamera.pitch,
357
357
  roll: 0
358
358
  }
359
- }), this._viewshedType === g.CONE && this._updatePrimitive());
359
+ }), this._viewshedType === p.CONE && this._updatePrimitive());
360
360
  }
361
361
  /**
362
362
  * Getter for the heading of a cone viewshed.
@@ -372,7 +372,7 @@ const I = class I extends Ae {
372
372
  set pitch(t) {
373
373
  if (this._headingPitchRollValues.pitch = t * k.RADIANS_PER_DEGREE, this._shadowCamera) {
374
374
  const o = t * k.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
375
- this._shadowCamera.lookUp(o), this._viewshedType === g.CONE && this._updatePrimitive();
375
+ this._shadowCamera.lookUp(o), this._viewshedType === p.CONE && this._updatePrimitive();
376
376
  }
377
377
  }
378
378
  /**
@@ -441,7 +441,7 @@ const I = class I extends Ae {
441
441
  context: this._scene.context,
442
442
  lightCamera: this._shadowCamera,
443
443
  enabled: !0,
444
- isPointLight: this._viewshedType === g.THREESIXTY,
444
+ isPointLight: this._viewshedType === p.THREESIXTY,
445
445
  softShadows: !0,
446
446
  fromLightSource: !0,
447
447
  cascadesEnabled: !1,
@@ -458,7 +458,7 @@ const I = class I extends Ae {
458
458
  this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new Nt({
459
459
  camera: this._shadowCamera,
460
460
  allowPicking: !1,
461
- spot: this._viewshedType === g.CONE
461
+ spot: this._viewshedType === p.CONE
462
462
  }), this._scene.primitives.add(this._primitive)) : this._removePrimitive();
463
463
  }
464
464
  /**
@@ -469,7 +469,7 @@ const I = class I extends Ae {
469
469
  if (!this._shadowCamera)
470
470
  return;
471
471
  const o = W.fromDegrees(t[0], t[1], t[2]);
472
- if (this.distance = W.distance(this._shadowCamera.position, o), this.type === g.CONE && !o.equals(this._shadowCamera.position)) {
472
+ if (this.distance = W.distance(this._shadowCamera.position, o), this.type === p.CONE && !o.equals(this._shadowCamera.position)) {
473
473
  const e = new W();
474
474
  W.subtract(o, this._shadowCamera.position, o), W.normalize(o, o), W.normalize(this._shadowCamera.position, e), this._shadowCamera.setView({
475
475
  orientation: {
@@ -525,7 +525,7 @@ class xt extends Re {
525
525
  return this._positioned;
526
526
  }
527
527
  async pipe(t) {
528
- return t.position && (this._position ? (this._viewshed.lookAt(H.mercatorToWgs84(t.position)), t.type & K.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = H.mercatorToWgs84(t.position), t.type & K.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), t;
528
+ return t.position && (this._position ? (this._viewshed.lookAt(z.mercatorToWgs84(t.position)), t.type & K.CLICK && (this.setActive(!1), this._finished.raiseEvent(null))) : (this._viewshed.position = z.mercatorToWgs84(t.position), t.type & K.CLICK && (this._position = !0, this._positioned.raiseEvent(null)))), t;
529
529
  }
530
530
  destroy() {
531
531
  super.destroy(), this._finished.destroy(), this._positioned.destroy();
@@ -574,13 +574,13 @@ function Lt(i, t, o) {
574
574
  function h(a = !0) {
575
575
  C(), l(), u(), e.value = null, a && o.clearSelection(), s.value = null, n.value = null;
576
576
  }
577
- function p(a) {
578
- C(), u(), i.maps.activeMap instanceof G && (e.value = a, a.activate(i.maps.activeMap), C = i.maps.activeMap.shadowMapChanged.addEventListener((r) => {
577
+ function w(a) {
578
+ C(), u(), i.maps.activeMap instanceof $ && (e.value = a, a.activate(i.maps.activeMap), C = i.maps.activeMap.shadowMapChanged.addEventListener((r) => {
579
579
  var _;
580
580
  r !== ((_ = e.value) == null ? void 0 : _.shadowMap) && h(!1);
581
581
  }));
582
582
  }
583
- async function w(a) {
583
+ async function g(a) {
584
584
  h(), await Ze();
585
585
  const { eventHandler: r } = i.maps, { featureInteraction: _ } = r, v = new x({
586
586
  viewshedType: a,
@@ -590,7 +590,7 @@ function Lt(i, t, o) {
590
590
  },
591
591
  heightOffset: d.value === P.ABSOLUTE ? 0 : ge
592
592
  });
593
- p(v);
593
+ w(v);
594
594
  const E = new xt(e.value);
595
595
  E.finished.addEventListener(() => {
596
596
  l(), e.value ? (e.value.showPrimitive = !0, n.value = y.EDIT) : h();
@@ -621,7 +621,7 @@ function Lt(i, t, o) {
621
621
  l();
622
622
  });
623
623
  const T = (r = v.getGeometry()) == null ? void 0 : r.on("change", () => {
624
- e.value ? e.value.position = H.mercatorToWgs84(
624
+ e.value ? e.value.position = z.mercatorToWgs84(
625
625
  /** @type {import("ol/geom").Point} */
626
626
  v.getGeometry().getCoordinates()
627
627
  ) : h();
@@ -635,7 +635,7 @@ function Lt(i, t, o) {
635
635
  l();
636
636
  }
637
637
  function N(a, r) {
638
- l(), e.value !== r && (p(r), d.value = r.heightOffset ? P.RELATIVE : P.ABSOLUTE), s.value = !!r.properties.title, n.value = a, s.value && o.setVisibility(r.name, !0);
638
+ l(), e.value !== r && (w(r), d.value = r.heightOffset ? P.RELATIVE : P.ABSOLUTE), s.value = !!r.properties.title, n.value = a, s.value && o.setVisibility(r.name, !0);
639
639
  }
640
640
  const S = [
641
641
  o.collectionComponent.collection.removed.addEventListener(
@@ -666,8 +666,8 @@ function Lt(i, t, o) {
666
666
  ), e.value.heightOffset = a === P.ABSOLUTE ? 0 : ge;
667
667
  else if (n.value === y.EDIT) {
668
668
  const { position: r, heightOffset: _ } = e.value;
669
- a === P.RELATIVE ? i.maps.activeMap.getHeightFromTerrain([H.wgs84ToMercator(r)]).then((v) => {
670
- const E = H.mercatorToWgs84(v[0]);
669
+ a === P.RELATIVE ? i.maps.activeMap.getHeightFromTerrain([z.wgs84ToMercator(r)]).then((v) => {
670
+ const E = z.mercatorToWgs84(v[0]);
671
671
  e.value && (e.value.heightOffset = r[2] - E[2], e.value.position = E);
672
672
  }) : (e.value.position = [
673
673
  r[0],
@@ -681,7 +681,7 @@ function Lt(i, t, o) {
681
681
  currentViewshed: e,
682
682
  currentIsPersisted: s,
683
683
  currentEditSession: c,
684
- createViewshed: w,
684
+ createViewshed: g,
685
685
  viewViewshed(a) {
686
686
  N(y.VIEW, a);
687
687
  },
@@ -700,9 +700,9 @@ function Lt(i, t, o) {
700
700
  changeHeightMode: L,
701
701
  async placeCurrentFeaturesOnTerrain() {
702
702
  var a, r;
703
- if (e.value && ((a = c.value) == null ? void 0 : a.type) === Ne.EDIT_FEATURES && i.maps.activeMap instanceof G) {
703
+ if (e.value && ((a = c.value) == null ? void 0 : a.type) === Ne.EDIT_FEATURES && i.maps.activeMap instanceof $) {
704
704
  const v = (await i.maps.activeMap.getHeightFromTerrain([
705
- H.wgs84ToMercator((r = e.value) == null ? void 0 : r.position)
705
+ z.wgs84ToMercator((r = e.value) == null ? void 0 : r.position)
706
706
  ]))[0][2] - e.value.position[2];
707
707
  c.value.translate(0, 0, v);
708
708
  }
@@ -776,9 +776,9 @@ const Se = (i, t) => {
776
776
  Y: void 0,
777
777
  Z: void 0
778
778
  }), h = te();
779
- let p = () => {
779
+ let w = () => {
780
780
  };
781
- const w = q({
781
+ const g = q({
782
782
  showPrimitive: !1,
783
783
  distance: void 0,
784
784
  fov: void 0,
@@ -789,15 +789,15 @@ const Se = (i, t) => {
789
789
  e.value && (u.X = e.value.position[0], u.Y = e.value.position[1], u.Z = t.heightMode.value === P.ABSOLUTE ? e.value.position[2] : e.value.heightOffset);
790
790
  }
791
791
  function S() {
792
- N(), e.value && (w.distance = e.value.distance, w.fov = e.value.fov, w.heading = e.value.heading, w.pitch = e.value.pitch, w.showPrimitive = e.value.showPrimitive, V.value = e.value.type);
792
+ N(), e.value && (g.distance = e.value.distance, g.fov = e.value.fov, g.heading = e.value.heading, g.pitch = e.value.pitch, g.showPrimitive = e.value.showPrimitive, V.value = e.value.type);
793
793
  }
794
794
  qe(() => {
795
795
  e.value && s.value !== y.CREATE && S();
796
- }), z(
796
+ }), G(
797
797
  e,
798
798
  () => {
799
799
  e.value && (C(), C = e.value.positionChanged.addEventListener(() => {
800
- N(), p();
800
+ N(), w();
801
801
  }));
802
802
  },
803
803
  { immediate: !0 }
@@ -809,11 +809,11 @@ const Se = (i, t) => {
809
809
  /** @type {import("@vcmap/core").CesiumMap} */
810
810
  (O = o.maps.activeMap.getScene()) == null ? void 0 : O.camera
811
811
  ), E = v == null ? void 0 : v.changed.addEventListener(() => {
812
- p();
812
+ w();
813
813
  });
814
- p = () => {
814
+ w = () => {
815
815
  var le;
816
- E == null || E(), h.value = null, (le = e.value) == null || le.activate(o.maps.activeMap), p = () => {
816
+ E == null || E(), h.value = null, (le = e.value) == null || le.activate(o.maps.activeMap), w = () => {
817
817
  };
818
818
  };
819
819
  }
@@ -826,17 +826,17 @@ const Se = (i, t) => {
826
826
  }
827
827
  );
828
828
  }), et(() => {
829
- C(), p(), l(), n.value || ((s.value === y.EDIT || s.value === y.MOVE) && e.value ? t.viewViewshed(e.value) : s.value === y.CREATE && t.stop()), c.value && (c.value.length > 1 ? t.setupMultiSelect() : c.value.length === 1 && e.value ? t.viewViewshed(e.value) : (
829
+ C(), w(), l(), n.value || ((s.value === y.EDIT || s.value === y.MOVE) && e.value ? t.viewViewshed(e.value) : s.value === y.CREATE && t.stop()), c.value && (c.value.length > 1 ? t.setupMultiSelect() : c.value.length === 1 && e.value ? t.viewViewshed(e.value) : (
830
830
  // when a persited viewshed is deselected, stops plugin
831
831
  !c.value.length && s.value === y.EDIT && t.stop(!1)
832
832
  ));
833
833
  }), S();
834
834
  function a(v, E) {
835
- p(), e.value && (w[v] = E, e.value[v] = E);
835
+ w(), e.value && (g[v] = E, e.value[v] = E);
836
836
  }
837
837
  const r = ve(() => {
838
838
  const v = [];
839
- return V.value === g.CONE && v.push({
839
+ return V.value === p.CONE && v.push({
840
840
  name: "jumpToViewpoint",
841
841
  title: h.value ? "viewshed.returnToViewpoint" : "viewshed.jumpToViewpoint",
842
842
  icon: "mdi-human-male",
@@ -857,7 +857,7 @@ const Se = (i, t) => {
857
857
  animate: !0
858
858
  // if not animate, async does not work and the cameraChanged listener is triggered immediately. alternatively set timeout
859
859
  })
860
- )), L()) : h.value && ((O = o.maps.activeMap) == null || O.gotoViewpoint(h.value), p());
860
+ )), L()) : h.value && ((O = o.maps.activeMap) == null || O.gotoViewpoint(h.value), w());
861
861
  }
862
862
  }), v.push({
863
863
  name: "moveViewshed",
@@ -873,7 +873,7 @@ const Se = (i, t) => {
873
873
  name: "showPrimitive",
874
874
  title: "viewshed.showPrimitive",
875
875
  icon: "mdi-eye",
876
- active: w.showPrimitive,
876
+ active: g.showPrimitive,
877
877
  callback() {
878
878
  this.active = !this.active, a("showPrimitive", this.active);
879
879
  }
@@ -882,7 +882,7 @@ const Se = (i, t) => {
882
882
  return {
883
883
  position: u,
884
884
  setPosition(v, E, T) {
885
- if (p(), !!e.value) {
885
+ if (w(), !!e.value) {
886
886
  if (T === 2 && t.heightMode.value === P.RELATIVE)
887
887
  e.value.heightOffset = Number(v);
888
888
  else {
@@ -892,14 +892,14 @@ const Se = (i, t) => {
892
892
  u[E] = Number(v);
893
893
  }
894
894
  },
895
- parameters: w,
895
+ parameters: g,
896
896
  setParameter: a,
897
897
  parameterRanges: Ft,
898
898
  ViewshedPluginModes: y,
899
899
  viewshedMode: s,
900
900
  currentIsPersisted: n,
901
901
  viewshedType: V,
902
- ViewshedTypes: g,
902
+ ViewshedTypes: p,
903
903
  HeightModes: P,
904
904
  heightMode: t.heightMode,
905
905
  TransformationMode: Be,
@@ -920,7 +920,7 @@ const Se = (i, t) => {
920
920
  class: "d-flex w-full justify-end px-2 pt-2 pb-1"
921
921
  };
922
922
  function Gt(i, t, o, e, s, n) {
923
- const d = b("VcsHelp"), l = b("v-row"), c = b("VcsFeatureTransforms"), C = b("VcsTextField"), u = b("v-col"), h = b("v-container"), p = b("VcsFormSection"), w = b("v-divider"), V = b("VcsLabel"), N = b("VcsSelect"), S = b("VcsSlider"), L = b("VcsFormButton");
923
+ const d = b("VcsHelp"), l = b("v-row"), c = b("VcsFeatureTransforms"), C = b("VcsTextField"), u = b("v-col"), h = b("v-container"), w = b("VcsFormSection"), g = b("v-divider"), V = b("VcsLabel"), N = b("VcsSelect"), S = b("VcsSlider"), L = b("VcsFormButton");
924
924
  return M(), B("div", null, [
925
925
  e.viewshedMode === e.ViewshedPluginModes.CREATE ? (M(), B("div", Wt, [
926
926
  e.viewshedType === e.ViewshedTypes.CONE ? (M(), D(d, { key: 0 }, {
@@ -943,8 +943,8 @@ function Gt(i, t, o, e, s, n) {
943
943
  ]),
944
944
  _: 1
945
945
  /* STABLE */
946
- })) : $("v-if", !0)
947
- ])) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (M(), D(p, {
946
+ })) : H("v-if", !0)
947
+ ])) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (M(), D(w, {
948
948
  key: 1,
949
949
  "header-actions": e.headerActions,
950
950
  heading: "viewshed.viewpoint",
@@ -1028,8 +1028,8 @@ function Gt(i, t, o, e, s, n) {
1028
1028
  ]),
1029
1029
  _: 1
1030
1030
  /* STABLE */
1031
- }, 8, ["header-actions"])) : $("v-if", !0),
1032
- m(w),
1031
+ }, 8, ["header-actions"])) : H("v-if", !0),
1032
+ m(g),
1033
1033
  m(h, { class: "px-1 py-0" }, {
1034
1034
  default: f(() => [
1035
1035
  m(l, { "no-gutters": "" }, {
@@ -1201,7 +1201,7 @@ function Gt(i, t, o, e, s, n) {
1201
1201
  },
1202
1202
  1024
1203
1203
  /* DYNAMIC_SLOTS */
1204
- )) : $("v-if", !0)
1204
+ )) : H("v-if", !0)
1205
1205
  ]),
1206
1206
  _: 2
1207
1207
  /* DYNAMIC */
@@ -1215,8 +1215,8 @@ function Gt(i, t, o, e, s, n) {
1215
1215
  ]),
1216
1216
  _: 1
1217
1217
  /* STABLE */
1218
- })) : $("v-if", !0),
1219
- m(w),
1218
+ })) : H("v-if", !0),
1219
+ m(g),
1220
1220
  e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (M(), B("div", Ht, [
1221
1221
  m(L, {
1222
1222
  onClick: t[0] || (t[0] = (a) => e.addToMyWorkspace()),
@@ -1253,12 +1253,12 @@ function Gt(i, t, o, e, s, n) {
1253
1253
  _: 1
1254
1254
  /* STABLE */
1255
1255
  })
1256
- ])) : $("v-if", !0)
1256
+ ])) : H("v-if", !0)
1257
1257
  ]);
1258
1258
  }
1259
- const Kt = /* @__PURE__ */ Se(jt, [["render", Gt]]), j = "@vcmap/viewshed", Yt = "3.0.0", Xt = "^6.0", se = {
1260
- [g.CONE]: "$vcsViewshed",
1261
- [g.THREESIXTY]: "$vcsViewshedCone"
1259
+ const Kt = /* @__PURE__ */ Se(jt, [["render", Gt]]), j = "@vcmap/viewshed", Yt = "3.0.2", Xt = "^6.0", se = {
1260
+ [p.CONE]: "$vcsViewshed",
1261
+ [p.THREESIXTY]: "$vcsViewshedCone"
1262
1262
  };
1263
1263
  function Jt(i, t, o) {
1264
1264
  const e = U(), s = U(), n = `${o.id}-editor`, d = {
@@ -1274,19 +1274,16 @@ function Jt(i, t, o) {
1274
1274
  }
1275
1275
  };
1276
1276
  ht(t, o, {
1277
- editor: (p) => ({
1277
+ editor: (w) => ({
1278
1278
  ...d,
1279
1279
  props: {
1280
1280
  selection: o.selection,
1281
- getViewshed: () => o.collection.getByKey(p.name)
1281
+ getViewshed: () => o.collection.getByKey(w.name)
1282
1282
  }
1283
1283
  })
1284
1284
  });
1285
1285
  function l() {
1286
- i.currentViewshed.value && (s.value = se[i.currentViewshed.value.type], i.currentIsPersisted.value ? e.value = i.currentViewshed.value.properties.title : i.mode.value === y.CREATE ? e.value = [
1287
- "viewshed.create",
1288
- `viewshed.${i.currentViewshed.value.type}`
1289
- ] : e.value = [
1286
+ i.currentViewshed.value && (s.value = se[i.currentViewshed.value.type], i.currentIsPersisted.value ? e.value = i.currentViewshed.value.properties.title : i.mode.value === y.CREATE ? e.value = `viewshed.create.${i.currentViewshed.value.type}` : e.value = [
1290
1287
  "viewshed.temporary",
1291
1288
  `viewshed.${i.currentViewshed.value.type}`
1292
1289
  ]);
@@ -1302,11 +1299,11 @@ function Jt(i, t, o) {
1302
1299
  j
1303
1300
  ));
1304
1301
  }
1305
- const C = z(i.currentViewshed, (p) => {
1306
- p && c();
1307
- }), u = z(i.currentIsPersisted, (p) => {
1308
- p && l();
1309
- }), h = z(i.mode, () => {
1302
+ const C = G(i.currentViewshed, (w) => {
1303
+ w && c();
1304
+ }), u = G(i.currentIsPersisted, (w) => {
1305
+ w && l();
1306
+ }), h = G(i.mode, () => {
1310
1307
  i.mode.value ? c() : t.windowManager.remove(n);
1311
1308
  });
1312
1309
  return {
@@ -1323,7 +1320,7 @@ function Zt(i, t, o, e) {
1323
1320
  currentIndex: 0,
1324
1321
  active: !1,
1325
1322
  background: !1,
1326
- disabled: !1,
1323
+ disabled: !(i.maps.activeMap instanceof $),
1327
1324
  callback() {
1328
1325
  if (this.active)
1329
1326
  this.background && t.currentViewshed.value ? t.editViewshed(t.currentViewshed.value) : t.stop();
@@ -1337,19 +1334,19 @@ function Zt(i, t, o, e) {
1337
1334
  const C = this.tools[this.currentIndex].name;
1338
1335
  t.createViewshed(C);
1339
1336
  },
1340
- tools: e.flatMap((c) => c === g.CONE ? {
1341
- name: g.CONE,
1342
- icon: se[g.CONE],
1343
- title: `viewshed.${g.CONE}`
1344
- } : c === g.THREESIXTY ? {
1345
- name: g.THREESIXTY,
1346
- icon: se[g.THREESIXTY],
1347
- title: `viewshed.${g.THREESIXTY}`
1337
+ tools: e.flatMap((c) => c === p.CONE ? {
1338
+ name: p.CONE,
1339
+ icon: se[p.CONE],
1340
+ title: `viewshed.create.${p.CONE}`
1341
+ } : c === p.THREESIXTY ? {
1342
+ name: p.THREESIXTY,
1343
+ icon: se[p.THREESIXTY],
1344
+ title: `viewshed.create.${p.THREESIXTY}`
1348
1345
  } : [])
1349
1346
  })
1350
- }, n = z(t.mode, (c) => {
1347
+ }, n = G(t.mode, (c) => {
1351
1348
  c === y.VIEW ? (s.action.background = !0, s.action.active = !0) : c ? (s.action.background = !1, s.action.active = !0) : (s.action.background = !1, s.action.active = !1);
1352
- }), d = z(
1349
+ }), d = G(
1353
1350
  t.currentViewshed,
1354
1351
  (c) => {
1355
1352
  c && (s.action.currentIndex = s.action.tools.findIndex(
@@ -1357,7 +1354,7 @@ function Zt(i, t, o, e) {
1357
1354
  ));
1358
1355
  }
1359
1356
  ), l = i.maps.mapActivated.addEventListener((c) => {
1360
- c instanceof G ? s.action.disabled = !1 : s.action.disabled = !0;
1357
+ c instanceof $ ? s.action.disabled = !1 : s.action.disabled = !0;
1361
1358
  });
1362
1359
  return {
1363
1360
  destroy() {
@@ -1367,7 +1364,7 @@ function Zt(i, t, o, e) {
1367
1364
  };
1368
1365
  }
1369
1366
  function qt(i, t, o, e) {
1370
- re(e, [Pt(g)]);
1367
+ re(e, [Pt(p)]);
1371
1368
  const { toolbox: s, destroy: n } = Zt(i, t, o, e), d = i.toolboxManager.add(s, o).id;
1372
1369
  return () => {
1373
1370
  i.toolboxManager.remove(d), n();
@@ -1381,7 +1378,7 @@ class ne extends Ue {
1381
1378
  var e;
1382
1379
  if (
1383
1380
  /** @type {import("@vcmap/core").CesiumMap | undefined} */
1384
- (e = this._app) == null ? void 0 : e.maps.getByType(G.className)[0]
1381
+ (e = this._app) == null ? void 0 : e.maps.getByType($.className)[0]
1385
1382
  )
1386
1383
  return new x(t);
1387
1384
  throw new Error("No CesiumMap available");
@@ -1413,15 +1410,15 @@ async function ei(i) {
1413
1410
  );
1414
1411
  e.addItemMapping({
1415
1412
  mappingFunction: vt(
1416
- [G.className],
1413
+ [$.className],
1417
1414
  i.maps
1418
1415
  ),
1419
1416
  owner: j
1420
1417
  });
1421
- const n = (u, h, p) => {
1422
- p.title = u.properties.title, p.titleChanged = (w) => {
1423
- u.properties.title = w, p.title = w, t.raiseEvent({ item: u, title: w });
1424
- }, p.actions.push(
1418
+ const n = (u, h, w) => {
1419
+ w.title = u.properties.title, w.titleChanged = (g) => {
1420
+ u.properties.title = g, w.title = g, t.raiseEvent({ item: u, title: g });
1421
+ }, w.actions.push(
1425
1422
  q({
1426
1423
  name: "visibilityAction",
1427
1424
  icon: "$vcsCheckbox",
@@ -1448,7 +1445,7 @@ async function ei(i) {
1448
1445
  j
1449
1446
  ), { action: c, destroy: C } = gt(
1450
1447
  async (u) => {
1451
- const { vueI18n: h } = i, w = (await Promise.all(
1448
+ const { vueI18n: h } = i, g = (await Promise.all(
1452
1449
  u.map(async (S) => {
1453
1450
  const L = await S.text();
1454
1451
  try {
@@ -1463,7 +1460,7 @@ async function ei(i) {
1463
1460
  }
1464
1461
  return [];
1465
1462
  })
1466
- )).flat(), V = w.map((S) => s.collection.add(S)).filter((S) => S != null), N = w.length - V.length;
1463
+ )).flat(), V = g.map((S) => s.collection.add(S)).filter((S) => S != null), N = g.length - V.length;
1467
1464
  if (N > 0)
1468
1465
  return i.notifier.add({
1469
1466
  type: X.WARNING,
@@ -1497,14 +1494,14 @@ async function ei(i) {
1497
1494
  e.selection.value.length && (e.selection.value = []);
1498
1495
  },
1499
1496
  setVisibility(u, h) {
1500
- const p = e.items.value.find(
1501
- (w) => u === w.name
1497
+ const w = e.items.value.find(
1498
+ (g) => u === g.name
1502
1499
  );
1503
- if (p) {
1504
- const w = p.actions.find(
1500
+ if (w) {
1501
+ const g = w.actions.find(
1505
1502
  (V) => V.name === "visibilityAction"
1506
1503
  );
1507
- w && (w.icon = h ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1504
+ g && (g.icon = h ? "$vcsCheckboxChecked" : "$vcsCheckbox");
1508
1505
  }
1509
1506
  },
1510
1507
  add(u) {
@@ -1530,7 +1527,7 @@ function J() {
1530
1527
  return {
1531
1528
  visibleColor: x.getDefaultOptions().visibleColor,
1532
1529
  shadowColor: x.getDefaultOptions().shadowColor,
1533
- tools: [...Object.values(g)]
1530
+ tools: [...Object.values(p)]
1534
1531
  };
1535
1532
  }
1536
1533
  const ti = {
@@ -1562,9 +1559,9 @@ const ti = {
1562
1559
  }
1563
1560
  return {
1564
1561
  localConfig: o,
1565
- ViewshedTypes: g,
1562
+ ViewshedTypes: p,
1566
1563
  apply: e,
1567
- toolItems: Object.values(g).map((s) => ({
1564
+ toolItems: Object.values(p).map((s) => ({
1568
1565
  value: s,
1569
1566
  title: `viewshed.${s}`
1570
1567
  }))
@@ -1572,10 +1569,10 @@ const ti = {
1572
1569
  }
1573
1570
  };
1574
1571
  function ii(i, t, o, e, s, n) {
1575
- const d = b("VcsLabel"), l = b("v-col"), c = b("VcsSelect"), C = b("v-row"), u = b("VColorPicker"), h = b("v-container"), p = b("VcsFormSection"), w = b("AbstractConfigEditor");
1576
- return M(), D(w, it({ onSubmit: e.apply }, { ...i.$attrs, ...i.$props }), {
1572
+ const d = b("VcsLabel"), l = b("v-col"), c = b("VcsSelect"), C = b("v-row"), u = b("VColorPicker"), h = b("v-container"), w = b("VcsFormSection"), g = b("AbstractConfigEditor");
1573
+ return M(), D(g, it({ onSubmit: e.apply }, { ...i.$attrs, ...i.$props }), {
1577
1574
  default: f(() => [
1578
- e.localConfig ? (M(), D(p, {
1575
+ e.localConfig ? (M(), D(w, {
1579
1576
  key: 0,
1580
1577
  heading: "viewshed.editor.general"
1581
1578
  }, {
@@ -1693,7 +1690,7 @@ function ii(i, t, o, e, s, n) {
1693
1690
  ]),
1694
1691
  _: 1
1695
1692
  /* STABLE */
1696
- })) : $("v-if", !0)
1693
+ })) : H("v-if", !0)
1697
1694
  ]),
1698
1695
  _: 1
1699
1696
  /* STABLE */
@@ -1740,8 +1737,8 @@ function ui(i) {
1740
1737
  s,
1741
1738
  d.collectionComponent
1742
1739
  ), { activeMap: C } = s.maps;
1743
- function u(w) {
1744
- if (n != null && n.m && n.cv && w instanceof G) {
1740
+ function u(g) {
1741
+ if (n != null && n.m && n.cv && g instanceof $) {
1745
1742
  n.cv.properties.title && delete n.cv.properties.title;
1746
1743
  const V = new x(n.cv);
1747
1744
  n.m === y.VIEW ? t.viewViewshed(V) : t.editViewshed(V);
@@ -1749,13 +1746,13 @@ function ui(i) {
1749
1746
  }
1750
1747
  let h = !1;
1751
1748
  C && (h = !0, u(C));
1752
- const p = s.maps.mapActivated.addEventListener(
1753
- (w) => {
1754
- t.stop(), h || (u(w), h = !0);
1749
+ const w = s.maps.mapActivated.addEventListener(
1750
+ (g) => {
1751
+ t.stop(), h || (u(g), h = !0);
1755
1752
  }
1756
1753
  );
1757
1754
  e = () => {
1758
- p(), l(), c(), d.destroy(), t.destroy();
1755
+ w(), l(), c(), d.destroy(), t.destroy();
1759
1756
  };
1760
1757
  },
1761
1758
  /**
@@ -1790,7 +1787,8 @@ function ui(i) {
1790
1787
  component: oi,
1791
1788
  title: "viewshed.editor.title",
1792
1789
  infoUrlCallback: o == null ? void 0 : o.getHelpUrlCallback(
1793
- "/components/plugins/viewshedToolConfig.html"
1790
+ "/components/plugins/viewshedToolConfig.html",
1791
+ "app-configurator"
1794
1792
  )
1795
1793
  }
1796
1794
  ];
@@ -1812,9 +1810,12 @@ function ui(i) {
1812
1810
  absolute: "Absolute",
1813
1811
  new: "New",
1814
1812
  cancel: "Cancel",
1815
- [g.CONE]: "Cone viewshed analysis",
1816
- [g.THREESIXTY]: "360° viewshed analysis",
1817
- create: "Create",
1813
+ [p.CONE]: "Cone viewshed analysis",
1814
+ [p.THREESIXTY]: "360° viewshed analysis",
1815
+ create: {
1816
+ [p.CONE]: "Create cone viewshed analysis",
1817
+ [p.THREESIXTY]: "Create 360° viewshed analysis"
1818
+ },
1818
1819
  addToMyWorkspace: "Add to My Workspace",
1819
1820
  temporary: "Temporary",
1820
1821
  jumpToViewpoint: "Jump to viewpoint",
@@ -1847,9 +1848,12 @@ function ui(i) {
1847
1848
  absolute: "Absolut",
1848
1849
  new: "Neu",
1849
1850
  cancel: "Abbrechen",
1850
- [g.CONE]: "Sichtkegelanalyse",
1851
- [g.THREESIXTY]: "360° Sichtsanalyse",
1852
- create: "Erzeuge",
1851
+ [p.CONE]: "Sichtkegelanalyse",
1852
+ [p.THREESIXTY]: "360° Sichtsanalyse",
1853
+ create: {
1854
+ [p.CONE]: "Sichtkegelanalyse erstellen",
1855
+ [p.THREESIXTY]: "360° Sichtanalyse erstellen"
1856
+ },
1853
1857
  addToMyWorkspace: "Zu Mein Arbeitsbereich hinzufügen",
1854
1858
  temporary: "Temporäre",
1855
1859
  jumpToViewpoint: "Zu Standpunkt springen",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/viewshed",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
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",
@@ -49,19 +49,19 @@
49
49
  "peerDependencies": {
50
50
  "@vcmap-cesium/engine": "^11.0.2",
51
51
  "@vcmap/core": "^6.0.0",
52
- "@vcmap/ui": "^6.0.1",
52
+ "@vcmap/ui": "^6.0.2",
53
53
  "ol": "^10.2.1",
54
54
  "vue": "~3.4.38",
55
55
  "vuetify": "^3.7.3"
56
56
  },
57
57
  "devDependencies": {
58
- "@vcmap/plugin-cli": "^4.0.0",
58
+ "@vcmap/plugin-cli": "^4.0.1",
59
59
  "@vcsuite/eslint-config": "^3.0.8",
60
- "@vitest/coverage-v8": "^2.0.1",
60
+ "@vitest/coverage-v8": "^2.1.3",
61
61
  "jest-canvas-mock": "^2.5.2",
62
62
  "jsdom": "^22.1.0",
63
63
  "resize-observer-polyfill": "^1.5.1",
64
- "vitest": "^2.0.1"
64
+ "vitest": "^2.1.3"
65
65
  },
66
66
  "dependencies": {
67
67
  "@vcsuite/check": "^2.1.0",
package/src/index.js CHANGED
@@ -166,6 +166,7 @@ export default function plugin(config) {
166
166
  title: 'viewshed.editor.title',
167
167
  infoUrlCallback: app?.getHelpUrlCallback(
168
168
  '/components/plugins/viewshedToolConfig.html',
169
+ 'app-configurator',
169
170
  ),
170
171
  },
171
172
  ];
@@ -189,7 +190,10 @@ export default function plugin(config) {
189
190
  cancel: 'Cancel',
190
191
  [ViewshedTypes.CONE]: 'Cone viewshed analysis',
191
192
  [ViewshedTypes.THREESIXTY]: '360° viewshed analysis',
192
- create: 'Create',
193
+ create: {
194
+ [ViewshedTypes.CONE]: 'Create cone viewshed analysis',
195
+ [ViewshedTypes.THREESIXTY]: 'Create 360° viewshed analysis',
196
+ },
193
197
  addToMyWorkspace: 'Add to My Workspace',
194
198
  temporary: 'Temporary',
195
199
  jumpToViewpoint: 'Jump to viewpoint',
@@ -226,7 +230,10 @@ export default function plugin(config) {
226
230
  cancel: 'Abbrechen',
227
231
  [ViewshedTypes.CONE]: 'Sichtkegelanalyse',
228
232
  [ViewshedTypes.THREESIXTY]: '360° Sichtsanalyse',
229
- create: 'Erzeuge',
233
+ create: {
234
+ [ViewshedTypes.CONE]: 'Sichtkegelanalyse erstellen',
235
+ [ViewshedTypes.THREESIXTY]: '360° Sichtanalyse erstellen',
236
+ },
230
237
  addToMyWorkspace: 'Zu Mein Arbeitsbereich hinzufügen',
231
238
  temporary: 'Temporäre',
232
239
  jumpToViewpoint: 'Zu Standpunkt springen',
@@ -28,7 +28,7 @@ function createViewshedToolbox(app, manager, name, tools) {
28
28
  currentIndex: 0,
29
29
  active: false,
30
30
  background: false,
31
- disabled: false,
31
+ disabled: !(app.maps.activeMap instanceof CesiumMap),
32
32
  callback() {
33
33
  if (this.active) {
34
34
  if (this.background && manager.currentViewshed.value) {
@@ -53,13 +53,13 @@ function createViewshedToolbox(app, manager, name, tools) {
53
53
  return {
54
54
  name: ViewshedTypes.CONE,
55
55
  icon: ViewshedIcons[ViewshedTypes.CONE],
56
- title: `viewshed.${ViewshedTypes.CONE}`,
56
+ title: `viewshed.create.${ViewshedTypes.CONE}`,
57
57
  };
58
58
  } else if (tool === ViewshedTypes.THREESIXTY) {
59
59
  return {
60
60
  name: ViewshedTypes.THREESIXTY,
61
61
  icon: ViewshedIcons[ViewshedTypes.THREESIXTY],
62
- title: `viewshed.${ViewshedTypes.THREESIXTY}`,
62
+ title: `viewshed.create.${ViewshedTypes.THREESIXTY}`,
63
63
  };
64
64
  } else {
65
65
  return [];
@@ -61,10 +61,7 @@ export function setupViewshedWindow(manager, app, collectionComponent) {
61
61
  if (manager.currentIsPersisted.value) {
62
62
  headerTitle.value = manager.currentViewshed.value.properties.title;
63
63
  } else if (manager.mode.value === ViewshedPluginModes.CREATE) {
64
- headerTitle.value = [
65
- 'viewshed.create',
66
- `viewshed.${manager.currentViewshed.value.type}`,
67
- ];
64
+ headerTitle.value = `viewshed.create.${manager.currentViewshed.value.type}`;
68
65
  } else {
69
66
  headerTitle.value = [
70
67
  'viewshed.temporary',