@openglobus/og 0.22.2 → 0.24.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.
Files changed (205) hide show
  1. package/css/og.css +137 -1
  2. package/lib/@openglobus/js/Globe.d.ts +0 -1
  3. package/lib/@openglobus/js/Object3d.d.ts +20 -10
  4. package/lib/@openglobus/js/camera/Camera.d.ts +57 -15
  5. package/lib/@openglobus/js/camera/Frustum.d.ts +3 -0
  6. package/lib/@openglobus/js/camera/PlanetCamera.d.ts +13 -0
  7. package/lib/@openglobus/js/control/CameraLock.d.ts +38 -0
  8. package/lib/@openglobus/js/control/MouseNavigation.d.ts +62 -51
  9. package/lib/@openglobus/js/control/OldMouseNavigation.d.ts +64 -0
  10. package/lib/@openglobus/js/control/SimpleNavigation.d.ts +27 -10
  11. package/lib/@openglobus/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  12. package/lib/@openglobus/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  13. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  14. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  15. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  16. package/lib/@openglobus/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  17. package/lib/@openglobus/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  18. package/lib/@openglobus/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  19. package/lib/@openglobus/js/control/geoObjectEditor/colors.d.ts +8 -0
  20. package/lib/@openglobus/js/control/index.d.ts +3 -2
  21. package/lib/@openglobus/js/entity/Entity.d.ts +282 -19
  22. package/lib/@openglobus/js/entity/EntityCollection.d.ts +8 -9
  23. package/lib/@openglobus/js/entity/GeoObject.d.ts +135 -39
  24. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +39 -63
  25. package/lib/@openglobus/js/entity/InstanceData.d.ts +76 -0
  26. package/lib/@openglobus/js/entity/Polyline.d.ts +19 -6
  27. package/lib/@openglobus/js/entity/PolylineHandler.d.ts +7 -0
  28. package/lib/@openglobus/js/index.d.ts +2 -1
  29. package/lib/@openglobus/js/input/MouseHandler.d.ts +1 -0
  30. package/lib/@openglobus/js/layer/Vector.d.ts +4 -0
  31. package/lib/@openglobus/js/light/LightSource.d.ts +1 -139
  32. package/lib/@openglobus/js/math/Mat3.d.ts +1 -1
  33. package/lib/@openglobus/js/math/Mat4.d.ts +10 -1
  34. package/lib/@openglobus/js/math/Plane.d.ts +3 -1
  35. package/lib/@openglobus/js/math/Quat.d.ts +47 -33
  36. package/lib/@openglobus/js/math/Ray.d.ts +10 -14
  37. package/lib/@openglobus/js/math/Vec2.d.ts +22 -0
  38. package/lib/@openglobus/js/math/Vec3.d.ts +15 -0
  39. package/lib/@openglobus/js/math.d.ts +2 -2
  40. package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +2 -2
  41. package/lib/@openglobus/js/quadTree/Node.d.ts +1 -1
  42. package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  43. package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  44. package/lib/@openglobus/js/renderer/Renderer.d.ts +63 -44
  45. package/lib/@openglobus/js/renderer/RendererEvents.d.ts +2 -0
  46. package/lib/@openglobus/js/scene/Planet.d.ts +15 -7
  47. package/lib/@openglobus/js/scene/RenderNode.d.ts +10 -25
  48. package/lib/@openglobus/js/shaders/drawnode.d.ts +1 -0
  49. package/lib/@openglobus/js/shaders/geoObject.d.ts +1 -0
  50. package/lib/@openglobus/js/shaders/utils.d.ts +1 -1
  51. package/lib/@openglobus/js/ui/Checkbox.d.ts +31 -0
  52. package/lib/@openglobus/js/ui/Dialog.d.ts +3 -0
  53. package/lib/@openglobus/js/ui/Input.d.ts +32 -0
  54. package/lib/@openglobus/js/ui/View.d.ts +3 -1
  55. package/lib/@openglobus/js/utils/objParser.d.ts +44 -12
  56. package/lib/@openglobus/js/utils/shared.d.ts +22 -0
  57. package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +0 -1
  58. package/lib/@openglobus/js/webgl/Framebuffer.d.ts +35 -8
  59. package/lib/@openglobus/js/webgl/Handler.d.ts +22 -12
  60. package/lib/@openglobus/og.css +1 -1
  61. package/lib/@openglobus/og.esm.js +1 -1
  62. package/lib/@openglobus/og.esm.js.map +1 -1
  63. package/lib/@openglobus/og.umd.js +1 -1
  64. package/lib/@openglobus/og.umd.js.map +1 -1
  65. package/lib/js/Globe.d.ts +0 -1
  66. package/lib/js/Globe.js +4 -2
  67. package/lib/js/Object3d.d.ts +20 -10
  68. package/lib/js/Object3d.js +124 -48
  69. package/lib/js/Popup.js +1 -1
  70. package/lib/js/camera/Camera.d.ts +57 -15
  71. package/lib/js/camera/Camera.js +109 -29
  72. package/lib/js/camera/Frustum.d.ts +3 -0
  73. package/lib/js/camera/Frustum.js +7 -0
  74. package/lib/js/camera/PlanetCamera.d.ts +13 -0
  75. package/lib/js/camera/PlanetCamera.js +52 -5
  76. package/lib/js/control/Atmosphere.js +10 -6
  77. package/lib/js/control/CameraLock.d.ts +38 -0
  78. package/lib/js/control/CameraLock.js +216 -0
  79. package/lib/js/control/Control.js +1 -1
  80. package/lib/js/control/DebugInfo.js +38 -8
  81. package/lib/js/control/KeyboardNavigation.js +9 -9
  82. package/lib/js/control/MouseNavigation.d.ts +62 -51
  83. package/lib/js/control/MouseNavigation.js +361 -305
  84. package/lib/js/control/MouseWheelZoomControl.d.ts +0 -44
  85. package/lib/js/control/MouseWheelZoomControl.js +270 -181
  86. package/lib/js/control/OldMouseNavigation.d.ts +64 -0
  87. package/lib/js/control/OldMouseNavigation.js +368 -0
  88. package/lib/js/control/ScaleControl.js +11 -5
  89. package/lib/js/control/SimpleNavigation.d.ts +27 -10
  90. package/lib/js/control/SimpleNavigation.js +149 -49
  91. package/lib/js/control/Sun.js +6 -6
  92. package/lib/js/control/TouchNavigation.js +11 -8
  93. package/lib/js/control/elevationProfile/ElevationProfileScene.js +6 -5
  94. package/lib/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  95. package/lib/js/control/geoObjectEditor/ArrowEntity.js +59 -0
  96. package/lib/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  97. package/lib/js/control/geoObjectEditor/AxisTrackEntity.js +93 -0
  98. package/lib/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  99. package/lib/js/control/geoObjectEditor/GeoObjectEditor.js +30 -0
  100. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  101. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +488 -0
  102. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  103. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +487 -43
  104. package/lib/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  105. package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +107 -0
  106. package/lib/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  107. package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +31 -0
  108. package/lib/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  109. package/lib/js/control/geoObjectEditor/RotateEntity.js +105 -0
  110. package/lib/js/control/geoObjectEditor/colors.d.ts +8 -0
  111. package/lib/js/control/geoObjectEditor/colors.js +8 -0
  112. package/lib/js/control/index.d.ts +3 -2
  113. package/lib/js/control/index.js +3 -2
  114. package/lib/js/control/timeline/TimelineControl.js +2 -0
  115. package/lib/js/control/visibleExtent/Segment.js +4 -4
  116. package/lib/js/entity/Entity.d.ts +282 -19
  117. package/lib/js/entity/Entity.js +497 -62
  118. package/lib/js/entity/EntityCollection.d.ts +8 -9
  119. package/lib/js/entity/EntityCollection.js +48 -45
  120. package/lib/js/entity/GeoObject.d.ts +135 -39
  121. package/lib/js/entity/GeoObject.js +150 -90
  122. package/lib/js/entity/GeoObjectHandler.d.ts +39 -63
  123. package/lib/js/entity/GeoObjectHandler.js +198 -295
  124. package/lib/js/entity/InstanceData.d.ts +76 -0
  125. package/lib/js/entity/InstanceData.js +347 -0
  126. package/lib/js/entity/Polyline.d.ts +19 -6
  127. package/lib/js/entity/Polyline.js +76 -36
  128. package/lib/js/entity/PolylineHandler.d.ts +7 -0
  129. package/lib/js/entity/PolylineHandler.js +26 -1
  130. package/lib/js/index.d.ts +2 -1
  131. package/lib/js/index.js +2 -1
  132. package/lib/js/input/MouseHandler.d.ts +1 -0
  133. package/lib/js/input/MouseHandler.js +12 -1
  134. package/lib/js/layer/Bing.js +2 -2
  135. package/lib/js/layer/Vector.d.ts +4 -0
  136. package/lib/js/layer/Vector.js +16 -0
  137. package/lib/js/light/LightSource.d.ts +1 -139
  138. package/lib/js/light/LightSource.js +21 -227
  139. package/lib/js/math/Mat3.d.ts +1 -1
  140. package/lib/js/math/Mat3.js +1 -1
  141. package/lib/js/math/Mat4.d.ts +10 -1
  142. package/lib/js/math/Mat4.js +17 -1
  143. package/lib/js/math/Plane.d.ts +3 -1
  144. package/lib/js/math/Plane.js +11 -1
  145. package/lib/js/math/Quat.d.ts +47 -33
  146. package/lib/js/math/Quat.js +92 -90
  147. package/lib/js/math/Ray.d.ts +10 -14
  148. package/lib/js/math/Ray.js +56 -33
  149. package/lib/js/math/Vec2.d.ts +22 -0
  150. package/lib/js/math/Vec2.js +32 -0
  151. package/lib/js/math/Vec3.d.ts +15 -0
  152. package/lib/js/math/Vec3.js +30 -1
  153. package/lib/js/math.d.ts +2 -2
  154. package/lib/js/math.js +3 -3
  155. package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
  156. package/lib/js/quadTree/EntityCollectionNode.js +8 -8
  157. package/lib/js/quadTree/Node.d.ts +1 -1
  158. package/lib/js/quadTree/Node.js +2 -2
  159. package/lib/js/quadTree/QuadTreeStrategy.js +1 -1
  160. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  161. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +2 -2
  162. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  163. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +2 -2
  164. package/lib/js/renderer/Renderer.d.ts +63 -44
  165. package/lib/js/renderer/Renderer.js +267 -266
  166. package/lib/js/renderer/RendererEvents.d.ts +2 -0
  167. package/lib/js/renderer/RendererEvents.js +5 -2
  168. package/lib/js/scene/Planet.d.ts +15 -7
  169. package/lib/js/scene/Planet.js +133 -90
  170. package/lib/js/scene/RenderNode.d.ts +10 -25
  171. package/lib/js/scene/RenderNode.js +70 -58
  172. package/lib/js/segment/Segment.js +4 -4
  173. package/lib/js/shaders/depth.js +2 -5
  174. package/lib/js/shaders/drawnode.d.ts +1 -0
  175. package/lib/js/shaders/drawnode.js +51 -52
  176. package/lib/js/shaders/geoObject.d.ts +1 -0
  177. package/lib/js/shaders/geoObject.js +154 -91
  178. package/lib/js/shaders/polyline.js +68 -51
  179. package/lib/js/shaders/utils.d.ts +1 -1
  180. package/lib/js/shaders/utils.js +11 -0
  181. package/lib/js/terrain/GlobusTerrain.js +2 -2
  182. package/lib/js/ui/Checkbox.d.ts +31 -0
  183. package/lib/js/ui/Checkbox.js +110 -0
  184. package/lib/js/ui/Color.js +2 -1
  185. package/lib/js/ui/Dialog.d.ts +3 -0
  186. package/lib/js/ui/Dialog.js +20 -0
  187. package/lib/js/ui/Input.d.ts +32 -0
  188. package/lib/js/ui/Input.js +107 -0
  189. package/lib/js/ui/View.d.ts +3 -1
  190. package/lib/js/ui/View.js +6 -0
  191. package/lib/js/utils/objParser.d.ts +44 -12
  192. package/lib/js/utils/objParser.js +241 -149
  193. package/lib/js/utils/shared.d.ts +22 -0
  194. package/lib/js/utils/shared.js +34 -0
  195. package/lib/js/webgl/BaseFramebuffer.d.ts +0 -1
  196. package/lib/js/webgl/Framebuffer.d.ts +35 -8
  197. package/lib/js/webgl/Framebuffer.js +136 -29
  198. package/lib/js/webgl/Handler.d.ts +22 -12
  199. package/lib/js/webgl/Handler.js +53 -34
  200. package/lib/js/webgl/Program.js +0 -8
  201. package/package.json +5 -3
  202. package/lib/@openglobus/js/control/EarthNavigation.d.ts +0 -50
  203. package/lib/@openglobus/js/control/MouseWheelZoomControl.d.ts +0 -44
  204. package/lib/js/control/EarthNavigation.d.ts +0 -50
  205. package/lib/js/control/EarthNavigation.js +0 -202
@@ -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 | null;
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 || [math.MAX32, math.MAX32, math.MAX32];
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 rn = this.renderNode;
196
- for (let i = 0; i < entity.childrenNodes.length; i++) {
197
- entity.childrenNodes[i]._entityCollection = this;
198
- entity.childrenNodes[i]._entityCollectionIndex = entity._entityCollectionIndex;
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 entity._entityCollection && this._renderNodeIndex === entity._entityCollection._renderNodeIndex;
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.childrenNodes.length; i++) {
272
- this._removeRecursively(entity.childrenNodes[i]);
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.renderNode = renderNode;
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
- if (this._renderNodeIndex !== -1) {
414
- this.renderNode.entityCollections.splice(this._renderNodeIndex, 1);
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.childrenNodes.length; i++) {
480
- this._clearEntity(entity.childrenNodes[i]);
482
+ for (let i = 0; i < entity.childEntities.length; i++) {
483
+ this._clearEntity(entity.childEntities[i]);
481
484
  }
482
485
  }
483
486
  }
@@ -1,34 +1,52 @@
1
1
  import { Entity } from "./Entity";
2
2
  import { Quat, Vec3, Vec4 } from "../math/index";
3
- import { GeoObjectHandler, InstanceData } from "./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 | Vec3 | NumberArray3} [scale] - Scale of the object.
17
+ * @property {Vec3 | NumberArray3} [translate] - Translation offset.
18
+ * @property {Vec4 | NumberArray4 | string} [color] - RGBA color or HTML color string.
19
+ * @property {boolean} [visibility] - Visibility flag.
20
+ */
7
21
  export interface IGeoObjectParams {
8
22
  object3d?: Object3d;
9
23
  objSrc?: string;
10
- textureSrc?: string;
11
24
  tag?: string;
12
25
  position?: Vec3 | NumberArray3;
13
- pitch?: number;
14
- yaw?: number;
15
- roll?: number;
16
26
  scale?: number | Vec3 | NumberArray3;
17
27
  translate?: Vec3 | NumberArray3;
18
28
  color?: Vec4 | NumberArray4 | string;
19
29
  visibility?: boolean;
20
30
  }
21
31
  /**
32
+ * Represents 3D object on the the globe or 3d space
22
33
  * @class
23
- * @param {Object} options - Geo object parameters:
24
- * @param {Vec3} [options.position] - Geo object position.
34
+ * @param {IGeoObjectParams} options - Geo object parameters:
35
+ * @param {Object3d} [options.object3d] - 3D object associated with the geo object.
36
+ * @param {string} [options.objSrc] - Source url of the 3D object.
37
+ * @param {string} [options.tag] - Unique instancing drawing identifier tag.
38
+ * @param {Vec3 | NumberArray3} [options.position] - Position in Cartesian coordinates.
39
+ * @param {number | Vec3 | NumberArray3} [options.scale=1] - Scale of the object.
40
+ * @param {Vec3 | NumberArray3} [options.translate] - Translation offset.
41
+ * @param {Vec4 | NumberArray4 | string} [options.color] - RGBA color or HTML color string.
42
+ * @param {boolean} [options.visibility=true] - Visibility flag.
25
43
  *
26
44
  * @todo: GeoObject and GeoObjectHandler provides instanced objects only.
27
45
  * It would be nice if it could provide not instanced rendering loop too.
28
46
  */
29
47
  declare class GeoObject {
30
48
  protected _tag: string;
31
- instanced: boolean;
49
+ static __counter__: number;
32
50
  /**
33
51
  * Entity instance that holds this geo object.
34
52
  * @public
@@ -41,22 +59,18 @@ declare class GeoObject {
41
59
  * @type {Vec3}
42
60
  */
43
61
  protected _position: Vec3;
44
- _positionHigh: Vec3;
45
- _positionLow: Vec3;
46
- protected _pitch: number;
47
- protected _yaw: number;
48
- protected _roll: number;
49
- protected _pitchRad: number;
50
- protected _yawRad: number;
51
- protected _rollRad: number;
62
+ _rtcPositionHigh: Vec3;
63
+ _rtcPositionLow: Vec3;
52
64
  protected _scale: Vec3;
53
65
  protected _translate: Vec3;
66
+ protected _localPosition: Vec3;
54
67
  /**
55
68
  * RGBA color.
56
69
  * @public
57
70
  * @type {Vec4}
58
71
  */
59
72
  _color: Vec4;
73
+ protected _qFrame: Quat;
60
74
  _qRot: Quat;
61
75
  protected _direction: Vec3;
62
76
  _handler: GeoObjectHandler | null;
@@ -64,35 +78,67 @@ declare class GeoObject {
64
78
  _tagData: InstanceData | null;
65
79
  _tagDataIndex: number;
66
80
  protected _object3d: Object3d;
67
- protected _visibility: boolean;
68
- protected _qNorthFrame: Quat;
69
- private _textureSrc?;
70
81
  _objectSrc?: string;
82
+ protected _visibility: boolean;
71
83
  protected _children: GeoObject[];
72
84
  constructor(options: IGeoObjectParams);
85
+ /**
86
+ * Gets the unique tag of the geo object.
87
+ * @returns {string}
88
+ */
73
89
  get tag(): string;
90
+ /**
91
+ * Gets the position of the geo object.
92
+ * @public
93
+ * @returns {Vec3}
94
+ */
74
95
  getPosition(): Vec3;
75
- getPitch(): number;
76
- getYaw(): number;
77
- getRoll(): number;
96
+ /**
97
+ * Gets the 3D object associated with this geo object.
98
+ * @public
99
+ * @returns {Object3d}
100
+ */
78
101
  get object3d(): Object3d;
102
+ /**
103
+ * Gets geometry mesh vertices.
104
+ * @public
105
+ * @returns {number[]}
106
+ */
79
107
  get vertices(): number[];
108
+ /**
109
+ * Gets geometry mesh normals.
110
+ * @public
111
+ * @returns {number[]}
112
+ */
80
113
  get normals(): number[];
114
+ /**
115
+ * Gets geometry mesh texture coordinates.
116
+ * @public
117
+ * @returns {number[]}
118
+ */
81
119
  get texCoords(): number[];
82
- get indices(): number[];
83
120
  /**
84
- * Sets geo object opacity.
121
+ * Gets geometry mesh indices.
85
122
  * @public
86
- * @param {number} a - Billboard opacity.
123
+ * @returns {number[]}
124
+ */
125
+ get indices(): number[];
126
+ /**
127
+ * Sets the opacity of the geo object.
128
+ * @param {number} a - Opacity value (0 to 1).
87
129
  */
88
130
  setOpacity(a: number): void;
89
131
  /**
90
- * Sets color.
91
- * @public
92
- * @param {number} r - Red.
93
- * @param {number} g - Green.
94
- * @param {number} b - Blue.
95
- * @param {number} [a] - Alpha.
132
+ * Gets the opacity of the geo object.
133
+ * @returns {number}
134
+ */
135
+ getOpacity(): number;
136
+ /**
137
+ * Sets the color of the geo object.
138
+ * @param {number} r - Red component.
139
+ * @param {number} g - Green component.
140
+ * @param {number} b - Blue component.
141
+ * @param {number} [a] - Alpha component.
96
142
  */
97
143
  setColor(r: number, g: number, b: number, a?: number): void;
98
144
  /**
@@ -121,31 +167,61 @@ declare class GeoObject {
121
167
  * @param {number} z - Z coordinate.
122
168
  */
123
169
  setPosition(x: number, y: number, z: number): void;
170
+ updateRTCPosition(): void;
124
171
  /**
125
172
  * Sets geo object position.
126
173
  * @public
127
174
  * @param {Vec3} position - Cartesian coordinates.
128
175
  */
129
176
  setPosition3v(position: Vec3): void;
130
- setYaw(yaw: number): void;
177
+ /**
178
+ * Sets Object3d for the object
179
+ * @param {Object3d} object
180
+ */
131
181
  setObject(object: Object3d): void;
182
+ /**
183
+ * Sets the object url source.
184
+ * @param {string} src
185
+ */
132
186
  setObjectSrc(src: string): void;
133
- setTextureSrc(src: string): void;
187
+ /**
188
+ * Sets object HTML color.
189
+ * @param {string} color
190
+ */
134
191
  setColorHTML(color: string): void;
135
192
  /**
136
- *
137
- * @param {number} pitch - Pitch in radians
193
+ * Sets scales.
194
+ * @public
195
+ * @param {number} scale
138
196
  */
139
- setPitch(pitch: number): void;
140
- setRoll(roll: number): void;
141
- setPitchYawRoll(pitch: number, yaw: number, roll: number): void;
142
197
  setScale(scale: number): void;
198
+ /**
199
+ * Sets X, Y, Z axis scales
200
+ * @public
201
+ * @param {Vec3} scale
202
+ */
143
203
  setScale3v(scale: Vec3): void;
204
+ /**
205
+ * Gets scale.
206
+ * @publci
207
+ * @returns {Vec3}
208
+ */
144
209
  getScale(): Vec3;
145
210
  setTranslate3v(translate: Vec3): void;
146
211
  getTranslate(): Vec3;
147
212
  /**
148
- * Removes geo object from handler.
213
+ * Sets local offset position.
214
+ * @param {Vec3} localPosition
215
+ */
216
+ setLocalPosition3v(localPosition: Vec3): void;
217
+ /**
218
+ * Gets local offset position.
219
+ * @public
220
+ * @returns {Vec3}
221
+ */
222
+ getLocalPosition(): Vec3;
223
+ /**
224
+ * Removes the geo object from the handler.
149
225
  * @public
150
226
  */
151
227
  remove(): void;
@@ -155,7 +231,27 @@ declare class GeoObject {
155
231
  * @param {Vec3} color - Picking color.
156
232
  */
157
233
  setPickingColor3v(color: Vec3): void;
234
+ /**
235
+ * Sets the rotation quaternion.
236
+ * @public
237
+ * @param {Quat} qRot - Rotation quaternion.
238
+ */
239
+ setRotation(qRot: Quat): void;
240
+ /**
241
+ * Returns orientation quaternion.
242
+ * @public
243
+ * @returns {Quat}
244
+ */
245
+ getRotation(): Quat;
246
+ /**
247
+ * Update object rotation
248
+ */
158
249
  updateRotation(): void;
250
+ /**
251
+ * Returns object direction
252
+ * @publcu
253
+ * @returns {Vec3}
254
+ */
159
255
  getDirection(): Vec3;
160
256
  }
161
257
  export { GeoObject };