@openglobus/ext-entity-editor 0.0.0-stage → 1.0.0
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/LICENSE.md +217 -0
- package/README.md +32 -2
- package/dist/entityEditor/CameraEditorView.d.ts +55 -0
- package/dist/entityEditor/EntityEditor.d.ts +22 -0
- package/dist/entityEditor/EntityEditorDialog.d.ts +36 -0
- package/dist/entityEditor/EntityEditorView.d.ts +63 -0
- package/dist/entityEditor/ProjectorEditorView.d.ts +28 -0
- package/dist/entityTree/EntityTree.d.ts +48 -0
- package/dist/entityTree/EntityTreeView.d.ts +23 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +910 -0
- package/dist/object3dManager/Object3dCollection.d.ts +20 -0
- package/dist/object3dManager/Object3dCollectionView.d.ts +14 -0
- package/dist/object3dManager/Object3dItemView.d.ts +9 -0
- package/dist/object3dManager/Object3dManager.d.ts +25 -0
- package/dist/object3dManager/Object3dManagerDialog.d.ts +20 -0
- package/dist/style.d.ts +8 -0
- package/package.json +30 -5
package/dist/index.js
ADDED
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { CameraLock as e, Control as t, Entity as n, EntityGizmo as r, Object3d as i, Vec3 as a, createEvents as o, defineExtension as s, input as c, math as l, ui as u, utils as d } from "@openglobus/og";
|
|
2
|
+
// src/entityEditor/CameraEditorView.ts
|
|
3
|
+
var f = "<div class=\"og-editor-panel\"></div>";
|
|
4
|
+
function p(e) {
|
|
5
|
+
let t = parseFloat(e);
|
|
6
|
+
return Number.isFinite(t) ? t : null;
|
|
7
|
+
}
|
|
8
|
+
function m(e) {
|
|
9
|
+
return !!e.properties.depthCamera;
|
|
10
|
+
}
|
|
11
|
+
var h = class extends u.View {
|
|
12
|
+
constructor(e) {
|
|
13
|
+
super({
|
|
14
|
+
template: f,
|
|
15
|
+
model: e.entity
|
|
16
|
+
}), this._onTitleBarChange = (e) => {
|
|
17
|
+
this._bodyEl?.classList.toggle("og-editor-panel__body_collapsed", e);
|
|
18
|
+
}, this._onChangeNear = (e) => {
|
|
19
|
+
let t = p(e), n = this._getCamera()?.frustums[0]?.far;
|
|
20
|
+
t !== null && n != null && this._setNearFar(t, n);
|
|
21
|
+
}, this._onChangeFar = (e) => {
|
|
22
|
+
let t = p(e), n = this._getCamera()?.frustums[0]?.near;
|
|
23
|
+
t !== null && n != null && this._setNearFar(n, t);
|
|
24
|
+
}, this._onChangeLeft = (e) => {
|
|
25
|
+
let t = p(e), n = this._getCamera()?.frustums[0];
|
|
26
|
+
t !== null && n && this._setBounds(t, n.right, n.bottom, n.top);
|
|
27
|
+
}, this._onChangeRight = (e) => {
|
|
28
|
+
let t = p(e), n = this._getCamera()?.frustums[0];
|
|
29
|
+
t !== null && n && this._setBounds(n.left, t, n.bottom, n.top);
|
|
30
|
+
}, this._onChangeBottom = (e) => {
|
|
31
|
+
let t = p(e), n = this._getCamera()?.frustums[0];
|
|
32
|
+
t !== null && n && this._setBounds(n.left, n.right, t, n.top);
|
|
33
|
+
}, this._onChangeTop = (e) => {
|
|
34
|
+
let t = p(e), n = this._getCamera()?.frustums[0];
|
|
35
|
+
t !== null && n && this._setBounds(n.left, n.right, n.bottom, t);
|
|
36
|
+
}, this._onChangeVerticalFov = (e) => {
|
|
37
|
+
let t = p(e), n = this._getCamera();
|
|
38
|
+
!n || t === null || t <= 0 || t >= 180 || (n.setViewAngle(t), n.update(), this._syncFrustumEntityScale(), this.refresh());
|
|
39
|
+
}, this._onChangeHorizontalFov = (e) => {
|
|
40
|
+
let t = p(e), n = this._getCamera();
|
|
41
|
+
!n || t === null || t <= 0 || t >= 180 || (n.setHorizontalViewAngle(t), n.update(), this._syncFrustumEntityScale(), this.refresh());
|
|
42
|
+
}, this._onChangeViewportWidth = (e) => {
|
|
43
|
+
let t = p(e), n = this._getCamera();
|
|
44
|
+
t !== null && n && this._setViewportSize(t, n.height);
|
|
45
|
+
}, this._onChangeViewportHeight = (e) => {
|
|
46
|
+
let t = p(e), n = this._getCamera();
|
|
47
|
+
t !== null && n && this._setViewportSize(n.width, t);
|
|
48
|
+
}, this._onChangeOrthographic = (e) => {
|
|
49
|
+
this._depthCamera && (this._depthCamera.isOrthographic = e, this._syncFrustumEntityScale(), this.refresh());
|
|
50
|
+
}, this._onChangeFocusDistance = (e) => {
|
|
51
|
+
let t = p(e);
|
|
52
|
+
this._depthCamera && t !== null && (this._depthCamera.focusDistance = t, this._syncFrustumEntityScale(), this.refresh());
|
|
53
|
+
}, this._onChangeShowFrustum = (e) => {
|
|
54
|
+
this._depthCamera && (this._depthCamera.showFrustum = e);
|
|
55
|
+
}, this._onChangeShowFootprint = (e) => {
|
|
56
|
+
this._depthCamera && (this._depthCamera.showFootprint = e);
|
|
57
|
+
}, this._onChangeBias = (e) => {
|
|
58
|
+
let t = p(e);
|
|
59
|
+
this._depthCamera && t !== null && (this._depthCamera.depthBiasWorld = t);
|
|
60
|
+
}, this._onChangeNormalBias = (e) => {
|
|
61
|
+
let t = p(e);
|
|
62
|
+
this._depthCamera && t !== null && (this._depthCamera.normalBias = t);
|
|
63
|
+
}, this._nearView = new u.Input({
|
|
64
|
+
label: "Near",
|
|
65
|
+
type: "number",
|
|
66
|
+
min: 0,
|
|
67
|
+
maxFixed: 4
|
|
68
|
+
}), this._farView = new u.Input({
|
|
69
|
+
label: "Far",
|
|
70
|
+
type: "number",
|
|
71
|
+
min: 0,
|
|
72
|
+
maxFixed: 4
|
|
73
|
+
}), this._leftView = new u.Input({
|
|
74
|
+
label: "Bounds left",
|
|
75
|
+
type: "number",
|
|
76
|
+
maxFixed: 4
|
|
77
|
+
}), this._rightView = new u.Input({
|
|
78
|
+
label: "Bounds right",
|
|
79
|
+
type: "number",
|
|
80
|
+
maxFixed: 4
|
|
81
|
+
}), this._bottomView = new u.Input({
|
|
82
|
+
label: "Bounds bottom",
|
|
83
|
+
type: "number",
|
|
84
|
+
maxFixed: 4
|
|
85
|
+
}), this._topView = new u.Input({
|
|
86
|
+
label: "Bounds top",
|
|
87
|
+
type: "number",
|
|
88
|
+
maxFixed: 4
|
|
89
|
+
}), this._verticalFovView = new u.Input({
|
|
90
|
+
label: "Vertical FOV",
|
|
91
|
+
type: "number",
|
|
92
|
+
min: .1,
|
|
93
|
+
max: 179.9,
|
|
94
|
+
maxFixed: 4
|
|
95
|
+
}), this._horizontalFovView = new u.Input({
|
|
96
|
+
label: "Horizontal FOV",
|
|
97
|
+
type: "number",
|
|
98
|
+
min: .1,
|
|
99
|
+
max: 179.9,
|
|
100
|
+
maxFixed: 4
|
|
101
|
+
}), this._viewportWidthView = new u.Input({
|
|
102
|
+
label: "Viewport width",
|
|
103
|
+
type: "number",
|
|
104
|
+
min: 1,
|
|
105
|
+
step: 1,
|
|
106
|
+
maxFixed: 0
|
|
107
|
+
}), this._viewportHeightView = new u.Input({
|
|
108
|
+
label: "Viewport height",
|
|
109
|
+
type: "number",
|
|
110
|
+
min: 1,
|
|
111
|
+
step: 1,
|
|
112
|
+
maxFixed: 0
|
|
113
|
+
}), this._orthographicView = new u.Checkbox({ label: "Orthographic" }), this._focusDistanceView = new u.Input({
|
|
114
|
+
label: "Focus distance",
|
|
115
|
+
type: "number",
|
|
116
|
+
min: 1e-6,
|
|
117
|
+
step: 1,
|
|
118
|
+
maxFixed: 4
|
|
119
|
+
}), this._showFrustumView = new u.Checkbox({ label: "Show frustum" }), this._showFootprintView = new u.Checkbox({ label: "Show footprint" }), this._biasView = new u.Input({
|
|
120
|
+
label: "Depth bias, m",
|
|
121
|
+
type: "number",
|
|
122
|
+
min: 0,
|
|
123
|
+
step: .1,
|
|
124
|
+
maxFixed: 3
|
|
125
|
+
}), this._normalBiasView = new u.Input({
|
|
126
|
+
label: "Normal bias",
|
|
127
|
+
type: "number",
|
|
128
|
+
min: 0,
|
|
129
|
+
step: .01,
|
|
130
|
+
maxFixed: 4
|
|
131
|
+
}), this._titleBarView = new u.TitleBarView({ title: "Camera" }), this._bodyEl = null, this._depthCamera = null, this.bindEntity(e.entity);
|
|
132
|
+
}
|
|
133
|
+
bindEntity(e) {
|
|
134
|
+
this.model = e, this._depthCamera = e.properties.depthCamera;
|
|
135
|
+
}
|
|
136
|
+
render(e) {
|
|
137
|
+
return super.render(e), this._titleBarView.appendTo(this.el), this._titleBarView.events.on("change", this._onTitleBarChange), this._bodyEl = document.createElement("div"), this._bodyEl.classList.add("og-editor-panel__body"), this.el.appendChild(this._bodyEl), this._nearView.appendTo(this._bodyEl), this._farView.appendTo(this._bodyEl), this._leftView.appendTo(this._bodyEl), this._topView.appendTo(this._bodyEl), this._rightView.appendTo(this._bodyEl), this._bottomView.appendTo(this._bodyEl), this._verticalFovView.appendTo(this._bodyEl), this._horizontalFovView.appendTo(this._bodyEl), this._viewportWidthView.appendTo(this._bodyEl), this._viewportHeightView.appendTo(this._bodyEl), this._orthographicView.appendTo(this._bodyEl), this._focusDistanceView.appendTo(this._bodyEl), this._showFrustumView.appendTo(this._bodyEl), this._showFootprintView.appendTo(this._bodyEl), this._biasView.appendTo(this._bodyEl), this._normalBiasView.appendTo(this._bodyEl), this._nearView.events.on("change", this._onChangeNear), this._farView.events.on("change", this._onChangeFar), this._leftView.events.on("change", this._onChangeLeft), this._rightView.events.on("change", this._onChangeRight), this._bottomView.events.on("change", this._onChangeBottom), this._topView.events.on("change", this._onChangeTop), this._verticalFovView.events.on("change", this._onChangeVerticalFov), this._horizontalFovView.events.on("change", this._onChangeHorizontalFov), this._viewportWidthView.events.on("change", this._onChangeViewportWidth), this._viewportHeightView.events.on("change", this._onChangeViewportHeight), this._orthographicView.events.on("change", this._onChangeOrthographic), this._focusDistanceView.events.on("change", this._onChangeFocusDistance), this._showFrustumView.events.on("change", this._onChangeShowFrustum), this._showFootprintView.events.on("change", this._onChangeShowFootprint), this._biasView.events.on("change", this._onChangeBias), this._normalBiasView.events.on("change", this._onChangeNormalBias), this.refresh(), this;
|
|
138
|
+
}
|
|
139
|
+
refresh() {
|
|
140
|
+
let e = this._getCamera();
|
|
141
|
+
if (!e) return;
|
|
142
|
+
let t = e.frustums[0];
|
|
143
|
+
t && (this._nearView.stopPropagation(), this._nearView.value = t.near, this._farView.stopPropagation(), this._farView.value = t.far, this._leftView.stopPropagation(), this._leftView.value = t.left, this._rightView.stopPropagation(), this._rightView.value = t.right, this._bottomView.stopPropagation(), this._bottomView.value = t.bottom, this._topView.stopPropagation(), this._topView.value = t.top), this._verticalFovView.stopPropagation(), this._verticalFovView.value = e.verticalViewAngle, this._horizontalFovView.stopPropagation(), this._horizontalFovView.value = e.horizontalViewAngle, this._viewportWidthView.stopPropagation(), this._viewportWidthView.value = e.width, this._viewportHeightView.stopPropagation(), this._viewportHeightView.value = e.height;
|
|
144
|
+
let n = this._depthCamera;
|
|
145
|
+
this._showFrustumView.visibility = !!n, this._showFootprintView.visibility = !!n, this._orthographicView.visibility = !!n, this._focusDistanceView.visibility = !!n && n.isOrthographic, this._biasView.visibility = !!n, this._normalBiasView.visibility = !!n, n && (this._orthographicView.checked !== n.isOrthographic && (this._orthographicView.stopPropagation(), this._orthographicView.checked = n.isOrthographic), this._focusDistanceView.stopPropagation(), this._focusDistanceView.value = n.focusDistance, this._showFrustumView.checked !== n.showFrustum && (this._showFrustumView.stopPropagation(), this._showFrustumView.checked = n.showFrustum), this._showFootprintView.checked !== n.showFootprint && (this._showFootprintView.stopPropagation(), this._showFootprintView.checked = n.showFootprint), this._biasView.stopPropagation(), this._biasView.value = n.depthBiasWorld, this._normalBiasView.stopPropagation(), this._normalBiasView.value = n.normalBias);
|
|
146
|
+
}
|
|
147
|
+
_getCamera() {
|
|
148
|
+
return this._depthCamera?.camera || null;
|
|
149
|
+
}
|
|
150
|
+
remove() {
|
|
151
|
+
this._nearView.remove(), this._farView.remove(), this._leftView.remove(), this._rightView.remove(), this._bottomView.remove(), this._topView.remove(), this._verticalFovView.remove(), this._horizontalFovView.remove(), this._viewportWidthView.remove(), this._viewportHeightView.remove(), this._orthographicView.remove(), this._focusDistanceView.remove(), this._showFrustumView.remove(), this._showFootprintView.remove(), this._biasView.remove(), this._normalBiasView.remove(), this._titleBarView.events.off("change", this._onTitleBarChange), this._titleBarView.remove(), this._bodyEl = null, super.remove();
|
|
152
|
+
}
|
|
153
|
+
_setNearFar(e, t) {
|
|
154
|
+
let n = this._getCamera();
|
|
155
|
+
!n || e <= 0 || t <= e || (n.setNearFar(e, t), n.update(), this.refresh());
|
|
156
|
+
}
|
|
157
|
+
_setBounds(e, t, n, r) {
|
|
158
|
+
let i = this._getCamera(), a = i?.frustums[0];
|
|
159
|
+
!i || !a || !i.isOrthographic || t <= e || r <= n || (a.setOrthoBounds(e, t, n, r), i.update()), this.refresh();
|
|
160
|
+
}
|
|
161
|
+
_syncFrustumEntityScale() {
|
|
162
|
+
let e = this._getCamera();
|
|
163
|
+
if (e && (this.model.geoObject?.tag?.toLowerCase() || "").includes("frustum")) {
|
|
164
|
+
if (this._depthCamera) this.model.setScale3v(this._depthCamera.frustumScale);
|
|
165
|
+
else {
|
|
166
|
+
let t = this.model.getScale().z || 1;
|
|
167
|
+
this.model.setScale3v(i.getFrustumScaleByCameraAngles(t, e.horizontalViewAngle, e.verticalViewAngle));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
_setViewportSize(e, t) {
|
|
172
|
+
let n = this._getCamera();
|
|
173
|
+
!n || e < 1 || t < 1 || (n.setViewportSize(e, t), this._syncFrustumEntityScale(), this.refresh());
|
|
174
|
+
}
|
|
175
|
+
}, g = 0, _ = 1, v = "<div class=\"og-editor-panel\"></div>", y = class extends u.View {
|
|
176
|
+
constructor(e) {
|
|
177
|
+
super({
|
|
178
|
+
template: v,
|
|
179
|
+
model: e.model
|
|
180
|
+
}), this._onTitleBarChange = (e) => {
|
|
181
|
+
this._bodyEl?.classList.toggle("og-editor-panel__body_collapsed", e);
|
|
182
|
+
}, this._onChangeRelativePosition = (e) => {
|
|
183
|
+
let t = this.model.getSelectedEntity();
|
|
184
|
+
t && (t.relativePosition = e, this.refresh(t));
|
|
185
|
+
}, this._onChangeYawMode = (e) => {
|
|
186
|
+
this.model.editMode = e ? _ : g;
|
|
187
|
+
}, this._onChangeLon = (e) => {
|
|
188
|
+
let t = this.model.getSelectedEntity();
|
|
189
|
+
if (t) {
|
|
190
|
+
let n = t.getLonLat();
|
|
191
|
+
t.setLonLat2(parseFloat(e), n.lat, n.height), this.refresh(t);
|
|
192
|
+
}
|
|
193
|
+
}, this._onChangeLat = (e) => {
|
|
194
|
+
let t = this.model.getSelectedEntity();
|
|
195
|
+
if (t) {
|
|
196
|
+
let n = t.getLonLat();
|
|
197
|
+
t.setLonLat2(n.lon, parseFloat(e), n.height), this.refresh(t);
|
|
198
|
+
}
|
|
199
|
+
}, this._onChangeHeight = (e) => {
|
|
200
|
+
let t = this.model.getSelectedEntity();
|
|
201
|
+
if (t) {
|
|
202
|
+
let n = t.getLonLat();
|
|
203
|
+
t.setLonLat2(n.lon, n.lat, parseFloat(e)), this.refresh(t);
|
|
204
|
+
}
|
|
205
|
+
}, this._onChangeX = (e) => {
|
|
206
|
+
let t = this.model.getSelectedEntity();
|
|
207
|
+
if (t) {
|
|
208
|
+
let n = t.getCartesian();
|
|
209
|
+
t.setCartesian(parseFloat(e), n.y, n.z), this.refresh(t);
|
|
210
|
+
}
|
|
211
|
+
}, this._onChangeY = (e) => {
|
|
212
|
+
let t = this.model.getSelectedEntity();
|
|
213
|
+
if (t) {
|
|
214
|
+
let n = t.getCartesian();
|
|
215
|
+
t.setCartesian(n.x, parseFloat(e), n.z), this.refresh(t);
|
|
216
|
+
}
|
|
217
|
+
}, this._onChangeZ = (e) => {
|
|
218
|
+
let t = this.model.getSelectedEntity();
|
|
219
|
+
if (t) {
|
|
220
|
+
let n = t.getCartesian();
|
|
221
|
+
t.setCartesian(n.x, n.y, parseFloat(e)), this.refresh(t);
|
|
222
|
+
}
|
|
223
|
+
}, this._onChangeAbsoluteX = (e) => {
|
|
224
|
+
let t = this.model.getSelectedEntity();
|
|
225
|
+
if (t) {
|
|
226
|
+
let n = t.getAbsoluteCartesian();
|
|
227
|
+
t.setAbsoluteCartesian(parseFloat(e), n.y, n.z), this.refresh(t);
|
|
228
|
+
}
|
|
229
|
+
}, this._onChangeAbsoluteY = (e) => {
|
|
230
|
+
let t = this.model.getSelectedEntity();
|
|
231
|
+
if (t) {
|
|
232
|
+
let n = t.getAbsoluteCartesian();
|
|
233
|
+
t.setAbsoluteCartesian(n.x, parseFloat(e), n.z), this.refresh(t);
|
|
234
|
+
}
|
|
235
|
+
}, this._onChangeAbsoluteZ = (e) => {
|
|
236
|
+
let t = this.model.getSelectedEntity();
|
|
237
|
+
if (t) {
|
|
238
|
+
let n = t.getAbsoluteCartesian();
|
|
239
|
+
t.setAbsoluteCartesian(n.x, n.y, parseFloat(e)), this.refresh(t);
|
|
240
|
+
}
|
|
241
|
+
}, this._onChangePitch = (e) => {
|
|
242
|
+
let t = this.model.getSelectedEntity();
|
|
243
|
+
t && (t.setPitch(parseFloat(e) * l.RADIANS), this.refresh(t));
|
|
244
|
+
}, this._onChangeYaw = (e) => {
|
|
245
|
+
let t = this.model.getSelectedEntity();
|
|
246
|
+
t && (t.setYaw(parseFloat(e) * l.RADIANS), this.refresh(t));
|
|
247
|
+
}, this._onChangeRoll = (e) => {
|
|
248
|
+
let t = this.model.getSelectedEntity();
|
|
249
|
+
t && (t.setRoll(parseFloat(e) * l.RADIANS), this.refresh(t));
|
|
250
|
+
}, this._onChangeAbsolutePitch = (e) => {
|
|
251
|
+
let t = this.model.getSelectedEntity();
|
|
252
|
+
t && (t.setAbsolutePitch(parseFloat(e) * l.RADIANS), this.refresh(t));
|
|
253
|
+
}, this._onChangeAbsoluteYaw = (e) => {
|
|
254
|
+
let t = this.model.getSelectedEntity();
|
|
255
|
+
t && (t.setAbsoluteYaw(parseFloat(e) * l.RADIANS), this.refresh(t));
|
|
256
|
+
}, this._onChangeAbsoluteRoll = (e) => {
|
|
257
|
+
let t = this.model.getSelectedEntity();
|
|
258
|
+
t && (t.setAbsoluteRoll(parseFloat(e) * l.RADIANS), this.refresh(t));
|
|
259
|
+
}, this._onChangeScale = (e) => {
|
|
260
|
+
let t = this.model.getSelectedEntity();
|
|
261
|
+
if (t) {
|
|
262
|
+
let n = parseFloat(e);
|
|
263
|
+
t.billboard && t.billboard.setScale(n), t.label && t.label.setScale(n), this._hasEntityScale(t) && (t.setScale(n), this._scaleXView.stopPropagation(), this._scaleYView.stopPropagation(), this._scaleZView.stopPropagation(), this._scaleXView.value = n, this._scaleYView.value = n, this._scaleZView.value = n);
|
|
264
|
+
}
|
|
265
|
+
}, this._onChangeScaleX = (e) => {
|
|
266
|
+
let t = this.model.getSelectedEntity();
|
|
267
|
+
if (t) {
|
|
268
|
+
let n = t.getScale();
|
|
269
|
+
t.setScale3v(new a(parseFloat(e), n.y, n.z));
|
|
270
|
+
}
|
|
271
|
+
}, this._onChangeScaleY = (e) => {
|
|
272
|
+
let t = this.model.getSelectedEntity();
|
|
273
|
+
if (t) {
|
|
274
|
+
let n = t.getScale();
|
|
275
|
+
t.setScale3v(new a(n.x, parseFloat(e), n.z));
|
|
276
|
+
}
|
|
277
|
+
}, this._onChangeScaleZ = (e) => {
|
|
278
|
+
let t = this.model.getSelectedEntity();
|
|
279
|
+
if (t) {
|
|
280
|
+
let n = t.getScale();
|
|
281
|
+
t.setScale3v(new a(n.x, n.y, parseFloat(e)));
|
|
282
|
+
}
|
|
283
|
+
}, this._onChangeOpacity = (e) => {
|
|
284
|
+
let t = this.model.getSelectedEntity();
|
|
285
|
+
t && t.setOpacity(e);
|
|
286
|
+
}, this._entity = e.entity || null, this._titleBarView = new u.TitleBarView({ title: "Entity" }), this._bodyEl = null, this._relativePositionView = new u.Checkbox({ label: "Relative position" }), this._yawModeView = new u.Checkbox({ label: "Yaw mode" }), this._lonView = new u.Input({
|
|
287
|
+
label: "Lon",
|
|
288
|
+
type: "number",
|
|
289
|
+
min: -180,
|
|
290
|
+
max: 180,
|
|
291
|
+
maxFixed: 10
|
|
292
|
+
}), this._latView = new u.Input({
|
|
293
|
+
label: "Lat",
|
|
294
|
+
type: "number",
|
|
295
|
+
min: -90,
|
|
296
|
+
max: 90,
|
|
297
|
+
maxFixed: 10
|
|
298
|
+
}), this._heightView = new u.Input({
|
|
299
|
+
label: "Height",
|
|
300
|
+
type: "number",
|
|
301
|
+
maxFixed: 4
|
|
302
|
+
}), this._xView = new u.Input({
|
|
303
|
+
label: "X",
|
|
304
|
+
type: "number",
|
|
305
|
+
maxFixed: 10
|
|
306
|
+
}), this._yView = new u.Input({
|
|
307
|
+
label: "Y",
|
|
308
|
+
type: "number"
|
|
309
|
+
}), this._zView = new u.Input({
|
|
310
|
+
label: "Z",
|
|
311
|
+
type: "number"
|
|
312
|
+
}), this._absXView = new u.Input({
|
|
313
|
+
label: "Absolute X",
|
|
314
|
+
type: "number",
|
|
315
|
+
maxFixed: 10
|
|
316
|
+
}), this._absYView = new u.Input({
|
|
317
|
+
label: "Absolute Y",
|
|
318
|
+
type: "number"
|
|
319
|
+
}), this._absZView = new u.Input({
|
|
320
|
+
label: "Absolute Z",
|
|
321
|
+
type: "number"
|
|
322
|
+
}), this._pitchView = new u.Input({
|
|
323
|
+
label: "Pitch",
|
|
324
|
+
type: "number",
|
|
325
|
+
maxFixed: 2
|
|
326
|
+
}), this._yawView = new u.Input({
|
|
327
|
+
label: "Yaw",
|
|
328
|
+
type: "number",
|
|
329
|
+
maxFixed: 2
|
|
330
|
+
}), this._rollView = new u.Input({
|
|
331
|
+
label: "Roll",
|
|
332
|
+
type: "number",
|
|
333
|
+
maxFixed: 2
|
|
334
|
+
}), this._absolutePitchView = new u.Input({
|
|
335
|
+
label: "Absolute pitch",
|
|
336
|
+
type: "number",
|
|
337
|
+
maxFixed: 2
|
|
338
|
+
}), this._absoluteYawView = new u.Input({
|
|
339
|
+
label: "Absolute yaw",
|
|
340
|
+
type: "number",
|
|
341
|
+
maxFixed: 2
|
|
342
|
+
}), this._absoluteRollView = new u.Input({
|
|
343
|
+
label: "Absolute roll",
|
|
344
|
+
type: "number",
|
|
345
|
+
maxFixed: 2
|
|
346
|
+
}), this._scaleView = new u.Input({
|
|
347
|
+
label: "Scale",
|
|
348
|
+
type: "number",
|
|
349
|
+
maxFixed: 2
|
|
350
|
+
}), this._scaleXView = new u.Input({
|
|
351
|
+
label: "Scale X",
|
|
352
|
+
type: "number",
|
|
353
|
+
maxFixed: 2
|
|
354
|
+
}), this._scaleYView = new u.Input({
|
|
355
|
+
label: "Scale Y",
|
|
356
|
+
type: "number",
|
|
357
|
+
maxFixed: 2
|
|
358
|
+
}), this._scaleZView = new u.Input({
|
|
359
|
+
label: "Scale Z",
|
|
360
|
+
type: "number",
|
|
361
|
+
maxFixed: 2
|
|
362
|
+
}), this._opacityView = new u.Slider({
|
|
363
|
+
label: "Opacity",
|
|
364
|
+
min: 0,
|
|
365
|
+
max: 1,
|
|
366
|
+
value: 1
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
bindEntity(e) {
|
|
370
|
+
this._entity = e, this.refresh(e);
|
|
371
|
+
}
|
|
372
|
+
render(e) {
|
|
373
|
+
return super.render(e), this._titleBarView.appendTo(this.el), this._titleBarView.events.on("change", this._onTitleBarChange), this._bodyEl = document.createElement("div"), this._bodyEl.classList.add("og-editor-panel__body"), this.el.appendChild(this._bodyEl), this._relativePositionView.appendTo(this._bodyEl), this._yawModeView.appendTo(this._bodyEl), this.model.planet && (this._lonView.appendTo(this._bodyEl), this._latView.appendTo(this._bodyEl), this._heightView.appendTo(this._bodyEl)), this._xView.appendTo(this._bodyEl), this._yView.appendTo(this._bodyEl), this._zView.appendTo(this._bodyEl), this._absXView.appendTo(this._bodyEl), this._absYView.appendTo(this._bodyEl), this._absZView.appendTo(this._bodyEl), this._pitchView.appendTo(this._bodyEl), this._yawView.appendTo(this._bodyEl), this._rollView.appendTo(this._bodyEl), this._absolutePitchView.appendTo(this._bodyEl), this._absoluteYawView.appendTo(this._bodyEl), this._absoluteRollView.appendTo(this._bodyEl), this._scaleView.appendTo(this._bodyEl), this._scaleXView.appendTo(this._bodyEl), this._scaleYView.appendTo(this._bodyEl), this._scaleZView.appendTo(this._bodyEl), this._opacityView.appendTo(this._bodyEl), this._relativePositionView.events.on("change", this._onChangeRelativePosition), this._yawModeView.events.on("change", this._onChangeYawMode), this._lonView.events.on("change", this._onChangeLon), this._latView.events.on("change", this._onChangeLat), this._heightView.events.on("change", this._onChangeHeight), this._xView.events.on("change", this._onChangeX), this._yView.events.on("change", this._onChangeY), this._zView.events.on("change", this._onChangeZ), this._absXView.events.on("change", this._onChangeAbsoluteX), this._absYView.events.on("change", this._onChangeAbsoluteY), this._absZView.events.on("change", this._onChangeAbsoluteZ), this._pitchView.events.on("change", this._onChangePitch), this._yawView.events.on("change", this._onChangeYaw), this._rollView.events.on("change", this._onChangeRoll), this._absolutePitchView.events.on("change", this._onChangeAbsolutePitch), this._absoluteYawView.events.on("change", this._onChangeAbsoluteYaw), this._absoluteRollView.events.on("change", this._onChangeAbsoluteRoll), this._scaleView.events.on("change", this._onChangeScale), this._scaleXView.events.on("change", this._onChangeScaleX), this._scaleYView.events.on("change", this._onChangeScaleY), this._scaleZView.events.on("change", this._onChangeScaleZ), this._opacityView.events.on("change", this._onChangeOpacity), this.refresh(), this;
|
|
374
|
+
}
|
|
375
|
+
refresh(e = this._entity) {
|
|
376
|
+
if (!e) return;
|
|
377
|
+
this._entity = e, this._relativePositionView.disabled = !e.parent, this._relativePositionView.checked = e.relativePosition;
|
|
378
|
+
let t = this.model.editMode === _;
|
|
379
|
+
this._yawModeView.checked !== t && (this._yawModeView.events.stopPropagation(), this._yawModeView.checked = t);
|
|
380
|
+
let n = e.getLonLat();
|
|
381
|
+
this._lonView.stopPropagation(), this._latView.stopPropagation(), this._heightView.stopPropagation(), this._lonView.value = n.lon, this._latView.value = n.lat, this._heightView.value = n.height;
|
|
382
|
+
let r = e.getCartesian();
|
|
383
|
+
this._xView.stopPropagation(), this._yView.stopPropagation(), this._zView.stopPropagation(), this._xView.value = r.x, this._yView.value = r.y, this._zView.value = r.z, r = e.getAbsoluteCartesian(), this._absXView.stopPropagation(), this._absYView.stopPropagation(), this._absZView.stopPropagation(), this._absXView.value = r.x, this._absYView.value = r.y, this._absZView.value = r.z, this.refreshRotation(e), this._scaleView.stopPropagation();
|
|
384
|
+
let i = e.getScale(), a = e.billboard || e.label;
|
|
385
|
+
a ? this._scaleView.value = a.getScale() : i.x === i.y && i.y === i.z ? this._scaleView.value = i.x : this._scaleView.value = 1, this._scaleXView.stopPropagation(), this._scaleYView.stopPropagation(), this._scaleZView.stopPropagation(), this._scaleXView.value = i.x, this._scaleYView.value = i.y, this._scaleZView.value = i.z;
|
|
386
|
+
let o = this._hasEntityScale(e);
|
|
387
|
+
this._scaleXView.visibility = o, this._scaleYView.visibility = o, this._scaleZView.visibility = o, this._opacityView.events.stopPropagation(), this._opacityView.value = e.getOpacity();
|
|
388
|
+
}
|
|
389
|
+
refreshRotation(e = this._entity) {
|
|
390
|
+
e && (this._pitchView.stopPropagation(), this._pitchView.value = e.getPitch() * l.DEGREES, this._yawView.stopPropagation(), this._yawView.value = e.getYaw() * l.DEGREES, this._rollView.stopPropagation(), this._rollView.value = e.getRoll() * l.DEGREES, this._absolutePitchView.stopPropagation(), this._absolutePitchView.value = e.getAbsolutePitch() * l.DEGREES, this._absoluteYawView.stopPropagation(), this._absoluteYawView.value = e.getAbsoluteYaw() * l.DEGREES, this._absoluteRollView.stopPropagation(), this._absoluteRollView.value = e.getAbsoluteRoll() * l.DEGREES);
|
|
391
|
+
}
|
|
392
|
+
remove() {
|
|
393
|
+
this._relativePositionView.remove(), this._yawModeView.remove(), this._lonView.remove(), this._latView.remove(), this._heightView.remove(), this._xView.remove(), this._yView.remove(), this._zView.remove(), this._absXView.remove(), this._absYView.remove(), this._absZView.remove(), this._pitchView.remove(), this._yawView.remove(), this._rollView.remove(), this._absolutePitchView.remove(), this._absoluteYawView.remove(), this._absoluteRollView.remove(), this._scaleView.remove(), this._scaleXView.remove(), this._scaleYView.remove(), this._scaleZView.remove(), this._opacityView.remove(), this._titleBarView.events.off("change", this._onTitleBarChange), this._titleBarView.remove(), this._bodyEl = null, super.remove();
|
|
394
|
+
}
|
|
395
|
+
_hasEntityScale(e) {
|
|
396
|
+
return !!e.geoObject || !(e.billboard || e.label);
|
|
397
|
+
}
|
|
398
|
+
}, b = 0, x = 1, S = "<div class=\"og-editor-panel\"></div>", C = "<div class=\"og-select\">\n <div class=\"og-input-label\">Render mode</div>\n <select>\n <option value=\"color\">Color</option>\n <option value=\"light\">Light</option>\n </select>\n</div>";
|
|
399
|
+
function w(e) {
|
|
400
|
+
let t = parseFloat(e);
|
|
401
|
+
return Number.isFinite(t) ? t : null;
|
|
402
|
+
}
|
|
403
|
+
var T = class extends u.View {
|
|
404
|
+
constructor(e) {
|
|
405
|
+
super({
|
|
406
|
+
template: S,
|
|
407
|
+
model: e.projector
|
|
408
|
+
}), this._onTitleBarChange = (e) => {
|
|
409
|
+
this._bodyEl?.classList.toggle("og-editor-panel__body_collapsed", e);
|
|
410
|
+
}, this._onChangeEnabled = (e) => {
|
|
411
|
+
this.model.enabled = e;
|
|
412
|
+
}, this._onChangeSourceEnabled = (e) => {
|
|
413
|
+
this.model.sourceEnabled = e;
|
|
414
|
+
}, this._onChangeColor = (e) => {
|
|
415
|
+
let t = this.model.getOpacity(), n = d.htmlColorToRgba(e);
|
|
416
|
+
this.model.setColor(n.x, n.y, n.z, t);
|
|
417
|
+
}, this._onChangeOpacity = (e) => {
|
|
418
|
+
let t = w(e);
|
|
419
|
+
t !== null && this.model.setOpacity(Math.max(0, Math.min(1, t)));
|
|
420
|
+
}, this._onChangePriority = (e) => {
|
|
421
|
+
let t = w(e);
|
|
422
|
+
t !== null && (this.model.priority = t);
|
|
423
|
+
}, this._onChangeMode = () => {
|
|
424
|
+
this._modeEl && (this.model.renderMode = this._modeEl.value === "light" ? x : b);
|
|
425
|
+
}, this._enabledView = new u.Checkbox({ label: "Enabled" }), this._sourceEnabledView = new u.Checkbox({ label: "Source enabled" }), this._colorView = new u.Color({ label: "Color" }), this._opacityView = new u.Input({
|
|
426
|
+
label: "Opacity",
|
|
427
|
+
type: "number",
|
|
428
|
+
min: 0,
|
|
429
|
+
max: 1,
|
|
430
|
+
step: .01,
|
|
431
|
+
maxFixed: 4
|
|
432
|
+
}), this._priorityView = new u.Input({
|
|
433
|
+
label: "Priority",
|
|
434
|
+
type: "number",
|
|
435
|
+
step: 1,
|
|
436
|
+
maxFixed: 0
|
|
437
|
+
}), this._modeEl = null, this._modeRowEl = null, this._titleBarView = new u.TitleBarView({ title: "Projector" }), this._bodyEl = null;
|
|
438
|
+
}
|
|
439
|
+
bindProjector(e) {
|
|
440
|
+
this.model = e;
|
|
441
|
+
}
|
|
442
|
+
render(e) {
|
|
443
|
+
return super.render(e), this._titleBarView.appendTo(this.el), this._titleBarView.events.on("change", this._onTitleBarChange), this._bodyEl = document.createElement("div"), this._bodyEl.classList.add("og-editor-panel__body"), this.el.appendChild(this._bodyEl), this._enabledView.appendTo(this._bodyEl), this._sourceEnabledView.appendTo(this._bodyEl), this._colorView.appendTo(this._bodyEl), this._opacityView.appendTo(this._bodyEl), this._priorityView.appendTo(this._bodyEl), this._modeRowEl = u.View.parseHTML(C)[0], this._modeEl = this._modeRowEl.querySelector("select"), this._bodyEl.appendChild(this._modeRowEl), this._enabledView.events.on("change", this._onChangeEnabled), this._sourceEnabledView.events.on("change", this._onChangeSourceEnabled), this._colorView.events.on("input", this._onChangeColor), this._opacityView.events.on("change", this._onChangeOpacity), this._priorityView.events.on("change", this._onChangePriority), this._modeEl.addEventListener("change", this._onChangeMode), this.refresh(), this;
|
|
444
|
+
}
|
|
445
|
+
refresh() {
|
|
446
|
+
let e = this.model;
|
|
447
|
+
this._enabledView.checked !== e.enabled && (this._enabledView.stopPropagation(), this._enabledView.checked = e.enabled), this._sourceEnabledView.checked !== e.sourceEnabled && (this._sourceEnabledView.stopPropagation(), this._sourceEnabledView.checked = e.sourceEnabled), this._sourceEnabledView.disabled = !e.source;
|
|
448
|
+
let t = e.getColor();
|
|
449
|
+
this._colorView.value !== t && (this._colorView.stopPropagation(), this._colorView.value = t), this._opacityView.stopPropagation(), this._opacityView.value = e.getOpacity(), this._priorityView.stopPropagation(), this._priorityView.value = e.priority, this._modeEl && (this._modeEl.value = e.renderMode === x ? "light" : "color");
|
|
450
|
+
}
|
|
451
|
+
remove() {
|
|
452
|
+
this._enabledView.remove(), this._sourceEnabledView.remove(), this._colorView.remove(), this._opacityView.remove(), this._priorityView.remove(), this._modeEl && this._modeEl.removeEventListener("change", this._onChangeMode), this._modeRowEl && this._modeRowEl.parentNode && this._modeRowEl.parentNode.removeChild(this._modeRowEl), this._titleBarView.events.off("change", this._onTitleBarChange), this._titleBarView.remove(), this._bodyEl = null, super.remove();
|
|
453
|
+
}
|
|
454
|
+
}, E = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" id=\"filter-center-focus\">\n <path d=\"M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z\"/>\n</svg>", D = "Entity Properties", O = class extends u.Dialog {
|
|
455
|
+
constructor(e) {
|
|
456
|
+
super({
|
|
457
|
+
title: D,
|
|
458
|
+
visible: !1,
|
|
459
|
+
resizable: !0,
|
|
460
|
+
useHide: !0,
|
|
461
|
+
top: 25,
|
|
462
|
+
right: 85,
|
|
463
|
+
width: 252,
|
|
464
|
+
height: 480,
|
|
465
|
+
minHeight: 100,
|
|
466
|
+
minWidth: 100,
|
|
467
|
+
model: e.model
|
|
468
|
+
}), this._onVisibility = (e) => {
|
|
469
|
+
this.model.setVisibility(e && !!this.model.getSelectedEntity());
|
|
470
|
+
}, this._onSelect = (e) => {
|
|
471
|
+
this._setDialogTitle(e), this.show(), this._refreshViews(e);
|
|
472
|
+
}, this._onUnselect = () => {
|
|
473
|
+
this._removeViews(), this.setTitle(D), this._$empty && (this._$empty.style.display = "");
|
|
474
|
+
}, this._onPosition = (e, t) => {
|
|
475
|
+
this._refreshViews(t);
|
|
476
|
+
}, this._onPitch = (e, t) => {
|
|
477
|
+
this._entityView?.refreshRotation(t);
|
|
478
|
+
}, this._onYaw = (e, t) => {
|
|
479
|
+
this._entityView?.refreshRotation(t);
|
|
480
|
+
}, this._onRoll = (e, t) => {
|
|
481
|
+
this._entityView?.refreshRotation(t);
|
|
482
|
+
}, this._entityView = null, this._cameraView = null, this._projectorView = null, this._$empty = null;
|
|
483
|
+
}
|
|
484
|
+
render(e) {
|
|
485
|
+
super.render(e), this._initSceneEvents();
|
|
486
|
+
let t = document.createElement("div");
|
|
487
|
+
t.classList.add("og-editor_toolbar"), this.container?.appendChild(t);
|
|
488
|
+
let n = new u.ToggleButton({
|
|
489
|
+
classList: ["og-editor_toolbar-button"],
|
|
490
|
+
icon: E,
|
|
491
|
+
title: "Lock/Unlock camera view"
|
|
492
|
+
});
|
|
493
|
+
return n.appendTo(t), this._$empty = document.createElement("div"), this._$empty.classList.add("og-editor_empty"), this._$empty.textContent = "No entity selected. Click an object on the map to edit it.", this.container?.appendChild(this._$empty), n.events.on("change", (e) => {
|
|
494
|
+
e ? this.model.lockView() : this.model.unlockView();
|
|
495
|
+
}), this.events.on("visibility", (e) => {
|
|
496
|
+
e || (n.events.stopPropagation(), n.setActive(!1));
|
|
497
|
+
}), this.events.on("visibility", this._onVisibility), this;
|
|
498
|
+
}
|
|
499
|
+
remove() {
|
|
500
|
+
this._removeViews(), super.remove(), this._clearSceneEvents();
|
|
501
|
+
}
|
|
502
|
+
_initSceneEvents() {
|
|
503
|
+
this.model.events.on("select", this._onSelect), this.model.events.on("unselect", this._onUnselect), this.model.events.on("position", this._onPosition), this.model.events.on("pitch", this._onPitch), this.model.events.on("yaw", this._onYaw), this.model.events.on("roll", this._onRoll);
|
|
504
|
+
}
|
|
505
|
+
_clearSceneEvents() {
|
|
506
|
+
this.model.events.off("select", this._onSelect), this.model.events.off("unselect", this._onUnselect), this.model.events.off("position", this._onPosition), this.model.events.off("pitch", this._onPitch), this.model.events.off("yaw", this._onYaw), this.model.events.off("roll", this._onRoll);
|
|
507
|
+
}
|
|
508
|
+
_refreshViews(e) {
|
|
509
|
+
this._setDialogTitle(e), this._$empty && (this._$empty.style.display = "none"), this._refreshEntityView(e), this._refreshCameraView(e), this._refreshProjectorView(e);
|
|
510
|
+
}
|
|
511
|
+
_refreshEntityView(e) {
|
|
512
|
+
this._entityView ? this._entityView.bindEntity(e) : (this._entityView = new y({
|
|
513
|
+
model: this.model,
|
|
514
|
+
entity: e
|
|
515
|
+
}), this._entityView.appendTo(this.container));
|
|
516
|
+
}
|
|
517
|
+
_removeEntityView() {
|
|
518
|
+
this._entityView &&= (this._entityView.remove(), null);
|
|
519
|
+
}
|
|
520
|
+
_refreshCameraView(e) {
|
|
521
|
+
m(e) ? this._cameraView ? (this._cameraView.bindEntity(e), this._cameraView.refresh()) : (this._cameraView = new h({ entity: e }), this._cameraView.appendTo(this.container)) : this._removeCameraView();
|
|
522
|
+
}
|
|
523
|
+
_removeCameraView() {
|
|
524
|
+
this._cameraView &&= (this._cameraView.remove(), null);
|
|
525
|
+
}
|
|
526
|
+
_refreshProjectorView(e) {
|
|
527
|
+
let t = e.properties.depthCamera, n = e.entityCollection?.scene?.renderer, r = t && n ? n.projectors.getByDepthCamera(t) : null;
|
|
528
|
+
r ? this._projectorView ? (this._projectorView.bindProjector(r), this._projectorView.refresh()) : (this._projectorView = new T({ projector: r }), this._projectorView.appendTo(this.container)) : this._removeProjectorView();
|
|
529
|
+
}
|
|
530
|
+
_removeProjectorView() {
|
|
531
|
+
this._projectorView &&= (this._projectorView.remove(), null);
|
|
532
|
+
}
|
|
533
|
+
_removeViews() {
|
|
534
|
+
this._removeProjectorView(), this._removeCameraView(), this._removeEntityView();
|
|
535
|
+
}
|
|
536
|
+
_setDialogTitle(e) {
|
|
537
|
+
let t = e.name?.trim(), n = t && t.length > 0 ? t : `entity:${e.id.toString()}`;
|
|
538
|
+
this.setTitle(n);
|
|
539
|
+
}
|
|
540
|
+
hide() {
|
|
541
|
+
super.hide(), this.model.events.stopPropagation(), this.model.unselect();
|
|
542
|
+
}
|
|
543
|
+
}, k = ".og-entityTree{width:100%}.og-entityTree__node{box-sizing:border-box;width:100%}.og-entityTree__row{align-items:center;min-height:22px;display:flex}.og-entityTree__toggleBtn{width:20px;height:20px;color:var(--grey5);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:0;font-size:14px}.og-entityTree__toggleBtn_hasChildren:hover{background-color:var(--grey7)}.og-entityTree__toggleBtn_empty{visibility:hidden;pointer-events:none}.og-entityTree__entityBtn{min-width:0;color:var(--grey6);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:4px;flex:1;justify-content:space-between;align-items:center;gap:8px;padding:3px 6px 3px 4px;font-size:12px;display:flex}.og-entityTree__entityBtn:hover,.og-entityTree__entityBtn:focus-visible,.og-entityTree__row_selected .og-entityTree__entityBtn{background-color:var(--grey7)}.og-entityTree__name{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.og-entityTree__type{color:var(--grey4);white-space:nowrap;font-size:11px}.og-entityTree__children_hidden{display:none}.og-entityTree__children{padding-left:17px}.og-entityTreeControl{width:100%;height:100%;color:var(--grey6);position:relative;overflow:hidden auto}.og-entityTreeControl__tree{box-sizing:border-box;width:100%;padding:4px}.og-entityTreeControl__empty,.og-editor_empty{color:var(--grey4);padding:10px 8px;font-size:13px}.og-editor_toolbar{display:flex}.og-editor_toolbar-button{float:left;width:25px;height:25px;margin:3px}.og-editor-panel__body_collapsed{display:none}.og-select{flex-direction:row;margin:5px;display:flex}.og-select .og-input-label{width:100%;height:100%;color:var(--grey6);text-align:left;margin-right:5px;font-family:Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;font-size:14px}.og-select select{background:var(--grey1);border:1px solid var(--grey2);width:100%;height:100%;color:var(--grey6);--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;border-radius:5px;padding-left:5px;position:relative}.og-select select:focus-visible{outline:none}.og-object3d-manager .og-ddialog-container{flex-direction:column;display:flex}.og-object3d-collection{width:100%;height:100%}.og-object3d-collection__item{background-color:var(--grey1);cursor:pointer;border:2px solid #0000;border-radius:5px;width:75px;height:75px;margin:3px;position:relative}.og-object3d-collection__item.active{border:solid var(--grey6) 2px}.og-object3d-collection__item_name{background:var(--grey11);width:100%;height:20px;color:var(--grey6);border-bottom-right-radius:5px;border-bottom-left-radius:5px;padding-top:3px;position:absolute;bottom:0;left:0}", A = null, j = 0;
|
|
544
|
+
function M() {
|
|
545
|
+
j++ === 0 && (A = document.createElement("style"), A.textContent = k, document.head.appendChild(A));
|
|
546
|
+
}
|
|
547
|
+
function N() {
|
|
548
|
+
j > 0 && --j === 0 && (A?.remove(), A = null);
|
|
549
|
+
}
|
|
550
|
+
// src/entityEditor/EntityEditor.ts
|
|
551
|
+
var P = class extends r {
|
|
552
|
+
constructor(e = {}) {
|
|
553
|
+
super({
|
|
554
|
+
name: "EntityEditor",
|
|
555
|
+
...e,
|
|
556
|
+
tools: "full"
|
|
557
|
+
}), this._onUnselectEntity = () => {
|
|
558
|
+
this._visibility || this._dialog.hide();
|
|
559
|
+
}, this._dialog = new O({ model: this._scene }), this._visibility = e.visibility || !1, this._cameraLock = null, this.events.on("unselect", this._onUnselectEntity);
|
|
560
|
+
}
|
|
561
|
+
oninit() {
|
|
562
|
+
super.oninit(), M(), this.renderer && (this._cameraLock = new e({ planet: this.planet }), this.renderer.addControl(this._cameraLock), this._dialog.appendTo(this.renderer.getUIContainer()), this._visibility && this._dialog.show());
|
|
563
|
+
}
|
|
564
|
+
ondeactivate() {
|
|
565
|
+
super.ondeactivate(), this._dialog.hide();
|
|
566
|
+
}
|
|
567
|
+
onremove() {
|
|
568
|
+
super.onremove(), this._dialog.remove(), this._cameraLock?.remove(), this._cameraLock = null, this._initialized && N();
|
|
569
|
+
}
|
|
570
|
+
positionDialogLeftOf(e) {
|
|
571
|
+
this._dialog.positionNearElementOnFirstOpen(e.el);
|
|
572
|
+
}
|
|
573
|
+
}, F = ["select"], I = "<div class=\"og-entityTree\"></div>", L = class extends u.View {
|
|
574
|
+
constructor(e) {
|
|
575
|
+
super({
|
|
576
|
+
...e,
|
|
577
|
+
template: I,
|
|
578
|
+
model: e.model || []
|
|
579
|
+
}), this.events = o(F), this._expandedByDefault = e.expandedByDefault ?? !1, this._expandedEntityIds = e.expandedEntityIds || /* @__PURE__ */ new Set();
|
|
580
|
+
}
|
|
581
|
+
render(e) {
|
|
582
|
+
return super.render(e), this._renderTree(), this;
|
|
583
|
+
}
|
|
584
|
+
setEntities(e) {
|
|
585
|
+
this.model = e, this._renderTree();
|
|
586
|
+
}
|
|
587
|
+
_renderTree() {
|
|
588
|
+
this.el && (this.el.innerHTML = "", this._renderEntities(this.model, this.el));
|
|
589
|
+
}
|
|
590
|
+
_renderEntities(e, t) {
|
|
591
|
+
for (let n = 0; n < e.length; n++) t.appendChild(this._createEntityNode(e[n]));
|
|
592
|
+
}
|
|
593
|
+
_createEntityNode(e) {
|
|
594
|
+
let t = document.createElement("div");
|
|
595
|
+
t.classList.add("og-entityTree__node");
|
|
596
|
+
let n = document.createElement("div");
|
|
597
|
+
n.classList.add("og-entityTree__row"), t.appendChild(n), n.dataset.entityId = e.id.toString();
|
|
598
|
+
let r = e.childEntities.length !== 0, i = r && (this._expandedByDefault || this._expandedEntityIds.has(e.id)), a = document.createElement("button");
|
|
599
|
+
a.type = "button", a.classList.add("og-entityTree__toggleBtn"), a.classList.add(r ? "og-entityTree__toggleBtn_hasChildren" : "og-entityTree__toggleBtn_empty"), a.disabled = e.childEntities.length === 0, a.textContent = r ? this._getToggleText(i) : "", n.appendChild(a);
|
|
600
|
+
let o = document.createElement("button");
|
|
601
|
+
o.type = "button", o.classList.add("og-entityTree__entityBtn"), o.title = e.name || `entity:${e.id.toString()}`;
|
|
602
|
+
let s = document.createElement("span");
|
|
603
|
+
s.classList.add("og-entityTree__name"), s.textContent = e.name || `entity:${e.id.toString()}`, o.appendChild(s);
|
|
604
|
+
let c = document.createElement("span");
|
|
605
|
+
c.classList.add("og-entityTree__type"), c.textContent = this._getEntityTypes(e), o.appendChild(c), n.appendChild(o);
|
|
606
|
+
let l = document.createElement("div");
|
|
607
|
+
return l.classList.add("og-entityTree__children"), r && !i && l.classList.add("og-entityTree__children_hidden"), t.appendChild(l), r && (this._renderEntities(e.childEntities, l), a.addEventListener("click", (t) => {
|
|
608
|
+
t.stopPropagation(), i = !i, i ? this._expandedEntityIds.add(e.id) : this._expandedEntityIds.delete(e.id), a.textContent = this._getToggleText(i), l.classList.toggle("og-entityTree__children_hidden", !i);
|
|
609
|
+
})), o.addEventListener("click", (t) => {
|
|
610
|
+
t.stopPropagation(), this.events.dispatch(this.events.select, e, this);
|
|
611
|
+
}), t;
|
|
612
|
+
}
|
|
613
|
+
setSelectedEntity(e) {
|
|
614
|
+
this.el?.querySelector(".og-entityTree__row_selected")?.classList.remove("og-entityTree__row_selected"), e && this.el?.querySelector(`[data-entity-id="${e.id}"]`)?.classList.add("og-entityTree__row_selected");
|
|
615
|
+
}
|
|
616
|
+
_getToggleText(e) {
|
|
617
|
+
return e ? "▾" : "▸";
|
|
618
|
+
}
|
|
619
|
+
_getEntityTypes(e) {
|
|
620
|
+
let t = [];
|
|
621
|
+
return e.billboard && t.push("billboard"), e.label && t.push("label"), e.geoObject && t.push("geoObject"), e.geometry && t.push("geometry"), e.polyline && t.push("polyline"), e.ray && t.push("ray"), e.pointCloud && t.push("pointCloud"), e.strip && t.push("strip"), t.length ? t.join(", ") : "";
|
|
622
|
+
}
|
|
623
|
+
}, R = "<svg width=\"1200pt\" height=\"1200pt\" version=\"1.1\" viewBox=\"0 0 1200 1200\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"m120 0h300v300h-300z\"/>\n<path d=\"m1080 660v-300h-300v120h-480v-120h-60v840h60v-240h480v120h300v-300h-300v120h-480v-360h480v120z\"/>\n</svg>", z = "<div class=\"og-entityTreeControl\">\n <div class=\"og-entityTreeControl__tree\"></div>\n </div>", B = class extends t {
|
|
624
|
+
constructor(e = {}) {
|
|
625
|
+
super({
|
|
626
|
+
name: "EntityTree",
|
|
627
|
+
...e
|
|
628
|
+
}), this._onDialogVisibility = (e) => {
|
|
629
|
+
this._toggleBtn.setActive(e), e && this._dialog.positionNearElementOnFirstOpen(this._toggleBtn.el, this.renderer?.div || void 0);
|
|
630
|
+
}, this._onToggleButtonChange = (e) => {
|
|
631
|
+
this._dialog.setVisibility(e);
|
|
632
|
+
}, this._onEntitySelect = (e) => {
|
|
633
|
+
this._resolveEntityEditor(), this._entityEditor && (this._entityEditor.selectEntity(e), this._entityEditor.positionDialogLeftOf(this._dialog));
|
|
634
|
+
}, this._onEditorSelectionChange = () => {
|
|
635
|
+
this._refreshSelection();
|
|
636
|
+
}, this._entities = e.entities ? [...e.entities] : [], this._expandedEntityIds = /* @__PURE__ */ new Set(), this._expandedByDefault = e.expandedByDefault ?? !1, this._entityEditor = e.entityEditor || null, this._visibility = e.visibility || !1, this._dialog = new u.Dialog({
|
|
637
|
+
title: e.title || "Entity Tree",
|
|
638
|
+
top: e.top ?? 15,
|
|
639
|
+
right: e.right ?? 67,
|
|
640
|
+
visible: !1,
|
|
641
|
+
useHide: !0,
|
|
642
|
+
width: e.width ?? 340,
|
|
643
|
+
maxHeight: e.maxHeight ?? 560
|
|
644
|
+
}), this._panel = new u.View({ template: z }), this._toggleBtn = new u.ToggleButton({
|
|
645
|
+
classList: ["og-map-button", "og-entityTreeControl_button"],
|
|
646
|
+
icon: R,
|
|
647
|
+
title: "Entity tree"
|
|
648
|
+
}), this._treeView = null, this._$tree = null;
|
|
649
|
+
}
|
|
650
|
+
oninit() {
|
|
651
|
+
this.renderer && (M(), this._toggleBtn.appendTo(this.renderer.topRightContainer()), this._dialog.appendTo(this.renderer.getUIContainer()), this._dialog.container && (this._panel.appendTo(this._dialog.container), this._panel.el && (this._$tree = this._panel.el.querySelector(".og-entityTreeControl__tree"), this._dialog.events.on("visibility", this._onDialogVisibility), this._toggleBtn.events.on("change", this._onToggleButtonChange), this._resolveEntityEditor(), this._renderEntityTree(), this._visibility && this._dialog.show())));
|
|
652
|
+
}
|
|
653
|
+
onremove() {
|
|
654
|
+
this._dialog.events.off("visibility", this._onDialogVisibility), this._toggleBtn.events.off("change", this._onToggleButtonChange), this._unbindEntityEditor(), this._clearTreeView(), this._dialog.remove(), this._panel.remove(), this._toggleBtn.remove(), this._initialized && N();
|
|
655
|
+
}
|
|
656
|
+
onactivate() {}
|
|
657
|
+
ondeactivate() {
|
|
658
|
+
this._dialog.hide();
|
|
659
|
+
}
|
|
660
|
+
show() {
|
|
661
|
+
this._dialog.show();
|
|
662
|
+
}
|
|
663
|
+
setEntity(e) {
|
|
664
|
+
this._entities = e ? [e] : [], this._expandedEntityIds.clear(), this._renderEntityTree();
|
|
665
|
+
}
|
|
666
|
+
setEntities(e) {
|
|
667
|
+
this._entities = [...e], this._expandedEntityIds.clear(), this._renderEntityTree();
|
|
668
|
+
}
|
|
669
|
+
addEntity(e) {
|
|
670
|
+
let t = e.rootEntity;
|
|
671
|
+
this._containsEntity(this._entities, t) || this._entities.push(t);
|
|
672
|
+
let n = e;
|
|
673
|
+
for (; n;) this._expandedEntityIds.add(n.id), n = n.parent;
|
|
674
|
+
this._renderEntityTree();
|
|
675
|
+
}
|
|
676
|
+
_refreshSelection() {
|
|
677
|
+
let e = this._getSelectedEntity(), t = !1;
|
|
678
|
+
if (e && this._containsEntity(this._entities, e.rootEntity)) {
|
|
679
|
+
let n = e.parent;
|
|
680
|
+
for (; n;) this._expandedEntityIds.has(n.id) || (this._expandedEntityIds.add(n.id), t = !0), n = n.parent;
|
|
681
|
+
}
|
|
682
|
+
t ? this._renderEntityTree() : this._treeView?.setSelectedEntity(e);
|
|
683
|
+
}
|
|
684
|
+
removeEntity(e) {
|
|
685
|
+
if (!this._entities.length) return;
|
|
686
|
+
let t = /* @__PURE__ */ new Set();
|
|
687
|
+
this._collectEntityIds(e, t);
|
|
688
|
+
let n = (t) => {
|
|
689
|
+
for (let r = 0; r < t.length; r++) {
|
|
690
|
+
let i = t[r];
|
|
691
|
+
if (i.isEqual(e)) return t.splice(r, 1), !0;
|
|
692
|
+
if (n(i.childEntities)) return !0;
|
|
693
|
+
}
|
|
694
|
+
return !1;
|
|
695
|
+
};
|
|
696
|
+
n(this._entities), t.forEach((e) => this._expandedEntityIds.delete(e)), this._renderEntityTree();
|
|
697
|
+
}
|
|
698
|
+
_containsEntity(e, t) {
|
|
699
|
+
for (let n = 0; n < e.length; n++) if (e[n].isEqual(t)) return !0;
|
|
700
|
+
return !1;
|
|
701
|
+
}
|
|
702
|
+
_collectEntityIds(e, t) {
|
|
703
|
+
t.add(e.id);
|
|
704
|
+
for (let n = 0; n < e.childEntities.length; n++) this._collectEntityIds(e.childEntities[n], t);
|
|
705
|
+
}
|
|
706
|
+
_resolveEntityEditor() {
|
|
707
|
+
if (!this._entityEditor && this.renderer) {
|
|
708
|
+
let e = this.renderer.controls.EntityEditor;
|
|
709
|
+
e instanceof P && (this._entityEditor = e);
|
|
710
|
+
}
|
|
711
|
+
this._entityEditor && (this._entityEditor.events.on("select", this._onEditorSelectionChange), this._entityEditor.events.on("unselect", this._onEditorSelectionChange));
|
|
712
|
+
}
|
|
713
|
+
_unbindEntityEditor() {
|
|
714
|
+
this._entityEditor && (this._entityEditor.events.off("select", this._onEditorSelectionChange), this._entityEditor.events.off("unselect", this._onEditorSelectionChange));
|
|
715
|
+
}
|
|
716
|
+
_getSelectedEntity() {
|
|
717
|
+
return this._entityEditor ? this._entityEditor.getSelectedEntity() : null;
|
|
718
|
+
}
|
|
719
|
+
_clearTreeView() {
|
|
720
|
+
this._treeView &&= (this._treeView.events.off("select", this._onEntitySelect), this._treeView.remove(), null);
|
|
721
|
+
}
|
|
722
|
+
_renderEntityTree() {
|
|
723
|
+
if (this._$tree) {
|
|
724
|
+
if (this._clearTreeView(), this._$tree.innerHTML = "", !this._entities.length) {
|
|
725
|
+
let e = document.createElement("div");
|
|
726
|
+
e.classList.add("og-entityTreeControl__empty"), e.textContent = "No entities. Click an object on the map to show it here.", this._$tree.appendChild(e);
|
|
727
|
+
} else this._treeView = new L({
|
|
728
|
+
model: this._entities,
|
|
729
|
+
expandedByDefault: this._expandedByDefault,
|
|
730
|
+
expandedEntityIds: this._expandedEntityIds
|
|
731
|
+
}), this._treeView.appendTo(this._$tree), this._treeView.setSelectedEntity(this._getSelectedEntity()), this._treeView.events.on("select", this._onEntitySelect);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}, V = ["click"], H = "<button class=\"og-object3d-collection__item\">\n <div class=\"og-object3d-collection__item_name\">{name}</div>\n </button>", U = class extends u.View {
|
|
735
|
+
constructor(e) {
|
|
736
|
+
super({
|
|
737
|
+
template: d.stringTemplate(H, { name: e.model.name }),
|
|
738
|
+
...e
|
|
739
|
+
}), this.events = o(V);
|
|
740
|
+
}
|
|
741
|
+
render(e) {
|
|
742
|
+
return super.render(e), this.el?.addEventListener("click", (e) => {
|
|
743
|
+
this.events.dispatch(this.events.click, this.model, this, e);
|
|
744
|
+
}), this;
|
|
745
|
+
}
|
|
746
|
+
}, W = ["select"], G = "<div class=\"og-object3d-collection\"></div>", K = class extends u.View {
|
|
747
|
+
constructor(e) {
|
|
748
|
+
super({
|
|
749
|
+
template: G,
|
|
750
|
+
model: e.model,
|
|
751
|
+
...e
|
|
752
|
+
}), this._onAdd = (e) => {
|
|
753
|
+
this._addItem(e);
|
|
754
|
+
}, this.events = o(W), this._activeView = null;
|
|
755
|
+
}
|
|
756
|
+
_addItem(e) {
|
|
757
|
+
let t = new U({ model: e });
|
|
758
|
+
t.appendTo(this.el), t.events.on("click", (e) => {
|
|
759
|
+
this._activeView && this._activeView.el?.classList.remove("active"), this._activeView = t, this._activeView.el?.classList.add("active"), this.events.dispatch(this.events.select, e, t);
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
render(e) {
|
|
763
|
+
super.render(e);
|
|
764
|
+
let t = this.model.getItems();
|
|
765
|
+
for (let e of t) this._addItem(e);
|
|
766
|
+
return this._initEvents(), this;
|
|
767
|
+
}
|
|
768
|
+
_initEvents() {
|
|
769
|
+
this.model.events.on("add", this._onAdd);
|
|
770
|
+
}
|
|
771
|
+
}, q = ["select"], J = "<svg class=\"svg-icon\" style=\"vertical-align: middle;fill: currentColor;overflow: hidden;\" viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M426.666667 170.666667H170.666667c-47.146667 0-84.906667 38.186667-84.906667 85.333333L85.333333 768c0 47.146667 38.186667 85.333333 85.333334 85.333333h682.666666c47.146667 0 85.333333-38.186667 85.333334-85.333333V341.333333c0-47.146667-38.186667-85.333333-85.333334-85.333333H512l-85.333333-85.333333z\" /></svg>", Y = class extends u.Dialog {
|
|
772
|
+
constructor(e) {
|
|
773
|
+
super({
|
|
774
|
+
classList: ["og-object3d-manager"],
|
|
775
|
+
title: "Object3D Collection",
|
|
776
|
+
visible: !1,
|
|
777
|
+
resizable: !0,
|
|
778
|
+
useHide: !0,
|
|
779
|
+
top: 25,
|
|
780
|
+
right: 85,
|
|
781
|
+
width: 252,
|
|
782
|
+
height: 480,
|
|
783
|
+
minHeight: 100,
|
|
784
|
+
minWidth: 100
|
|
785
|
+
}), this._onLoadClick = () => {
|
|
786
|
+
let e = new u.View({
|
|
787
|
+
initRender: !0,
|
|
788
|
+
template: "<input type=\"file\" accept=\".obj,.mtl\" multiple />"
|
|
789
|
+
});
|
|
790
|
+
e.el && (e.el.addEventListener("change", (e) => {
|
|
791
|
+
let t = e.target;
|
|
792
|
+
if (t.files) {
|
|
793
|
+
let e = Array.from(t.files), n = e.find((e) => e.name.toLowerCase().endsWith(".obj")), r = e.find((e) => e.name.toLowerCase().endsWith(".mtl"));
|
|
794
|
+
n && X(n, r).then(this._addObject);
|
|
795
|
+
}
|
|
796
|
+
}), e.el.click());
|
|
797
|
+
}, this._addObject = (e) => {
|
|
798
|
+
this._object3dCollectionView.model.addItem(e);
|
|
799
|
+
}, this.events = o(q), this._object3dCollectionView = new K({ model: e.model });
|
|
800
|
+
}
|
|
801
|
+
render(e) {
|
|
802
|
+
super.render(e);
|
|
803
|
+
let t = document.createElement("div");
|
|
804
|
+
t.classList.add("og-editor_toolbar"), this.container?.appendChild(t);
|
|
805
|
+
let n = new u.Button({
|
|
806
|
+
classList: ["og-editor_toolbar-button"],
|
|
807
|
+
icon: J,
|
|
808
|
+
title: "Load 3D object"
|
|
809
|
+
});
|
|
810
|
+
return n.appendTo(t), n.events.on("click", this._onLoadClick), this._object3dCollectionView.appendTo(this.container), this._object3dCollectionView.events.on("select", (e) => {
|
|
811
|
+
this.events.dispatch(this.events.select, e);
|
|
812
|
+
}), this;
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
async function X(e, t) {
|
|
816
|
+
return await i.readFileObj(e, t).then((n) => ({
|
|
817
|
+
name: e.name,
|
|
818
|
+
objects: t ? n : [i.merge(n)]
|
|
819
|
+
}));
|
|
820
|
+
}
|
|
821
|
+
// src/object3dManager/Object3dCollection.ts
|
|
822
|
+
var Z = ["add", "remove"], Q = class e {
|
|
823
|
+
constructor(t = {}) {
|
|
824
|
+
this.events = o(Z, this), this._items = e.createItemsMap(t.collection || []);
|
|
825
|
+
}
|
|
826
|
+
static createItemsMap(e) {
|
|
827
|
+
let t = /* @__PURE__ */ new Map();
|
|
828
|
+
for (let n = 0; n < e.length; n++) t.set(e[n].name, e[n]);
|
|
829
|
+
return t;
|
|
830
|
+
}
|
|
831
|
+
getItem(e) {
|
|
832
|
+
return this._items.get(e);
|
|
833
|
+
}
|
|
834
|
+
addItem(e, t = !1) {
|
|
835
|
+
(!this._items.has(e.name) || t) && (this._items.set(e.name, e), this.events.dispatch(this.events.add, e));
|
|
836
|
+
}
|
|
837
|
+
getItems() {
|
|
838
|
+
return Array.from(this._items, ([e, t]) => t);
|
|
839
|
+
}
|
|
840
|
+
}, $ = class extends t {
|
|
841
|
+
constructor(e = {}) {
|
|
842
|
+
super(e), this._onSelect = (e) => {
|
|
843
|
+
this._currentItem = e;
|
|
844
|
+
}, this._onClick = (e) => {
|
|
845
|
+
if (!this.planet || !this._layer || !this._currentItem) return;
|
|
846
|
+
let t = this.planet.getLonLatFromPixelTerrain(e.pos);
|
|
847
|
+
if (t && (this.renderer.setRelativeCenter(this.planet.camera.eye), this.renderer.events.isKeyPressed(c.KEY_CTRL))) {
|
|
848
|
+
let e = this._createEntity(this._currentItem, t);
|
|
849
|
+
this._layer.add(e);
|
|
850
|
+
}
|
|
851
|
+
}, this._layer = e.layer || null, this._currentItem = null, this._collection = new Q({ collection: e.collection }), this._dialog = new Y({ model: this._collection });
|
|
852
|
+
}
|
|
853
|
+
oninit() {
|
|
854
|
+
M(), this.renderer && (this._dialog.appendTo(this.renderer.getUIContainer()), this._dialog.events.on("select", this._onSelect), this.activate());
|
|
855
|
+
}
|
|
856
|
+
onactivate() {
|
|
857
|
+
this._dialog.show(), this._initEvents();
|
|
858
|
+
}
|
|
859
|
+
ondeactivate() {
|
|
860
|
+
this._dialog.hide(), this._clearEvents();
|
|
861
|
+
}
|
|
862
|
+
onremove() {
|
|
863
|
+
this._dialog.events.off("select", this._onSelect), this._dialog.remove(), this._initialized && N();
|
|
864
|
+
}
|
|
865
|
+
bindLayer(e) {
|
|
866
|
+
this._layer = e;
|
|
867
|
+
}
|
|
868
|
+
_initEvents() {
|
|
869
|
+
this.planet && this.planet.renderer && this.planet.renderer.events.on("lclick", this._onClick);
|
|
870
|
+
}
|
|
871
|
+
_clearEvents() {
|
|
872
|
+
this.planet && this.planet.renderer && this.planet.renderer.events.off("lclick", this._onClick);
|
|
873
|
+
}
|
|
874
|
+
_createEntity(e, t) {
|
|
875
|
+
let r = e.name, i = e.scale, a = new n({
|
|
876
|
+
lonlat: t,
|
|
877
|
+
pitch: 0,
|
|
878
|
+
yaw: 0,
|
|
879
|
+
roll: 0,
|
|
880
|
+
scale: i
|
|
881
|
+
});
|
|
882
|
+
for (let t = 0; t < e.objects.length; t++) {
|
|
883
|
+
let i = e.objects[t], o = new n({
|
|
884
|
+
forceGlobalPosition: !0,
|
|
885
|
+
forceGlobalRotation: !0,
|
|
886
|
+
forceGlobalScale: !0,
|
|
887
|
+
geoObject: {
|
|
888
|
+
tag: `${r}:${t.toString()}`,
|
|
889
|
+
object3d: i
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
a.appendChild(o);
|
|
893
|
+
}
|
|
894
|
+
return a;
|
|
895
|
+
}
|
|
896
|
+
}, ee = s({
|
|
897
|
+
id: "og.entity-editor",
|
|
898
|
+
version: "1.0.0",
|
|
899
|
+
og: "^1.0.0-rc.50",
|
|
900
|
+
extensionApi: "^1",
|
|
901
|
+
activate(e) {
|
|
902
|
+
if (!e.globe) throw Error("og.entity-editor needs a Globe");
|
|
903
|
+
let t = new P();
|
|
904
|
+
return e.globe.planet.addControl(t), t;
|
|
905
|
+
},
|
|
906
|
+
deactivate(e) {
|
|
907
|
+
e.get("og.entity-editor")?.exports?.remove();
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
export { P as EntityEditor, B as EntityTree, L as EntityTreeView, $ as Object3dManager, ee as default };
|