@vcmap/viewshed 4.1.0 → 4.1.1
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 +4 -0
- package/dist/index.js +97 -91
- package/package.json +1 -1
- package/src/viewshed.ts +11 -0
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,26 +2,26 @@ var ze = Object.defineProperty;
|
|
|
2
2
|
var He = (e, o, t) => o in e ? ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
3
|
var C = (e, o, t) => He(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
4
|
import { VcsCameraPrimitive as Ke, VcsObject as Ye, VcsEvent as se, AbstractInteraction as Xe, EventType as oe, Projection as Z, SessionType as Je, CesiumMap as H, startEditFeaturesSession as Ze, startEditGeometrySession as qe, VectorLayer as Qe, maxZIndex as et, wgs84Projection as tt, markVolatile as it, Viewpoint as ot, TransformationMode as st, Category as nt, moduleIdSymbol as ee } from "../../../assets/core.js";
|
|
5
|
-
import { shallowRef as le, ref as K, nextTick as at, defineComponent as Ae, inject as me, reactive as Q, watchEffect as rt, watch as q, onMounted as lt, onUnmounted as ct, computed as dt, resolveComponent as V, openBlock as N, createElementBlock as te, createCommentVNode as Y, createBlock as
|
|
5
|
+
import { shallowRef as le, ref as K, nextTick as at, defineComponent as Ae, inject as me, reactive as Q, watchEffect as rt, watch as q, onMounted as lt, onUnmounted as ct, computed as dt, resolveComponent as V, openBlock as N, createElementBlock as te, createCommentVNode as Y, createBlock as B, withCtx as v, createTextVNode as z, toDisplayString as W, createVNode as m, createElementVNode as ut, Fragment as Ve, renderList as Se, toRaw as ht, mergeProps as ft } from "../../../assets/vue.js";
|
|
6
6
|
import { Color as ne, Matrix4 as pt, Transforms as mt, Primitive as Oe, PerInstanceColorAppearance as Te, GeometryInstance as Re, SphereGeometry as vt, ColorGeometryInstanceAttribute as Me, SphereOutlineGeometry as wt, Math as F, Cartesian3 as x, ShadowMap as gt, Camera as Ct, HeightReference as _t } from "../../../assets/cesium.js";
|
|
7
7
|
import { ol$Observable$unByKey as Et, Feature as yt, ol$geom$Point as bt, ol$style$Style as Vt } from "../../../assets/ol.js";
|
|
8
8
|
import { VcsWorkspaceWrapper as St, VcsTextField as Ot, VcsSelect as ke, VcsLabeledSlider as Tt, VcsLabel as De, VcsHelp as Rt, VcsFormSection as $e, VcsFeatureTransforms as Mt, VcsFormButton as Nt, makeEditorCollectionComponentClass as It, WindowSlot as Pt, ToolboxType as Ne, createSupportedMapMappingFunction as At, createListExportAction as kt, downloadText as Dt, createListImportAction as $t, NotificationType as re, AbstractConfigEditor as Lt, VcsCallback as Le } from "../../../assets/ui.js";
|
|
9
|
-
import { VRow as Fe, VDivider as Ft, VCol as
|
|
9
|
+
import { VRow as Fe, VDivider as Ft, VCol as Be, VColorPicker as Bt, VContainer as Wt } from "../../../assets/vuetify.js";
|
|
10
10
|
const b = {
|
|
11
11
|
ERROR: 2,
|
|
12
12
|
WARN: 4,
|
|
13
13
|
INFO: 8,
|
|
14
14
|
DEBUG: 16
|
|
15
|
-
},
|
|
15
|
+
}, j = {
|
|
16
16
|
ERROR: 0,
|
|
17
17
|
WARN: 0,
|
|
18
18
|
INFO: 0,
|
|
19
19
|
DEBUG: 0
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
j.ERROR = b.ERROR | b.WARN | b.INFO | b.DEBUG;
|
|
22
|
+
j.WARN = b.WARN | b.INFO | b.DEBUG;
|
|
23
|
+
j.INFO = b.INFO | b.DEBUG;
|
|
24
|
+
j.DEBUG = b.DEBUG;
|
|
25
25
|
const ie = {
|
|
26
26
|
logLevel: b.INFO
|
|
27
27
|
}, ae = /* @__PURE__ */ new Map();
|
|
@@ -29,7 +29,7 @@ ae.set(b.ERROR, "error");
|
|
|
29
29
|
ae.set(b.WARN, "warn");
|
|
30
30
|
ae.set(b.INFO, "info");
|
|
31
31
|
ae.set(b.DEBUG, "log");
|
|
32
|
-
class
|
|
32
|
+
class We {
|
|
33
33
|
/**
|
|
34
34
|
* @param {string=} className
|
|
35
35
|
*/
|
|
@@ -42,7 +42,7 @@ class je {
|
|
|
42
42
|
* @param {...any} optArgs
|
|
43
43
|
*/
|
|
44
44
|
error(o, ...t) {
|
|
45
|
-
ie.logLevel &
|
|
45
|
+
ie.logLevel & j.ERROR && this._log(String(o), b.ERROR, t);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Logs a warning message
|
|
@@ -50,7 +50,7 @@ class je {
|
|
|
50
50
|
* @param {...any} optArgs
|
|
51
51
|
*/
|
|
52
52
|
warning(o, ...t) {
|
|
53
|
-
ie.logLevel &
|
|
53
|
+
ie.logLevel & j.WARN && this._log(String(o), b.WARN, t);
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Deprecate a function. deprecations are stored on the logger
|
|
@@ -71,7 +71,7 @@ class je {
|
|
|
71
71
|
* @param {...any} optArgs
|
|
72
72
|
*/
|
|
73
73
|
info(o, ...t) {
|
|
74
|
-
ie.logLevel &
|
|
74
|
+
ie.logLevel & j.INFO && this._log(String(o), b.INFO, t);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Logs a debug message
|
|
@@ -79,7 +79,7 @@ class je {
|
|
|
79
79
|
* @param {...any} optArgs
|
|
80
80
|
*/
|
|
81
81
|
debug(o, ...t) {
|
|
82
|
-
ie.logLevel &
|
|
82
|
+
ie.logLevel & j.DEBUG && this._log(String(o), b.DEBUG, t);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* Alias for debug
|
|
@@ -87,7 +87,7 @@ class je {
|
|
|
87
87
|
* @param {...any} optArgs
|
|
88
88
|
*/
|
|
89
89
|
log(o, ...t) {
|
|
90
|
-
ie.logLevel &
|
|
90
|
+
ie.logLevel & j.DEBUG && this._log(String(o), b.DEBUG, t);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Logs a message
|
|
@@ -103,17 +103,17 @@ class je {
|
|
|
103
103
|
}
|
|
104
104
|
const ve = /* @__PURE__ */ new Map();
|
|
105
105
|
let ce;
|
|
106
|
-
function
|
|
107
|
-
return ce || (ce = new
|
|
106
|
+
function jt() {
|
|
107
|
+
return ce || (ce = new We()), ce;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
const o = new
|
|
109
|
+
function Gt(e) {
|
|
110
|
+
const o = new We(e);
|
|
111
111
|
return ve.set(e, o), o;
|
|
112
112
|
}
|
|
113
113
|
function X(e) {
|
|
114
|
-
return e ? ve.has(e) ? ve.get(e) :
|
|
114
|
+
return e ? ve.has(e) ? ve.get(e) : Gt(e) : jt();
|
|
115
115
|
}
|
|
116
|
-
const
|
|
116
|
+
const je = Symbol("isMatcher"), Ut = Symbol("Integer"), xt = Symbol("NonEmptyString"), Ee = /* @__PURE__ */ new Map();
|
|
117
117
|
[
|
|
118
118
|
[String, "string"],
|
|
119
119
|
[Number, "number"],
|
|
@@ -125,7 +125,7 @@ const Ge = Symbol("isMatcher"), Ut = Symbol("Integer"), xt = Symbol("NonEmptyStr
|
|
|
125
125
|
Ee.set(e, o);
|
|
126
126
|
});
|
|
127
127
|
function zt(e) {
|
|
128
|
-
return e == null ? void 0 : e[
|
|
128
|
+
return e == null ? void 0 : e[je];
|
|
129
129
|
}
|
|
130
130
|
function we(e) {
|
|
131
131
|
if (!e || String(e) !== "[object Object]")
|
|
@@ -190,7 +190,7 @@ function Yt(e, o) {
|
|
|
190
190
|
const t = Ee.get(o);
|
|
191
191
|
return t ? typeof e === t ? !1 : `expected ${A(e)} to be a ${String(t)}` : null;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Ge(e) {
|
|
194
194
|
if (e === null)
|
|
195
195
|
return "null";
|
|
196
196
|
const o = Ee.get(e);
|
|
@@ -208,7 +208,7 @@ function Be(e) {
|
|
|
208
208
|
if (we(e)) {
|
|
209
209
|
const n = {};
|
|
210
210
|
Object.keys(e).forEach((d) => {
|
|
211
|
-
n[d] =
|
|
211
|
+
n[d] = Ge(e[d]);
|
|
212
212
|
});
|
|
213
213
|
try {
|
|
214
214
|
i = `Object of ${JSON.stringify(n)}`;
|
|
@@ -235,7 +235,7 @@ function Xt(e, o) {
|
|
|
235
235
|
if (s === Object)
|
|
236
236
|
return ge(i, {}, t);
|
|
237
237
|
if (s instanceof Function)
|
|
238
|
-
return i instanceof s ? !1 : `Expected ${A(i, !0)} to be of Type ${
|
|
238
|
+
return i instanceof s ? !1 : `Expected ${A(i, !0)} to be of Type ${Ge(s)}`;
|
|
239
239
|
if (typeof s == "object") {
|
|
240
240
|
const r = ge(i, s, t);
|
|
241
241
|
return r || !1;
|
|
@@ -254,7 +254,7 @@ function Zt(e, o) {
|
|
|
254
254
|
ye(e, Object);
|
|
255
255
|
let t = Object.values(e);
|
|
256
256
|
const i = (s) => t.includes(s) ? !1 : `expected ${A(s)} to be of enum: ${t.join(", ")}`;
|
|
257
|
-
return i[
|
|
257
|
+
return i[je] = !0, i;
|
|
258
258
|
}
|
|
259
259
|
function Ue(e, o, t) {
|
|
260
260
|
if (e != null) {
|
|
@@ -331,7 +331,13 @@ class Qt extends Ke {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
var _ = /* @__PURE__ */ ((e) => (e.CONE = "cone", e.THREESIXTY = "360", e))(_ || {});
|
|
334
|
-
function ei(e
|
|
334
|
+
function ei(e) {
|
|
335
|
+
const o = e;
|
|
336
|
+
["_terrainBias", "_primitiveBias", "_pointBias"].forEach((t) => {
|
|
337
|
+
o[t].normalShading = !1;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function ti(e, o) {
|
|
335
341
|
const t = new Ct(e), i = t.frustum;
|
|
336
342
|
return i.fov = o.fov, i.near = o.near, i.aspectRatio = o.aspectRatio, i.far = o.far, t;
|
|
337
343
|
}
|
|
@@ -523,7 +529,7 @@ const P = class P extends Ye {
|
|
|
523
529
|
this._cesiumMap = t;
|
|
524
530
|
const i = t.getScene();
|
|
525
531
|
if (i)
|
|
526
|
-
this._shadowCamera =
|
|
532
|
+
this._shadowCamera = ti(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
|
|
527
533
|
else
|
|
528
534
|
throw new Error("CesiumMap contains no scene");
|
|
529
535
|
this._updateShadowMap(), this._updatePrimitive();
|
|
@@ -545,7 +551,7 @@ const P = class P extends Ye {
|
|
|
545
551
|
pointLightRadius: this._shadowCamera.frustum.far,
|
|
546
552
|
maximumDistance: 200,
|
|
547
553
|
size: 2048
|
|
548
|
-
}), this._shadowMap.viewshed = this._colors, this._cesiumMap.setShadowMap(this._shadowMap));
|
|
554
|
+
}), ei(this._shadowMap), this._shadowMap.viewshed = this._colors, this._cesiumMap.setShadowMap(this._shadowMap));
|
|
549
555
|
}
|
|
550
556
|
_removePrimitive() {
|
|
551
557
|
var t;
|
|
@@ -603,9 +609,9 @@ const P = class P extends Ye {
|
|
|
603
609
|
}
|
|
604
610
|
};
|
|
605
611
|
C(P, "MIN_DISTANCE", 10);
|
|
606
|
-
let
|
|
607
|
-
const T = "@vcmap/viewshed",
|
|
608
|
-
class
|
|
612
|
+
let G = P;
|
|
613
|
+
const T = "@vcmap/viewshed", ii = "4.1.1", oi = "^6.3";
|
|
614
|
+
class si extends Xe {
|
|
609
615
|
constructor(t) {
|
|
610
616
|
super(oe.CLICKMOVE);
|
|
611
617
|
C(this, "_viewshed");
|
|
@@ -632,7 +638,7 @@ class oi extends Xe {
|
|
|
632
638
|
}
|
|
633
639
|
var J = /* @__PURE__ */ ((e) => (e.ABSOLUTE = "absolute", e.RELATIVE = "relative", e))(J || {}), O = /* @__PURE__ */ ((e) => (e.CREATE = "create", e.VIEW = "view", e.EDIT = "edit", e.MOVE = "move", e.MULTI_SELECT = "multiSelect", e))(O || {});
|
|
634
640
|
const Ie = 1.8;
|
|
635
|
-
function
|
|
641
|
+
function ni(e) {
|
|
636
642
|
const o = new Qe({
|
|
637
643
|
projection: tt.toJSON(),
|
|
638
644
|
zIndex: et - 1
|
|
@@ -653,7 +659,7 @@ function ue(e, o) {
|
|
|
653
659
|
const t = o === "absolute" ? oe.CLICKMOVE : oe.NONE;
|
|
654
660
|
e.setActive(t), e.pickPosition = t, e.pullPickedPosition = 1.8;
|
|
655
661
|
}
|
|
656
|
-
function
|
|
662
|
+
function ai(e, o, t) {
|
|
657
663
|
const i = le(null), s = K(null), n = K(null), d = K(
|
|
658
664
|
"absolute"
|
|
659
665
|
/* ABSOLUTE */
|
|
@@ -678,7 +684,7 @@ function ni(e, o, t) {
|
|
|
678
684
|
}
|
|
679
685
|
async function y(a) {
|
|
680
686
|
h(), await at();
|
|
681
|
-
const { eventHandler: p } = e.maps, { featureInteraction: E } = p, S = new
|
|
687
|
+
const { eventHandler: p } = e.maps, { featureInteraction: E } = p, S = new G({
|
|
682
688
|
viewshedType: a,
|
|
683
689
|
colorOptions: {
|
|
684
690
|
visibleColor: o.visibleColor,
|
|
@@ -687,7 +693,7 @@ function ni(e, o, t) {
|
|
|
687
693
|
heightOffset: d.value === "absolute" ? 0 : Ie
|
|
688
694
|
});
|
|
689
695
|
g(S);
|
|
690
|
-
const I = new
|
|
696
|
+
const I = new si(i.value);
|
|
691
697
|
I.finished.addEventListener(() => {
|
|
692
698
|
u(), i.value ? (i.value.showPrimitive = !0, n.value = "edit") : h();
|
|
693
699
|
});
|
|
@@ -716,7 +722,7 @@ function ni(e, o, t) {
|
|
|
716
722
|
layer: E,
|
|
717
723
|
feature: S,
|
|
718
724
|
destroy: I
|
|
719
|
-
} =
|
|
725
|
+
} = ni(i.value.position);
|
|
720
726
|
e.layers.add(E), l.value = [S], d.value === "absolute" ? (r.value = Ze(e, E), r.value.setFeatures([S])) : (r.value = qe(e, E), r.value.setFeature(S)), r.value.stopped.addEventListener(() => {
|
|
721
727
|
u();
|
|
722
728
|
});
|
|
@@ -820,15 +826,15 @@ function ni(e, o, t) {
|
|
|
820
826
|
}
|
|
821
827
|
};
|
|
822
828
|
}
|
|
823
|
-
const
|
|
824
|
-
distance: [
|
|
829
|
+
const ri = {
|
|
830
|
+
distance: [G.MIN_DISTANCE, 2e3],
|
|
825
831
|
fov: [25, 85],
|
|
826
832
|
heading: [0, 360],
|
|
827
833
|
pitch: [-90, 90]
|
|
828
|
-
},
|
|
834
|
+
}, li = Ae({
|
|
829
835
|
name: "ViewshedWindow",
|
|
830
836
|
components: {
|
|
831
|
-
VCol:
|
|
837
|
+
VCol: Be,
|
|
832
838
|
VDivider: Ft,
|
|
833
839
|
VRow: Fe,
|
|
834
840
|
VcsFormButton: Nt,
|
|
@@ -985,7 +991,7 @@ const ai = {
|
|
|
985
991
|
},
|
|
986
992
|
parameters: h,
|
|
987
993
|
setParameter: U,
|
|
988
|
-
parameterRanges:
|
|
994
|
+
parameterRanges: ri,
|
|
989
995
|
ViewshedPluginModes: O,
|
|
990
996
|
viewshedMode: s,
|
|
991
997
|
currentIsPersisted: n,
|
|
@@ -1018,26 +1024,26 @@ const ai = {
|
|
|
1018
1024
|
for (const [i, s] of o)
|
|
1019
1025
|
t[i] = s;
|
|
1020
1026
|
return t;
|
|
1021
|
-
},
|
|
1022
|
-
function
|
|
1027
|
+
}, ci = { key: 0 }, di = { class: "px-1" };
|
|
1028
|
+
function ui(e, o, t, i, s, n) {
|
|
1023
1029
|
const d = V("VcsHelp"), r = V("VcsLabel"), u = V("v-col"), l = V("VcsSelect"), c = V("v-row"), f = V("v-divider"), h = V("VcsFormButton"), g = V("VcsFeatureTransforms"), y = V("VcsTextField"), k = V("VcsFormSection"), M = V("VcsLabeledSlider"), U = V("VcsWorkspaceWrapper");
|
|
1024
1030
|
return N(), te("div", null, [
|
|
1025
1031
|
Y(" CREATE "),
|
|
1026
|
-
e.viewshedMode === e.ViewshedPluginModes.CREATE ? (N(), te("div",
|
|
1027
|
-
e.viewshedType === e.ViewshedTypes.CONE ? (N(),
|
|
1032
|
+
e.viewshedMode === e.ViewshedPluginModes.CREATE ? (N(), te("div", ci, [
|
|
1033
|
+
e.viewshedType === e.ViewshedTypes.CONE ? (N(), B(d, { key: 0 }, {
|
|
1028
1034
|
default: v(() => [
|
|
1029
1035
|
z(
|
|
1030
|
-
|
|
1036
|
+
W(e.$t("viewshed.createDescription")),
|
|
1031
1037
|
1
|
|
1032
1038
|
/* TEXT */
|
|
1033
1039
|
)
|
|
1034
1040
|
]),
|
|
1035
1041
|
_: 1
|
|
1036
1042
|
/* STABLE */
|
|
1037
|
-
})) : e.viewshedType === e.ViewshedTypes.THREESIXTY ? (N(),
|
|
1043
|
+
})) : e.viewshedType === e.ViewshedTypes.THREESIXTY ? (N(), B(d, { key: 1 }, {
|
|
1038
1044
|
default: v(() => [
|
|
1039
1045
|
z(
|
|
1040
|
-
|
|
1046
|
+
W(e.$t("viewshed.createThreeSixtyDescription")),
|
|
1041
1047
|
1
|
|
1042
1048
|
/* TEXT */
|
|
1043
1049
|
)
|
|
@@ -1055,7 +1061,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1055
1061
|
m(r, { "html-for": "heightMode" }, {
|
|
1056
1062
|
default: v(() => [
|
|
1057
1063
|
z(
|
|
1058
|
-
|
|
1064
|
+
W(e.$t("viewshed.heightMode")),
|
|
1059
1065
|
1
|
|
1060
1066
|
/* TEXT */
|
|
1061
1067
|
)
|
|
@@ -1094,7 +1100,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1094
1100
|
}, {
|
|
1095
1101
|
default: v(() => [
|
|
1096
1102
|
z(
|
|
1097
|
-
|
|
1103
|
+
W(e.$t("viewshed.cancel")),
|
|
1098
1104
|
1
|
|
1099
1105
|
/* TEXT */
|
|
1100
1106
|
)
|
|
@@ -1108,7 +1114,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1108
1114
|
})
|
|
1109
1115
|
])) : Y("v-if", !0),
|
|
1110
1116
|
Y(" EDIT AND MOVE "),
|
|
1111
|
-
e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (N(),
|
|
1117
|
+
e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? (N(), B(U, {
|
|
1112
1118
|
key: 1,
|
|
1113
1119
|
"disable-add": e.currentIsPersisted,
|
|
1114
1120
|
class: "wrapper",
|
|
@@ -1129,8 +1135,8 @@ function di(e, o, t, i, s, n) {
|
|
|
1129
1135
|
default: v(() => [
|
|
1130
1136
|
ut(
|
|
1131
1137
|
"span",
|
|
1132
|
-
|
|
1133
|
-
|
|
1138
|
+
di,
|
|
1139
|
+
W(e.$t("viewshed.position")),
|
|
1134
1140
|
1
|
|
1135
1141
|
/* TEXT */
|
|
1136
1142
|
)
|
|
@@ -1138,7 +1144,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1138
1144
|
_: 1
|
|
1139
1145
|
/* STABLE */
|
|
1140
1146
|
}),
|
|
1141
|
-
e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? (N(),
|
|
1147
|
+
e.viewshedMode === e.ViewshedPluginModes.MOVE && e.heightMode === e.HeightModes.ABSOLUTE ? (N(), B(c, {
|
|
1142
1148
|
key: 0,
|
|
1143
1149
|
"no-gutters": "",
|
|
1144
1150
|
class: "px-1"
|
|
@@ -1153,7 +1159,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1153
1159
|
]),
|
|
1154
1160
|
_: 1
|
|
1155
1161
|
/* STABLE */
|
|
1156
|
-
})) : (N(),
|
|
1162
|
+
})) : (N(), B(c, {
|
|
1157
1163
|
key: 1,
|
|
1158
1164
|
"no-gutters": "",
|
|
1159
1165
|
class: "px-1"
|
|
@@ -1162,7 +1168,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1162
1168
|
(N(!0), te(
|
|
1163
1169
|
Ve,
|
|
1164
1170
|
null,
|
|
1165
|
-
Se(e.position, ($, a, p) => (N(),
|
|
1171
|
+
Se(e.position, ($, a, p) => (N(), B(
|
|
1166
1172
|
u,
|
|
1167
1173
|
{
|
|
1168
1174
|
key: p,
|
|
@@ -1210,7 +1216,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1210
1216
|
m(r, { "html-for": "heightMode" }, {
|
|
1211
1217
|
default: v(() => [
|
|
1212
1218
|
z(
|
|
1213
|
-
|
|
1219
|
+
W(e.$t("viewshed.heightMode")),
|
|
1214
1220
|
1
|
|
1215
1221
|
/* TEXT */
|
|
1216
1222
|
)
|
|
@@ -1245,7 +1251,7 @@ function di(e, o, t, i, s, n) {
|
|
|
1245
1251
|
key: a,
|
|
1246
1252
|
class: "px-1"
|
|
1247
1253
|
}, [
|
|
1248
|
-
a === "distance" || e.viewshedType === e.ViewshedTypes.CONE && a !== "showPrimitive" ? (N(),
|
|
1254
|
+
a === "distance" || e.viewshedType === e.ViewshedTypes.CONE && a !== "showPrimitive" ? (N(), B(M, {
|
|
1249
1255
|
key: 0,
|
|
1250
1256
|
class: "pa-0",
|
|
1251
1257
|
label: `viewshed.${a}`,
|
|
@@ -1269,13 +1275,13 @@ function di(e, o, t, i, s, n) {
|
|
|
1269
1275
|
}, 8, ["disable-add", "onAddClicked", "onNewClicked"])) : Y("v-if", !0)
|
|
1270
1276
|
]);
|
|
1271
1277
|
}
|
|
1272
|
-
const
|
|
1278
|
+
const hi = /* @__PURE__ */ xe(li, [["render", ui]]), Ce = {
|
|
1273
1279
|
[_.CONE]: "$vcsViewshed",
|
|
1274
1280
|
[_.THREESIXTY]: "$vcsViewshedCone"
|
|
1275
1281
|
};
|
|
1276
|
-
function
|
|
1282
|
+
function fi(e, o, t) {
|
|
1277
1283
|
const i = K(""), s = K(), n = `${t.id}-editor`, d = {
|
|
1278
|
-
component:
|
|
1284
|
+
component: hi,
|
|
1279
1285
|
provides: { manager: e },
|
|
1280
1286
|
state: {
|
|
1281
1287
|
headerTitle: i,
|
|
@@ -1323,7 +1329,7 @@ function hi(e, o, t) {
|
|
|
1323
1329
|
}
|
|
1324
1330
|
};
|
|
1325
1331
|
}
|
|
1326
|
-
function
|
|
1332
|
+
function pi(e, o, t, i) {
|
|
1327
1333
|
function s(l) {
|
|
1328
1334
|
return l === _.CONE ? {
|
|
1329
1335
|
name: _.CONE,
|
|
@@ -1394,9 +1400,9 @@ function fi(e, o, t, i) {
|
|
|
1394
1400
|
}
|
|
1395
1401
|
};
|
|
1396
1402
|
}
|
|
1397
|
-
function
|
|
1403
|
+
function mi(e, o, t, i) {
|
|
1398
1404
|
ye(i, [Zt(_)]);
|
|
1399
|
-
const { toolbox: s, destroy: n } =
|
|
1405
|
+
const { toolbox: s, destroy: n } = pi(e, o, t, i), d = e.toolboxManager.add(s, t).id;
|
|
1400
1406
|
return () => {
|
|
1401
1407
|
e.toolboxManager.remove(d), n();
|
|
1402
1408
|
};
|
|
@@ -1408,11 +1414,11 @@ class _e extends nt {
|
|
|
1408
1414
|
async _deserializeItem(o) {
|
|
1409
1415
|
var i;
|
|
1410
1416
|
if ((i = this._app) == null ? void 0 : i.maps.getByType(H.className)[0])
|
|
1411
|
-
return Promise.resolve(new
|
|
1417
|
+
return Promise.resolve(new G(o));
|
|
1412
1418
|
throw new Error("No CesiumMap available");
|
|
1413
1419
|
}
|
|
1414
1420
|
}
|
|
1415
|
-
function
|
|
1421
|
+
function vi(e, o) {
|
|
1416
1422
|
let t, i = 0;
|
|
1417
1423
|
const s = new Set(
|
|
1418
1424
|
o.filter((n) => n.type === e).map((n) => n.properties.title)
|
|
@@ -1422,7 +1428,7 @@ function mi(e, o) {
|
|
|
1422
1428
|
while (!t);
|
|
1423
1429
|
return t;
|
|
1424
1430
|
}
|
|
1425
|
-
async function
|
|
1431
|
+
async function wi(e) {
|
|
1426
1432
|
const o = new se(), t = new se(), { collectionComponent: i, category: s } = await e.categoryManager.requestCategory(
|
|
1427
1433
|
{
|
|
1428
1434
|
type: _e.className,
|
|
@@ -1473,7 +1479,7 @@ async function vi(e) {
|
|
|
1473
1479
|
c.map(async (M) => {
|
|
1474
1480
|
const U = await M.text();
|
|
1475
1481
|
try {
|
|
1476
|
-
return JSON.parse(U).map((a) => new
|
|
1482
|
+
return JSON.parse(U).map((a) => new G(a));
|
|
1477
1483
|
} catch {
|
|
1478
1484
|
e.notifier.add({
|
|
1479
1485
|
type: re.ERROR,
|
|
@@ -1529,7 +1535,7 @@ async function vi(e) {
|
|
|
1529
1535
|
}
|
|
1530
1536
|
},
|
|
1531
1537
|
add(c) {
|
|
1532
|
-
c.properties.title =
|
|
1538
|
+
c.properties.title = vi(c.type, [
|
|
1533
1539
|
...s.collection
|
|
1534
1540
|
]), s.collection.add(c);
|
|
1535
1541
|
},
|
|
@@ -1543,17 +1549,17 @@ async function vi(e) {
|
|
|
1543
1549
|
}
|
|
1544
1550
|
};
|
|
1545
1551
|
}
|
|
1546
|
-
const
|
|
1552
|
+
const gi = Ae({
|
|
1547
1553
|
name: "ViewshedConfigEditor",
|
|
1548
1554
|
components: {
|
|
1549
1555
|
AbstractConfigEditor: Lt,
|
|
1550
1556
|
VcsFormSection: $e,
|
|
1551
|
-
VContainer:
|
|
1557
|
+
VContainer: Wt,
|
|
1552
1558
|
VRow: Fe,
|
|
1553
|
-
VCol:
|
|
1559
|
+
VCol: Be,
|
|
1554
1560
|
VcsLabel: De,
|
|
1555
1561
|
VcsSelect: ke,
|
|
1556
|
-
VColorPicker:
|
|
1562
|
+
VColorPicker: Bt
|
|
1557
1563
|
},
|
|
1558
1564
|
props: {
|
|
1559
1565
|
getConfig: {
|
|
@@ -1586,11 +1592,11 @@ const wi = Ae({
|
|
|
1586
1592
|
};
|
|
1587
1593
|
}
|
|
1588
1594
|
});
|
|
1589
|
-
function
|
|
1595
|
+
function Ci(e, o, t, i, s, n) {
|
|
1590
1596
|
const d = V("VcsLabel"), r = V("v-col"), u = V("VcsSelect"), l = V("v-row"), c = V("VColorPicker"), f = V("v-container"), h = V("VcsFormSection"), g = V("AbstractConfigEditor");
|
|
1591
|
-
return N(),
|
|
1597
|
+
return N(), B(g, ft({ ...e.$attrs, ...e.$props }, { onSubmit: e.apply }), {
|
|
1592
1598
|
default: v(() => [
|
|
1593
|
-
e.localConfig ? (N(),
|
|
1599
|
+
e.localConfig ? (N(), B(h, {
|
|
1594
1600
|
key: 0,
|
|
1595
1601
|
heading: "viewshed.editor.general"
|
|
1596
1602
|
}, {
|
|
@@ -1604,7 +1610,7 @@ function gi(e, o, t, i, s, n) {
|
|
|
1604
1610
|
m(d, { "html-for": "viewshed-editor-tools" }, {
|
|
1605
1611
|
default: v(() => [
|
|
1606
1612
|
z(
|
|
1607
|
-
|
|
1613
|
+
W(e.$t("viewshed.editor.tools")),
|
|
1608
1614
|
1
|
|
1609
1615
|
/* TEXT */
|
|
1610
1616
|
)
|
|
@@ -1640,7 +1646,7 @@ function gi(e, o, t, i, s, n) {
|
|
|
1640
1646
|
m(d, { "html-for": "viewshed-editor-visible-color" }, {
|
|
1641
1647
|
default: v(() => [
|
|
1642
1648
|
z(
|
|
1643
|
-
|
|
1649
|
+
W(e.$t("viewshed.editor.visibleColor")),
|
|
1644
1650
|
1
|
|
1645
1651
|
/* TEXT */
|
|
1646
1652
|
)
|
|
@@ -1674,7 +1680,7 @@ function gi(e, o, t, i, s, n) {
|
|
|
1674
1680
|
m(d, { "html-for": "viewshed-editor-shadow-color" }, {
|
|
1675
1681
|
default: v(() => [
|
|
1676
1682
|
z(
|
|
1677
|
-
|
|
1683
|
+
W(e.$t("viewshed.editor.shadowColor")),
|
|
1678
1684
|
1
|
|
1679
1685
|
/* TEXT */
|
|
1680
1686
|
)
|
|
@@ -1714,7 +1720,7 @@ function gi(e, o, t, i, s, n) {
|
|
|
1714
1720
|
/* STABLE */
|
|
1715
1721
|
}, 16, ["onSubmit"]);
|
|
1716
1722
|
}
|
|
1717
|
-
const
|
|
1723
|
+
const _i = /* @__PURE__ */ xe(gi, [["render", Ci]]);
|
|
1718
1724
|
class he extends Le {
|
|
1719
1725
|
constructor(t, i) {
|
|
1720
1726
|
super(t, i);
|
|
@@ -1761,8 +1767,8 @@ class fe extends Le {
|
|
|
1761
1767
|
}
|
|
1762
1768
|
function Pe() {
|
|
1763
1769
|
return {
|
|
1764
|
-
visibleColor:
|
|
1765
|
-
shadowColor:
|
|
1770
|
+
visibleColor: G.getDefaultOptions().colorOptions.visibleColor,
|
|
1771
|
+
shadowColor: G.getDefaultOptions().colorOptions.shadowColor,
|
|
1766
1772
|
tools: [...Object.values(_)]
|
|
1767
1773
|
};
|
|
1768
1774
|
}
|
|
@@ -1775,12 +1781,12 @@ function pe(e, o, t) {
|
|
|
1775
1781
|
X(T).error("Failed to create viewshed", String(n));
|
|
1776
1782
|
});
|
|
1777
1783
|
} else if (t.cv) {
|
|
1778
|
-
const s = new
|
|
1784
|
+
const s = new G(t.cv);
|
|
1779
1785
|
t.m === O.VIEW ? o == null || o.viewViewshed(s) : o == null || o.editViewshed(s);
|
|
1780
1786
|
}
|
|
1781
1787
|
}
|
|
1782
1788
|
}
|
|
1783
|
-
function
|
|
1789
|
+
function Ri(e) {
|
|
1784
1790
|
let o, t, i = () => {
|
|
1785
1791
|
};
|
|
1786
1792
|
const s = Pe(), n = { ...s, ...e }, d = Q({});
|
|
@@ -1789,10 +1795,10 @@ function Ti(e) {
|
|
|
1789
1795
|
return T;
|
|
1790
1796
|
},
|
|
1791
1797
|
get version() {
|
|
1792
|
-
return
|
|
1798
|
+
return ii;
|
|
1793
1799
|
},
|
|
1794
1800
|
get mapVersion() {
|
|
1795
|
-
return
|
|
1801
|
+
return oi;
|
|
1796
1802
|
},
|
|
1797
1803
|
getDefaultOptions: Pe,
|
|
1798
1804
|
state: d,
|
|
@@ -1810,18 +1816,18 @@ function Ti(e) {
|
|
|
1810
1816
|
_e.className,
|
|
1811
1817
|
_e
|
|
1812
1818
|
);
|
|
1813
|
-
const l = await
|
|
1814
|
-
t =
|
|
1819
|
+
const l = await wi(r);
|
|
1820
|
+
t = ai(
|
|
1815
1821
|
r,
|
|
1816
1822
|
n,
|
|
1817
1823
|
l
|
|
1818
1824
|
);
|
|
1819
|
-
const c =
|
|
1825
|
+
const c = mi(
|
|
1820
1826
|
r,
|
|
1821
1827
|
t,
|
|
1822
1828
|
T,
|
|
1823
1829
|
n.tools || s.tools
|
|
1824
|
-
), { destroy: f } =
|
|
1830
|
+
), { destroy: f } = fi(
|
|
1825
1831
|
t,
|
|
1826
1832
|
r,
|
|
1827
1833
|
l.collectionComponent
|
|
@@ -1863,7 +1869,7 @@ function Ti(e) {
|
|
|
1863
1869
|
getConfigEditors() {
|
|
1864
1870
|
return [
|
|
1865
1871
|
{
|
|
1866
|
-
component:
|
|
1872
|
+
component: _i,
|
|
1867
1873
|
title: "viewshed.editor.title",
|
|
1868
1874
|
infoUrlCallback: o == null ? void 0 : o.getHelpUrlCallback(
|
|
1869
1875
|
"/components/plugins/viewshedToolConfig.html",
|
|
@@ -1958,6 +1964,6 @@ function Ti(e) {
|
|
|
1958
1964
|
};
|
|
1959
1965
|
}
|
|
1960
1966
|
export {
|
|
1961
|
-
|
|
1967
|
+
Ri as default,
|
|
1962
1968
|
Pe as getDefaultOptions
|
|
1963
1969
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/viewshed",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
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.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/viewshed.ts
CHANGED
|
@@ -42,6 +42,16 @@ export type ColorOptions = {
|
|
|
42
42
|
shadowColor?: string;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
function disableNormalShading(shadowMap: ShadowMap): void {
|
|
46
|
+
const biases = shadowMap as unknown as Record<
|
|
47
|
+
string,
|
|
48
|
+
{ normalShading: boolean }
|
|
49
|
+
>;
|
|
50
|
+
['_terrainBias', '_primitiveBias', '_pointBias'].forEach((key) => {
|
|
51
|
+
biases[key].normalShading = false;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
/**
|
|
46
56
|
* Creates camera and sets frustum options and orientation.
|
|
47
57
|
*/
|
|
@@ -438,6 +448,7 @@ export default class Viewshed extends VcsObject {
|
|
|
438
448
|
maximumDistance: 200,
|
|
439
449
|
size: 2048,
|
|
440
450
|
});
|
|
451
|
+
disableNormalShading(this._shadowMap);
|
|
441
452
|
this._shadowMap.viewshed = this._colors;
|
|
442
453
|
this._cesiumMap.setShadowMap(this._shadowMap);
|
|
443
454
|
}
|