@vcmap/viewshed 3.0.1 → 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";
@@ -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();
@@ -575,7 +575,7 @@ function Lt(i, t, o) {
575
575
  C(), l(), u(), e.value = null, a && o.clearSelection(), s.value = null, n.value = null;
576
576
  }
577
577
  function w(a) {
578
- C(), u(), i.maps.activeMap instanceof G && (e.value = a, a.activate(i.maps.activeMap), C = i.maps.activeMap.shadowMapChanged.addEventListener((r) => {
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
  }));
@@ -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();
@@ -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],
@@ -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
  }
@@ -793,7 +793,7 @@ const Se = (i, t) => {
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(() => {
@@ -943,7 +943,7 @@ function Gt(i, t, o, e, s, n) {
943
943
  ]),
944
944
  _: 1
945
945
  /* STABLE */
946
- })) : $("v-if", !0)
946
+ })) : H("v-if", !0)
947
947
  ])) : e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (M(), D(w, {
948
948
  key: 1,
949
949
  "header-actions": e.headerActions,
@@ -1028,7 +1028,7 @@ function Gt(i, t, o, e, s, n) {
1028
1028
  ]),
1029
1029
  _: 1
1030
1030
  /* STABLE */
1031
- }, 8, ["header-actions"])) : $("v-if", !0),
1031
+ }, 8, ["header-actions"])) : H("v-if", !0),
1032
1032
  m(g),
1033
1033
  m(h, { class: "px-1 py-0" }, {
1034
1034
  default: f(() => [
@@ -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,7 +1215,7 @@ function Gt(i, t, o, e, s, n) {
1215
1215
  ]),
1216
1216
  _: 1
1217
1217
  /* STABLE */
1218
- })) : $("v-if", !0),
1218
+ })) : H("v-if", !0),
1219
1219
  m(g),
1220
1220
  e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (M(), B("div", Ht, [
1221
1221
  m(L, {
@@ -1253,10 +1253,10 @@ 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.1", Xt = "^6.0", se = {
1259
+ const Kt = /* @__PURE__ */ Se(jt, [["render", Gt]]), j = "@vcmap/viewshed", Yt = "3.0.2", Xt = "^6.0", se = {
1260
1260
  [p.CONE]: "$vcsViewshed",
1261
1261
  [p.THREESIXTY]: "$vcsViewshedCone"
1262
1262
  };
@@ -1299,11 +1299,11 @@ function Jt(i, t, o) {
1299
1299
  j
1300
1300
  ));
1301
1301
  }
1302
- const C = z(i.currentViewshed, (w) => {
1302
+ const C = G(i.currentViewshed, (w) => {
1303
1303
  w && c();
1304
- }), u = z(i.currentIsPersisted, (w) => {
1304
+ }), u = G(i.currentIsPersisted, (w) => {
1305
1305
  w && l();
1306
- }), h = z(i.mode, () => {
1306
+ }), h = G(i.mode, () => {
1307
1307
  i.mode.value ? c() : t.windowManager.remove(n);
1308
1308
  });
1309
1309
  return {
@@ -1320,7 +1320,7 @@ function Zt(i, t, o, e) {
1320
1320
  currentIndex: 0,
1321
1321
  active: !1,
1322
1322
  background: !1,
1323
- disabled: !1,
1323
+ disabled: !(i.maps.activeMap instanceof $),
1324
1324
  callback() {
1325
1325
  if (this.active)
1326
1326
  this.background && t.currentViewshed.value ? t.editViewshed(t.currentViewshed.value) : t.stop();
@@ -1344,9 +1344,9 @@ function Zt(i, t, o, e) {
1344
1344
  title: `viewshed.create.${p.THREESIXTY}`
1345
1345
  } : [])
1346
1346
  })
1347
- }, n = z(t.mode, (c) => {
1347
+ }, n = G(t.mode, (c) => {
1348
1348
  c === y.VIEW ? (s.action.background = !0, s.action.active = !0) : c ? (s.action.background = !1, s.action.active = !0) : (s.action.background = !1, s.action.active = !1);
1349
- }), d = z(
1349
+ }), d = G(
1350
1350
  t.currentViewshed,
1351
1351
  (c) => {
1352
1352
  c && (s.action.currentIndex = s.action.tools.findIndex(
@@ -1354,7 +1354,7 @@ function Zt(i, t, o, e) {
1354
1354
  ));
1355
1355
  }
1356
1356
  ), l = i.maps.mapActivated.addEventListener((c) => {
1357
- c instanceof G ? s.action.disabled = !1 : s.action.disabled = !0;
1357
+ c instanceof $ ? s.action.disabled = !1 : s.action.disabled = !0;
1358
1358
  });
1359
1359
  return {
1360
1360
  destroy() {
@@ -1378,7 +1378,7 @@ class ne extends Ue {
1378
1378
  var e;
1379
1379
  if (
1380
1380
  /** @type {import("@vcmap/core").CesiumMap | undefined} */
1381
- (e = this._app) == null ? void 0 : e.maps.getByType(G.className)[0]
1381
+ (e = this._app) == null ? void 0 : e.maps.getByType($.className)[0]
1382
1382
  )
1383
1383
  return new x(t);
1384
1384
  throw new Error("No CesiumMap available");
@@ -1410,7 +1410,7 @@ async function ei(i) {
1410
1410
  );
1411
1411
  e.addItemMapping({
1412
1412
  mappingFunction: vt(
1413
- [G.className],
1413
+ [$.className],
1414
1414
  i.maps
1415
1415
  ),
1416
1416
  owner: j
@@ -1690,7 +1690,7 @@ function ii(i, t, o, e, s, n) {
1690
1690
  ]),
1691
1691
  _: 1
1692
1692
  /* STABLE */
1693
- })) : $("v-if", !0)
1693
+ })) : H("v-if", !0)
1694
1694
  ]),
1695
1695
  _: 1
1696
1696
  /* STABLE */
@@ -1738,7 +1738,7 @@ function ui(i) {
1738
1738
  d.collectionComponent
1739
1739
  ), { activeMap: C } = s.maps;
1740
1740
  function u(g) {
1741
- if (n != null && n.m && n.cv && g instanceof G) {
1741
+ if (n != null && n.m && n.cv && g instanceof $) {
1742
1742
  n.cv.properties.title && delete n.cv.properties.title;
1743
1743
  const V = new x(n.cv);
1744
1744
  n.m === y.VIEW ? t.viewViewshed(V) : t.editViewshed(V);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/viewshed",
3
- "version": "3.0.1",
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,7 +49,7 @@
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"
@@ -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) {