@vcmap/viewshed 2.0.4 → 2.0.5
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 +502 -485
- package/package.json +1 -1
- package/src/index.js +29 -14
- package/src/util/toolboxHelper.js +0 -1
- package/src/viewshed.js +23 -30
- package/src/viewshedManager.js +38 -18
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { VcsCameraPrimitive as
|
|
5
|
-
import { Color as
|
|
6
|
-
import { shallowRef as
|
|
7
|
-
import { ol$Observable$unByKey as
|
|
8
|
-
import { VcsTextField as
|
|
9
|
-
import { VContainer as
|
|
10
|
-
const
|
|
1
|
+
var pe = Object.defineProperty;
|
|
2
|
+
var we = (s, e, i) => e in s ? pe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
|
|
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";
|
|
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 $ = [
|
|
11
11
|
[String, "string"],
|
|
12
12
|
[Number, "number"],
|
|
13
13
|
[Boolean, "boolean"],
|
|
@@ -15,7 +15,7 @@ const x = [
|
|
|
15
15
|
[void 0, "undefined"],
|
|
16
16
|
[Symbol, "symbol"]
|
|
17
17
|
];
|
|
18
|
-
function
|
|
18
|
+
function B(s) {
|
|
19
19
|
const e = {};
|
|
20
20
|
if (!s || e.toString(s) !== "[object Object]")
|
|
21
21
|
return !1;
|
|
@@ -25,7 +25,7 @@ function W(s) {
|
|
|
25
25
|
const t = e.hasOwnProperty, o = t.call(i, "constructor") && i.constructor;
|
|
26
26
|
return typeof o == "function" && t.toString.call(o) === t.toString.call(Object);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function b(s, e) {
|
|
29
29
|
if (s === null)
|
|
30
30
|
return "null";
|
|
31
31
|
if (typeof s > "u")
|
|
@@ -34,7 +34,7 @@ function T(s, e) {
|
|
|
34
34
|
return typeof s;
|
|
35
35
|
let i;
|
|
36
36
|
if (Array.isArray(s))
|
|
37
|
-
i = `[${s.map((o) =>
|
|
37
|
+
i = `[${s.map((o) => b(o, e)).join(",")}]`;
|
|
38
38
|
else
|
|
39
39
|
try {
|
|
40
40
|
i = JSON.stringify(s);
|
|
@@ -43,59 +43,59 @@ function T(s, e) {
|
|
|
43
43
|
}
|
|
44
44
|
return i = i || typeof s, i.length > 20 ? `${i.substr(0, 20)}...` : i;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" ? s === e ? !1 : `Expected ${
|
|
46
|
+
function nt(s, e) {
|
|
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
|
|
49
|
+
function rt(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");
|
|
53
53
|
if (Array.isArray(s)) {
|
|
54
54
|
let t = !1;
|
|
55
|
-
return s.findIndex((
|
|
55
|
+
return s.findIndex((n) => {
|
|
56
56
|
try {
|
|
57
|
-
z(
|
|
57
|
+
z(n, e[0], i);
|
|
58
58
|
} catch (a) {
|
|
59
59
|
t = a.message.replace(/Match failed:\s/, "");
|
|
60
60
|
}
|
|
61
61
|
return t;
|
|
62
|
-
}) > -1 ? `${t} in ${
|
|
62
|
+
}) > -1 ? `${t} in ${b(s)}` : !1;
|
|
63
63
|
}
|
|
64
|
-
return `Expected ${
|
|
64
|
+
return `Expected ${b(s)} to be an Array`;
|
|
65
65
|
}
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function X(s, e, i) {
|
|
69
69
|
const t = i ? `${i}.` : "";
|
|
70
|
-
if (!
|
|
71
|
-
return `Expected ${
|
|
72
|
-
let
|
|
73
|
-
const a = Object.keys(e).find((
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
|
|
70
|
+
if (!B(s))
|
|
71
|
+
return `Expected ${b(s)} to be a plain Object`;
|
|
72
|
+
let n = !1;
|
|
73
|
+
const a = Object.keys(e).find((c) => {
|
|
74
|
+
const r = s[c];
|
|
75
|
+
if (B(e[c]))
|
|
76
|
+
n = X(r, e[c], t + c);
|
|
77
77
|
else
|
|
78
78
|
try {
|
|
79
|
-
z(
|
|
80
|
-
} catch (
|
|
81
|
-
|
|
79
|
+
z(r, e[c]);
|
|
80
|
+
} catch (f) {
|
|
81
|
+
n = f.message.replace(/Match failed:\s/, "");
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return n;
|
|
84
84
|
});
|
|
85
|
-
return a ? `${
|
|
85
|
+
return a ? `${n} in object.${t}${a}` : !1;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function at(s, e) {
|
|
88
88
|
if (e === Number)
|
|
89
|
-
return Number.isFinite(s) ? !1 : `expected ${
|
|
90
|
-
for (let i =
|
|
91
|
-
if (e ===
|
|
92
|
-
return typeof s ===
|
|
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]}`;
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Y(s) {
|
|
96
96
|
if (s === null)
|
|
97
97
|
return "null";
|
|
98
|
-
const e =
|
|
98
|
+
const e = $.find((o) => o[0] === s);
|
|
99
99
|
if (e)
|
|
100
100
|
return e[1];
|
|
101
101
|
let i = s.toString();
|
|
@@ -104,10 +104,10 @@ function X(s) {
|
|
|
104
104
|
const t = i.match(/function (.*)\(/);
|
|
105
105
|
if (t && t.length > 1)
|
|
106
106
|
return t[1];
|
|
107
|
-
if (
|
|
107
|
+
if (B(s)) {
|
|
108
108
|
const o = {};
|
|
109
|
-
Object.keys(s).forEach((
|
|
110
|
-
o[
|
|
109
|
+
Object.keys(s).forEach((n) => {
|
|
110
|
+
o[n] = Y(s[n]);
|
|
111
111
|
});
|
|
112
112
|
try {
|
|
113
113
|
i = `Object of ${JSON.stringify(o)}`;
|
|
@@ -117,49 +117,49 @@ function X(s) {
|
|
|
117
117
|
}
|
|
118
118
|
return i;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function fe(s, e, i) {
|
|
121
121
|
const t = i ? `${i}.` : "";
|
|
122
122
|
let o = !1;
|
|
123
123
|
return Object.keys(s).find((a) => {
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
o =
|
|
124
|
+
if (B(e[a])) {
|
|
125
|
+
const c = s[a];
|
|
126
|
+
o = fe(c, e[a], t + a);
|
|
127
127
|
} else
|
|
128
128
|
e[a] || (o = `Found additional key ${t}${a}`);
|
|
129
129
|
return o = o ? o.replace(/\sin.*/, "") : !1, o;
|
|
130
|
-
}) ? `${o} in ${
|
|
130
|
+
}) ? `${o} in ${b(s)}` : !1;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const t = function(a,
|
|
134
|
-
if (
|
|
135
|
-
return a ===
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
142
|
-
if (Array.isArray(
|
|
143
|
-
return
|
|
144
|
-
if (
|
|
145
|
-
return a instanceof
|
|
146
|
-
if (
|
|
147
|
-
return
|
|
148
|
-
if (typeof
|
|
149
|
-
throw new Error(`Cannot handler pattern ${
|
|
150
|
-
const
|
|
151
|
-
return
|
|
132
|
+
function lt(s, e, i) {
|
|
133
|
+
const t = function(a, c) {
|
|
134
|
+
if (c == null)
|
|
135
|
+
return a === c ? !1 : `Expected ${b(a)} to be ${c}`;
|
|
136
|
+
const r = at(a, c);
|
|
137
|
+
if (r !== null)
|
|
138
|
+
return r;
|
|
139
|
+
const f = nt(a, c);
|
|
140
|
+
if (f !== null)
|
|
141
|
+
return f;
|
|
142
|
+
if (Array.isArray(c))
|
|
143
|
+
return rt(a, c, i);
|
|
144
|
+
if (c instanceof Function)
|
|
145
|
+
return a instanceof c ? !1 : `Expected ${b(a, !0)} to be of Type ${Y(c)}`;
|
|
146
|
+
if (c === Object)
|
|
147
|
+
return X(a, {});
|
|
148
|
+
if (typeof c != "object")
|
|
149
|
+
throw new Error(`Cannot handler pattern ${c}`);
|
|
150
|
+
const h = X(a, c);
|
|
151
|
+
return h || (i ? fe(a, c) : !1);
|
|
152
152
|
};
|
|
153
153
|
let o;
|
|
154
|
-
return Array.isArray(e) && e.length > 1 ? e.every((a) => t(s, a)) && (o = `Expected ${
|
|
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 =
|
|
157
|
+
const t = lt(s, e, i);
|
|
158
158
|
if (t)
|
|
159
159
|
throw new Error(`Match failed: ${t}`);
|
|
160
160
|
return !1;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function ct(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 at(s, e, i) {
|
|
|
167
167
|
}
|
|
168
168
|
return i;
|
|
169
169
|
}
|
|
170
|
-
const
|
|
171
|
-
class
|
|
170
|
+
const dt = new j(), H = new Ie();
|
|
171
|
+
class ht extends me {
|
|
172
172
|
constructor(e) {
|
|
173
173
|
super(e), this.spot = e.spot;
|
|
174
174
|
}
|
|
@@ -182,48 +182,48 @@ class ct extends pe {
|
|
|
182
182
|
super.update(e);
|
|
183
183
|
else {
|
|
184
184
|
const i = this._planesPrimitives, t = this._outlinePrimitives;
|
|
185
|
-
i.length === 0 && (
|
|
185
|
+
i.length === 0 && (Re.eastNorthUpToFixedFrame(
|
|
186
186
|
this._camera.positionWC,
|
|
187
187
|
void 0,
|
|
188
|
-
|
|
189
|
-
), i[0] = new
|
|
188
|
+
H
|
|
189
|
+
), i[0] = new ee({
|
|
190
190
|
allowPicking: this.allowPicking,
|
|
191
|
-
geometryInstances: new
|
|
192
|
-
geometry: new
|
|
191
|
+
geometryInstances: new te({
|
|
192
|
+
geometry: new $e({
|
|
193
193
|
radius: 2
|
|
194
194
|
}),
|
|
195
195
|
attributes: {
|
|
196
|
-
color:
|
|
197
|
-
|
|
196
|
+
color: ie.fromColor(
|
|
197
|
+
j.fromAlpha(this._color, 0.1, dt)
|
|
198
198
|
)
|
|
199
199
|
},
|
|
200
|
-
modelMatrix:
|
|
200
|
+
modelMatrix: H
|
|
201
201
|
}),
|
|
202
|
-
appearance: new
|
|
202
|
+
appearance: new se({
|
|
203
203
|
translucent: !0,
|
|
204
204
|
flat: !0
|
|
205
205
|
}),
|
|
206
206
|
asynchronous: !1
|
|
207
|
-
}), t[0] = new
|
|
207
|
+
}), t[0] = new ee({
|
|
208
208
|
allowPicking: this.allowPicking,
|
|
209
|
-
geometryInstances: new
|
|
210
|
-
geometry: new
|
|
209
|
+
geometryInstances: new te({
|
|
210
|
+
geometry: new Ne({
|
|
211
211
|
radius: 2
|
|
212
212
|
}),
|
|
213
213
|
attributes: {
|
|
214
|
-
color:
|
|
214
|
+
color: ie.fromColor(this._color)
|
|
215
215
|
},
|
|
216
|
-
modelMatrix:
|
|
216
|
+
modelMatrix: H
|
|
217
217
|
}),
|
|
218
|
-
appearance: new
|
|
218
|
+
appearance: new se({
|
|
219
219
|
translucent: !1,
|
|
220
220
|
flat: !0
|
|
221
221
|
}),
|
|
222
222
|
asynchronous: !1
|
|
223
223
|
}));
|
|
224
224
|
const { length: o } = i;
|
|
225
|
-
for (let
|
|
226
|
-
t[
|
|
225
|
+
for (let n = 0; n < o; ++n)
|
|
226
|
+
t[n].update(e), i[n].update(e);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -231,14 +231,14 @@ const w = {
|
|
|
231
231
|
CONE: "cone",
|
|
232
232
|
THREESIXTY: "360"
|
|
233
233
|
};
|
|
234
|
-
function
|
|
235
|
-
const i = new
|
|
234
|
+
function ut(s, e) {
|
|
235
|
+
const i = new De(s), t = (
|
|
236
236
|
/** @type {import("@vcmap-cesium/engine").PerspectiveFrustum} */
|
|
237
237
|
i.frustum
|
|
238
238
|
);
|
|
239
239
|
return t.fov = e.fov, t.near = e.near, t.aspectRatio = e.aspectRatio, t.far = e.far, i;
|
|
240
240
|
}
|
|
241
|
-
const E = class E extends
|
|
241
|
+
const E = class E extends ge {
|
|
242
242
|
static get className() {
|
|
243
243
|
return "Viewshed";
|
|
244
244
|
}
|
|
@@ -249,7 +249,7 @@ const E = class E extends we {
|
|
|
249
249
|
static getDefaultOptions() {
|
|
250
250
|
return {
|
|
251
251
|
frustum: {
|
|
252
|
-
fov:
|
|
252
|
+
fov: T.PI / 3,
|
|
253
253
|
near: 1,
|
|
254
254
|
aspectRatio: 1,
|
|
255
255
|
far: 300
|
|
@@ -266,32 +266,31 @@ const E = class E extends we {
|
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* @param {ViewshedOptions} options The options for the viewshed.
|
|
269
|
-
* @param {import("@vcmap/core").CesiumMap} [cesiumMap] The cesiumMap the viewshed should be applied to. If this parameter is passed, the viewshed is activated and all other viewsheds are deactivated.
|
|
270
269
|
*/
|
|
271
|
-
constructor(e
|
|
272
|
-
var t, o,
|
|
270
|
+
constructor(e) {
|
|
271
|
+
var i, t, o, n, a, c;
|
|
273
272
|
super(e), this._cesiumMap = null, this._shadowCamera = null, this._scene = null, this._frustumOptions = {
|
|
274
|
-
fov: ((
|
|
275
|
-
far: ((
|
|
276
|
-
near: ((
|
|
277
|
-
aspectRatio: ((
|
|
273
|
+
fov: ((i = e.frustumOptions) == null ? void 0 : i.fov) || E.getDefaultOptions().frustum.fov,
|
|
274
|
+
far: ((t = e.frustumOptions) == null ? void 0 : t.far) || E.getDefaultOptions().frustum.far,
|
|
275
|
+
near: ((o = e.frustumOptions) == null ? void 0 : o.near) || E.getDefaultOptions().frustum.near,
|
|
276
|
+
aspectRatio: ((n = e.frustumOptions) == null ? void 0 : n.aspectRatio) || E.getDefaultOptions().frustum.aspectRatio
|
|
278
277
|
}, this._headingPitchRollValues = e.orientation || {
|
|
279
278
|
...E.getDefaultOptions().orientation
|
|
280
|
-
}, this._position = e.position || E.getDefaultOptions().position, this._viewshedType =
|
|
281
|
-
visibleColor:
|
|
282
|
-
((
|
|
279
|
+
}, this._position = e.position || E.getDefaultOptions().position, this._viewshedType = ct(e.viewshedType, w), this._colors = {
|
|
280
|
+
visibleColor: j.fromCssColorString(
|
|
281
|
+
((a = e.colorOptions) == null ? void 0 : a.visibleColor) || E.getDefaultOptions().visibleColor
|
|
283
282
|
),
|
|
284
|
-
shadowColor:
|
|
285
|
-
((
|
|
283
|
+
shadowColor: j.fromCssColorString(
|
|
284
|
+
((c = e.colorOptions) == null ? void 0 : c.shadowColor) || E.getDefaultOptions().shadowColor
|
|
286
285
|
)
|
|
287
|
-
}, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this.
|
|
286
|
+
}, this._heightOffset = e.heightOffset || 0, this._shadowMap = null, this._primitive = null, this._showPrimitive = !!e.showPrimitive, this._positionChanged = new x(), this._active = !1;
|
|
288
287
|
}
|
|
289
288
|
/**
|
|
290
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.
|
|
291
290
|
* @param {import("ol/coordinate").Coordinate} coords The new positions coordinates in degrees
|
|
292
291
|
*/
|
|
293
292
|
set position(e) {
|
|
294
|
-
z(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position =
|
|
293
|
+
z(e, [Number]), this._position = e, this._shadowCamera && (this._shadowCamera.position = O.fromDegrees(
|
|
295
294
|
e[0],
|
|
296
295
|
e[1],
|
|
297
296
|
e[2] + this._heightOffset
|
|
@@ -315,7 +314,7 @@ const E = class E extends we {
|
|
|
315
314
|
* @param {number} value the offset that is added to the position height.
|
|
316
315
|
*/
|
|
317
316
|
set heightOffset(e) {
|
|
318
|
-
this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position =
|
|
317
|
+
this._heightOffset = e, this._shadowCamera && (this._shadowCamera.position = O.fromDegrees(
|
|
319
318
|
this.position[0],
|
|
320
319
|
this.position[1],
|
|
321
320
|
this.position[2] + e
|
|
@@ -347,23 +346,23 @@ const E = class E extends we {
|
|
|
347
346
|
* @param {number} value The field of view in degrees.
|
|
348
347
|
*/
|
|
349
348
|
set fov(e) {
|
|
350
|
-
this._frustumOptions.fov = e *
|
|
349
|
+
this._frustumOptions.fov = e * T.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.frustum.fov = e * T.RADIANS_PER_DEGREE, this._viewshedType === w.CONE && this._updatePrimitive());
|
|
351
350
|
}
|
|
352
351
|
/**
|
|
353
352
|
* Returns the field of view.
|
|
354
353
|
* @returns {number} The field of view in degrees.
|
|
355
354
|
*/
|
|
356
355
|
get fov() {
|
|
357
|
-
return this._frustumOptions.fov *
|
|
356
|
+
return this._frustumOptions.fov * T.DEGREES_PER_RADIAN;
|
|
358
357
|
}
|
|
359
358
|
/**
|
|
360
359
|
* Sets the heading of a cone viewshed. Does not have impact on 360 viewshed.
|
|
361
360
|
* @param {number} value Heading in degrees.
|
|
362
361
|
*/
|
|
363
362
|
set heading(e) {
|
|
364
|
-
this._headingPitchRollValues.heading = e *
|
|
363
|
+
this._headingPitchRollValues.heading = e * T.RADIANS_PER_DEGREE, this._shadowCamera && (this._shadowCamera.setView({
|
|
365
364
|
orientation: {
|
|
366
|
-
heading: e *
|
|
365
|
+
heading: e * T.RADIANS_PER_DEGREE,
|
|
367
366
|
pitch: this._shadowCamera.pitch,
|
|
368
367
|
roll: 0
|
|
369
368
|
}
|
|
@@ -374,15 +373,15 @@ const E = class E extends we {
|
|
|
374
373
|
* @returns {number} The heading in degress.
|
|
375
374
|
*/
|
|
376
375
|
get heading() {
|
|
377
|
-
return this._headingPitchRollValues.heading *
|
|
376
|
+
return this._headingPitchRollValues.heading * T.DEGREES_PER_RADIAN;
|
|
378
377
|
}
|
|
379
378
|
/**
|
|
380
379
|
* Sets the pitch of a cone viewshed. 0 is horizontal. Does not have impact on 360 viewshed.
|
|
381
380
|
* @param {number} value The pitch in degrees.
|
|
382
381
|
*/
|
|
383
382
|
set pitch(e) {
|
|
384
|
-
if (this._headingPitchRollValues.pitch = e *
|
|
385
|
-
const i = e *
|
|
383
|
+
if (this._headingPitchRollValues.pitch = e * T.RADIANS_PER_DEGREE, this._shadowCamera) {
|
|
384
|
+
const i = e * T.RADIANS_PER_DEGREE - this._shadowCamera.pitch;
|
|
386
385
|
this._shadowCamera.lookUp(i), this._viewshedType === w.CONE && this._updatePrimitive();
|
|
387
386
|
}
|
|
388
387
|
}
|
|
@@ -391,7 +390,7 @@ const E = class E extends we {
|
|
|
391
390
|
* @returns {number} The pitch in degrees.
|
|
392
391
|
*/
|
|
393
392
|
get pitch() {
|
|
394
|
-
return this._headingPitchRollValues.pitch *
|
|
393
|
+
return this._headingPitchRollValues.pitch * T.DEGREES_PER_RADIAN;
|
|
395
394
|
}
|
|
396
395
|
/**
|
|
397
396
|
* Sets whether the primitive of the viewshed should be shown or not.
|
|
@@ -408,21 +407,27 @@ const E = class E extends we {
|
|
|
408
407
|
return this._showPrimitive;
|
|
409
408
|
}
|
|
410
409
|
/**
|
|
411
|
-
*
|
|
410
|
+
* Returns the type of the Viewshed.
|
|
412
411
|
* @returns {ViewshedTypes}
|
|
413
412
|
*/
|
|
414
413
|
get type() {
|
|
415
414
|
return this._viewshedType;
|
|
416
415
|
}
|
|
417
416
|
/**
|
|
418
|
-
*
|
|
417
|
+
* @returns {ShadowMap|null}
|
|
418
|
+
*/
|
|
419
|
+
get shadowMap() {
|
|
420
|
+
return this._shadowMap;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Deactivates the viewshed by removing primitive and removing shadowMap.
|
|
419
424
|
*/
|
|
420
425
|
deactivate() {
|
|
421
|
-
var e
|
|
422
|
-
this._active && (this._removePrimitive(),
|
|
426
|
+
var e;
|
|
427
|
+
this._active && (this._removePrimitive(), this._shadowMap.enabled = !1, (e = this._shadowMap) == null || e.destroy(), this._shadowCamera = null, this._scene = null, this._cesiumMap = null, this._shadowMap = null, this._active = !1);
|
|
423
428
|
}
|
|
424
429
|
/**
|
|
425
|
-
* Activates viewshed.
|
|
430
|
+
* Activates viewshed.
|
|
426
431
|
* @param {import("@vcmap/core").CesiumMap} cesiumMap The cesium map to which the shadow map of the viewshed is applied to.
|
|
427
432
|
*/
|
|
428
433
|
activate(e) {
|
|
@@ -430,12 +435,10 @@ const E = class E extends we {
|
|
|
430
435
|
this._cesiumMap = e;
|
|
431
436
|
const i = e.getScene();
|
|
432
437
|
if (i)
|
|
433
|
-
this._shadowCamera =
|
|
438
|
+
this._shadowCamera = ut(i, this._frustumOptions), this._position && (this.position = this._position), this._scene = i;
|
|
434
439
|
else
|
|
435
440
|
throw new Error("CesiumMap contains no scene");
|
|
436
|
-
this._updateShadowMap(), this._updatePrimitive()
|
|
437
|
-
this._shadowMap !== t && this.deactivate();
|
|
438
|
-
});
|
|
441
|
+
this._updateShadowMap(), this._updatePrimitive();
|
|
439
442
|
}
|
|
440
443
|
}
|
|
441
444
|
/**
|
|
@@ -443,7 +446,7 @@ const E = class E extends we {
|
|
|
443
446
|
*/
|
|
444
447
|
_updateShadowMap() {
|
|
445
448
|
var e;
|
|
446
|
-
!this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((e = this._shadowMap) == null || e.destroy(), this._shadowMap = new
|
|
449
|
+
!this._active || !this._shadowCamera || !this._cesiumMap || !this._scene || ((e = this._shadowMap) == null || e.destroy(), this._shadowMap = new xe({
|
|
447
450
|
// @ts-ignore
|
|
448
451
|
context: this._scene.context,
|
|
449
452
|
lightCamera: this._shadowCamera,
|
|
@@ -458,11 +461,11 @@ const E = class E extends we {
|
|
|
458
461
|
}), this._shadowMap.viewshed = this._colors, this._cesiumMap.setShadowMap(this._shadowMap));
|
|
459
462
|
}
|
|
460
463
|
_removePrimitive() {
|
|
461
|
-
var e;
|
|
462
|
-
this._primitive && ((e = this._scene) == null ||
|
|
464
|
+
var e, i, t;
|
|
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);
|
|
463
466
|
}
|
|
464
467
|
_updatePrimitive() {
|
|
465
|
-
this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new
|
|
468
|
+
this._showPrimitive && this._active && this._scene ? (this._removePrimitive(), this._primitive = new ht({
|
|
466
469
|
camera: this._shadowCamera,
|
|
467
470
|
allowPicking: !1,
|
|
468
471
|
spot: this._viewshedType === w.CONE
|
|
@@ -475,10 +478,10 @@ const E = class E extends we {
|
|
|
475
478
|
lookAt(e) {
|
|
476
479
|
if (!this._shadowCamera)
|
|
477
480
|
return;
|
|
478
|
-
const i =
|
|
479
|
-
if (this.distance =
|
|
480
|
-
const t = new
|
|
481
|
-
|
|
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({
|
|
482
485
|
orientation: {
|
|
483
486
|
direction: i,
|
|
484
487
|
up: t
|
|
@@ -510,18 +513,20 @@ const E = class E extends we {
|
|
|
510
513
|
* Destroys the viewshed.
|
|
511
514
|
*/
|
|
512
515
|
destroy() {
|
|
513
|
-
|
|
516
|
+
var t;
|
|
517
|
+
const e = this._cesiumMap, i = this._shadowMap;
|
|
518
|
+
this.deactivate(), ((t = e == null ? void 0 : e.getScene()) == null ? void 0 : t.shadowMap) === i && e.setDefaultShadowMap();
|
|
514
519
|
}
|
|
515
520
|
};
|
|
516
|
-
|
|
521
|
+
Q(E, "MIN_DISTANCE", 10);
|
|
517
522
|
let M = E;
|
|
518
|
-
class
|
|
523
|
+
class ft extends _e {
|
|
519
524
|
/**
|
|
520
525
|
*
|
|
521
526
|
* @param {import("./viewshed").default} viewshed
|
|
522
527
|
*/
|
|
523
528
|
constructor(e) {
|
|
524
|
-
super(
|
|
529
|
+
super(N.CLICKMOVE), this._viewshed = e, this._positioned = new x(), this._finished = new x(), this._position = !1, this.setActive();
|
|
525
530
|
}
|
|
526
531
|
get finished() {
|
|
527
532
|
return this._finished;
|
|
@@ -530,7 +535,7 @@ class ht extends me {
|
|
|
530
535
|
return this._positioned;
|
|
531
536
|
}
|
|
532
537
|
async pipe(e) {
|
|
533
|
-
return e.position && (this._position ? (this._viewshed.lookAt(I.mercatorToWgs84(e.position)), e.type &
|
|
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;
|
|
534
539
|
}
|
|
535
540
|
destroy() {
|
|
536
541
|
super.destroy(), this._finished.destroy(), this._positioned.destroy();
|
|
@@ -539,21 +544,21 @@ class ht extends me {
|
|
|
539
544
|
const y = {
|
|
540
545
|
ABSOLUTE: "absolute",
|
|
541
546
|
RELATIVE: "relative"
|
|
542
|
-
},
|
|
547
|
+
}, m = {
|
|
543
548
|
CREATE: "create",
|
|
544
549
|
VIEW: "view",
|
|
545
550
|
EDIT: "edit",
|
|
546
551
|
MOVE: "move",
|
|
547
552
|
MULTI_SELECT: "multiSelect"
|
|
548
|
-
},
|
|
549
|
-
function
|
|
550
|
-
const e = new
|
|
551
|
-
projection:
|
|
552
|
-
zIndex:
|
|
553
|
+
}, re = 1.8;
|
|
554
|
+
function vt(s) {
|
|
555
|
+
const e = new Ve({
|
|
556
|
+
projection: be.toJSON(),
|
|
557
|
+
zIndex: Me - 1
|
|
553
558
|
});
|
|
554
|
-
|
|
555
|
-
const i = new
|
|
556
|
-
return i.setStyle(new
|
|
559
|
+
Te(e), e.activate();
|
|
560
|
+
const i = new ze(new Ge(s));
|
|
561
|
+
return i.setStyle(new He({})), e.addFeatures([i]), e.vectorProperties.altitudeMode = Le.NONE, {
|
|
557
562
|
layer: e,
|
|
558
563
|
feature: i,
|
|
559
564
|
destroy() {
|
|
@@ -561,119 +566,123 @@ function ut(s) {
|
|
|
561
566
|
}
|
|
562
567
|
};
|
|
563
568
|
}
|
|
564
|
-
function
|
|
565
|
-
const i = e === y.ABSOLUTE ?
|
|
569
|
+
function U(s, e) {
|
|
570
|
+
const i = e === y.ABSOLUTE ? N.CLICKMOVE : N.NONE;
|
|
566
571
|
s.setActive(i), s.pickPosition = i, s.pullPickedPosition = 1.8;
|
|
567
572
|
}
|
|
568
|
-
function
|
|
569
|
-
const t =
|
|
570
|
-
let
|
|
573
|
+
function pt(s, e, i) {
|
|
574
|
+
const t = K(null), o = A(null), n = A(null), a = A(y.ABSOLUTE);
|
|
575
|
+
let c = () => {
|
|
576
|
+
};
|
|
577
|
+
const r = K(null);
|
|
578
|
+
let f = () => {
|
|
571
579
|
};
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
o.value && t.value ? (t.value.deactivate(), i.setVisibility(t.value.name, !1)) : (f = t.value) == null || f.destroy(), t.value = h, (d = t.value) == null || d.activate(s.maps.activeMap);
|
|
580
|
+
function h() {
|
|
581
|
+
var l;
|
|
582
|
+
o.value && t.value ? (t.value.deactivate(), i.setVisibility(t.value.name, !1)) : (l = t.value) == null || l.destroy();
|
|
576
583
|
}
|
|
577
|
-
function
|
|
578
|
-
|
|
584
|
+
function v(l = !0) {
|
|
585
|
+
f(), c(), h(), t.value = null, l && i.clearSelection(), o.value = null, n.value = null;
|
|
579
586
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
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) => {
|
|
589
|
+
var p;
|
|
590
|
+
d !== ((p = t.value) == null ? void 0 : p.shadowMap) && v(!1);
|
|
591
|
+
}));
|
|
592
|
+
}
|
|
593
|
+
async function _(l) {
|
|
594
|
+
v(), await ke();
|
|
595
|
+
const { eventHandler: d } = s.maps, { featureInteraction: p } = d, g = new M({
|
|
596
|
+
viewshedType: l,
|
|
597
|
+
colorOptions: {
|
|
598
|
+
visibleColor: e.visibleColor,
|
|
599
|
+
shadowColor: e.shadowColor
|
|
591
600
|
},
|
|
592
|
-
|
|
593
|
-
s.maps.activeMap
|
|
594
|
-
);
|
|
595
|
-
const p = new ht(t.value);
|
|
596
|
-
p.finished.addEventListener(() => {
|
|
597
|
-
l(), t.value ? (t.value.showPrimitive = !0, r.value = g.EDIT) : c();
|
|
601
|
+
heightOffset: a.value === y.ABSOLUTE ? 0 : re
|
|
598
602
|
});
|
|
599
|
-
|
|
600
|
-
|
|
603
|
+
u(g);
|
|
604
|
+
const C = new ft(t.value);
|
|
605
|
+
C.finished.addEventListener(() => {
|
|
606
|
+
c(), t.value ? (t.value.showPrimitive = !0, n.value = m.EDIT) : v();
|
|
607
|
+
});
|
|
608
|
+
const k = d.addExclusiveInteraction(
|
|
609
|
+
C,
|
|
601
610
|
() => {
|
|
602
|
-
|
|
611
|
+
C.destroy();
|
|
603
612
|
}
|
|
604
613
|
);
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}),
|
|
608
|
-
|
|
614
|
+
U(p, a.value), C.positioned.addEventListener(() => {
|
|
615
|
+
U(p, y.ABSOLUTE);
|
|
616
|
+
}), c = () => {
|
|
617
|
+
k(), C.destroy(), p.setActive(), c = () => {
|
|
609
618
|
};
|
|
610
|
-
},
|
|
619
|
+
}, n.value = m.CREATE;
|
|
611
620
|
}
|
|
612
|
-
function
|
|
613
|
-
var
|
|
614
|
-
if (t.value &&
|
|
615
|
-
|
|
621
|
+
function V(l) {
|
|
622
|
+
var d;
|
|
623
|
+
if (t.value && l) {
|
|
624
|
+
c();
|
|
616
625
|
const {
|
|
617
|
-
layer:
|
|
618
|
-
feature:
|
|
626
|
+
layer: p,
|
|
627
|
+
feature: g,
|
|
619
628
|
destroy: C
|
|
620
|
-
} =
|
|
621
|
-
s.layers.add(
|
|
622
|
-
|
|
629
|
+
} = vt(t.value.position);
|
|
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
|
+
c();
|
|
623
632
|
});
|
|
624
|
-
const
|
|
633
|
+
const k = (d = g.getGeometry()) == null ? void 0 : d.on("change", () => {
|
|
625
634
|
t.value ? t.value.position = I.mercatorToWgs84(
|
|
626
635
|
/** @type {import("ol/geom").Point} */
|
|
627
|
-
|
|
628
|
-
) :
|
|
636
|
+
g.getGeometry().getCoordinates()
|
|
637
|
+
) : v();
|
|
629
638
|
});
|
|
630
|
-
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
},
|
|
639
|
+
n.value = m.MOVE, c = () => {
|
|
640
|
+
var q;
|
|
641
|
+
c = () => {
|
|
642
|
+
}, k && Be(k), (q = r.value) == null || q.stop(), r.value = null, s.layers.remove(p), C(), n.value = m.EDIT;
|
|
634
643
|
};
|
|
635
644
|
} else
|
|
636
|
-
|
|
645
|
+
c();
|
|
637
646
|
}
|
|
638
|
-
function
|
|
639
|
-
|
|
647
|
+
function P(l, d) {
|
|
648
|
+
c(), t.value !== d && (u(d), a.value = d.heightOffset ? y.RELATIVE : y.ABSOLUTE), o.value = !!d.properties.title, n.value = l, o.value && i.setVisibility(d.name, !0);
|
|
640
649
|
}
|
|
641
|
-
const
|
|
650
|
+
const L = [
|
|
642
651
|
i.collectionComponent.collection.removed.addEventListener(
|
|
643
|
-
(
|
|
644
|
-
var
|
|
645
|
-
i.remove(
|
|
652
|
+
(l) => {
|
|
653
|
+
var d;
|
|
654
|
+
i.remove(l.name), ((d = t.value) == null ? void 0 : d.name) === l.name && v();
|
|
646
655
|
}
|
|
647
656
|
),
|
|
648
|
-
i.renamed.addEventListener(({ item:
|
|
649
|
-
var
|
|
650
|
-
const
|
|
657
|
+
i.renamed.addEventListener(({ item: l, title: d }) => {
|
|
658
|
+
var g;
|
|
659
|
+
const p = s.windowManager.get(
|
|
651
660
|
`${i.collectionComponent.id}-editor`
|
|
652
661
|
);
|
|
653
|
-
|
|
662
|
+
p && ((g = t.value) == null ? void 0 : g.name) === l.name && (p.state.headerTitle = d);
|
|
654
663
|
}),
|
|
655
|
-
i.visibilityChanged.addEventListener((
|
|
656
|
-
var
|
|
657
|
-
const
|
|
658
|
-
|
|
664
|
+
i.visibilityChanged.addEventListener((l) => {
|
|
665
|
+
var p;
|
|
666
|
+
const d = ((p = t.value) == null ? void 0 : p.name) === l.name;
|
|
667
|
+
d ? v() : (P(m.VIEW, l), i.clearSelection()), i.setVisibility(l.name, !d);
|
|
659
668
|
})
|
|
660
669
|
];
|
|
661
|
-
function
|
|
662
|
-
if (!(
|
|
663
|
-
if (a.value =
|
|
664
|
-
|
|
670
|
+
function G(l) {
|
|
671
|
+
if (!(l === a.value || !t.value)) {
|
|
672
|
+
if (a.value = l, n.value === m.MOVE && c(), n.value === m.CREATE)
|
|
673
|
+
U(
|
|
665
674
|
s.maps.eventHandler.featureInteraction,
|
|
666
|
-
|
|
667
|
-
), t.value.heightOffset =
|
|
668
|
-
else if (
|
|
669
|
-
const { position:
|
|
670
|
-
|
|
671
|
-
const C = I.mercatorToWgs84(
|
|
672
|
-
t.value && (t.value.heightOffset =
|
|
675
|
+
l
|
|
676
|
+
), t.value.heightOffset = l === y.ABSOLUTE ? 0 : re;
|
|
677
|
+
else if (n.value === m.EDIT) {
|
|
678
|
+
const { position: d, heightOffset: p } = t.value;
|
|
679
|
+
l === y.RELATIVE ? s.maps.activeMap.getHeightFromTerrain([I.wgs84ToMercator(d)]).then((g) => {
|
|
680
|
+
const C = I.mercatorToWgs84(g[0]);
|
|
681
|
+
t.value && (t.value.heightOffset = d[2] - C[2], t.value.position = C);
|
|
673
682
|
}) : (t.value.position = [
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
683
|
+
d[0],
|
|
684
|
+
d[1],
|
|
685
|
+
d[2] + p
|
|
677
686
|
], t.value.heightOffset = 0);
|
|
678
687
|
}
|
|
679
688
|
}
|
|
@@ -681,86 +690,86 @@ function ft(s, e, i) {
|
|
|
681
690
|
return {
|
|
682
691
|
currentViewshed: t,
|
|
683
692
|
currentIsPersisted: o,
|
|
684
|
-
currentEditSession:
|
|
685
|
-
createViewshed:
|
|
686
|
-
viewViewshed(
|
|
687
|
-
|
|
693
|
+
currentEditSession: r,
|
|
694
|
+
createViewshed: _,
|
|
695
|
+
viewViewshed(l) {
|
|
696
|
+
P(m.VIEW, l);
|
|
688
697
|
},
|
|
689
|
-
editViewshed(
|
|
690
|
-
|
|
698
|
+
editViewshed(l) {
|
|
699
|
+
P(m.EDIT, l), o.value && (i.setSelection(l.name), i.collectionComponent.openEditorWindow(l));
|
|
691
700
|
},
|
|
692
701
|
persistCurrent() {
|
|
693
702
|
t.value && (i.add(t.value), o.value = !0, i.setSelection(t.value.name), i.setVisibility(t.value.name, !0));
|
|
694
703
|
},
|
|
695
|
-
moveCurrentViewshed:
|
|
704
|
+
moveCurrentViewshed: V,
|
|
696
705
|
setupMultiSelect() {
|
|
697
|
-
|
|
706
|
+
c(), n.value = m.MULTI_SELECT, h(), t.value = null;
|
|
698
707
|
},
|
|
699
|
-
mode:
|
|
708
|
+
mode: n,
|
|
700
709
|
heightMode: a,
|
|
701
|
-
changeHeightMode:
|
|
710
|
+
changeHeightMode: G,
|
|
702
711
|
async placeCurrentFeaturesOnTerrain() {
|
|
703
|
-
var
|
|
704
|
-
if (t.value && ((
|
|
705
|
-
const
|
|
706
|
-
I.wgs84ToMercator((
|
|
712
|
+
var l, d;
|
|
713
|
+
if (t.value && ((l = r.value) == null ? void 0 : l.type) === Ce.EDIT_FEATURES && s.maps.activeMap instanceof D) {
|
|
714
|
+
const g = (await s.maps.activeMap.getHeightFromTerrain([
|
|
715
|
+
I.wgs84ToMercator((d = t.value) == null ? void 0 : d.position)
|
|
707
716
|
]))[0][2] - t.value.position[2];
|
|
708
|
-
|
|
717
|
+
r.value.translate(0, 0, g);
|
|
709
718
|
}
|
|
710
719
|
},
|
|
711
|
-
stop:
|
|
720
|
+
stop: v,
|
|
712
721
|
destroy() {
|
|
713
|
-
|
|
722
|
+
v(), L.forEach((l) => l());
|
|
714
723
|
}
|
|
715
724
|
};
|
|
716
725
|
}
|
|
717
|
-
function
|
|
718
|
-
var
|
|
719
|
-
e && (
|
|
720
|
-
var
|
|
721
|
-
if (a ? (
|
|
722
|
-
|
|
726
|
+
function ve(s, e, i, t, o, n, a, c) {
|
|
727
|
+
var r = typeof s == "function" ? s.options : s;
|
|
728
|
+
e && (r.render = e, r.staticRenderFns = i, r._compiled = !0), t && (r.functional = !0), n && (r._scopeId = "data-v-" + n);
|
|
729
|
+
var f;
|
|
730
|
+
if (a ? (f = function(u) {
|
|
731
|
+
u = u || // cached call
|
|
723
732
|
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
724
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !
|
|
725
|
-
},
|
|
733
|
+
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !u && typeof __VUE_SSR_CONTEXT__ < "u" && (u = __VUE_SSR_CONTEXT__), o && o.call(this, u), u && u._registeredComponents && u._registeredComponents.add(a);
|
|
734
|
+
}, r._ssrRegister = f) : o && (f = c ? function() {
|
|
726
735
|
o.call(
|
|
727
736
|
this,
|
|
728
|
-
(
|
|
737
|
+
(r.functional ? this.parent : this).$root.$options.shadowRoot
|
|
729
738
|
);
|
|
730
|
-
} : o),
|
|
731
|
-
if (
|
|
732
|
-
|
|
733
|
-
var
|
|
734
|
-
|
|
735
|
-
return
|
|
739
|
+
} : o), f)
|
|
740
|
+
if (r.functional) {
|
|
741
|
+
r._injectStyles = f;
|
|
742
|
+
var h = r.render;
|
|
743
|
+
r.render = function(_, V) {
|
|
744
|
+
return f.call(V), h(_, V);
|
|
736
745
|
};
|
|
737
746
|
} else {
|
|
738
|
-
var
|
|
739
|
-
|
|
747
|
+
var v = r.beforeCreate;
|
|
748
|
+
r.beforeCreate = v ? [].concat(v, f) : [f];
|
|
740
749
|
}
|
|
741
750
|
return {
|
|
742
751
|
exports: s,
|
|
743
|
-
options:
|
|
752
|
+
options: r
|
|
744
753
|
};
|
|
745
754
|
}
|
|
746
|
-
const
|
|
755
|
+
const wt = {
|
|
747
756
|
distance: [M.MIN_DISTANCE, 2e3],
|
|
748
757
|
fov: [25, 85],
|
|
749
758
|
heading: [0, 360],
|
|
750
759
|
pitch: [-90, 90]
|
|
751
|
-
},
|
|
760
|
+
}, mt = {
|
|
752
761
|
components: {
|
|
753
|
-
VcsTextField:
|
|
754
|
-
VContainer:
|
|
755
|
-
VRow:
|
|
756
|
-
VCol:
|
|
757
|
-
VcsSlider:
|
|
758
|
-
VcsLabel:
|
|
759
|
-
VcsFormSection:
|
|
760
|
-
VDivider:
|
|
761
|
-
VcsSelect:
|
|
762
|
-
VcsFormButton:
|
|
763
|
-
VcsFeatureTransforms:
|
|
762
|
+
VcsTextField: Ue,
|
|
763
|
+
VContainer: de,
|
|
764
|
+
VRow: he,
|
|
765
|
+
VCol: ue,
|
|
766
|
+
VcsSlider: Ke,
|
|
767
|
+
VcsLabel: ae,
|
|
768
|
+
VcsFormSection: le,
|
|
769
|
+
VDivider: st,
|
|
770
|
+
VcsSelect: ce,
|
|
771
|
+
VcsFormButton: Xe,
|
|
772
|
+
VcsFeatureTransforms: Ye
|
|
764
773
|
},
|
|
765
774
|
name: "ViewshedWindow",
|
|
766
775
|
props: {
|
|
@@ -778,87 +787,87 @@ const vt = {
|
|
|
778
787
|
setup(s) {
|
|
779
788
|
const e = (
|
|
780
789
|
/** @type {import("./viewshedManager.js").ViewshedManager} */
|
|
781
|
-
|
|
790
|
+
oe("manager")
|
|
782
791
|
), i = (
|
|
783
792
|
/** @type {import("@vcmap/ui").VcsUiApp} */
|
|
784
|
-
|
|
793
|
+
oe("vcsApp")
|
|
785
794
|
), {
|
|
786
795
|
currentViewshed: t,
|
|
787
796
|
mode: o,
|
|
788
|
-
currentIsPersisted:
|
|
789
|
-
} = e, a =
|
|
790
|
-
let
|
|
797
|
+
currentIsPersisted: n
|
|
798
|
+
} = e, a = ne(() => s.selection);
|
|
799
|
+
let c = () => {
|
|
791
800
|
};
|
|
792
|
-
const
|
|
801
|
+
const r = W({
|
|
793
802
|
X: void 0,
|
|
794
803
|
Y: void 0,
|
|
795
804
|
Z: void 0
|
|
796
|
-
}),
|
|
797
|
-
let
|
|
805
|
+
}), f = K();
|
|
806
|
+
let h = () => {
|
|
798
807
|
};
|
|
799
|
-
const
|
|
808
|
+
const v = W({
|
|
800
809
|
showPrimitive: !1,
|
|
801
810
|
distance: void 0,
|
|
802
811
|
fov: void 0,
|
|
803
812
|
heading: void 0,
|
|
804
813
|
pitch: void 0
|
|
805
|
-
}),
|
|
814
|
+
}), u = A();
|
|
806
815
|
function _() {
|
|
807
|
-
t.value && (
|
|
816
|
+
t.value && (r.X = t.value.position[0], r.Y = t.value.position[1], r.Z = e.heightMode.value === y.ABSOLUTE ? t.value.position[2] : t.value.heightOffset);
|
|
808
817
|
}
|
|
809
818
|
function V() {
|
|
810
|
-
_(), t.value && (
|
|
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);
|
|
811
820
|
}
|
|
812
|
-
|
|
813
|
-
t.value && o.value !==
|
|
821
|
+
Fe(() => {
|
|
822
|
+
t.value && o.value !== m.CREATE && V();
|
|
814
823
|
}), R(
|
|
815
824
|
t,
|
|
816
825
|
() => {
|
|
817
|
-
t.value && (
|
|
818
|
-
_(),
|
|
826
|
+
t.value && (c(), c = t.value.positionChanged.addEventListener(() => {
|
|
827
|
+
_(), h();
|
|
819
828
|
}));
|
|
820
829
|
},
|
|
821
830
|
{ immediate: !0 }
|
|
822
831
|
);
|
|
823
|
-
async function
|
|
824
|
-
var
|
|
825
|
-
(
|
|
826
|
-
const
|
|
832
|
+
async function P() {
|
|
833
|
+
var p, g;
|
|
834
|
+
(p = t.value) == null || p.deactivate();
|
|
835
|
+
const l = (
|
|
827
836
|
/** @type {import("@vcmap/core").CesiumMap} */
|
|
828
|
-
(
|
|
829
|
-
),
|
|
830
|
-
|
|
837
|
+
(g = i.maps.activeMap.getScene()) == null ? void 0 : g.camera
|
|
838
|
+
), d = l == null ? void 0 : l.changed.addEventListener(() => {
|
|
839
|
+
h();
|
|
831
840
|
});
|
|
832
|
-
|
|
833
|
-
var
|
|
834
|
-
|
|
841
|
+
h = () => {
|
|
842
|
+
var C;
|
|
843
|
+
d == null || d(), f.value = null, (C = t.value) == null || C.activate(i.maps.activeMap), h = () => {
|
|
835
844
|
};
|
|
836
845
|
};
|
|
837
846
|
}
|
|
838
|
-
|
|
839
|
-
var
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
}),
|
|
843
|
-
|
|
847
|
+
je(() => {
|
|
848
|
+
var d;
|
|
849
|
+
const l = (d = s.getViewshed) == null ? void 0 : d.call(s);
|
|
850
|
+
l && e.editViewshed(l);
|
|
851
|
+
}), We(() => {
|
|
852
|
+
c(), h(), n.value || ((o.value === m.EDIT || o.value === m.MOVE) && t.value ? e.viewViewshed(t.value) : o.value === m.CREATE && e.stop()), a.value && (a.value.length > 1 ? e.setupMultiSelect() : a.value.length === 1 && t.value ? e.viewViewshed(t.value) : (
|
|
844
853
|
// when a persited viewshed is deselected, stops plugin
|
|
845
|
-
!a.value.length && o.value ===
|
|
854
|
+
!a.value.length && o.value === m.EDIT && e.stop(!1)
|
|
846
855
|
));
|
|
847
856
|
}), V();
|
|
848
|
-
function
|
|
849
|
-
|
|
857
|
+
function L(l, d) {
|
|
858
|
+
h(), t.value && (v[l] = d, t.value[l] = d);
|
|
850
859
|
}
|
|
851
|
-
const
|
|
852
|
-
const
|
|
853
|
-
return
|
|
860
|
+
const G = ne(() => {
|
|
861
|
+
const l = [];
|
|
862
|
+
return u.value === w.CONE && l.push({
|
|
854
863
|
name: "jumpToViewpoint",
|
|
855
|
-
title:
|
|
864
|
+
title: f.value ? "viewshed.returnToViewpoint" : "viewshed.jumpToViewpoint",
|
|
856
865
|
icon: "mdi-human-male",
|
|
857
|
-
active: !!
|
|
866
|
+
active: !!f.value,
|
|
858
867
|
async callback() {
|
|
859
|
-
var
|
|
860
|
-
e.moveCurrentViewshed(!1), t.value && !
|
|
861
|
-
new
|
|
868
|
+
var d, p, g;
|
|
869
|
+
e.moveCurrentViewshed(!1), t.value && !f.value ? (f.value = await ((d = i.maps.activeMap) == null ? void 0 : d.getViewpoint()), await ((p = i.maps.activeMap) == null ? void 0 : p.gotoViewpoint(
|
|
870
|
+
new Oe({
|
|
862
871
|
groundPosition: [
|
|
863
872
|
t.value.position[0],
|
|
864
873
|
t.value.position[1],
|
|
@@ -870,71 +879,71 @@ const vt = {
|
|
|
870
879
|
animate: !0
|
|
871
880
|
// if not animate, async does not work and the cameraChanged listener is triggered immediately. alternatively set timeout
|
|
872
881
|
})
|
|
873
|
-
)),
|
|
882
|
+
)), P()) : f.value && ((g = i.maps.activeMap) == null || g.gotoViewpoint(f.value), h());
|
|
874
883
|
}
|
|
875
|
-
}),
|
|
884
|
+
}), l.push({
|
|
876
885
|
name: "moveViewshed",
|
|
877
886
|
title: "viewshed.move",
|
|
878
887
|
icon: e.heightMode.value === y.RELATIVE ? "$vcsEditVertices" : "mdi-axis-arrow",
|
|
879
|
-
active: o.value ===
|
|
888
|
+
active: o.value === m.MOVE,
|
|
880
889
|
callback() {
|
|
881
890
|
e.moveCurrentViewshed(
|
|
882
|
-
o.value !==
|
|
891
|
+
o.value !== m.MOVE
|
|
883
892
|
);
|
|
884
893
|
}
|
|
885
|
-
}),
|
|
894
|
+
}), l.unshift({
|
|
886
895
|
name: "showPrimitive",
|
|
887
896
|
title: "viewshed.showPrimitive",
|
|
888
897
|
icon: "mdi-eye",
|
|
889
|
-
active:
|
|
898
|
+
active: v.showPrimitive,
|
|
890
899
|
callback() {
|
|
891
|
-
this.active = !this.active,
|
|
900
|
+
this.active = !this.active, L("showPrimitive", this.active);
|
|
892
901
|
}
|
|
893
|
-
}),
|
|
902
|
+
}), l;
|
|
894
903
|
});
|
|
895
904
|
return {
|
|
896
|
-
position:
|
|
897
|
-
setPosition(d, p
|
|
898
|
-
if (
|
|
899
|
-
if (
|
|
900
|
-
t.value.heightOffset = Number(
|
|
905
|
+
position: r,
|
|
906
|
+
setPosition(l, d, p) {
|
|
907
|
+
if (h(), !!t.value) {
|
|
908
|
+
if (p === 2 && e.heightMode.value === y.RELATIVE)
|
|
909
|
+
t.value.heightOffset = Number(l);
|
|
901
910
|
else {
|
|
902
|
-
const
|
|
903
|
-
|
|
911
|
+
const g = [...t.value.position];
|
|
912
|
+
g[p] = Number(l), t.value.position = g;
|
|
904
913
|
}
|
|
905
|
-
|
|
914
|
+
r[d] = Number(l);
|
|
906
915
|
}
|
|
907
916
|
},
|
|
908
|
-
parameters:
|
|
909
|
-
setParameter:
|
|
910
|
-
parameterRanges:
|
|
911
|
-
ViewshedPluginModes:
|
|
917
|
+
parameters: v,
|
|
918
|
+
setParameter: L,
|
|
919
|
+
parameterRanges: wt,
|
|
920
|
+
ViewshedPluginModes: m,
|
|
912
921
|
viewshedMode: o,
|
|
913
|
-
currentIsPersisted:
|
|
914
|
-
viewshedType:
|
|
922
|
+
currentIsPersisted: n,
|
|
923
|
+
viewshedType: u,
|
|
915
924
|
ViewshedTypes: w,
|
|
916
925
|
HeightModes: y,
|
|
917
926
|
heightMode: e.heightMode,
|
|
918
|
-
TransformationMode:
|
|
927
|
+
TransformationMode: Se,
|
|
919
928
|
changeHeightMode: e.changeHeightMode,
|
|
920
929
|
async createNewViewshed() {
|
|
921
|
-
await e.createViewshed(
|
|
930
|
+
await e.createViewshed(u.value);
|
|
922
931
|
},
|
|
923
932
|
addToMyWorkspace: () => e.persistCurrent(),
|
|
924
933
|
cancel: () => e.stop(),
|
|
925
|
-
headerActions:
|
|
934
|
+
headerActions: G
|
|
926
935
|
};
|
|
927
936
|
}
|
|
928
937
|
};
|
|
929
|
-
var
|
|
938
|
+
var gt = function() {
|
|
930
939
|
var e = this, i = e._self._c;
|
|
931
|
-
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,
|
|
932
|
-
return i("v-col", { key:
|
|
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
|
+
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);
|
|
933
942
|
}), 1)], 1)], 1) : e._e(), i("v-divider"), i("v-container", { staticClass: "px-1 py-0" }, [i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", [e._v(" " + e._s(e.$t("viewshed.heightMode")) + " ")])], 1), i("v-col", [i("VcsSelect", { attrs: { items: Object.values(e.HeightModes).map((t) => ({
|
|
934
943
|
value: t,
|
|
935
944
|
text: `viewshed.${t}`
|
|
936
945
|
})), value: e.heightMode }, on: { input: e.changeHeightMode } })], 1)], 1)], 1), e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("v-container", { staticClass: "px-1 pt-0 pb-2" }, e._l(e.parameters, function(t, o) {
|
|
937
|
-
return i("v-row", { key: o, attrs: { "no-gutters": "" } }, [o === "distance" || e.viewshedType === e.ViewshedTypes.CONE && o !== "showPrimitive" ? i("v-col", [i("v-row", { staticClass: "pr-1", attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": o } }, [e._v(" " + e._s(e.$t(`viewshed.${o}`)) + " ")])], 1), i("v-col", { staticClass: "d-flex justify-end align-center" }, [o === "distance" ? i("span", [e._v(e._s(`${t} m`))]) : i("span", [e._v(e._s(`${t} °`))])])], 1), i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsSlider", { attrs: { id: o, value: t, type: "number", step: "1", min: e.parameterRanges[o][0], max: e.parameterRanges[o][1], height: "15" }, on: { input: (
|
|
946
|
+
return i("v-row", { key: o, attrs: { "no-gutters": "" } }, [o === "distance" || e.viewshedType === e.ViewshedTypes.CONE && o !== "showPrimitive" ? i("v-col", [i("v-row", { staticClass: "pr-1", attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsLabel", { attrs: { "html-for": o } }, [e._v(" " + e._s(e.$t(`viewshed.${o}`)) + " ")])], 1), i("v-col", { staticClass: "d-flex justify-end align-center" }, [o === "distance" ? i("span", [e._v(e._s(`${t} m`))]) : i("span", [e._v(e._s(`${t} °`))])])], 1), i("v-row", { attrs: { "no-gutters": "" } }, [i("v-col", [i("VcsSlider", { attrs: { id: o, value: t, type: "number", step: "1", min: e.parameterRanges[o][0], max: e.parameterRanges[o][1], height: "15" }, on: { input: (n) => e.setParameter(o, n) } })], 1)], 1)], 1) : e._e()], 1);
|
|
938
947
|
}), 1) : e._e(), i("v-divider"), e.viewshedMode === e.ViewshedPluginModes.EDIT || e.viewshedMode === e.ViewshedPluginModes.MOVE ? i("div", { staticClass: "d-flex w-full justify-space-between px-2 pt-2 pb-1" }, [i("VcsFormButton", { attrs: { tooltip: "viewshed.addToMyWorkspace", icon: "$vcsComponentsPlus", disabled: e.currentIsPersisted || void 0 }, on: { click: function(t) {
|
|
939
948
|
return e.addToMyWorkspace();
|
|
940
949
|
} } }), i("VcsFormButton", { attrs: { variant: "filled" }, on: { click: function(t) {
|
|
@@ -942,23 +951,23 @@ var wt = function() {
|
|
|
942
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) {
|
|
943
952
|
return e.cancel();
|
|
944
953
|
} } }, [e._v(" " + e._s(e.$t("viewshed.cancel")) + " ")])], 1) : e._e()], 1);
|
|
945
|
-
},
|
|
946
|
-
pt,
|
|
947
|
-
wt,
|
|
954
|
+
}, _t = [], Ct = /* @__PURE__ */ ve(
|
|
948
955
|
mt,
|
|
956
|
+
gt,
|
|
957
|
+
_t,
|
|
949
958
|
!1,
|
|
950
959
|
null,
|
|
951
960
|
null,
|
|
952
961
|
null,
|
|
953
962
|
null
|
|
954
963
|
);
|
|
955
|
-
const
|
|
964
|
+
const Et = Ct.exports, S = "@vcmap/viewshed", yt = "2.0.5", Vt = "^5.1", J = {
|
|
956
965
|
[w.CONE]: "$vcsViewshed",
|
|
957
966
|
[w.THREESIXTY]: "$vcsViewshedCone"
|
|
958
967
|
};
|
|
959
|
-
function
|
|
960
|
-
const t = A(), o = A(),
|
|
961
|
-
component:
|
|
968
|
+
function bt(s, e, i) {
|
|
969
|
+
const t = A(), o = A(), n = `${i.id}-editor`, a = {
|
|
970
|
+
component: Et,
|
|
962
971
|
provides: {
|
|
963
972
|
manager: s
|
|
964
973
|
},
|
|
@@ -969,17 +978,17 @@ function yt(s, e, i) {
|
|
|
969
978
|
infoUrlCallback: e.getHelpUrlCallback("tools/viewshedTool.html")
|
|
970
979
|
}
|
|
971
980
|
};
|
|
972
|
-
|
|
973
|
-
editor: (
|
|
981
|
+
Je(e, i, {
|
|
982
|
+
editor: (u) => ({
|
|
974
983
|
...a,
|
|
975
984
|
props: {
|
|
976
985
|
selection: i.selection,
|
|
977
|
-
getViewshed: () => i.collection.getByKey(
|
|
986
|
+
getViewshed: () => i.collection.getByKey(u.name)
|
|
978
987
|
}
|
|
979
988
|
})
|
|
980
989
|
});
|
|
981
|
-
function
|
|
982
|
-
s.currentViewshed.value && (o.value =
|
|
990
|
+
function c() {
|
|
991
|
+
s.currentViewshed.value && (o.value = J[s.currentViewshed.value.type], s.currentIsPersisted.value ? t.value = s.currentViewshed.value.properties.title : s.mode.value === m.CREATE ? t.value = [
|
|
983
992
|
"viewshed.create",
|
|
984
993
|
`viewshed.${s.currentViewshed.value.type}`
|
|
985
994
|
] : t.value = [
|
|
@@ -987,34 +996,34 @@ function yt(s, e, i) {
|
|
|
987
996
|
`viewshed.${s.currentViewshed.value.type}`
|
|
988
997
|
]);
|
|
989
998
|
}
|
|
990
|
-
function
|
|
991
|
-
|
|
999
|
+
function r() {
|
|
1000
|
+
c(), s.currentViewshed.value && !s.currentIsPersisted.value && (s.mode.value === m.EDIT || s.mode.value === m.MOVE || s.mode.value === m.CREATE) && (e.windowManager.has(n) || e.windowManager.add(
|
|
992
1001
|
{
|
|
993
1002
|
...a,
|
|
994
|
-
id:
|
|
1003
|
+
id: n,
|
|
995
1004
|
parentId: "category-manager",
|
|
996
|
-
slot:
|
|
1005
|
+
slot: Ze.DYNAMIC_LEFT
|
|
997
1006
|
},
|
|
998
|
-
|
|
1007
|
+
S
|
|
999
1008
|
));
|
|
1000
1009
|
}
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1003
|
-
}),
|
|
1004
|
-
|
|
1005
|
-
}),
|
|
1006
|
-
s.mode.value ?
|
|
1010
|
+
const f = R(s.currentViewshed, (u) => {
|
|
1011
|
+
u && r();
|
|
1012
|
+
}), h = R(s.currentIsPersisted, (u) => {
|
|
1013
|
+
u && c();
|
|
1014
|
+
}), v = R(s.mode, () => {
|
|
1015
|
+
s.mode.value ? r() : e.windowManager.remove(n);
|
|
1007
1016
|
});
|
|
1008
1017
|
return {
|
|
1009
1018
|
destroy() {
|
|
1010
|
-
e.windowManager.remove(
|
|
1019
|
+
e.windowManager.remove(n), f(), v(), h();
|
|
1011
1020
|
}
|
|
1012
1021
|
};
|
|
1013
1022
|
}
|
|
1014
|
-
function
|
|
1023
|
+
function Mt(s, e, i, t) {
|
|
1015
1024
|
const o = {
|
|
1016
|
-
type:
|
|
1017
|
-
action:
|
|
1025
|
+
type: qe.SELECT,
|
|
1026
|
+
action: W({
|
|
1018
1027
|
name: i,
|
|
1019
1028
|
currentIndex: 0,
|
|
1020
1029
|
active: !1,
|
|
@@ -1024,54 +1033,54 @@ function Vt(s, e, i, t) {
|
|
|
1024
1033
|
if (this.active)
|
|
1025
1034
|
this.background && e.currentViewshed.value ? e.editViewshed(e.currentViewshed.value) : e.stop();
|
|
1026
1035
|
else {
|
|
1027
|
-
const
|
|
1028
|
-
e.createViewshed(
|
|
1036
|
+
const r = this.tools[this.currentIndex].name;
|
|
1037
|
+
e.createViewshed(r);
|
|
1029
1038
|
}
|
|
1030
1039
|
},
|
|
1031
|
-
selected(
|
|
1032
|
-
if (
|
|
1033
|
-
this.currentIndex =
|
|
1034
|
-
const
|
|
1035
|
-
e.createViewshed(
|
|
1040
|
+
selected(r) {
|
|
1041
|
+
if (r !== this.currentIndex) {
|
|
1042
|
+
this.currentIndex = r;
|
|
1043
|
+
const f = this.tools[this.currentIndex].name;
|
|
1044
|
+
e.createViewshed(f);
|
|
1036
1045
|
}
|
|
1037
1046
|
},
|
|
1038
|
-
tools: t.flatMap((
|
|
1047
|
+
tools: t.flatMap((r) => r === w.CONE ? {
|
|
1039
1048
|
name: w.CONE,
|
|
1040
|
-
icon:
|
|
1049
|
+
icon: J[w.CONE],
|
|
1041
1050
|
title: `viewshed.${w.CONE}`
|
|
1042
|
-
} :
|
|
1051
|
+
} : r === w.THREESIXTY ? {
|
|
1043
1052
|
name: w.THREESIXTY,
|
|
1044
|
-
icon:
|
|
1053
|
+
icon: J[w.THREESIXTY],
|
|
1045
1054
|
title: `viewshed.${w.THREESIXTY}`
|
|
1046
1055
|
} : [])
|
|
1047
1056
|
})
|
|
1048
|
-
},
|
|
1049
|
-
|
|
1057
|
+
}, n = R(e.mode, (r) => {
|
|
1058
|
+
r === m.VIEW ? (o.action.background = !0, o.action.active = !0) : r ? (o.action.background = !1, o.action.active = !0) : (o.action.background = !1, o.action.active = !1);
|
|
1050
1059
|
}), a = R(
|
|
1051
1060
|
e.currentViewshed,
|
|
1052
|
-
(
|
|
1053
|
-
|
|
1054
|
-
(
|
|
1061
|
+
(r) => {
|
|
1062
|
+
r && (o.action.currentIndex = o.action.tools.findIndex(
|
|
1063
|
+
(f) => f.name === r.type
|
|
1055
1064
|
));
|
|
1056
1065
|
}
|
|
1057
|
-
),
|
|
1058
|
-
|
|
1066
|
+
), c = s.maps.mapActivated.addEventListener((r) => {
|
|
1067
|
+
r instanceof D ? o.action.disabled = !1 : o.action.disabled = !0;
|
|
1059
1068
|
});
|
|
1060
1069
|
return {
|
|
1061
1070
|
destroy() {
|
|
1062
|
-
|
|
1071
|
+
n(), a(), c();
|
|
1063
1072
|
},
|
|
1064
1073
|
toolbox: o
|
|
1065
1074
|
};
|
|
1066
1075
|
}
|
|
1067
|
-
function
|
|
1076
|
+
function Tt(s, e, i, t) {
|
|
1068
1077
|
z(t, [Object.values(w)]);
|
|
1069
|
-
const { toolbox: o, destroy:
|
|
1078
|
+
const { toolbox: o, destroy: n } = Mt(s, e, i, t), a = s.toolboxManager.add(o, i).id;
|
|
1070
1079
|
return () => {
|
|
1071
|
-
s.toolboxManager.remove(a),
|
|
1080
|
+
s.toolboxManager.remove(a), n();
|
|
1072
1081
|
};
|
|
1073
1082
|
}
|
|
1074
|
-
class
|
|
1083
|
+
class Z extends Pe {
|
|
1075
1084
|
static get className() {
|
|
1076
1085
|
return "ViewshedCategory";
|
|
1077
1086
|
}
|
|
@@ -1079,138 +1088,138 @@ class J extends Oe {
|
|
|
1079
1088
|
var t;
|
|
1080
1089
|
const i = (
|
|
1081
1090
|
/** @type {import("@vcmap/core").CesiumMap | undefined} */
|
|
1082
|
-
(t = this._app) == null ? void 0 : t.maps.getByType(
|
|
1091
|
+
(t = this._app) == null ? void 0 : t.maps.getByType(D.className)[0]
|
|
1083
1092
|
);
|
|
1084
1093
|
if (i)
|
|
1085
1094
|
return new M(e, i);
|
|
1086
1095
|
throw new Error("No CesiumMap available");
|
|
1087
1096
|
}
|
|
1088
1097
|
}
|
|
1089
|
-
function
|
|
1098
|
+
function Ot(s, e) {
|
|
1090
1099
|
let i, t = 0;
|
|
1091
1100
|
const o = new Set(
|
|
1092
|
-
e.filter((
|
|
1101
|
+
e.filter((n) => n.type === s).map((n) => n.properties.title)
|
|
1093
1102
|
);
|
|
1094
1103
|
do
|
|
1095
1104
|
t += 1, o.has(`${s}-${t}`) || (i = `${s}-${t}`);
|
|
1096
1105
|
while (!i);
|
|
1097
1106
|
return i;
|
|
1098
1107
|
}
|
|
1099
|
-
async function
|
|
1100
|
-
const e = new
|
|
1108
|
+
async function St(s) {
|
|
1109
|
+
const e = new x(), i = new x(), { collectionComponent: t, category: o } = await s.categoryManager.requestCategory(
|
|
1101
1110
|
{
|
|
1102
|
-
type:
|
|
1111
|
+
type: Z.className,
|
|
1103
1112
|
name: "Viewsheds",
|
|
1104
1113
|
title: "Viewsheds"
|
|
1105
1114
|
},
|
|
1106
|
-
|
|
1115
|
+
S,
|
|
1107
1116
|
{
|
|
1108
1117
|
selectable: !0,
|
|
1109
1118
|
renamable: !0,
|
|
1110
1119
|
removable: !0
|
|
1111
1120
|
}
|
|
1112
|
-
),
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
},
|
|
1116
|
-
|
|
1121
|
+
), n = (h, v, u) => {
|
|
1122
|
+
u.title = h.properties.title, u.titleChanged = (_) => {
|
|
1123
|
+
h.properties.title = _, u.title = _, e.raiseEvent({ item: h, title: _ });
|
|
1124
|
+
}, u.actions.push(
|
|
1125
|
+
W({
|
|
1117
1126
|
name: "visibilityAction",
|
|
1118
1127
|
icon: "$vcsCheckbox",
|
|
1119
1128
|
callback() {
|
|
1120
|
-
i.raiseEvent(
|
|
1129
|
+
i.raiseEvent(h);
|
|
1121
1130
|
}
|
|
1122
1131
|
})
|
|
1123
1132
|
);
|
|
1124
1133
|
};
|
|
1125
1134
|
s.categoryManager.addMappingFunction(
|
|
1126
1135
|
() => !0,
|
|
1127
|
-
|
|
1128
|
-
|
|
1136
|
+
n,
|
|
1137
|
+
S,
|
|
1129
1138
|
[t.id]
|
|
1130
1139
|
);
|
|
1131
|
-
const { action: a, destroy:
|
|
1140
|
+
const { action: a, destroy: c } = Qe(
|
|
1132
1141
|
t.selection,
|
|
1133
1142
|
() => {
|
|
1134
|
-
const
|
|
1135
|
-
(
|
|
1143
|
+
const h = t.selection.value.map(
|
|
1144
|
+
(v) => t.collection.getByKey(v.name)
|
|
1136
1145
|
);
|
|
1137
|
-
|
|
1146
|
+
et(JSON.stringify(h), "viewsheds.json");
|
|
1138
1147
|
},
|
|
1139
|
-
|
|
1140
|
-
), { action:
|
|
1141
|
-
async (
|
|
1148
|
+
S
|
|
1149
|
+
), { action: r, destroy: f } = tt(
|
|
1150
|
+
async (h) => {
|
|
1142
1151
|
await Promise.all(
|
|
1143
|
-
|
|
1144
|
-
const
|
|
1145
|
-
JSON.parse(
|
|
1146
|
-
const
|
|
1147
|
-
o.collection.add(
|
|
1152
|
+
h.map(async (v) => {
|
|
1153
|
+
const u = await v.text();
|
|
1154
|
+
JSON.parse(u).forEach((V) => {
|
|
1155
|
+
const P = new M(V);
|
|
1156
|
+
o.collection.add(P);
|
|
1148
1157
|
});
|
|
1149
1158
|
})
|
|
1150
1159
|
);
|
|
1151
1160
|
},
|
|
1152
1161
|
s.windowManager,
|
|
1153
|
-
|
|
1162
|
+
S,
|
|
1154
1163
|
"category-manager"
|
|
1155
1164
|
);
|
|
1156
|
-
return t.addActions([a,
|
|
1165
|
+
return t.addActions([a, r]), {
|
|
1157
1166
|
renamed: e,
|
|
1158
1167
|
visibilityChanged: i,
|
|
1159
|
-
setSelection(
|
|
1160
|
-
|
|
1168
|
+
setSelection(h) {
|
|
1169
|
+
h && (t.selection.value = t.items.value.filter((v) => h === v.name));
|
|
1161
1170
|
},
|
|
1162
1171
|
clearSelection() {
|
|
1163
1172
|
t.selection.value.length && (t.selection.value = []);
|
|
1164
1173
|
},
|
|
1165
|
-
setVisibility(
|
|
1166
|
-
const
|
|
1167
|
-
(_) =>
|
|
1174
|
+
setVisibility(h, v) {
|
|
1175
|
+
const u = t.items.value.find(
|
|
1176
|
+
(_) => h === _.name
|
|
1168
1177
|
);
|
|
1169
|
-
if (
|
|
1170
|
-
const _ =
|
|
1178
|
+
if (u) {
|
|
1179
|
+
const _ = u.actions.find(
|
|
1171
1180
|
(V) => V.name === "visibilityAction"
|
|
1172
1181
|
);
|
|
1173
|
-
_ && (_.icon =
|
|
1182
|
+
_ && (_.icon = v ? "$vcsCheckboxChecked" : "$vcsCheckbox");
|
|
1174
1183
|
}
|
|
1175
1184
|
},
|
|
1176
|
-
add(
|
|
1177
|
-
|
|
1178
|
-
|
|
1185
|
+
add(h) {
|
|
1186
|
+
h.properties.title = Ot(
|
|
1187
|
+
h.type,
|
|
1179
1188
|
/** @type {import("./viewshed.js").default[]} */
|
|
1180
1189
|
[
|
|
1181
1190
|
...o.collection
|
|
1182
1191
|
]
|
|
1183
|
-
), o.collection.add(
|
|
1192
|
+
), o.collection.add(h);
|
|
1184
1193
|
},
|
|
1185
|
-
remove(
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1194
|
+
remove(h) {
|
|
1195
|
+
const v = o.collection.getByKey(h);
|
|
1196
|
+
v && o.collection.remove(v);
|
|
1188
1197
|
},
|
|
1189
1198
|
collectionComponent: t,
|
|
1190
1199
|
destroy() {
|
|
1191
|
-
s.categoryManager.removeOwner(
|
|
1200
|
+
s.categoryManager.removeOwner(S), e.destroy(), i.destroy(), c(), f();
|
|
1192
1201
|
}
|
|
1193
1202
|
};
|
|
1194
1203
|
}
|
|
1195
|
-
function
|
|
1204
|
+
function F() {
|
|
1196
1205
|
return {
|
|
1197
1206
|
visibleColor: M.getDefaultOptions().visibleColor,
|
|
1198
1207
|
shadowColor: M.getDefaultOptions().shadowColor,
|
|
1199
1208
|
tools: [...Object.values(w)]
|
|
1200
1209
|
};
|
|
1201
1210
|
}
|
|
1202
|
-
const
|
|
1211
|
+
const Pt = {
|
|
1203
1212
|
name: "ViewshedConfigEditor",
|
|
1204
1213
|
title: "Viewshed Editor",
|
|
1205
1214
|
components: {
|
|
1206
|
-
AbstractConfigEditor:
|
|
1207
|
-
VcsFormSection:
|
|
1208
|
-
VContainer:
|
|
1209
|
-
VRow:
|
|
1210
|
-
VCol:
|
|
1211
|
-
VcsLabel:
|
|
1212
|
-
VcsSelect:
|
|
1213
|
-
VColorPicker:
|
|
1215
|
+
AbstractConfigEditor: it,
|
|
1216
|
+
VcsFormSection: le,
|
|
1217
|
+
VContainer: de,
|
|
1218
|
+
VRow: he,
|
|
1219
|
+
VCol: ue,
|
|
1220
|
+
VcsLabel: ae,
|
|
1221
|
+
VcsSelect: ce,
|
|
1222
|
+
VColorPicker: ot
|
|
1214
1223
|
},
|
|
1215
1224
|
props: {
|
|
1216
1225
|
getConfig: {
|
|
@@ -1225,7 +1234,7 @@ const Ot = {
|
|
|
1225
1234
|
setup(s) {
|
|
1226
1235
|
const e = A({});
|
|
1227
1236
|
s.getConfig().then((t) => {
|
|
1228
|
-
e.value = Object.assign(
|
|
1237
|
+
e.value = Object.assign(F(), t);
|
|
1229
1238
|
});
|
|
1230
1239
|
async function i() {
|
|
1231
1240
|
await s.setConfig(e.value);
|
|
@@ -1241,7 +1250,7 @@ const Ot = {
|
|
|
1241
1250
|
};
|
|
1242
1251
|
}
|
|
1243
1252
|
};
|
|
1244
|
-
var
|
|
1253
|
+
var At = function() {
|
|
1245
1254
|
var e = this, i = e._self._c;
|
|
1246
1255
|
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) {
|
|
1247
1256
|
e.$set(e.localConfig, "tools", t);
|
|
@@ -1250,29 +1259,29 @@ var St = function() {
|
|
|
1250
1259
|
}, 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) {
|
|
1251
1260
|
e.$set(e.localConfig, "shadowColor", t);
|
|
1252
1261
|
}, expression: "localConfig.shadowColor" } })], 1)], 1)], 1)], 1) : e._e()], 1);
|
|
1253
|
-
},
|
|
1254
|
-
Ot,
|
|
1255
|
-
St,
|
|
1262
|
+
}, It = [], Rt = /* @__PURE__ */ ve(
|
|
1256
1263
|
Pt,
|
|
1264
|
+
At,
|
|
1265
|
+
It,
|
|
1257
1266
|
!1,
|
|
1258
1267
|
null,
|
|
1259
1268
|
null,
|
|
1260
1269
|
null,
|
|
1261
1270
|
null
|
|
1262
1271
|
);
|
|
1263
|
-
const
|
|
1264
|
-
function
|
|
1272
|
+
const $t = Rt.exports;
|
|
1273
|
+
function Wt(s) {
|
|
1265
1274
|
let e, i = () => {
|
|
1266
1275
|
};
|
|
1267
1276
|
return {
|
|
1268
1277
|
get name() {
|
|
1269
|
-
return
|
|
1278
|
+
return S;
|
|
1270
1279
|
},
|
|
1271
1280
|
get version() {
|
|
1272
|
-
return
|
|
1281
|
+
return yt;
|
|
1273
1282
|
},
|
|
1274
1283
|
get mapVersion() {
|
|
1275
|
-
return
|
|
1284
|
+
return Vt;
|
|
1276
1285
|
},
|
|
1277
1286
|
/**
|
|
1278
1287
|
* @param {import("@vcmap/ui").VcsUiApp} vcsUiApp
|
|
@@ -1281,47 +1290,55 @@ function Ft(s) {
|
|
|
1281
1290
|
*/
|
|
1282
1291
|
async initialize(t, o) {
|
|
1283
1292
|
t.categoryClassRegistry.registerClass(
|
|
1284
|
-
this[
|
|
1285
|
-
|
|
1286
|
-
|
|
1293
|
+
this[Ae],
|
|
1294
|
+
Z.className,
|
|
1295
|
+
Z
|
|
1287
1296
|
);
|
|
1288
|
-
const
|
|
1289
|
-
e =
|
|
1297
|
+
const n = await St(t);
|
|
1298
|
+
e = pt(
|
|
1290
1299
|
t,
|
|
1291
1300
|
s,
|
|
1292
|
-
|
|
1301
|
+
n
|
|
1293
1302
|
);
|
|
1294
|
-
const a =
|
|
1303
|
+
const a = Tt(
|
|
1295
1304
|
t,
|
|
1296
1305
|
e,
|
|
1297
|
-
|
|
1298
|
-
s.tools ||
|
|
1299
|
-
), { destroy:
|
|
1306
|
+
S,
|
|
1307
|
+
s.tools || F().tools
|
|
1308
|
+
), { destroy: c } = bt(
|
|
1300
1309
|
e,
|
|
1301
1310
|
t,
|
|
1302
|
-
|
|
1311
|
+
n.collectionComponent
|
|
1312
|
+
), { activeMap: r } = t.maps;
|
|
1313
|
+
function f(u) {
|
|
1314
|
+
if (o != null && o.mode && o.currentViewshed && u instanceof D) {
|
|
1315
|
+
const _ = new M(o.currentViewshed, r);
|
|
1316
|
+
o.mode === m.VIEW ? e.viewViewshed(_) : e.editViewshed(_);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
let h = !1;
|
|
1320
|
+
r && (h = !0, f(r));
|
|
1321
|
+
const v = t.maps.mapActivated.addEventListener(
|
|
1322
|
+
(u) => {
|
|
1323
|
+
e.stop(), h || (f(u), h = !0);
|
|
1324
|
+
}
|
|
1303
1325
|
);
|
|
1304
1326
|
i = () => {
|
|
1305
|
-
a(),
|
|
1327
|
+
v(), a(), c(), n.destroy(), e.destroy();
|
|
1306
1328
|
};
|
|
1307
|
-
const { activeMap: n } = t.maps;
|
|
1308
|
-
if (o != null && o.mode && o.currentViewshed && n instanceof B) {
|
|
1309
|
-
const u = new M(o.currentViewshed, n);
|
|
1310
|
-
o.mode === g.VIEW ? e.viewViewshed(u) : e.editViewshed(u);
|
|
1311
|
-
}
|
|
1312
1329
|
},
|
|
1313
1330
|
/**
|
|
1314
1331
|
* should return all default values of the configuration
|
|
1315
1332
|
* @returns {ViewshedPluginOptions}
|
|
1316
1333
|
*/
|
|
1317
|
-
getDefaultOptions:
|
|
1334
|
+
getDefaultOptions: F,
|
|
1318
1335
|
/**
|
|
1319
1336
|
* should return the plugin's serialization excluding all default values
|
|
1320
1337
|
* @returns {ViewshedPluginOptions}
|
|
1321
1338
|
*/
|
|
1322
1339
|
toJSON() {
|
|
1323
1340
|
const t = {};
|
|
1324
|
-
return s.tools &&
|
|
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;
|
|
1325
1342
|
},
|
|
1326
1343
|
/**
|
|
1327
1344
|
* should return the plugins state
|
|
@@ -1339,7 +1356,7 @@ function Ft(s) {
|
|
|
1339
1356
|
* @returns {Array<import("@vcmap/ui").PluginConfigEditor>}
|
|
1340
1357
|
*/
|
|
1341
1358
|
getConfigEditors() {
|
|
1342
|
-
return [{ component:
|
|
1359
|
+
return [{ component: $t }];
|
|
1343
1360
|
},
|
|
1344
1361
|
destroy: i,
|
|
1345
1362
|
i18n: {
|
|
@@ -1415,5 +1432,5 @@ function Ft(s) {
|
|
|
1415
1432
|
};
|
|
1416
1433
|
}
|
|
1417
1434
|
export {
|
|
1418
|
-
|
|
1435
|
+
Wt as default
|
|
1419
1436
|
};
|