@openglobus/og 0.22.1 → 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 +64 -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 +3 -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/Globe.js +2 -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 +64 -44
- package/lib/js/renderer/Renderer.js +264 -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 +3 -0
- package/lib/js/webgl/Handler.js +11 -1
- package/lib/js/webgl/Program.js +0 -8
- package/package.json +4 -2
|
@@ -5,7 +5,7 @@ import { Ellipsoid } from "../ellipsoid/Ellipsoid";
|
|
|
5
5
|
import { EntityCollectionNode } from "../quadTree/EntityCollectionNode";
|
|
6
6
|
import { GeoObjectHandler } from "./GeoObjectHandler";
|
|
7
7
|
import { LabelHandler } from "./LabelHandler";
|
|
8
|
-
import { NumberArray3 } from "../math/Vec3";
|
|
8
|
+
import { Vec3, NumberArray3 } from "../math/Vec3";
|
|
9
9
|
import { PointCloudHandler } from "./PointCloudHandler";
|
|
10
10
|
import { PolylineHandler } from "./PolylineHandler";
|
|
11
11
|
import { RayHandler } from "./RayHandler";
|
|
@@ -23,6 +23,7 @@ interface IEntityCollectionParams {
|
|
|
23
23
|
opacity?: number;
|
|
24
24
|
useLighting?: boolean;
|
|
25
25
|
entities?: Entity[];
|
|
26
|
+
depthOrder?: number;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* An observable collection of og.Entity instances where each entity has a unique id.
|
|
@@ -80,12 +81,6 @@ declare class EntityCollection {
|
|
|
80
81
|
* @readonly
|
|
81
82
|
*/
|
|
82
83
|
protected __id: number;
|
|
83
|
-
/**
|
|
84
|
-
* Render node collections array index.
|
|
85
|
-
* @protected
|
|
86
|
-
* @type {number}
|
|
87
|
-
*/
|
|
88
|
-
protected _renderNodeIndex: number;
|
|
89
84
|
/**
|
|
90
85
|
* Render node context.
|
|
91
86
|
* @public
|
|
@@ -186,12 +181,15 @@ declare class EntityCollection {
|
|
|
186
181
|
_layer?: Vector;
|
|
187
182
|
_quadNode?: EntityCollectionNode;
|
|
188
183
|
_useLighting: number;
|
|
184
|
+
protected _depthOrder: number;
|
|
189
185
|
constructor(options?: IEntityCollectionParams);
|
|
186
|
+
get depthOrder(): number;
|
|
187
|
+
set depthOrder(depghOrder: number);
|
|
190
188
|
isEmpty(): boolean;
|
|
191
189
|
get id(): number;
|
|
192
190
|
get useLighting(): boolean;
|
|
193
191
|
set useLighting(f: boolean);
|
|
194
|
-
isEqual(ec: EntityCollection): boolean;
|
|
192
|
+
isEqual(ec: EntityCollection | null): boolean;
|
|
195
193
|
/**
|
|
196
194
|
* Sets collection visibility.
|
|
197
195
|
* @public
|
|
@@ -252,7 +250,7 @@ declare class EntityCollection {
|
|
|
252
250
|
* @param {Entity} entity - Entity.
|
|
253
251
|
* @returns {boolean} -
|
|
254
252
|
*/
|
|
255
|
-
belongs(entity: Entity): boolean
|
|
253
|
+
belongs(entity: Entity): boolean;
|
|
256
254
|
protected _removeRecursively(entity: Entity): void;
|
|
257
255
|
/**
|
|
258
256
|
* Removes entity from this collection.
|
|
@@ -286,6 +284,7 @@ declare class EntityCollection {
|
|
|
286
284
|
* @param {RenderNode} renderNode
|
|
287
285
|
*/
|
|
288
286
|
bindRenderNode(renderNode: RenderNode): void;
|
|
287
|
+
protected _onChangeRelativeCenter: (c: Vec3) => void;
|
|
289
288
|
/**
|
|
290
289
|
* Updates coordinates all lonLat entities in collection after collection attached to the planet node.
|
|
291
290
|
* @protected
|
|
@@ -57,8 +57,11 @@ import { StripHandler } from "./StripHandler";
|
|
|
57
57
|
*/
|
|
58
58
|
class EntityCollection {
|
|
59
59
|
constructor(options = {}) {
|
|
60
|
+
this._onChangeRelativeCenter = (c) => {
|
|
61
|
+
this.geoObjectHandler.setRelativeCenter(c);
|
|
62
|
+
this.polylineHandler.setRelativeCenter(c);
|
|
63
|
+
};
|
|
60
64
|
this.__id = EntityCollection.__counter__++;
|
|
61
|
-
this._renderNodeIndex = -1;
|
|
62
65
|
this.renderNode = null;
|
|
63
66
|
this._visibility = options.visibility == undefined ? true : options.visibility;
|
|
64
67
|
this.polygonOffsetUnits =
|
|
@@ -74,7 +77,7 @@ class EntityCollection {
|
|
|
74
77
|
this.setPickingEnabled(options.pickingEnabled);
|
|
75
78
|
}
|
|
76
79
|
this._entities = [];
|
|
77
|
-
this.scaleByDistance = options.scaleByDistance || [
|
|
80
|
+
this.scaleByDistance = options.scaleByDistance || [1.0, 1.0, 1.0];
|
|
78
81
|
let pickingScale = new Float32Array([1.0, 1.0, 1.0]);
|
|
79
82
|
if (options.pickingScale !== undefined) {
|
|
80
83
|
if (options.pickingScale instanceof Array) {
|
|
@@ -88,6 +91,7 @@ class EntityCollection {
|
|
|
88
91
|
pickingScale[2] = options.pickingScale;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
94
|
+
this._depthOrder = options.depthOrder || 0;
|
|
91
95
|
this.pickingScale = pickingScale;
|
|
92
96
|
this._opacity = options.opacity == undefined ? 1.0 : options.opacity;
|
|
93
97
|
this._fadingOpacity = this._opacity;
|
|
@@ -98,6 +102,15 @@ class EntityCollection {
|
|
|
98
102
|
this.addEntities(options.entities);
|
|
99
103
|
}
|
|
100
104
|
}
|
|
105
|
+
get depthOrder() {
|
|
106
|
+
return this._depthOrder;
|
|
107
|
+
}
|
|
108
|
+
set depthOrder(depghOrder) {
|
|
109
|
+
this._depthOrder = depghOrder;
|
|
110
|
+
if (this.renderNode) {
|
|
111
|
+
this.renderNode.updateEntityCollectionsDepthOrder();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
101
114
|
isEmpty() {
|
|
102
115
|
return this._entities.length == 0;
|
|
103
116
|
}
|
|
@@ -111,7 +124,7 @@ class EntityCollection {
|
|
|
111
124
|
this._useLighting = Number(f);
|
|
112
125
|
}
|
|
113
126
|
isEqual(ec) {
|
|
114
|
-
return this.__id === ec.__id;
|
|
127
|
+
return ec !== null && (this.__id === ec.__id);
|
|
115
128
|
}
|
|
116
129
|
/**
|
|
117
130
|
* Sets collection visibility.
|
|
@@ -121,6 +134,7 @@ class EntityCollection {
|
|
|
121
134
|
setVisibility(visibility) {
|
|
122
135
|
this._visibility = visibility;
|
|
123
136
|
this._fadingOpacity = this._opacity * (visibility ? 1 : 0);
|
|
137
|
+
this.renderNode?.updateEntityCollectionsDepthOrder();
|
|
124
138
|
this.events.dispatch(this.events.visibilitychange, this);
|
|
125
139
|
}
|
|
126
140
|
/**
|
|
@@ -177,6 +191,24 @@ class EntityCollection {
|
|
|
177
191
|
this._addRecursively(entity);
|
|
178
192
|
}
|
|
179
193
|
_addRecursively(entity) {
|
|
194
|
+
let rn = this.renderNode;
|
|
195
|
+
if (rn) {
|
|
196
|
+
if (entity._independentPicking || !entity.parent) {
|
|
197
|
+
if (rn) {
|
|
198
|
+
rn.renderer && rn.renderer.assignPickingColor(entity);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
entity._pickingColor = entity.parent._pickingColor;
|
|
203
|
+
}
|
|
204
|
+
rn.renderer && rn.renderer.assignPickingColor(entity);
|
|
205
|
+
if (rn.ellipsoid && entity._cartesian.isZero()) {
|
|
206
|
+
entity.setCartesian3v(rn.ellipsoid.lonLatToCartesian(entity._lonLat));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
entity.setPickingColor();
|
|
210
|
+
entity._updateAbsolutePosition();
|
|
211
|
+
entity.setScale3v(entity.getScale());
|
|
180
212
|
// billboard
|
|
181
213
|
entity.billboard && this.billboardHandler.add(entity.billboard);
|
|
182
214
|
// label
|
|
@@ -192,19 +224,10 @@ class EntityCollection {
|
|
|
192
224
|
//geoObject
|
|
193
225
|
entity.geoObject && this.geoObjectHandler.add(entity.geoObject);
|
|
194
226
|
this.events.dispatch(this.events.entityadd, entity);
|
|
195
|
-
let
|
|
196
|
-
|
|
197
|
-
entity.
|
|
198
|
-
entity.
|
|
199
|
-
if (entity.childrenNodes[i]._independentPicking) {
|
|
200
|
-
if (rn) {
|
|
201
|
-
rn.renderer && rn.renderer.assignPickingColor(entity.childrenNodes[i]);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
entity.childrenNodes[i]._pickingColor = entity._pickingColor;
|
|
206
|
-
}
|
|
207
|
-
this._addRecursively(entity.childrenNodes[i]);
|
|
227
|
+
for (let i = 0; i < entity.childEntities.length; i++) {
|
|
228
|
+
entity.childEntities[i]._entityCollection = this;
|
|
229
|
+
entity.childEntities[i]._entityCollectionIndex = entity._entityCollectionIndex;
|
|
230
|
+
this._addRecursively(entity.childEntities[i]);
|
|
208
231
|
}
|
|
209
232
|
}
|
|
210
233
|
/**
|
|
@@ -218,15 +241,7 @@ class EntityCollection {
|
|
|
218
241
|
entity._entityCollection = this;
|
|
219
242
|
entity._entityCollectionIndex = this._entities.length;
|
|
220
243
|
this._entities.push(entity);
|
|
221
|
-
let rn = this.renderNode;
|
|
222
|
-
if (rn) {
|
|
223
|
-
rn.renderer && rn.renderer.assignPickingColor(entity);
|
|
224
|
-
if (rn.ellipsoid && entity._cartesian.isZero()) {
|
|
225
|
-
entity.setCartesian3v(rn.ellipsoid.lonLatToCartesian(entity._lonLat));
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
244
|
this._addRecursively(entity);
|
|
229
|
-
entity.setPickingColor();
|
|
230
245
|
}
|
|
231
246
|
return this;
|
|
232
247
|
}
|
|
@@ -249,7 +264,7 @@ class EntityCollection {
|
|
|
249
264
|
* @returns {boolean} -
|
|
250
265
|
*/
|
|
251
266
|
belongs(entity) {
|
|
252
|
-
return
|
|
267
|
+
return this.isEqual(entity._entityCollection);
|
|
253
268
|
}
|
|
254
269
|
_removeRecursively(entity) {
|
|
255
270
|
entity._entityCollection = null;
|
|
@@ -268,8 +283,8 @@ class EntityCollection {
|
|
|
268
283
|
entity.strip && this.stripHandler.remove(entity.strip);
|
|
269
284
|
// geoObject
|
|
270
285
|
entity.geoObject && this.geoObjectHandler.remove(entity.geoObject);
|
|
271
|
-
for (let i = 0; i < entity.
|
|
272
|
-
this._removeRecursively(entity.
|
|
286
|
+
for (let i = 0; i < entity.childEntities.length; i++) {
|
|
287
|
+
this._removeRecursively(entity.childEntities[i]);
|
|
273
288
|
}
|
|
274
289
|
}
|
|
275
290
|
/**
|
|
@@ -337,14 +352,7 @@ class EntityCollection {
|
|
|
337
352
|
*/
|
|
338
353
|
addTo(renderNode, isHidden = false) {
|
|
339
354
|
if (!this.renderNode) {
|
|
340
|
-
this
|
|
341
|
-
if (!isHidden) {
|
|
342
|
-
this._renderNodeIndex = renderNode.entityCollections.length;
|
|
343
|
-
renderNode.entityCollections.push(this);
|
|
344
|
-
}
|
|
345
|
-
renderNode.ellipsoid && this._updateGeodeticCoordinates(renderNode.ellipsoid);
|
|
346
|
-
this.bindRenderNode(renderNode);
|
|
347
|
-
this.events.dispatch(this.events.add, this);
|
|
355
|
+
renderNode.addEntityCollection(this, isHidden);
|
|
348
356
|
}
|
|
349
357
|
return this;
|
|
350
358
|
}
|
|
@@ -362,6 +370,7 @@ class EntityCollection {
|
|
|
362
370
|
this.polylineHandler.setRenderNode(renderNode);
|
|
363
371
|
this.pointCloudHandler.setRenderNode(renderNode);
|
|
364
372
|
this.stripHandler.setRenderNode(renderNode);
|
|
373
|
+
renderNode.renderer.events.on("changerelativecenter", this._onChangeRelativeCenter);
|
|
365
374
|
this.updateBillboardsTextureAtlas();
|
|
366
375
|
this.updateLabelsFontAtlas();
|
|
367
376
|
this.createPickingColors();
|
|
@@ -410,15 +419,9 @@ class EntityCollection {
|
|
|
410
419
|
*/
|
|
411
420
|
remove() {
|
|
412
421
|
if (this.renderNode) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
// reindex in the renderNode
|
|
416
|
-
for (let i = this._renderNodeIndex; i < this.renderNode.entityCollections.length; i++) {
|
|
417
|
-
this.renderNode.entityCollections[i]._renderNodeIndex = i;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
422
|
+
this.renderNode.removeEntityCollection(this);
|
|
423
|
+
this.renderNode.renderer?.events.off("changerelativecenter", this._onChangeRelativeCenter);
|
|
420
424
|
this.renderNode = null;
|
|
421
|
-
this._renderNodeIndex = -1;
|
|
422
425
|
this.events.dispatch(this.events.remove, this);
|
|
423
426
|
}
|
|
424
427
|
}
|
|
@@ -476,8 +479,8 @@ class EntityCollection {
|
|
|
476
479
|
_clearEntity(entity) {
|
|
477
480
|
entity._entityCollection = null;
|
|
478
481
|
entity._entityCollectionIndex = -1;
|
|
479
|
-
for (let i = 0; i < entity.
|
|
480
|
-
this._clearEntity(entity.
|
|
482
|
+
for (let i = 0; i < entity.childEntities.length; i++) {
|
|
483
|
+
this._clearEntity(entity.childEntities[i]);
|
|
481
484
|
}
|
|
482
485
|
}
|
|
483
486
|
}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { Entity } from "./Entity";
|
|
2
2
|
import { Quat, Vec3, Vec4 } from "../math/index";
|
|
3
|
-
import { GeoObjectHandler
|
|
3
|
+
import { GeoObjectHandler } from "./GeoObjectHandler";
|
|
4
|
+
import { InstanceData } from "./InstanceData";
|
|
4
5
|
import { NumberArray3 } from "../math/Vec3";
|
|
5
6
|
import { NumberArray4 } from "../math/Vec4";
|
|
6
7
|
import { Object3d } from "../Object3d";
|
|
8
|
+
export declare const LOCAL_FORWARD: Vec3;
|
|
9
|
+
/**
|
|
10
|
+
* Interface for GeoObject parameters.
|
|
11
|
+
* @typedef {Object} IGeoObjectParams
|
|
12
|
+
* @property {Object3d} [object3d] - 3D object associated with the geo object.
|
|
13
|
+
* @property {string} [objSrc] - Source url of the 3D object.
|
|
14
|
+
* @property {string} [tag] - Unique instancing drawing identifier tag.
|
|
15
|
+
* @property {Vec3 | NumberArray3} [position] - Position in Cartesian coordinates.
|
|
16
|
+
* @property {number} [pitch] - Rotation around X-axis in degrees.
|
|
17
|
+
* @property {number} [yaw] - Rotation around Y-axis in degrees.
|
|
18
|
+
* @property {number} [roll] - Rotation around Z-axis in degrees.
|
|
19
|
+
* @property {number | Vec3 | NumberArray3} [scale] - Scale of the object.
|
|
20
|
+
* @property {Vec3 | NumberArray3} [translate] - Translation offset.
|
|
21
|
+
* @property {Vec4 | NumberArray4 | string} [color] - RGBA color or HTML color string.
|
|
22
|
+
* @property {boolean} [visibility] - Visibility flag.
|
|
23
|
+
*/
|
|
7
24
|
export interface IGeoObjectParams {
|
|
8
25
|
object3d?: Object3d;
|
|
9
26
|
objSrc?: string;
|
|
10
|
-
textureSrc?: string;
|
|
11
27
|
tag?: string;
|
|
12
28
|
position?: Vec3 | NumberArray3;
|
|
13
29
|
pitch?: number;
|
|
@@ -19,16 +35,27 @@ export interface IGeoObjectParams {
|
|
|
19
35
|
visibility?: boolean;
|
|
20
36
|
}
|
|
21
37
|
/**
|
|
38
|
+
* Represents 3D object on the the globe or 3d space
|
|
22
39
|
* @class
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
40
|
+
* @param {IGeoObjectParams} options - Geo object parameters:
|
|
41
|
+
* @param {Object3d} [options.object3d] - 3D object associated with the geo object.
|
|
42
|
+
* @param {string} [options.objSrc] - Source url of the 3D object.
|
|
43
|
+
* @param {string} [options.tag] - Unique instancing drawing identifier tag.
|
|
44
|
+
* @param {Vec3 | NumberArray3} [options.position] - Position in Cartesian coordinates.
|
|
45
|
+
* @param {number} [options.pitch=0] - Rotation around X-axis in degrees.
|
|
46
|
+
* @param {number} [options.yaw=0] - Rotation around Y-axis in degrees.
|
|
47
|
+
* @param {number} [options.roll=0] - Rotation around Z-axis in degrees.
|
|
48
|
+
* @param {number | Vec3 | NumberArray3} [options.scale=1] - Scale of the object.
|
|
49
|
+
* @param {Vec3 | NumberArray3} [options.translate] - Translation offset.
|
|
50
|
+
* @param {Vec4 | NumberArray4 | string} [options.color] - RGBA color or HTML color string.
|
|
51
|
+
* @param {boolean} [options.visibility=true] - Visibility flag.
|
|
25
52
|
*
|
|
26
53
|
* @todo: GeoObject and GeoObjectHandler provides instanced objects only.
|
|
27
54
|
* It would be nice if it could provide not instanced rendering loop too.
|
|
28
55
|
*/
|
|
29
56
|
declare class GeoObject {
|
|
30
57
|
protected _tag: string;
|
|
31
|
-
|
|
58
|
+
static __counter__: number;
|
|
32
59
|
/**
|
|
33
60
|
* Entity instance that holds this geo object.
|
|
34
61
|
* @public
|
|
@@ -41,22 +68,18 @@ declare class GeoObject {
|
|
|
41
68
|
* @type {Vec3}
|
|
42
69
|
*/
|
|
43
70
|
protected _position: Vec3;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
protected _pitch: number;
|
|
47
|
-
protected _yaw: number;
|
|
48
|
-
protected _roll: number;
|
|
49
|
-
protected _pitchRad: number;
|
|
50
|
-
protected _yawRad: number;
|
|
51
|
-
protected _rollRad: number;
|
|
71
|
+
_rtcPositionHigh: Vec3;
|
|
72
|
+
_rtcPositionLow: Vec3;
|
|
52
73
|
protected _scale: Vec3;
|
|
53
74
|
protected _translate: Vec3;
|
|
75
|
+
protected _localPosition: Vec3;
|
|
54
76
|
/**
|
|
55
77
|
* RGBA color.
|
|
56
78
|
* @public
|
|
57
79
|
* @type {Vec4}
|
|
58
80
|
*/
|
|
59
81
|
_color: Vec4;
|
|
82
|
+
protected _qFrame: Quat;
|
|
60
83
|
_qRot: Quat;
|
|
61
84
|
protected _direction: Vec3;
|
|
62
85
|
_handler: GeoObjectHandler | null;
|
|
@@ -64,35 +87,67 @@ declare class GeoObject {
|
|
|
64
87
|
_tagData: InstanceData | null;
|
|
65
88
|
_tagDataIndex: number;
|
|
66
89
|
protected _object3d: Object3d;
|
|
67
|
-
protected _visibility: boolean;
|
|
68
|
-
protected _qNorthFrame: Quat;
|
|
69
|
-
private _textureSrc?;
|
|
70
90
|
_objectSrc?: string;
|
|
91
|
+
protected _visibility: boolean;
|
|
71
92
|
protected _children: GeoObject[];
|
|
72
93
|
constructor(options: IGeoObjectParams);
|
|
94
|
+
/**
|
|
95
|
+
* Gets the unique tag of the geo object.
|
|
96
|
+
* @returns {string}
|
|
97
|
+
*/
|
|
73
98
|
get tag(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the position of the geo object.
|
|
101
|
+
* @public
|
|
102
|
+
* @returns {Vec3}
|
|
103
|
+
*/
|
|
74
104
|
getPosition(): Vec3;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Gets the 3D object associated with this geo object.
|
|
107
|
+
* @public
|
|
108
|
+
* @returns {Object3d}
|
|
109
|
+
*/
|
|
78
110
|
get object3d(): Object3d;
|
|
111
|
+
/**
|
|
112
|
+
* Gets geometry mesh vertices.
|
|
113
|
+
* @public
|
|
114
|
+
* @returns {number[]}
|
|
115
|
+
*/
|
|
79
116
|
get vertices(): number[];
|
|
117
|
+
/**
|
|
118
|
+
* Gets geometry mesh normals.
|
|
119
|
+
* @public
|
|
120
|
+
* @returns {number[]}
|
|
121
|
+
*/
|
|
80
122
|
get normals(): number[];
|
|
123
|
+
/**
|
|
124
|
+
* Gets geometry mesh texture coordinates.
|
|
125
|
+
* @public
|
|
126
|
+
* @returns {number[]}
|
|
127
|
+
*/
|
|
81
128
|
get texCoords(): number[];
|
|
82
|
-
get indices(): number[];
|
|
83
129
|
/**
|
|
84
|
-
*
|
|
130
|
+
* Gets geometry mesh indices.
|
|
85
131
|
* @public
|
|
86
|
-
* @
|
|
132
|
+
* @returns {number[]}
|
|
133
|
+
*/
|
|
134
|
+
get indices(): number[];
|
|
135
|
+
/**
|
|
136
|
+
* Sets the opacity of the geo object.
|
|
137
|
+
* @param {number} a - Opacity value (0 to 1).
|
|
87
138
|
*/
|
|
88
139
|
setOpacity(a: number): void;
|
|
89
140
|
/**
|
|
90
|
-
*
|
|
91
|
-
* @
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
141
|
+
* Gets the opacity of the geo object.
|
|
142
|
+
* @returns {number}
|
|
143
|
+
*/
|
|
144
|
+
getOpacity(): number;
|
|
145
|
+
/**
|
|
146
|
+
* Sets the color of the geo object.
|
|
147
|
+
* @param {number} r - Red component.
|
|
148
|
+
* @param {number} g - Green component.
|
|
149
|
+
* @param {number} b - Blue component.
|
|
150
|
+
* @param {number} [a] - Alpha component.
|
|
96
151
|
*/
|
|
97
152
|
setColor(r: number, g: number, b: number, a?: number): void;
|
|
98
153
|
/**
|
|
@@ -121,31 +176,61 @@ declare class GeoObject {
|
|
|
121
176
|
* @param {number} z - Z coordinate.
|
|
122
177
|
*/
|
|
123
178
|
setPosition(x: number, y: number, z: number): void;
|
|
179
|
+
updateRTCPosition(): void;
|
|
124
180
|
/**
|
|
125
181
|
* Sets geo object position.
|
|
126
182
|
* @public
|
|
127
183
|
* @param {Vec3} position - Cartesian coordinates.
|
|
128
184
|
*/
|
|
129
185
|
setPosition3v(position: Vec3): void;
|
|
130
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Sets Object3d for the object
|
|
188
|
+
* @param {Object3d} object
|
|
189
|
+
*/
|
|
131
190
|
setObject(object: Object3d): void;
|
|
191
|
+
/**
|
|
192
|
+
* Sets the object url source.
|
|
193
|
+
* @param {string} src
|
|
194
|
+
*/
|
|
132
195
|
setObjectSrc(src: string): void;
|
|
133
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Sets object HTML color.
|
|
198
|
+
* @param {string} color
|
|
199
|
+
*/
|
|
134
200
|
setColorHTML(color: string): void;
|
|
135
201
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @
|
|
202
|
+
* Sets scales.
|
|
203
|
+
* @public
|
|
204
|
+
* @param {number} scale
|
|
138
205
|
*/
|
|
139
|
-
setPitch(pitch: number): void;
|
|
140
|
-
setRoll(roll: number): void;
|
|
141
|
-
setPitchYawRoll(pitch: number, yaw: number, roll: number): void;
|
|
142
206
|
setScale(scale: number): void;
|
|
207
|
+
/**
|
|
208
|
+
* Sets X, Y, Z axis scales
|
|
209
|
+
* @public
|
|
210
|
+
* @param {Vec3} scale
|
|
211
|
+
*/
|
|
143
212
|
setScale3v(scale: Vec3): void;
|
|
213
|
+
/**
|
|
214
|
+
* Gets scale.
|
|
215
|
+
* @publci
|
|
216
|
+
* @returns {Vec3}
|
|
217
|
+
*/
|
|
144
218
|
getScale(): Vec3;
|
|
145
219
|
setTranslate3v(translate: Vec3): void;
|
|
146
220
|
getTranslate(): Vec3;
|
|
147
221
|
/**
|
|
148
|
-
*
|
|
222
|
+
* Sets local offset position.
|
|
223
|
+
* @param {Vec3} localPosition
|
|
224
|
+
*/
|
|
225
|
+
setLocalPosition3v(localPosition: Vec3): void;
|
|
226
|
+
/**
|
|
227
|
+
* Gets local offset position.
|
|
228
|
+
* @public
|
|
229
|
+
* @returns {Vec3}
|
|
230
|
+
*/
|
|
231
|
+
getLocalPosition(): Vec3;
|
|
232
|
+
/**
|
|
233
|
+
* Removes the geo object from the handler.
|
|
149
234
|
* @public
|
|
150
235
|
*/
|
|
151
236
|
remove(): void;
|
|
@@ -155,7 +240,27 @@ declare class GeoObject {
|
|
|
155
240
|
* @param {Vec3} color - Picking color.
|
|
156
241
|
*/
|
|
157
242
|
setPickingColor3v(color: Vec3): void;
|
|
243
|
+
/**
|
|
244
|
+
* Sets the rotation quaternion.
|
|
245
|
+
* @public
|
|
246
|
+
* @param {Quat} qRot - Rotation quaternion.
|
|
247
|
+
*/
|
|
248
|
+
setRotation(qRot: Quat): void;
|
|
249
|
+
/**
|
|
250
|
+
* Returns orientation quaternion.
|
|
251
|
+
* @public
|
|
252
|
+
* @returns {Quat}
|
|
253
|
+
*/
|
|
254
|
+
getRotation(): Quat;
|
|
255
|
+
/**
|
|
256
|
+
* Update object rotation
|
|
257
|
+
*/
|
|
158
258
|
updateRotation(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Returns object direction
|
|
261
|
+
* @publcu
|
|
262
|
+
* @returns {Vec3}
|
|
263
|
+
*/
|
|
159
264
|
getDirection(): Vec3;
|
|
160
265
|
}
|
|
161
266
|
export { GeoObject };
|