@openglobus/og 0.16.3 → 0.17.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 (181) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +24 -2
  3. package/dist/@openglobus/og.css +1 -1
  4. package/dist/@openglobus/og.esm.js +2 -2
  5. package/dist/@openglobus/og.esm.js.map +1 -1
  6. package/dist/@openglobus/og.umd.js +2 -2
  7. package/dist/@openglobus/og.umd.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/og/Clock.js +1 -5
  10. package/src/og/Events.js +0 -4
  11. package/src/og/Extent.js +5 -9
  12. package/src/og/Globe.js +92 -55
  13. package/src/og/ImageCanvas.js +12 -5
  14. package/src/og/Lock.js +44 -48
  15. package/src/og/LonLat.js +0 -4
  16. package/src/og/Object3d.js +1 -1
  17. package/src/og/Stack.js +49 -53
  18. package/src/og/astro/earth.js +112 -116
  19. package/src/og/astro/jd.js +514 -518
  20. package/src/og/astro/orbit.js +119 -123
  21. package/src/og/astro/rotation.js +36 -40
  22. package/src/og/bv/Box.js +77 -81
  23. package/src/og/bv/Sphere.js +57 -61
  24. package/src/og/camera/Camera.js +20 -7
  25. package/src/og/camera/PlanetCamera.js +8 -15
  26. package/src/og/control/Atmosphere.js +0 -4
  27. package/src/og/control/Control.js +9 -8
  28. package/src/og/control/DebugInfo.js +0 -4
  29. package/src/og/control/DrawingSwitcher.js +117 -0
  30. package/src/og/control/EarthCoordinates.js +214 -214
  31. package/src/og/control/GeoImageDragControl.js +0 -4
  32. package/src/og/control/KeyboardNavigation.js +0 -4
  33. package/src/og/control/LayerAnimation.js +0 -4
  34. package/src/og/control/LayerSwitcher.js +2 -4
  35. package/src/og/control/Lighting.js +11 -15
  36. package/src/og/control/MouseNavigation.js +0 -4
  37. package/src/og/control/MouseWheelZoomControl.js +0 -4
  38. package/src/og/control/RulerSwitcher.js +0 -4
  39. package/src/og/control/ScaleControl.js +2 -6
  40. package/src/og/control/ShowFps.js +40 -44
  41. package/src/og/control/SimpleNavigation.js +10 -10
  42. package/src/og/control/SimpleSkyBackground.js +0 -4
  43. package/src/og/control/Sun.js +0 -4
  44. package/src/og/control/ToggleWireframe.js +35 -39
  45. package/src/og/control/ZoomControl.js +0 -4
  46. package/src/og/control/drawing/DrawingControl.js +51 -0
  47. package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
  48. package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
  49. package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
  50. package/src/og/control/index.js +5 -1
  51. package/src/og/control/ruler/Ruler.js +0 -4
  52. package/src/og/control/ruler/RulerScene.js +3 -2
  53. package/src/og/control/selection/Selection.js +0 -4
  54. package/src/og/control/selection/SelectionScene.js +2 -4
  55. package/src/og/control/timeline/TimelineControl.js +4 -4
  56. package/src/og/control/timeline/TimelineModel.js +2 -2
  57. package/src/og/control/timeline/TimelineView.js +1 -0
  58. package/src/og/control/visibleExtent/Segment.js +5 -5
  59. package/src/og/control/visibleExtent/drawnode.js +0 -4
  60. package/src/og/ellipsoid/Ellipsoid.js +205 -275
  61. package/src/og/ellipsoid/wgs84.js +0 -4
  62. package/src/og/entity/BaseBillboard.js +375 -379
  63. package/src/og/entity/Billboard.js +0 -4
  64. package/src/og/entity/BillboardHandler.js +0 -4
  65. package/src/og/entity/Entity.js +22 -22
  66. package/src/og/entity/EntityCollection.js +7 -11
  67. package/src/og/entity/GeoObject.js +0 -4
  68. package/src/og/entity/GeoObjectHandler.js +0 -4
  69. package/src/og/entity/Geometry.js +5 -4
  70. package/src/og/entity/GeometryHandler.js +3 -4
  71. package/src/og/entity/Label.js +0 -4
  72. package/src/og/entity/LabelHandler.js +0 -4
  73. package/src/og/entity/PointCloud.js +0 -4
  74. package/src/og/entity/PointCloudHandler.js +122 -126
  75. package/src/og/entity/Polyline.js +4 -6
  76. package/src/og/entity/PolylineHandler.js +104 -108
  77. package/src/og/entity/Ray.js +29 -29
  78. package/src/og/entity/Strip.js +1 -1
  79. package/src/og/index.js +3 -1
  80. package/src/og/input/KeyboardHandler.js +128 -132
  81. package/src/og/input/MouseHandler.js +94 -98
  82. package/src/og/input/TouchHandler.js +59 -63
  83. package/src/og/input/input.js +44 -48
  84. package/src/og/layer/BaseGeoImage.js +5 -8
  85. package/src/og/layer/CanvasTiles.js +0 -4
  86. package/src/og/layer/GeoImage.js +0 -4
  87. package/src/og/layer/GeoTexture2d.js +0 -4
  88. package/src/og/layer/GeoVideo.js +0 -4
  89. package/src/og/layer/KML.js +1 -0
  90. package/src/og/layer/Layer.js +22 -26
  91. package/src/og/layer/Material.js +0 -4
  92. package/src/og/layer/Vector.js +23 -20
  93. package/src/og/layer/WMS.js +182 -186
  94. package/src/og/layer/XYZ.js +0 -4
  95. package/src/og/light/LightSource.js +0 -4
  96. package/src/og/math/Line2.js +28 -32
  97. package/src/og/math/Mat3.js +152 -156
  98. package/src/og/math/Ray.js +0 -4
  99. package/src/og/math/Vec2.js +0 -4
  100. package/src/og/math/Vec3.js +0 -4
  101. package/src/og/math/Vec4.js +0 -4
  102. package/src/og/math/coder.js +104 -104
  103. package/src/og/math.js +39 -7
  104. package/src/og/proj/EPSG3857.js +13 -13
  105. package/src/og/proj/Proj.js +59 -63
  106. package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
  107. package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
  108. package/src/og/quadTree/EntityCollectionNode.js +12 -16
  109. package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
  110. package/src/og/quadTree/QuadTreeStrategy.js +1 -0
  111. package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
  112. package/src/og/renderer/Renderer.js +109 -22
  113. package/src/og/renderer/RendererEvents.js +0 -4
  114. package/src/og/scene/Axes.js +74 -78
  115. package/src/og/scene/BaseNode.js +0 -4
  116. package/src/og/scene/Planet.js +114 -112
  117. package/src/og/scene/RenderNode.js +11 -3
  118. package/src/og/scene/SkyBox.js +104 -108
  119. package/src/og/segment/Segment.js +8 -4
  120. package/src/og/segment/SegmentLonLat.js +2 -6
  121. package/src/og/segment/segmentHelper.js +229 -225
  122. package/src/og/shaders/billboard.js +0 -4
  123. package/src/og/shaders/drawnode.js +5 -9
  124. package/src/og/shaders/geoObject.js +0 -4
  125. package/src/og/shaders/label.js +0 -4
  126. package/src/og/shaders/pickingMask.js +0 -4
  127. package/src/og/shaders/pointCloud.js +0 -4
  128. package/src/og/shaders/polyline.js +0 -4
  129. package/src/og/shaders/ray.js +0 -4
  130. package/src/og/shaders/skybox.js +0 -4
  131. package/src/og/terrain/EmptyTerrain.js +0 -4
  132. package/src/og/utils/FontAtlas.js +0 -4
  133. package/src/og/utils/GeoImageCreator.js +1 -2
  134. package/src/og/utils/NormalMapCreator.js +8 -9
  135. package/src/og/utils/VectorTileCreator.js +3 -9
  136. package/src/og/utils/shared.js +20 -1
  137. package/src/og/webgl/Framebuffer.js +0 -4
  138. package/src/og/webgl/Handler.js +45 -19
  139. package/src/og/webgl/Multisample.js +0 -4
  140. package/src/og/webgl/Program.js +0 -4
  141. package/src/og/webgl/ProgramController.js +2 -2
  142. package/types/Clock.d.ts +1 -1
  143. package/types/Extent.d.ts +5 -5
  144. package/types/Globe.d.ts +15 -1
  145. package/types/ImageCanvas.d.ts +5 -0
  146. package/types/bv/Box.d.ts +1 -1
  147. package/types/bv/Sphere.d.ts +3 -3
  148. package/types/camera/Camera.d.ts +3 -2
  149. package/types/camera/PlanetCamera.d.ts +4 -4
  150. package/types/control/DrawingSwitcher.d.ts +13 -0
  151. package/types/control/EarthCoordinates.d.ts +1 -1
  152. package/types/control/Lighting.d.ts +8 -8
  153. package/types/control/drawing/DrawingControl.d.ts +14 -0
  154. package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
  155. package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
  156. package/types/control/index.d.ts +3 -1
  157. package/types/control/ruler/RulerScene.d.ts +0 -1
  158. package/types/control/selection/SelectionScene.d.ts +0 -1
  159. package/types/ellipsoid/Ellipsoid.d.ts +50 -63
  160. package/types/entity/Entity.d.ts +3 -2
  161. package/types/entity/Geometry.d.ts +5 -0
  162. package/types/entity/Polyline.d.ts +1 -1
  163. package/types/entity/Ray.d.ts +1 -0
  164. package/types/index.d.ts +1 -0
  165. package/types/layer/BaseGeoImage.d.ts +1 -1
  166. package/types/layer/CanvasTiles.d.ts +1 -1
  167. package/types/layer/Layer.d.ts +1 -1
  168. package/types/layer/Vector.d.ts +1 -0
  169. package/types/math.d.ts +7 -0
  170. package/types/renderer/Renderer.d.ts +7 -1
  171. package/types/scene/Axes.d.ts +0 -1
  172. package/types/scene/Planet.d.ts +26 -24
  173. package/types/scene/RenderNode.d.ts +2 -0
  174. package/types/scene/SkyBox.d.ts +0 -1
  175. package/types/segment/Segment.d.ts +3 -2
  176. package/types/segment/SegmentLonLat.d.ts +0 -1
  177. package/types/utils/GeoImageCreator.d.ts +1 -1
  178. package/types/utils/NormalMapCreator.d.ts +1 -1
  179. package/types/utils/VectorTileCreator.d.ts +2 -2
  180. package/types/utils/shared.d.ts +2 -0
  181. package/types/webgl/Handler.d.ts +6 -4
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/Billboard
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { BaseBillboard } from "./BaseBillboard.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/BillboardHandler
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import * as shaders from "../shaders/billboard.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/Entity
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Extent } from "../Extent.js";
@@ -90,14 +86,14 @@ class Entity {
90
86
  * @protected
91
87
  * @type {LonLat}
92
88
  */
93
- this._lonlat = utils.createLonLat(options.lonlat);
89
+ this._lonLat = utils.createLonLat(options.lonlat);
94
90
 
95
91
  /**
96
92
  * World Mercator entity coordinates.
97
93
  * @protected
98
94
  * @type {LonLat}
99
95
  */
100
- this._lonlatMerc = null;
96
+ this._lonLatMerc = null;
101
97
 
102
98
  /**
103
99
  * Entity visible terrain altitude.
@@ -227,6 +223,10 @@ class Entity {
227
223
  this._counter = n;
228
224
  }
229
225
 
226
+ get layerIndex() {
227
+ return this._layerIndex;
228
+ }
229
+
230
230
  get instanceName() {
231
231
  return "Entity";
232
232
  }
@@ -343,12 +343,12 @@ class Entity {
343
343
  let ec = this._entityCollection;
344
344
 
345
345
  if (ec && ec.renderNode && ec.renderNode.ellipsoid) {
346
- this._lonlat = ec.renderNode.ellipsoid.cartesianToLonLat(p);
346
+ this._lonLat = ec.renderNode.ellipsoid.cartesianToLonLat(p);
347
347
 
348
- if (Math.abs(this._lonlat.lat) < mercator.MAX_LAT) {
349
- this._lonlatMerc = this._lonlat.forwardMercator();
348
+ if (Math.abs(this._lonLat.lat) < mercator.MAX_LAT) {
349
+ this._lonLatMerc = this._lonLat.forwardMercator();
350
350
  } else {
351
- this._lonlatMerc = null;
351
+ this._lonLatMerc = null;
352
352
  }
353
353
  }
354
354
 
@@ -384,12 +384,12 @@ class Entity {
384
384
  let ec = this._entityCollection;
385
385
 
386
386
  if (!skipLonLat && ec && ec.renderNode && ec.renderNode.ellipsoid) {
387
- this._lonlat = ec.renderNode.ellipsoid.cartesianToLonLat(p);
387
+ this._lonLat = ec.renderNode.ellipsoid.cartesianToLonLat(p);
388
388
 
389
- if (Math.abs(this._lonlat.lat) < mercator.MAX_LAT) {
390
- this._lonlatMerc = this._lonlat.forwardMercator();
389
+ if (Math.abs(this._lonLat.lat) < mercator.MAX_LAT) {
390
+ this._lonLatMerc = this._lonLat.forwardMercator();
391
391
  } else {
392
- this._lonlatMerc = null;
392
+ this._lonLatMerc = null;
393
393
  }
394
394
  }
395
395
  }
@@ -400,7 +400,7 @@ class Entity {
400
400
  * @returns {LonLat} -
401
401
  */
402
402
  getLonLat() {
403
- return this._lonlat.clone();
403
+ return this._lonLat.clone();
404
404
  }
405
405
 
406
406
  /**
@@ -409,7 +409,7 @@ class Entity {
409
409
  * @param {LonLat} lonlat - WGS84 coordinates.
410
410
  */
411
411
  setLonLat(lonlat) {
412
- let l = this._lonlat;
412
+ let l = this._lonLat;
413
413
 
414
414
  l.lon = lonlat.lon;
415
415
  l.lat = lonlat.lat;
@@ -418,9 +418,9 @@ class Entity {
418
418
  let ec = this._entityCollection;
419
419
  if (ec && ec.renderNode && ec.renderNode.ellipsoid) {
420
420
  if (Math.abs(l.lat) < mercator.MAX_LAT) {
421
- this._lonlatMerc = l.forwardMercator();
421
+ this._lonLatMerc = l.forwardMercator();
422
422
  } else {
423
- this._lonlatMerc = null;
423
+ this._lonLatMerc = null;
424
424
  }
425
425
 
426
426
  ec.renderNode.ellipsoid.lonLatToCartesianRes(l, this._cartesian);
@@ -436,7 +436,7 @@ class Entity {
436
436
  * @param {number} [height] - Height
437
437
  */
438
438
  setLonLat2(lon, lat, height) {
439
- let l = this._lonlat;
439
+ let l = this._lonLat;
440
440
 
441
441
  l.lon = lon;
442
442
  l.lat = lat;
@@ -445,9 +445,9 @@ class Entity {
445
445
  let ec = this._entityCollection;
446
446
  if (ec && ec.renderNode && ec.renderNode.ellipsoid) {
447
447
  if (Math.abs(l.lat) < mercator.MAX_LAT) {
448
- this._lonlatMerc = l.forwardMercator();
448
+ this._lonLatMerc = l.forwardMercator();
449
449
  } else {
450
- this._lonlatMerc = null;
450
+ this._lonLatMerc = null;
451
451
  }
452
452
 
453
453
  ec.renderNode.ellipsoid.lonLatToCartesianRes(l, this._cartesian);
@@ -683,7 +683,7 @@ class Entity {
683
683
  */
684
684
  getExtent() {
685
685
  let res;
686
- let c = this._lonlat;
686
+ let c = this._lonLat;
687
687
  if (this.billboard || this.label) {
688
688
  res = new Extent(new LonLat(c.lon, c.lat), new LonLat(c.lon, c.lat));
689
689
  } else {
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/EntityCollection
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Events } from "../Events.js";
@@ -213,10 +209,6 @@ class EntityCollection {
213
209
  this._counter = n;
214
210
  }
215
211
 
216
- // setPolygonOffset(factor, units) {
217
- // this.polygonOffsetUnits = units;
218
- // }
219
-
220
212
  /**
221
213
  * Sets collection visibility.
222
214
  * @public
@@ -334,7 +326,7 @@ class EntityCollection {
334
326
  if (rn) {
335
327
  rn.renderer && rn.renderer.assignPickingColor(entity);
336
328
  if (rn.ellipsoid && entity._cartesian.isZero()) {
337
- entity.setCartesian3v(rn.ellipsoid.lonLatToCartesian(entity._lonlat));
329
+ entity.setCartesian3v(rn.ellipsoid.lonLatToCartesian(entity._lonLat));
338
330
  }
339
331
  }
340
332
  this._addRecursively(entity);
@@ -472,10 +464,12 @@ class EntityCollection {
472
464
  addTo(renderNode, isHidden) {
473
465
  if (!this.renderNode) {
474
466
  this.renderNode = renderNode;
467
+
475
468
  if (!isHidden) {
476
469
  this._renderNodeIndex = renderNode.entityCollections.length;
477
470
  renderNode.entityCollections.push(this);
478
471
  }
472
+
479
473
  renderNode.ellipsoid && this._updateGeodeticCoordinates(renderNode.ellipsoid);
480
474
 
481
475
  this.bindRenderNode(renderNode);
@@ -490,10 +484,12 @@ class EntityCollection {
490
484
  * @param {RenderNode} renderNode
491
485
  */
492
486
  bindRenderNode(renderNode) {
493
- if (renderNode.renderer) {
487
+ if (renderNode.renderer && renderNode.renderer.isInitialized()) {
488
+
494
489
  this.billboardHandler.setRenderer(renderNode.renderer);
495
490
  this.labelHandler.setRenderer(renderNode.renderer);
496
491
  this.rayHandler.setRenderer(renderNode.renderer);
492
+
497
493
  this.geoObjectHandler.setRenderNode(renderNode);
498
494
  this.polylineHandler.setRenderNode(renderNode);
499
495
  this.pointCloudHandler.setRenderNode(renderNode);
@@ -515,7 +511,7 @@ class EntityCollection {
515
511
  var i = e.length;
516
512
  while (i--) {
517
513
  var ei = e[i];
518
- ei._lonlat && ei.setCartesian3v(ellipsoid.lonLatToCartesian(ei._lonlat));
514
+ ei._lonLat && ei.setCartesian3v(ellipsoid.lonLatToCartesian(ei._lonLat));
519
515
  }
520
516
  }
521
517
 
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/GeoObject
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Quat, Vec3 } from "../math/index.js";
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- /**
4
- * @module og/entity/GeoObjectHandler
5
- */
6
-
7
3
  import * as shaders from "../shaders/geoObject.js";
8
4
  import { concatArrays, loadImage, makeArrayTyped, spliceArray } from "../utils/shared.js";
9
5
 
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/Geometry
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Extent } from "../Extent.js";
@@ -192,6 +188,11 @@ class Geometry {
192
188
  return res;
193
189
  }
194
190
 
191
+ /**
192
+ * @todo ASAP need test for this method
193
+ * @param geoJson
194
+ * @returns {Geometry}
195
+ */
195
196
  setGeometry(geoJson) {
196
197
  var h = this._handler;
197
198
  this.remove();
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/GeometryHandler
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { doubleToTwoFloatsV2 } from "../math/coder.js";
@@ -527,6 +523,9 @@ class GeometryHandler {
527
523
  assignHandler(handler) {
528
524
  this._handler = handler;
529
525
  this.refresh();
526
+ if (handler.isInitialized()) {
527
+ this.update();
528
+ }
530
529
  }
531
530
 
532
531
  /**
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/Label
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Vec4 } from "../math/Vec4.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/LabelHandler
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import * as shaders from "../shaders/label.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/PointCloud
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Vec3 } from "../math/Vec3.js";
@@ -1,126 +1,122 @@
1
- /**
2
- * @module og/entity/PointCloudHandler
3
- */
4
-
5
- "use strict";
6
-
7
- import * as shaders from "../shaders/pointCloud.js";
8
-
9
- class PointCloudHandler {
10
- constructor(entityCollection) {
11
- /**
12
- * Picking rendering option.
13
- * @public
14
- * @type {boolean}
15
- */
16
- this.pickingEnabled = true;
17
-
18
- /**
19
- * Parent collection
20
- * @private
21
- * @type {EntityCollection}
22
- */
23
- this._entityCollection = entityCollection;
24
-
25
- /**
26
- * Renderer
27
- * @private
28
- * @type {Renderer}
29
- */
30
- this._renderer = null;
31
-
32
- /**
33
- * Point cloud array
34
- * @private
35
- * @type {Array.<PointCloud>}
36
- */
37
- this._pointClouds = [];
38
-
39
- this.__staticId = PointCloudHandler._staticCounter++;
40
- }
41
-
42
- static get _staticCounter() {
43
- if (!this._counter && this._counter !== 0) {
44
- this._counter = 0;
45
- }
46
- return this._counter;
47
- }
48
-
49
- static set _staticCounter(n) {
50
- this._counter = n;
51
- }
52
-
53
- _initProgram() {
54
- if (this._renderer.handler) {
55
- if (!this._renderer.handler.programs.pointCloud) {
56
- this._renderer.handler.addProgram(shaders.pointCloud());
57
- }
58
- }
59
- }
60
-
61
- setRenderNode(renderNode) {
62
- this._renderer = renderNode.renderer;
63
- this._initProgram();
64
- for (var i = 0; i < this._pointClouds.length; i++) {
65
- this._pointClouds[i].setRenderNode(renderNode);
66
- }
67
- }
68
-
69
- add(pointCloud) {
70
- if (pointCloud._handlerIndex === -1) {
71
- pointCloud._handler = this;
72
- pointCloud._handlerIndex = this._pointClouds.length;
73
- this._pointClouds.push(pointCloud);
74
- this._entityCollection &&
75
- this._entityCollection.renderNode &&
76
- pointCloud.setRenderNode(this._entityCollection.renderNode);
77
- }
78
- }
79
-
80
- remove(pointCloud) {
81
- var index = pointCloud._handlerIndex;
82
- if (index !== -1) {
83
- pointCloud._deleteBuffers();
84
- pointCloud._handlerIndex = -1;
85
- pointCloud._handler = null;
86
- this._pointClouds.splice(index, 1);
87
- this.reindexPointCloudArray(index);
88
- }
89
- }
90
-
91
- reindexPointCloudArray(startIndex) {
92
- var pc = this._pointClouds;
93
- for (var i = startIndex; i < pc.length; i++) {
94
- pc[i]._handlerIndex = i;
95
- }
96
- }
97
-
98
- draw() {
99
- var i = this._pointClouds.length;
100
- while (i--) {
101
- this._pointClouds[i].draw();
102
- }
103
- }
104
-
105
- drawPicking() {
106
- if (this.pickingEnabled) {
107
- var i = this._pointClouds.length;
108
- while (i--) {
109
- this._pointClouds[i].drawPicking();
110
- }
111
- }
112
- }
113
-
114
- clear() {
115
- var i = this._pointClouds.length;
116
- while (i--) {
117
- this._pointClouds[i]._deleteBuffers();
118
- this._pointClouds[i]._handler = null;
119
- this._pointClouds[i]._handlerIndex = -1;
120
- }
121
- this._pointClouds.length = 0;
122
- this._pointClouds = [];
123
- }
124
- }
125
-
126
- export { PointCloudHandler };
1
+ "use strict";
2
+
3
+ import * as shaders from "../shaders/pointCloud.js";
4
+
5
+ class PointCloudHandler {
6
+ constructor(entityCollection) {
7
+ /**
8
+ * Picking rendering option.
9
+ * @public
10
+ * @type {boolean}
11
+ */
12
+ this.pickingEnabled = true;
13
+
14
+ /**
15
+ * Parent collection
16
+ * @private
17
+ * @type {EntityCollection}
18
+ */
19
+ this._entityCollection = entityCollection;
20
+
21
+ /**
22
+ * Renderer
23
+ * @private
24
+ * @type {Renderer}
25
+ */
26
+ this._renderer = null;
27
+
28
+ /**
29
+ * Point cloud array
30
+ * @private
31
+ * @type {Array.<PointCloud>}
32
+ */
33
+ this._pointClouds = [];
34
+
35
+ this.__staticId = PointCloudHandler._staticCounter++;
36
+ }
37
+
38
+ static get _staticCounter() {
39
+ if (!this._counter && this._counter !== 0) {
40
+ this._counter = 0;
41
+ }
42
+ return this._counter;
43
+ }
44
+
45
+ static set _staticCounter(n) {
46
+ this._counter = n;
47
+ }
48
+
49
+ _initProgram() {
50
+ if (this._renderer.handler) {
51
+ if (!this._renderer.handler.programs.pointCloud) {
52
+ this._renderer.handler.addProgram(shaders.pointCloud());
53
+ }
54
+ }
55
+ }
56
+
57
+ setRenderNode(renderNode) {
58
+ this._renderer = renderNode.renderer;
59
+ this._initProgram();
60
+ for (var i = 0; i < this._pointClouds.length; i++) {
61
+ this._pointClouds[i].setRenderNode(renderNode);
62
+ }
63
+ }
64
+
65
+ add(pointCloud) {
66
+ if (pointCloud._handlerIndex === -1) {
67
+ pointCloud._handler = this;
68
+ pointCloud._handlerIndex = this._pointClouds.length;
69
+ this._pointClouds.push(pointCloud);
70
+ this._entityCollection &&
71
+ this._entityCollection.renderNode &&
72
+ pointCloud.setRenderNode(this._entityCollection.renderNode);
73
+ }
74
+ }
75
+
76
+ remove(pointCloud) {
77
+ var index = pointCloud._handlerIndex;
78
+ if (index !== -1) {
79
+ pointCloud._deleteBuffers();
80
+ pointCloud._handlerIndex = -1;
81
+ pointCloud._handler = null;
82
+ this._pointClouds.splice(index, 1);
83
+ this.reindexPointCloudArray(index);
84
+ }
85
+ }
86
+
87
+ reindexPointCloudArray(startIndex) {
88
+ var pc = this._pointClouds;
89
+ for (var i = startIndex; i < pc.length; i++) {
90
+ pc[i]._handlerIndex = i;
91
+ }
92
+ }
93
+
94
+ draw() {
95
+ var i = this._pointClouds.length;
96
+ while (i--) {
97
+ this._pointClouds[i].draw();
98
+ }
99
+ }
100
+
101
+ drawPicking() {
102
+ if (this.pickingEnabled) {
103
+ var i = this._pointClouds.length;
104
+ while (i--) {
105
+ this._pointClouds[i].drawPicking();
106
+ }
107
+ }
108
+ }
109
+
110
+ clear() {
111
+ var i = this._pointClouds.length;
112
+ while (i--) {
113
+ this._pointClouds[i]._deleteBuffers();
114
+ this._pointClouds[i]._handler = null;
115
+ this._pointClouds[i]._handlerIndex = -1;
116
+ }
117
+ this._pointClouds.length = 0;
118
+ this._pointClouds = [];
119
+ }
120
+ }
121
+
122
+ export { PointCloudHandler };
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/entity/Polyline
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Extent } from "../Extent.js";
@@ -96,7 +92,7 @@ class Polyline {
96
92
  this._pathLengths = [];
97
93
 
98
94
  /**
99
- * Polyline geodetic degrees coordiantes.
95
+ * Polyline geodetic degrees coordinates.
100
96
  * @private
101
97
  * @type {Array.<LonLat>}
102
98
  */
@@ -1763,7 +1759,9 @@ class Polyline {
1763
1759
  this._createData3v([].concat(this._path3v));
1764
1760
  }
1765
1761
  this._refresh();
1766
- this._update();
1762
+ if (renderNode.renderer.isInitialized()) {
1763
+ this._update();
1764
+ }
1767
1765
  }
1768
1766
  }
1769
1767