@openglobus/og 0.22.2 → 0.23.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/css/og.css +137 -1
- package/lib/@openglobus/js/Object3d.d.ts +20 -10
- package/lib/@openglobus/js/camera/Camera.d.ts +9 -0
- package/lib/@openglobus/js/camera/Frustum.d.ts +3 -0
- package/lib/@openglobus/js/control/CameraLock.d.ts +38 -0
- package/lib/@openglobus/js/control/SimpleNavigation.d.ts +27 -10
- package/lib/@openglobus/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
- package/lib/@openglobus/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
- package/lib/@openglobus/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
- package/lib/@openglobus/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
- package/lib/@openglobus/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
- package/lib/@openglobus/js/control/geoObjectEditor/colors.d.ts +8 -0
- package/lib/@openglobus/js/control/index.d.ts +2 -0
- package/lib/@openglobus/js/entity/Entity.d.ts +278 -19
- package/lib/@openglobus/js/entity/EntityCollection.d.ts +8 -9
- package/lib/@openglobus/js/entity/GeoObject.d.ts +141 -36
- package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +39 -63
- package/lib/@openglobus/js/entity/InstanceData.d.ts +76 -0
- package/lib/@openglobus/js/entity/Polyline.d.ts +19 -6
- package/lib/@openglobus/js/entity/PolylineHandler.d.ts +7 -0
- package/lib/@openglobus/js/index.d.ts +2 -1
- package/lib/@openglobus/js/layer/Vector.d.ts +4 -0
- package/lib/@openglobus/js/light/LightSource.d.ts +1 -139
- package/lib/@openglobus/js/math/Quat.d.ts +46 -33
- package/lib/@openglobus/js/math/Ray.d.ts +10 -4
- package/lib/@openglobus/js/math/Vec3.d.ts +15 -0
- package/lib/@openglobus/js/math.d.ts +2 -2
- package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +2 -2
- package/lib/@openglobus/js/quadTree/Node.d.ts +1 -1
- package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/@openglobus/js/renderer/Renderer.d.ts +63 -44
- package/lib/@openglobus/js/renderer/RendererEvents.d.ts +1 -0
- package/lib/@openglobus/js/scene/Planet.d.ts +11 -7
- package/lib/@openglobus/js/scene/RenderNode.d.ts +10 -25
- package/lib/@openglobus/js/shaders/drawnode.d.ts +1 -0
- package/lib/@openglobus/js/shaders/geoObject.d.ts +1 -0
- package/lib/@openglobus/js/shaders/utils.d.ts +1 -1
- package/lib/@openglobus/js/ui/Checkbox.d.ts +31 -0
- package/lib/@openglobus/js/ui/Dialog.d.ts +3 -0
- package/lib/@openglobus/js/ui/Input.d.ts +32 -0
- package/lib/@openglobus/js/ui/View.d.ts +3 -1
- package/lib/@openglobus/js/utils/objParser.d.ts +44 -12
- package/lib/@openglobus/js/utils/shared.d.ts +22 -0
- package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +0 -1
- package/lib/@openglobus/js/webgl/Framebuffer.d.ts +35 -8
- package/lib/@openglobus/js/webgl/Handler.d.ts +1 -0
- package/lib/@openglobus/og.css +1 -1
- package/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/js/Object3d.d.ts +20 -10
- package/lib/js/Object3d.js +124 -48
- package/lib/js/camera/Camera.d.ts +9 -0
- package/lib/js/camera/Camera.js +27 -1
- package/lib/js/camera/Frustum.d.ts +3 -0
- package/lib/js/camera/Frustum.js +7 -0
- package/lib/js/control/Atmosphere.js +10 -6
- package/lib/js/control/CameraLock.d.ts +38 -0
- package/lib/js/control/CameraLock.js +216 -0
- package/lib/js/control/Control.js +1 -1
- package/lib/js/control/DebugInfo.js +13 -3
- package/lib/js/control/KeyboardNavigation.js +1 -1
- package/lib/js/control/ScaleControl.js +9 -3
- package/lib/js/control/SimpleNavigation.d.ts +27 -10
- package/lib/js/control/SimpleNavigation.js +148 -49
- package/lib/js/control/Sun.js +1 -1
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +4 -4
- package/lib/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
- package/lib/js/control/geoObjectEditor/ArrowEntity.js +59 -0
- package/lib/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
- package/lib/js/control/geoObjectEditor/AxisTrackEntity.js +93 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditor.js +30 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +502 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +487 -43
- package/lib/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
- package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +106 -0
- package/lib/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
- package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +34 -0
- package/lib/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
- package/lib/js/control/geoObjectEditor/RotateEntity.js +105 -0
- package/lib/js/control/geoObjectEditor/colors.d.ts +8 -0
- package/lib/js/control/geoObjectEditor/colors.js +8 -0
- package/lib/js/control/index.d.ts +2 -0
- package/lib/js/control/index.js +2 -0
- package/lib/js/control/timeline/TimelineControl.js +2 -0
- package/lib/js/entity/Entity.d.ts +278 -19
- package/lib/js/entity/Entity.js +483 -63
- package/lib/js/entity/EntityCollection.d.ts +8 -9
- package/lib/js/entity/EntityCollection.js +48 -45
- package/lib/js/entity/GeoObject.d.ts +141 -36
- package/lib/js/entity/GeoObject.js +153 -90
- package/lib/js/entity/GeoObjectHandler.d.ts +39 -63
- package/lib/js/entity/GeoObjectHandler.js +198 -295
- package/lib/js/entity/InstanceData.d.ts +76 -0
- package/lib/js/entity/InstanceData.js +344 -0
- package/lib/js/entity/Polyline.d.ts +19 -6
- package/lib/js/entity/Polyline.js +76 -36
- package/lib/js/entity/PolylineHandler.d.ts +7 -0
- package/lib/js/entity/PolylineHandler.js +26 -1
- package/lib/js/index.d.ts +2 -1
- package/lib/js/index.js +2 -1
- package/lib/js/layer/Bing.js +2 -2
- package/lib/js/layer/Vector.d.ts +4 -0
- package/lib/js/layer/Vector.js +16 -0
- package/lib/js/light/LightSource.d.ts +1 -139
- package/lib/js/light/LightSource.js +21 -227
- package/lib/js/math/Quat.d.ts +46 -33
- package/lib/js/math/Quat.js +91 -90
- package/lib/js/math/Ray.d.ts +10 -4
- package/lib/js/math/Ray.js +20 -4
- package/lib/js/math/Vec3.d.ts +15 -0
- package/lib/js/math/Vec3.js +30 -1
- package/lib/js/math.d.ts +2 -2
- package/lib/js/math.js +3 -3
- package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
- package/lib/js/quadTree/EntityCollectionNode.js +8 -8
- package/lib/js/quadTree/Node.d.ts +1 -1
- package/lib/js/quadTree/Node.js +2 -2
- package/lib/js/quadTree/QuadTreeStrategy.js +1 -1
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +2 -2
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +2 -2
- package/lib/js/renderer/Renderer.d.ts +63 -44
- package/lib/js/renderer/Renderer.js +260 -263
- package/lib/js/renderer/RendererEvents.d.ts +1 -0
- package/lib/js/renderer/RendererEvents.js +2 -1
- package/lib/js/scene/Planet.d.ts +11 -7
- package/lib/js/scene/Planet.js +109 -87
- package/lib/js/scene/RenderNode.d.ts +10 -25
- package/lib/js/scene/RenderNode.js +70 -58
- package/lib/js/shaders/depth.js +2 -5
- package/lib/js/shaders/drawnode.d.ts +1 -0
- package/lib/js/shaders/drawnode.js +51 -52
- package/lib/js/shaders/geoObject.d.ts +1 -0
- package/lib/js/shaders/geoObject.js +154 -91
- package/lib/js/shaders/polyline.js +68 -51
- package/lib/js/shaders/utils.d.ts +1 -1
- package/lib/js/shaders/utils.js +11 -0
- package/lib/js/ui/Checkbox.d.ts +31 -0
- package/lib/js/ui/Checkbox.js +110 -0
- package/lib/js/ui/Color.js +2 -1
- package/lib/js/ui/Dialog.d.ts +3 -0
- package/lib/js/ui/Dialog.js +20 -0
- package/lib/js/ui/Input.d.ts +32 -0
- package/lib/js/ui/Input.js +107 -0
- package/lib/js/ui/View.d.ts +3 -1
- package/lib/js/ui/View.js +6 -0
- package/lib/js/utils/objParser.d.ts +44 -12
- package/lib/js/utils/objParser.js +241 -149
- package/lib/js/utils/shared.d.ts +22 -0
- package/lib/js/utils/shared.js +34 -0
- package/lib/js/webgl/BaseFramebuffer.d.ts +0 -1
- package/lib/js/webgl/Framebuffer.d.ts +35 -8
- package/lib/js/webgl/Framebuffer.js +136 -29
- package/lib/js/webgl/Handler.d.ts +1 -0
- package/lib/js/webgl/Handler.js +11 -1
- package/lib/js/webgl/Program.js +0 -8
- package/package.json +4 -2
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { Dialog } from "../../ui/Dialog";
|
|
2
|
+
import { Input } from "../../ui/Input";
|
|
3
|
+
import { Checkbox } from "../../ui/Checkbox";
|
|
4
|
+
import { Button } from "../../ui/Button";
|
|
5
|
+
import { Vec3 } from "../../math/Vec3";
|
|
6
|
+
import { ToggleButton } from "../../ui/ToggleButton";
|
|
7
|
+
const ICON_LOCK_BUTTON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" id="filter-center-focus">
|
|
8
|
+
<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"/>
|
|
9
|
+
</svg>`;
|
|
10
|
+
export class GeoObjectPropertiesDialog extends Dialog {
|
|
11
|
+
constructor(params) {
|
|
12
|
+
super({
|
|
13
|
+
title: "GeoObject Properties",
|
|
14
|
+
visible: false,
|
|
15
|
+
resizable: true,
|
|
16
|
+
useHide: true,
|
|
17
|
+
top: 25,
|
|
18
|
+
right: 85,
|
|
19
|
+
width: 252,
|
|
20
|
+
height: 480,
|
|
21
|
+
minHeight: 100,
|
|
22
|
+
minWidth: 100,
|
|
23
|
+
model: params.model
|
|
24
|
+
});
|
|
25
|
+
this._onVisibility = (vis) => {
|
|
26
|
+
this.model.setVisibility(vis);
|
|
27
|
+
};
|
|
28
|
+
this._onSelect = (entity) => {
|
|
29
|
+
this.show();
|
|
30
|
+
this._refresh(entity);
|
|
31
|
+
};
|
|
32
|
+
this._onUnselect = (entity) => {
|
|
33
|
+
this.hide();
|
|
34
|
+
};
|
|
35
|
+
this._onChangeRelativePosition = (checked) => {
|
|
36
|
+
let entity = this.model.getSelectedEntity();
|
|
37
|
+
if (entity) {
|
|
38
|
+
entity.relativePosition = checked;
|
|
39
|
+
this._refresh(entity);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
this._onPosition = (pos, entity) => {
|
|
43
|
+
this._refresh(entity);
|
|
44
|
+
// let ll = entity.getLonLat();
|
|
45
|
+
// this._lonView.stopPropagation();
|
|
46
|
+
// this._latView.stopPropagation();
|
|
47
|
+
// this._heightView.stopPropagation();
|
|
48
|
+
// this._lonView.value = ll.lon;
|
|
49
|
+
// this._latView.value = ll.lat;
|
|
50
|
+
// this._heightView.value = ll.height;
|
|
51
|
+
//
|
|
52
|
+
// let cart = entity.getCartesian();
|
|
53
|
+
// this._xView.stopPropagation();
|
|
54
|
+
// this._yView.stopPropagation();
|
|
55
|
+
// this._zView.stopPropagation();
|
|
56
|
+
// this._xView.value = cart.x;
|
|
57
|
+
// this._yView.value = cart.y;
|
|
58
|
+
// this._zView.value = cart.z;
|
|
59
|
+
};
|
|
60
|
+
this._onPitch = (a, entity) => {
|
|
61
|
+
this._pitchView.stopPropagation();
|
|
62
|
+
this._pitchView.value = entity.getPitch();
|
|
63
|
+
this._absolutePitchView.stopPropagation();
|
|
64
|
+
this._absolutePitchView.value = entity.getAbsolutePitch();
|
|
65
|
+
};
|
|
66
|
+
this._onYaw = (a, entity) => {
|
|
67
|
+
this._yawView.stopPropagation();
|
|
68
|
+
this._yawView.value = entity.getYaw();
|
|
69
|
+
this._absoluteYawView.stopPropagation();
|
|
70
|
+
this._absoluteYawView.value = entity.getAbsoluteYaw();
|
|
71
|
+
};
|
|
72
|
+
this._onRoll = (a, entity) => {
|
|
73
|
+
this._rollView.stopPropagation();
|
|
74
|
+
this._rollView.value = entity.getRoll();
|
|
75
|
+
this._absoluteRollView.stopPropagation();
|
|
76
|
+
this._absoluteRollView.value = entity.getAbsoluteRoll();
|
|
77
|
+
};
|
|
78
|
+
this._onChangeLon = (val) => {
|
|
79
|
+
let entity = this.model.getSelectedEntity();
|
|
80
|
+
if (entity) {
|
|
81
|
+
let ll = entity.getLonLat();
|
|
82
|
+
entity.setLonLat2(parseFloat(val), ll.lat, ll.height);
|
|
83
|
+
this._refresh(entity);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
this._onChangeLat = (val) => {
|
|
87
|
+
let entity = this.model.getSelectedEntity();
|
|
88
|
+
if (entity) {
|
|
89
|
+
let ll = entity.getLonLat();
|
|
90
|
+
entity.setLonLat2(ll.lon, parseFloat(val), ll.height);
|
|
91
|
+
this._refresh(entity);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this._onChangeHeight = (val) => {
|
|
95
|
+
let entity = this.model.getSelectedEntity();
|
|
96
|
+
if (entity) {
|
|
97
|
+
let ll = entity.getLonLat();
|
|
98
|
+
entity.setLonLat2(ll.lon, ll.lat, parseFloat(val));
|
|
99
|
+
this._refresh(entity);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
this._onChangeX = (val) => {
|
|
103
|
+
let entity = this.model.getSelectedEntity();
|
|
104
|
+
if (entity) {
|
|
105
|
+
let cart = entity.getCartesian();
|
|
106
|
+
entity.setCartesian(parseFloat(val), cart.y, cart.z);
|
|
107
|
+
this._refresh(entity);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
this._onChangeY = (val) => {
|
|
111
|
+
let entity = this.model.getSelectedEntity();
|
|
112
|
+
if (entity) {
|
|
113
|
+
let cart = entity.getCartesian();
|
|
114
|
+
entity.setCartesian(cart.x, parseFloat(val), cart.z);
|
|
115
|
+
this._refresh(entity);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
this._onChangeZ = (val) => {
|
|
119
|
+
let entity = this.model.getSelectedEntity();
|
|
120
|
+
if (entity) {
|
|
121
|
+
let cart = entity.getCartesian();
|
|
122
|
+
entity.setCartesian(cart.x, cart.y, parseFloat(val));
|
|
123
|
+
this._refresh(entity);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
this._onChangeAbsoluteX = (val) => {
|
|
127
|
+
let entity = this.model.getSelectedEntity();
|
|
128
|
+
if (entity) {
|
|
129
|
+
let cart = entity.getAbsoluteCartesian();
|
|
130
|
+
entity.setAbsoluteCartesian(parseFloat(val), cart.y, cart.z);
|
|
131
|
+
this._refresh(entity);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
this._onChangeAbsoluteY = (val) => {
|
|
135
|
+
let entity = this.model.getSelectedEntity();
|
|
136
|
+
if (entity) {
|
|
137
|
+
let cart = entity.getAbsoluteCartesian();
|
|
138
|
+
entity.setAbsoluteCartesian(cart.x, parseFloat(val), cart.z);
|
|
139
|
+
this._refresh(entity);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
this._onChangeAbsoluteZ = (val) => {
|
|
143
|
+
let entity = this.model.getSelectedEntity();
|
|
144
|
+
if (entity) {
|
|
145
|
+
let cart = entity.getAbsoluteCartesian();
|
|
146
|
+
entity.setAbsoluteCartesian(cart.x, cart.y, parseFloat(val));
|
|
147
|
+
this._refresh(entity);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
this._onChangePitch = (val) => {
|
|
151
|
+
let entity = this.model.getSelectedEntity();
|
|
152
|
+
if (entity) {
|
|
153
|
+
entity.setPitch(parseFloat(val));
|
|
154
|
+
this._refresh(entity);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
this._onChangeYaw = (val) => {
|
|
158
|
+
let entity = this.model.getSelectedEntity();
|
|
159
|
+
if (entity) {
|
|
160
|
+
entity.setYaw(parseFloat(val));
|
|
161
|
+
this._refresh(entity);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
this._onChangeRoll = (val) => {
|
|
165
|
+
let entity = this.model.getSelectedEntity();
|
|
166
|
+
if (entity) {
|
|
167
|
+
entity.setRoll(parseFloat(val));
|
|
168
|
+
this._refresh(entity);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
this._onChangeAbsolutePitch = (val) => {
|
|
172
|
+
let entity = this.model.getSelectedEntity();
|
|
173
|
+
if (entity) {
|
|
174
|
+
entity.setAbsolutePitch(parseFloat(val));
|
|
175
|
+
this._refresh(entity);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
this._onChangeAbsoluteYaw = (val) => {
|
|
179
|
+
let entity = this.model.getSelectedEntity();
|
|
180
|
+
if (entity) {
|
|
181
|
+
entity.setAbsoluteYaw(parseFloat(val));
|
|
182
|
+
this._refresh(entity);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
this._onChangeAbsoluteRoll = (val) => {
|
|
186
|
+
let entity = this.model.getSelectedEntity();
|
|
187
|
+
if (entity) {
|
|
188
|
+
entity.setAbsoluteRoll(parseFloat(val));
|
|
189
|
+
this._refresh(entity);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
this._onChangeScale = (val) => {
|
|
193
|
+
let entity = this.model.getSelectedEntity();
|
|
194
|
+
if (entity) {
|
|
195
|
+
let s = parseFloat(val);
|
|
196
|
+
entity.setScale(s);
|
|
197
|
+
this._scaleXView.stopPropagation();
|
|
198
|
+
this._scaleYView.stopPropagation();
|
|
199
|
+
this._scaleZView.stopPropagation();
|
|
200
|
+
this._scaleXView.value = s;
|
|
201
|
+
this._scaleYView.value = s;
|
|
202
|
+
this._scaleZView.value = s;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
this._onChangeScaleX = (val) => {
|
|
206
|
+
let entity = this.model.getSelectedEntity();
|
|
207
|
+
if (entity) {
|
|
208
|
+
let s = entity.getScale();
|
|
209
|
+
entity.setScale3v(new Vec3(parseFloat(val), s.y, s.z));
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
this._onChangeScaleY = (val) => {
|
|
213
|
+
let entity = this.model.getSelectedEntity();
|
|
214
|
+
if (entity) {
|
|
215
|
+
let s = entity.getScale();
|
|
216
|
+
entity.setScale3v(new Vec3(s.x, parseFloat(val), s.z));
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
this._onChangeScaleZ = (val) => {
|
|
220
|
+
let entity = this.model.getSelectedEntity();
|
|
221
|
+
if (entity) {
|
|
222
|
+
let s = entity.getScale();
|
|
223
|
+
entity.setScale3v(new Vec3(s.x, s.y, parseFloat(val)));
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
this._onGround = () => {
|
|
227
|
+
let entity = this.model.getSelectedEntity();
|
|
228
|
+
if (entity && this.model.planet) {
|
|
229
|
+
if (this.model.planet.terrain) {
|
|
230
|
+
this.model.planet.terrain.getHeightAsync(entity.getLonLat(), (height) => {
|
|
231
|
+
this._heightView.value = height;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this._heightView.value = 0;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
this._relativePositionView = new Checkbox({
|
|
240
|
+
label: "Relative position"
|
|
241
|
+
});
|
|
242
|
+
this._lonView = new Input({
|
|
243
|
+
label: "Lon",
|
|
244
|
+
type: "number",
|
|
245
|
+
min: -180,
|
|
246
|
+
max: 180,
|
|
247
|
+
maxFixed: 10
|
|
248
|
+
});
|
|
249
|
+
this._latView = new Input({
|
|
250
|
+
label: "Lat",
|
|
251
|
+
type: "number",
|
|
252
|
+
min: -90,
|
|
253
|
+
max: 90,
|
|
254
|
+
maxFixed: 10
|
|
255
|
+
});
|
|
256
|
+
this._heightView = new Input({
|
|
257
|
+
label: "Height",
|
|
258
|
+
type: "number",
|
|
259
|
+
maxFixed: 4
|
|
260
|
+
});
|
|
261
|
+
this._xView = new Input({
|
|
262
|
+
label: "X",
|
|
263
|
+
type: "number",
|
|
264
|
+
maxFixed: 10
|
|
265
|
+
});
|
|
266
|
+
this._yView = new Input({
|
|
267
|
+
label: "Y",
|
|
268
|
+
type: "number",
|
|
269
|
+
});
|
|
270
|
+
this._zView = new Input({
|
|
271
|
+
label: "Z",
|
|
272
|
+
type: "number",
|
|
273
|
+
});
|
|
274
|
+
this._absXView = new Input({
|
|
275
|
+
label: "Absolute X",
|
|
276
|
+
type: "number",
|
|
277
|
+
maxFixed: 10
|
|
278
|
+
});
|
|
279
|
+
this._absYView = new Input({
|
|
280
|
+
label: "Absolute Y",
|
|
281
|
+
type: "number",
|
|
282
|
+
});
|
|
283
|
+
this._absZView = new Input({
|
|
284
|
+
label: "Absolute Z",
|
|
285
|
+
type: "number",
|
|
286
|
+
});
|
|
287
|
+
this._pitchView = new Input({
|
|
288
|
+
label: "Pitch",
|
|
289
|
+
type: "number",
|
|
290
|
+
maxFixed: 2
|
|
291
|
+
});
|
|
292
|
+
this._yawView = new Input({
|
|
293
|
+
label: "Yaw",
|
|
294
|
+
type: "number",
|
|
295
|
+
maxFixed: 2
|
|
296
|
+
});
|
|
297
|
+
this._rollView = new Input({
|
|
298
|
+
label: "Roll",
|
|
299
|
+
type: "number",
|
|
300
|
+
maxFixed: 2
|
|
301
|
+
});
|
|
302
|
+
this._absolutePitchView = new Input({
|
|
303
|
+
label: "Absolute pitch",
|
|
304
|
+
type: "number",
|
|
305
|
+
maxFixed: 2
|
|
306
|
+
});
|
|
307
|
+
this._absoluteYawView = new Input({
|
|
308
|
+
label: "Absolute yaw",
|
|
309
|
+
type: "number",
|
|
310
|
+
maxFixed: 2
|
|
311
|
+
});
|
|
312
|
+
this._absoluteRollView = new Input({
|
|
313
|
+
label: "Absolute roll",
|
|
314
|
+
type: "number",
|
|
315
|
+
maxFixed: 2
|
|
316
|
+
});
|
|
317
|
+
this._scaleView = new Input({
|
|
318
|
+
label: "Scale",
|
|
319
|
+
type: "number",
|
|
320
|
+
maxFixed: 2
|
|
321
|
+
});
|
|
322
|
+
this._scaleXView = new Input({
|
|
323
|
+
label: "Scale X",
|
|
324
|
+
type: "number",
|
|
325
|
+
maxFixed: 2
|
|
326
|
+
});
|
|
327
|
+
this._scaleYView = new Input({
|
|
328
|
+
label: "Scale Y",
|
|
329
|
+
type: "number",
|
|
330
|
+
maxFixed: 2
|
|
331
|
+
});
|
|
332
|
+
this._scaleZView = new Input({
|
|
333
|
+
label: "Scale Z",
|
|
334
|
+
type: "number",
|
|
335
|
+
maxFixed: 2
|
|
336
|
+
});
|
|
337
|
+
this._groundBtn = new Button({
|
|
338
|
+
text: "Ground",
|
|
339
|
+
title: "Put on the ground",
|
|
340
|
+
name: "ground",
|
|
341
|
+
classList: ["og-editor-ground_button"]
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
render(params) {
|
|
345
|
+
super.render(params);
|
|
346
|
+
this._initSceneEvents();
|
|
347
|
+
let $toolbar = document.createElement("div");
|
|
348
|
+
$toolbar.classList.add("og-editor_toolbar");
|
|
349
|
+
this.container?.appendChild($toolbar);
|
|
350
|
+
let cameraLockBtn = new ToggleButton({
|
|
351
|
+
classList: ["og-editor_toolbar-button"],
|
|
352
|
+
icon: ICON_LOCK_BUTTON_SVG,
|
|
353
|
+
title: "Lock/Unlock camera view"
|
|
354
|
+
});
|
|
355
|
+
cameraLockBtn.appendTo($toolbar);
|
|
356
|
+
cameraLockBtn.events.on("change", (isActive) => {
|
|
357
|
+
if (isActive) {
|
|
358
|
+
this.model.lockView();
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
this.model.unlockView();
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
this.events.on("visibility", (vis) => {
|
|
365
|
+
if (!vis) {
|
|
366
|
+
cameraLockBtn.events.stopPropagation();
|
|
367
|
+
cameraLockBtn.setActive(false);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
this.events.on("visibility", this._onVisibility);
|
|
371
|
+
this._relativePositionView.appendTo(this.container);
|
|
372
|
+
if (this.model.planet) {
|
|
373
|
+
this._lonView.appendTo(this.container);
|
|
374
|
+
this._latView.appendTo(this.container);
|
|
375
|
+
this._heightView.appendTo(this.container);
|
|
376
|
+
}
|
|
377
|
+
this._xView.appendTo(this.container);
|
|
378
|
+
this._yView.appendTo(this.container);
|
|
379
|
+
this._zView.appendTo(this.container);
|
|
380
|
+
this._absXView.appendTo(this.container);
|
|
381
|
+
this._absYView.appendTo(this.container);
|
|
382
|
+
this._absZView.appendTo(this.container);
|
|
383
|
+
this._pitchView.appendTo(this.container);
|
|
384
|
+
this._yawView.appendTo(this.container);
|
|
385
|
+
this._rollView.appendTo(this.container);
|
|
386
|
+
this._absolutePitchView.appendTo(this.container);
|
|
387
|
+
this._absoluteYawView.appendTo(this.container);
|
|
388
|
+
this._absoluteRollView.appendTo(this.container);
|
|
389
|
+
this._scaleView.appendTo(this.container);
|
|
390
|
+
this._scaleXView.appendTo(this.container);
|
|
391
|
+
this._scaleYView.appendTo(this.container);
|
|
392
|
+
this._scaleZView.appendTo(this.container);
|
|
393
|
+
if (this.model.planet) {
|
|
394
|
+
this._groundBtn.appendTo(this.container);
|
|
395
|
+
}
|
|
396
|
+
this._relativePositionView.events.on("change", this._onChangeRelativePosition);
|
|
397
|
+
this._lonView.events.on("change", this._onChangeLon);
|
|
398
|
+
this._latView.events.on("change", this._onChangeLat);
|
|
399
|
+
this._heightView.events.on("change", this._onChangeHeight);
|
|
400
|
+
this._xView.events.on("change", this._onChangeX);
|
|
401
|
+
this._yView.events.on("change", this._onChangeY);
|
|
402
|
+
this._zView.events.on("change", this._onChangeZ);
|
|
403
|
+
this._absXView.events.on("change", this._onChangeAbsoluteX);
|
|
404
|
+
this._absYView.events.on("change", this._onChangeAbsoluteY);
|
|
405
|
+
this._absZView.events.on("change", this._onChangeAbsoluteZ);
|
|
406
|
+
this._pitchView.events.on("change", this._onChangePitch);
|
|
407
|
+
this._yawView.events.on("change", this._onChangeYaw);
|
|
408
|
+
this._rollView.events.on("change", this._onChangeRoll);
|
|
409
|
+
this._absolutePitchView.events.on("change", this._onChangeAbsolutePitch);
|
|
410
|
+
this._absoluteYawView.events.on("change", this._onChangeAbsoluteYaw);
|
|
411
|
+
this._absoluteRollView.events.on("change", this._onChangeAbsoluteRoll);
|
|
412
|
+
this._scaleView.events.on("change", this._onChangeScale);
|
|
413
|
+
this._scaleXView.events.on("change", this._onChangeScaleX);
|
|
414
|
+
this._scaleYView.events.on("change", this._onChangeScaleY);
|
|
415
|
+
this._scaleZView.events.on("change", this._onChangeScaleZ);
|
|
416
|
+
this._groundBtn.appendTo(this.container);
|
|
417
|
+
this._groundBtn.events.on("click", this._onGround);
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
remove() {
|
|
421
|
+
super.remove();
|
|
422
|
+
this._clearSceneEvents();
|
|
423
|
+
}
|
|
424
|
+
_initSceneEvents() {
|
|
425
|
+
this.model.events.on("select", this._onSelect);
|
|
426
|
+
this.model.events.on("unselect", this._onUnselect);
|
|
427
|
+
this.model.events.on("position", this._onPosition);
|
|
428
|
+
this.model.events.on("pitch", this._onPitch);
|
|
429
|
+
this.model.events.on("yaw", this._onYaw);
|
|
430
|
+
this.model.events.on("roll", this._onRoll);
|
|
431
|
+
}
|
|
432
|
+
_clearSceneEvents() {
|
|
433
|
+
this.model.events.off("select", this._onSelect);
|
|
434
|
+
this.model.events.off("unselect", this._onUnselect);
|
|
435
|
+
this.model.events.off("position", this._onPosition);
|
|
436
|
+
this.model.events.off("pitch", this._onPitch);
|
|
437
|
+
this.model.events.off("yaw", this._onYaw);
|
|
438
|
+
this.model.events.off("roll", this._onRoll);
|
|
439
|
+
}
|
|
440
|
+
_refresh(entity) {
|
|
441
|
+
if (!entity.parent) {
|
|
442
|
+
this._relativePositionView.disabled = true;
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
this._relativePositionView.disabled = false;
|
|
446
|
+
}
|
|
447
|
+
//this._relativePositionView.stopPropagation();
|
|
448
|
+
this._relativePositionView.checked = entity.relativePosition;
|
|
449
|
+
let ll = entity.getLonLat();
|
|
450
|
+
this._lonView.stopPropagation();
|
|
451
|
+
this._latView.stopPropagation();
|
|
452
|
+
this._heightView.stopPropagation();
|
|
453
|
+
this._lonView.value = ll.lon;
|
|
454
|
+
this._latView.value = ll.lat;
|
|
455
|
+
this._heightView.value = ll.height;
|
|
456
|
+
let cart = entity.getCartesian();
|
|
457
|
+
this._xView.stopPropagation();
|
|
458
|
+
this._yView.stopPropagation();
|
|
459
|
+
this._zView.stopPropagation();
|
|
460
|
+
this._xView.value = cart.x;
|
|
461
|
+
this._yView.value = cart.y;
|
|
462
|
+
this._zView.value = cart.z;
|
|
463
|
+
cart = entity.getAbsoluteCartesian();
|
|
464
|
+
this._absXView.stopPropagation();
|
|
465
|
+
this._absYView.stopPropagation();
|
|
466
|
+
this._absZView.stopPropagation();
|
|
467
|
+
this._absXView.value = cart.x;
|
|
468
|
+
this._absYView.value = cart.y;
|
|
469
|
+
this._absZView.value = cart.z;
|
|
470
|
+
this._pitchView.stopPropagation();
|
|
471
|
+
this._yawView.stopPropagation();
|
|
472
|
+
this._rollView.stopPropagation();
|
|
473
|
+
this._pitchView.value = entity.getPitch();
|
|
474
|
+
this._yawView.value = entity.getYaw();
|
|
475
|
+
this._rollView.value = entity.getRoll();
|
|
476
|
+
this._absolutePitchView.stopPropagation();
|
|
477
|
+
this._absoluteYawView.stopPropagation();
|
|
478
|
+
this._absoluteRollView.stopPropagation();
|
|
479
|
+
this._absolutePitchView.value = entity.getAbsolutePitch();
|
|
480
|
+
this._absoluteYawView.value = entity.getAbsoluteYaw();
|
|
481
|
+
this._absoluteRollView.value = entity.getAbsoluteRoll();
|
|
482
|
+
this._scaleView.stopPropagation();
|
|
483
|
+
let scl = entity.getScale();
|
|
484
|
+
if ((scl.x === scl.y) && (scl.y === scl.z)) {
|
|
485
|
+
this._scaleView.value = scl.x;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
this._scaleView.value = 1;
|
|
489
|
+
}
|
|
490
|
+
this._scaleXView.stopPropagation();
|
|
491
|
+
this._scaleYView.stopPropagation();
|
|
492
|
+
this._scaleZView.stopPropagation();
|
|
493
|
+
this._scaleXView.value = scl.x;
|
|
494
|
+
this._scaleYView.value = scl.y;
|
|
495
|
+
this._scaleZView.value = scl.z;
|
|
496
|
+
}
|
|
497
|
+
hide() {
|
|
498
|
+
super.hide();
|
|
499
|
+
this.model.events.stopPropagation();
|
|
500
|
+
this.model.unselect();
|
|
501
|
+
}
|
|
502
|
+
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { EventsHandler } from '../../Events';
|
|
2
2
|
import { Planet } from "../../scene/Planet";
|
|
3
3
|
import { RenderNode } from '../../scene/RenderNode';
|
|
4
|
-
import { Vector } from '../../layer/Vector';
|
|
5
4
|
import { Vec2 } from '../../math/Vec2';
|
|
5
|
+
import { Vec3 } from '../../math/Vec3';
|
|
6
|
+
import { Quat } from '../../math/Quat';
|
|
6
7
|
import { IMouseState } from "../../renderer/RendererEvents";
|
|
7
8
|
import { Ellipsoid } from "../../ellipsoid/Ellipsoid";
|
|
9
|
+
import { Entity } from "../../entity/Entity";
|
|
10
|
+
import { MoveAxisEntity } from "./MoveAxisEntity";
|
|
11
|
+
import { MovePlaneEntity } from "./MovePlaneEntity";
|
|
12
|
+
import { RotateEntity } from "./RotateEntity";
|
|
13
|
+
import { AxisTrackEntity } from "./AxisTrackEntity";
|
|
14
|
+
import { EntityCollection } from "../../entity/EntityCollection";
|
|
8
15
|
export interface IGeoObjectEditorSceneParams {
|
|
9
16
|
planet?: Planet;
|
|
17
|
+
name?: string;
|
|
10
18
|
}
|
|
11
19
|
type GeoObjectSceneEventsList = [
|
|
12
20
|
"mousemove",
|
|
@@ -33,26 +41,87 @@ type GeoObjectSceneEventsList = [
|
|
|
33
41
|
"touchend",
|
|
34
42
|
"doubletouch",
|
|
35
43
|
"touchleave",
|
|
36
|
-
"touchenter"
|
|
44
|
+
"touchenter",
|
|
45
|
+
"select",
|
|
46
|
+
"unselect",
|
|
47
|
+
"change",
|
|
48
|
+
"position",
|
|
49
|
+
"pitch",
|
|
50
|
+
"yaw",
|
|
51
|
+
"roll",
|
|
52
|
+
"scale"
|
|
37
53
|
];
|
|
38
54
|
declare class GeoObjectEditorScene extends RenderNode {
|
|
39
55
|
events: EventsHandler<GeoObjectSceneEventsList>;
|
|
40
56
|
protected _planet: Planet | null;
|
|
41
57
|
protected _startPos: Vec2 | null;
|
|
42
58
|
protected _startClick: Vec2;
|
|
43
|
-
protected
|
|
44
|
-
protected
|
|
59
|
+
protected _moveLayer: EntityCollection;
|
|
60
|
+
protected _planeLayer: EntityCollection;
|
|
61
|
+
protected _rotateLayer: EntityCollection;
|
|
62
|
+
protected _axisTrackLayer: EntityCollection;
|
|
63
|
+
protected _selectedEntity: Entity | null;
|
|
64
|
+
protected _selectedEntityCart: Vec3;
|
|
65
|
+
protected _selectedEntityPitch: number;
|
|
66
|
+
protected _selectedEntityYaw: number;
|
|
67
|
+
protected _selectedEntityRoll: number;
|
|
68
|
+
protected _clickPos: Vec2;
|
|
69
|
+
protected _axisEntity: MoveAxisEntity;
|
|
70
|
+
protected _planeEntity: MovePlaneEntity;
|
|
71
|
+
protected _rotateEntity: RotateEntity;
|
|
72
|
+
protected _axisTrackEntity: AxisTrackEntity;
|
|
73
|
+
protected _selectedMove: string | null;
|
|
74
|
+
protected _ops: Record<string, (mouseState: IMouseState) => void>;
|
|
75
|
+
protected _axisTrackVisibility: boolean;
|
|
45
76
|
constructor(options?: IGeoObjectEditorSceneParams);
|
|
77
|
+
get planet(): Planet | null;
|
|
78
|
+
bindPlanet(planet: Planet): void;
|
|
46
79
|
init(): void;
|
|
47
80
|
onremove(): void;
|
|
48
|
-
|
|
49
|
-
protected
|
|
50
|
-
protected
|
|
81
|
+
protected _addAxisLayers(): void;
|
|
82
|
+
protected _onAxisLayerMouseEnter: (e: IMouseState) => void;
|
|
83
|
+
protected _onAxisLayerMouseLeave: (e: IMouseState) => void;
|
|
84
|
+
protected _navActivate(): void;
|
|
85
|
+
protected _navDeactivate(): void;
|
|
86
|
+
protected _onAxisLayerLUp: (e: IMouseState) => void;
|
|
87
|
+
protected _onAxisLayerLDown: (e: IMouseState) => void;
|
|
88
|
+
protected _onPlaneLayerMouseEnter: (e: IMouseState) => void;
|
|
89
|
+
protected _onPlaneLayerMouseLeave: (e: IMouseState) => void;
|
|
90
|
+
protected _onPlaneLayerLUp: (e: IMouseState) => void;
|
|
91
|
+
protected _onPlaneLayerLDown: (e: IMouseState) => void;
|
|
92
|
+
protected _onRotateLayerMouseEnter: (e: IMouseState) => void;
|
|
93
|
+
protected _onRotateLayerMouseLeave: (e: IMouseState) => void;
|
|
94
|
+
protected _onRotateLayerLUp: (e: IMouseState) => void;
|
|
95
|
+
protected _onRotateLayerLDown: (e: IMouseState) => void;
|
|
96
|
+
protected _onMouseMove: (e: IMouseState) => void;
|
|
97
|
+
protected _removeAxisLayers(): void;
|
|
98
|
+
activate(): void;
|
|
99
|
+
protected deactivate(): void;
|
|
100
|
+
protected _setAxisTrackVisibility(visibility: boolean): void;
|
|
51
101
|
setVisibility(visibility: boolean): void;
|
|
102
|
+
readyToEdit(entity: Entity): boolean;
|
|
103
|
+
select(entity: Entity): void;
|
|
104
|
+
unselect(): void;
|
|
52
105
|
protected _onLclick: (e: IMouseState) => void;
|
|
53
|
-
protected _onMouseMove: (e: IMouseState) => void;
|
|
54
106
|
clear(): void;
|
|
55
107
|
frame(): void;
|
|
56
|
-
get
|
|
108
|
+
protected get _ellipsoid(): Ellipsoid | null;
|
|
109
|
+
protected _moveX: (e: IMouseState) => void;
|
|
110
|
+
protected _moveY: (e: IMouseState) => void;
|
|
111
|
+
protected _moveZ: (e: IMouseState) => void;
|
|
112
|
+
protected _moveXZ: (e: IMouseState) => void;
|
|
113
|
+
protected _moveXY: (e: IMouseState) => void;
|
|
114
|
+
protected _moveZY: (e: IMouseState) => void;
|
|
115
|
+
getFrameRotation(cartesian: Vec3): Quat;
|
|
116
|
+
protected _rotatePitch: (e: IMouseState) => void;
|
|
117
|
+
protected _rotateYaw: (e: IMouseState) => void;
|
|
118
|
+
protected _rotateRoll: (e: IMouseState) => void;
|
|
119
|
+
protected _scale: (e: IMouseState) => void;
|
|
120
|
+
protected _scaleX: (e: IMouseState) => void;
|
|
121
|
+
protected _scaleY: (e: IMouseState) => void;
|
|
122
|
+
protected _scaleZ: (e: IMouseState) => void;
|
|
123
|
+
getSelectedEntity(): Entity | null;
|
|
124
|
+
lockView(): void;
|
|
125
|
+
unlockView(): void;
|
|
57
126
|
}
|
|
58
127
|
export { GeoObjectEditorScene };
|