@openglobus/og 0.13.4 → 0.13.7

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 (55) hide show
  1. package/css/og.css +66 -25
  2. package/dist/@openglobus/og.css +1 -1
  3. package/dist/@openglobus/og.esm.js +2 -2
  4. package/dist/@openglobus/og.esm.js.map +1 -1
  5. package/dist/@openglobus/og.umd.js +2 -2
  6. package/dist/@openglobus/og.umd.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/og/Events.js +188 -188
  9. package/src/og/Extent.js +1 -9
  10. package/src/og/Globe.js +1 -0
  11. package/src/og/control/DebugInfo.js +15 -4
  12. package/src/og/control/EarthCoordinates.js +151 -160
  13. package/src/og/control/KeyboardNavigation.js +48 -2
  14. package/src/og/control/TouchNavigation.js +13 -13
  15. package/src/og/control/ZoomControl.js +1 -1
  16. package/src/og/ellipsoid/Ellipsoid.js +1 -1
  17. package/src/og/entity/Billboard.js +165 -165
  18. package/src/og/entity/BillboardHandler.js +1 -1
  19. package/src/og/entity/Geometry.js +319 -319
  20. package/src/og/entity/Label.js +348 -346
  21. package/src/og/entity/LabelHandler.js +44 -37
  22. package/src/og/input/input.js +7 -1
  23. package/src/og/layer/CanvasTiles.js +8 -8
  24. package/src/og/layer/KML.js +181 -12
  25. package/src/og/layer/Layer.js +4 -2
  26. package/src/og/layer/XYZ.js +4 -2
  27. package/src/og/quadTree/Node.js +1 -0
  28. package/src/og/renderer/RendererEvents.js +17 -3
  29. package/src/og/scene/Planet.js +89 -30
  30. package/src/og/segment/Segment.js +1 -0
  31. package/src/og/shaders/label.js +56 -13
  32. package/src/og/terrain/EmptyTerrain.js +164 -146
  33. package/src/og/terrain/Geoid.js +246 -241
  34. package/src/og/terrain/GlobusTerrain.js +23 -24
  35. package/src/og/terrain/MapboxTerrain.js +292 -294
  36. package/src/og/utils/FontAtlas.js +25 -15
  37. package/src/og/utils/Loader.js +53 -12
  38. package/src/og/utils/PlainSegmentWorker.js +38 -26
  39. package/src/og/utils/TextureAtlas.js +291 -280
  40. package/src/og/utils/units.js +78 -0
  41. package/types/control/EarthCoordinates.d.ts +27 -30
  42. package/types/control/KeyboardNavigation.d.ts +3 -0
  43. package/types/entity/Label.d.ts +1 -0
  44. package/types/entity/LabelHandler.d.ts +1 -1
  45. package/types/input/input.d.ts +6 -0
  46. package/types/layer/KML.d.ts +26 -1
  47. package/types/renderer/RendererEvents.d.ts +2 -0
  48. package/types/scene/Planet.d.ts +10 -1
  49. package/types/terrain/EmptyTerrain.d.ts +4 -1
  50. package/types/terrain/Geoid.d.ts +1 -10
  51. package/types/terrain/GlobusTerrain.d.ts +0 -2
  52. package/types/terrain/MapboxTerrain.d.ts +1 -1
  53. package/types/utils/Loader.d.ts +3 -0
  54. package/types/utils/TextureAtlas.d.ts +2 -0
  55. package/types/utils/units.d.ts +20 -0
@@ -88,7 +88,13 @@ const EVENT_NAMES = [
88
88
  * Triggered when all data is loaded
89
89
  * @event og.scene.Planet#rendercompleted
90
90
  */
91
- "rendercompleted"
91
+ "rendercompleted",
92
+
93
+ /**
94
+ * Triggered when all data is loaded
95
+ * @event og.scene.Planet#terraincompleted
96
+ */
97
+ "terraincompleted"
92
98
  ];
93
99
 
94
100
  /**
@@ -428,6 +434,10 @@ export class Planet extends RenderNode {
428
434
  this.always = [];
429
435
 
430
436
  this._renderCompleted = false;
437
+ this._renderCompletedActivated = false;
438
+
439
+ this._terrainCompleted = false;
440
+ this._terrainCompletedActivated = false;
431
441
  }
432
442
 
433
443
  static getBearingNorthRotationQuat(cartesian) {
@@ -454,6 +464,7 @@ export class Planet extends RenderNode {
454
464
  this._minLodSize = minLodSize || this._minLodSize;
455
465
  this._curLodSize = currentLodSize || this._curLodSize;
456
466
  this._renderCompletedActivated = false;
467
+ this._terrainCompletedActivated = false;
457
468
  }
458
469
 
459
470
  /**
@@ -571,6 +582,7 @@ export class Planet extends RenderNode {
571
582
  */
572
583
  setHeightFactor(factor) {
573
584
  this._renderCompletedActivated = false;
585
+ this._terrainCompletedActivated = false;
574
586
 
575
587
  if (this._heightFactor !== factor) {
576
588
  this._heightFactor = factor;
@@ -593,6 +605,7 @@ export class Planet extends RenderNode {
593
605
  */
594
606
  setTerrain(terrain) {
595
607
  this._renderCompletedActivated = false;
608
+ this._terrainCompletedActivated = false;
596
609
 
597
610
  if (this._initialized) {
598
611
  this.memClear();
@@ -613,21 +626,36 @@ export class Planet extends RenderNode {
613
626
  this._quadTree.destroyBranches();
614
627
  }
615
628
 
616
- if (terrain._geoid) {
617
- if (!terrain._geoid.model) {
618
- terrain._geoid.model = null;
619
- Geoid.loadModel(terrain._geoid.src)
620
- .then((m) => {
621
- terrain.getGeoid().setModel(m);
622
- this._plainSegmentWorker.setGeoid(terrain.getGeoid());
623
- })
624
- .catch((err) => {
625
- console.log(err);
626
- });
627
- } else {
628
- this._plainSegmentWorker.setGeoid(terrain.getGeoid());
629
- }
629
+ //if (terrain._geoid) {
630
+
631
+ if (terrain._geoid.model) {
632
+ this._plainSegmentWorker.setGeoid(terrain.getGeoid());
633
+ terrain._isReady = true;
634
+ } else {
635
+ Geoid.loadModel(terrain._geoid.src)
636
+ .then((m) => {
637
+ terrain.getGeoid().setModel(m);
638
+ this._plainSegmentWorker.setGeoid(terrain.getGeoid());
639
+ terrain._isReady = true;
640
+ })
641
+ .catch((err) => {
642
+ console.log(err);
643
+ });
630
644
  }
645
+
646
+ // if (!terrain._geoid.model) {
647
+ // Geoid.loadModel(terrain._geoid.src)
648
+ // .then((m) => {
649
+ // terrain.getGeoid().setModel(m);
650
+ // this._plainSegmentWorker.setGeoid(terrain.getGeoid());
651
+ // })
652
+ // .catch((err) => {
653
+ // console.log(err);
654
+ // });
655
+ // } else {
656
+ // this._plainSegmentWorker.setGeoid(terrain.getGeoid());
657
+ // }
658
+ //}
631
659
  }
632
660
 
633
661
  /**
@@ -677,10 +705,10 @@ export class Planet extends RenderNode {
677
705
  !this._indexesCache[i][j] && (this._indexesCache[i][j] = new Array(TABLESIZE));
678
706
  for (var k = 0; k <= TABLESIZE; k++) {
679
707
  !this._indexesCache[i][j][k] &&
680
- (this._indexesCache[i][j][k] = new Array(TABLESIZE));
708
+ (this._indexesCache[i][j][k] = new Array(TABLESIZE));
681
709
  for (var m = 0; m <= TABLESIZE; m++) {
682
710
  !this._indexesCache[i][j][k][m] &&
683
- (this._indexesCache[i][j][k][m] = new Array(TABLESIZE));
711
+ (this._indexesCache[i][j][k][m] = new Array(TABLESIZE));
684
712
  for (var q = 0; q <= TABLESIZE; q++) {
685
713
  let ptr = {
686
714
  buffer: null
@@ -708,6 +736,7 @@ export class Planet extends RenderNode {
708
736
 
709
737
  this.renderer.events.on("resize", () => {
710
738
  this._renderCompletedActivated = false;
739
+ this._terrainCompletedActivated = false;
711
740
  });
712
741
 
713
742
  // Initialize texture coordinates buffer pool
@@ -917,15 +946,7 @@ export class Planet extends RenderNode {
917
946
  }
918
947
  }
919
948
 
920
- if (this.renderer) {
921
- if (html.length) {
922
- this.renderer.div.attributions.style.display = "block";
923
- this.renderer.div.attributions.innerHTML = "<ul>" + html + "</ul>";
924
- } else {
925
- this.renderer.div.attributions.style.display = "none";
926
- this.renderer.div.attributions.innerHTML = "";
927
- }
928
- }
949
+ this._applyAttribution(html)
929
950
  }
930
951
 
931
952
  /**
@@ -971,17 +992,28 @@ export class Planet extends RenderNode {
971
992
  }
972
993
  }
973
994
 
995
+ this._applyAttribution(html);
996
+
997
+ this._sortLayers();
998
+ }
999
+
1000
+ /**
1001
+ * Apply to render list of layer attributions
1002
+ * @private
1003
+ */
1004
+ _applyAttribution(html) {
974
1005
  if (this.renderer) {
975
1006
  if (html.length) {
976
- this.renderer.div.attributions.style.display = "block";
977
- this.renderer.div.attributions.innerHTML = "<ul>" + html + "</ul>";
1007
+ html = "<ul>" + html + "</ul>";
1008
+ if (this.renderer.div.attributions.innerHTML !== html) {
1009
+ this.renderer.div.attributions.style.display = "block";
1010
+ this.renderer.div.attributions.innerHTML = html;
1011
+ }
978
1012
  } else {
979
1013
  this.renderer.div.attributions.style.display = "none";
980
1014
  this.renderer.div.attributions.innerHTML = "";
981
1015
  }
982
1016
  }
983
-
984
- this._sortLayers();
985
1017
  }
986
1018
 
987
1019
  /**
@@ -1138,6 +1170,17 @@ export class Planet extends RenderNode {
1138
1170
  this._renderCompletedActivated = false;
1139
1171
  }
1140
1172
  this._renderCompleted = true;
1173
+
1174
+ if (this._terrainCompleted) {
1175
+ if (!this._terrainCompletedActivated) {
1176
+ this._terrainCompletedActivated = true;
1177
+ this.events.dispatch(this.events.terraincompleted, true);
1178
+ }
1179
+ } else {
1180
+ this._terrainCompletedActivated = false;
1181
+ }
1182
+
1183
+ this._terrainCompleted = true;
1141
1184
  }
1142
1185
 
1143
1186
  /**
@@ -1789,4 +1832,20 @@ export class Planet extends RenderNode {
1789
1832
  }
1790
1833
  }
1791
1834
  }
1835
+
1836
+ async getHeightDefault(lonLat) {
1837
+ return new Promise((resolve, reject) => {
1838
+ this.terrain.getHeightAsync(lonLat.clone(), (alt) => {
1839
+ resolve(alt);
1840
+ });
1841
+ });
1842
+ }
1843
+
1844
+ async getHeightAboveELL(lonLat) {
1845
+ return new Promise((resolve, reject) => {
1846
+ this.terrain.getHeightAsync(lonLat.clone(), (alt) => {
1847
+ resolve(alt + this.terrain.geoid.getHeightLonLat(lonLat));
1848
+ });
1849
+ });
1850
+ }
1792
1851
  }
@@ -1488,6 +1488,7 @@ class Segment {
1488
1488
 
1489
1489
  if (!m.isReady) {
1490
1490
  this.planet._renderCompleted = false;
1491
+ this.planet._terrainReady = false;
1491
1492
  }
1492
1493
 
1493
1494
  slice.append(li, m);
@@ -6,6 +6,10 @@
6
6
 
7
7
  import { Program } from '../webgl/Program.js';
8
8
 
9
+ const DEFINE = `
10
+ #define EMPTY -1.0
11
+ #define RTL 1.0`;
12
+
9
13
  const PROJECT = `vec2 project(vec4 p) {
10
14
  return (0.5 * p.xyz / p.w + 0.5).xy * viewport;
11
15
  }`;
@@ -47,7 +51,9 @@ export function label_webgl2() {
47
51
  },
48
52
  vertexShader:
49
53
  `#version 300 es
50
-
54
+
55
+ ${DEFINE}
56
+
51
57
  in float a_outline;
52
58
  in vec4 a_gliphParam;
53
59
  in vec2 a_vertices;
@@ -77,14 +83,14 @@ export function label_webgl2() {
77
83
  uniform float depthOffset;
78
84
 
79
85
  const vec3 ZERO3 = vec3(0.0);
80
-
86
+
81
87
  ${PROJECT}
82
88
 
83
89
  ${ROTATE2D}
84
90
 
85
91
  void main() {
86
92
 
87
- if(a_texCoord.z == -1.0) {
93
+ if(a_texCoord.w == EMPTY) {
88
94
  gl_Position = vec4(0.0);
89
95
  return;
90
96
  }
@@ -95,7 +101,7 @@ export function label_webgl2() {
95
101
  v_outline = a_outline;
96
102
 
97
103
  v_fontIndex = int(a_fontIndex);
98
- v_uv = vec2(a_texCoord.xy);
104
+ v_uv = a_texCoord.xy;
99
105
  vec3 look = a_positions - cameraPos;
100
106
  float lookDist = length(look);
101
107
  v_rgba = a_rgba;
@@ -127,8 +133,18 @@ export function label_webgl2() {
127
133
  projPos.z += depthOffset + a_offset.z;
128
134
 
129
135
  vec2 screenPos = project(projPos);
130
-
131
- vec2 v = screenPos + rotate2d(a_rotation) * ((a_vertices * a_gliphParam.xy + a_gliphParam.zw + vec2(a_texCoord.z, 0.0) + vec2(a_texCoord.w, 0.0)) * a_size * scd + a_offset.xy);
136
+
137
+ vec2 vert = a_vertices;
138
+ vec4 gp = a_gliphParam;
139
+ if(a_texCoord.w == RTL){
140
+ vert.x = step(vert.x * 0.5 + 1.0, 1.0);
141
+ gp.x = -a_gliphParam.x;
142
+ gp.z = -(a_gliphParam.z + a_texCoord.z);
143
+ }else{
144
+ gp.z = a_gliphParam.z + a_texCoord.z;
145
+ }
146
+
147
+ vec2 v = screenPos + rotate2d(a_rotation) * ((vert * gp.xy + gp.zw) * a_size * scd + a_offset.xy);
132
148
 
133
149
  gl_Position = vec4((2.0 * v / viewport - 1.0) * projPos.w, projPos.z, projPos.w);
134
150
  }`,
@@ -270,7 +286,9 @@ export function label_screen() {
270
286
  a_fontIndex: "float"
271
287
  },
272
288
  vertexShader:
273
- `
289
+ `
290
+ ${DEFINE}
291
+
274
292
  attribute float a_outline;
275
293
  attribute vec4 a_gliphParam;
276
294
  attribute vec2 a_vertices;
@@ -306,7 +324,7 @@ export function label_screen() {
306
324
 
307
325
  void main() {
308
326
 
309
- if(a_texCoord.z == -1.0) {
327
+ if(a_texCoord.w == EMPTY) {
310
328
  gl_Position = vec4(0.0);
311
329
  return;
312
330
  }
@@ -349,9 +367,19 @@ export function label_screen() {
349
367
  projPos.z += depthOffset + a_offset.z;
350
368
 
351
369
  vec2 screenPos = project(projPos);
352
-
353
- vec2 v = screenPos + rotate2d(a_rotation) * ((a_vertices * a_gliphParam.xy + a_gliphParam.zw + vec2(a_texCoord.z, 0.0) + vec2(a_texCoord.w, 0.0)) * a_size * scd + a_offset.xy);
354
-
370
+
371
+ vec2 vert = a_vertices;
372
+ vec4 gp = a_gliphParam;
373
+ if(a_texCoord.w == RTL){
374
+ vert.x = step(vert.x * 0.5 + 1.0, 1.0);
375
+ gp.x = -a_gliphParam.x;
376
+ gp.z = -(a_gliphParam.z + a_texCoord.z);
377
+ }else{
378
+ gp.z = a_gliphParam.z + a_texCoord.z;
379
+ }
380
+
381
+ vec2 v = screenPos + rotate2d(a_rotation) * ((vert * gp.xy + gp.zw) * a_size * scd + a_offset.xy);
382
+
355
383
  gl_Position = vec4((2.0 * v / viewport - 1.0) * projPos.w, projPos.z, projPos.w);
356
384
  }`,
357
385
  fragmentShader:
@@ -487,6 +515,9 @@ export function labelPicking() {
487
515
  },
488
516
  vertexShader:
489
517
  `
518
+
519
+ ${DEFINE}
520
+
490
521
  attribute vec4 a_gliphParam;
491
522
  attribute vec2 a_vertices;
492
523
  attribute vec4 a_texCoord;
@@ -519,7 +550,7 @@ export function labelPicking() {
519
550
  vec3 a_positions = a_positionsHigh + a_positionsLow;
520
551
  vec3 cameraPos = eyePositionHigh + eyePositionLow;
521
552
 
522
- if(a_texCoord.z == -1.0){
553
+ if(a_texCoord.w == EMPTY) {
523
554
  gl_Position = vec4(0.0);
524
555
  return;
525
556
  }
@@ -554,7 +585,19 @@ export function labelPicking() {
554
585
  projPos.z += depthOffset + a_offset.z;
555
586
 
556
587
  vec2 screenPos = project(projPos);
557
- vec2 v = screenPos + rotate2d(a_rotation) * ((a_vertices * a_gliphParam.xy + a_gliphParam.zw + vec2(a_texCoord.z, 0.0) + vec2(a_texCoord.w, 0.0)) * a_size * scd + a_offset.xy);
588
+
589
+ vec2 vert = a_vertices;
590
+ vec4 gp = a_gliphParam;
591
+ if(a_texCoord.w == RTL){
592
+ vert.x = step(vert.x * 0.5 + 1.0, 1.0);
593
+ gp.x = -a_gliphParam.x;
594
+ gp.z = -(a_gliphParam.z + a_texCoord.z);
595
+ }else{
596
+ gp.z = a_gliphParam.z + a_texCoord.z;
597
+ }
598
+
599
+ vec2 v = screenPos + rotate2d(a_rotation) * ((vert * gp.xy + gp.zw) * a_size * scd + a_offset.xy);
600
+
558
601
  gl_Position = vec4((2.0 * v / viewport - 1.0) * projPos.w, projPos.z, projPos.w);
559
602
  }`,
560
603
  fragmentShader:
@@ -1,148 +1,166 @@
1
- /**
2
- * @module og/terrainProvider/EmptyTerrain
3
- */
4
-
5
- "use strict";
6
-
7
- import { binarySearchFast } from "../utils/shared.js";
8
-
9
- /**
10
- * Class represents terrain provider without elevation data.
11
- * @class
12
- */
13
- class EmptyTerrain {
14
- constructor(options = {}) {
15
- this.equalizeVertices = false;
16
-
1
+ /**
2
+ * @module og/terrainProvider/EmptyTerrain
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { binarySearchFast } from "../utils/shared.js";
8
+ import { Geoid } from "./Geoid.js";
9
+
10
+ /**
11
+ * Class represents terrain provider without elevation data.
12
+ * @class
13
+ */
14
+ class EmptyTerrain {
15
+ constructor(options = {}) {
16
+ this.equalizeVertices = false;
17
+
17
18
  this.equalizeNormals = false;
18
19
 
19
- this.isEmpty = true;
20
-
21
- /**
22
- * Provider name is "empty"
23
- * @public
24
- * @type {string}
25
- */
26
- this.name = "empty";
27
-
28
- /**
29
- * Minimal z-index value for segment elevation data handling.
30
- * @public
31
- * @type {number}
32
- */
33
- this.minZoom = 1000000;
34
-
35
- /**
36
- * Maximal z-index value for segment elevation data handling.
37
- * @public
38
- * @type {number}
39
- */
40
- this.maxZoom = 21;
41
-
42
- /**
43
- * @public
44
- * @type {Array.<number>}
45
- */
46
- this.gridSizeByZoom = options.gridSizeByZoom || [
47
- 32, 16, 16, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
48
- ];
49
- //this.gridSizeByZoom = options.gridSizeByZoom || [32, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2];
50
-
51
- this._maxNodeZoom = this.gridSizeByZoom.length - 1;
52
-
53
- /**
54
- * Elevation grid size. Currend is 2x2 is the smallest grid size.
55
- * @public
56
- * @type {number}
57
- */
58
- this.plainGridSize = 2;
59
-
60
- /**
61
- * Planet node.
62
- * @protected
63
- * @type {Planet}
64
- */
65
- this._planet = null;
66
-
67
- this._geoid = null;
68
-
69
- // const _ellToAltFn = [
70
- // (lon, lat, alt, callback) => callback(alt),
71
- // (lon, lat, alt, callback) => callback(alt - this._geoid.getHeight(lon, lat)),
72
- // (lon, lat, alt, callback) => {
73
-
74
- // let x = mercator.getTileX(lon, zoom),
75
- // y = mercator.getTileY(lat, zoom);
76
-
77
- // let mslAlt = alt - this._geoid.getHeight(lon, lat);
78
-
79
- // if (true) {
80
-
81
- // } else {
82
-
83
- // }
84
-
85
- // return callback(mslAlt);
86
- // },
87
- // ];
88
- }
89
-
90
- static checkNoDataValue(noDataValues, value) {
91
- return binarySearchFast(noDataValues, value) !== -1;
92
- }
93
-
94
- isBlur() {
95
- return false;
96
- }
97
-
98
- set maxNodeZoom(val) {
99
- if (val > this.gridSizeByZoom.length - 1) {
100
- val = this.gridSizeByZoom.length - 1;
101
- }
102
- this._maxNodeZoom = val;
103
- }
104
-
105
- get maxNodeZoom() {
106
- return this._maxNodeZoom;
107
- }
108
-
109
- set geoid(geoid) {
110
- this._geoid = geoid;
111
- }
112
-
113
- get geoid() {
114
- return this._geoid;
115
- }
116
-
117
- /**
118
- * Loads or creates segment elevation data.
119
- * @public
120
- * @virtual
121
- * @param {Segment} segment - Segment to create elevation data.
122
- */
123
- handleSegmentTerrain(segment) {
124
- segment.terrainIsLoading = false;
125
- segment.terrainReady = true;
126
- segment.terrainExists = true;
127
- }
128
-
129
- isReady() {
130
- return (this._geoid && this._geoid.model) || !this._geoid;
131
- }
132
-
133
- /**
134
- * Abstract function
135
- * @public
136
- * @abstract
137
- */
138
- abortLoading() {}
139
-
140
- /**
141
- * Abstract function
142
- * @public
143
- * @abstract
144
- */
145
- clearCache() {}
146
- }
147
-
148
- export { EmptyTerrain };
20
+ this.isEmpty = true;
21
+
22
+ /**
23
+ * Provider name is "empty"
24
+ * @public
25
+ * @type {string}
26
+ */
27
+ this.name = "empty";
28
+
29
+ /**
30
+ * Minimal z-index value for segment elevation data handling.
31
+ * @public
32
+ * @type {number}
33
+ */
34
+ this.minZoom = 1000000;
35
+
36
+ /**
37
+ * Maximal z-index value for segment elevation data handling.
38
+ * @public
39
+ * @type {number}
40
+ */
41
+ this.maxZoom = 21;
42
+
43
+ /**
44
+ * @public
45
+ * @type {Array.<number>}
46
+ */
47
+ this.gridSizeByZoom = options.gridSizeByZoom || [
48
+ 32, 16, 16, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
49
+ ];
50
+ //this.gridSizeByZoom = options.gridSizeByZoom || [32, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2];
51
+
52
+ this._maxNodeZoom = this.gridSizeByZoom.length - 1;
53
+
54
+ /**
55
+ * Elevation grid size. Currend is 2x2 is the smallest grid size.
56
+ * @public
57
+ * @type {number}
58
+ */
59
+ this.plainGridSize = 2;
60
+
61
+ /**
62
+ * Planet node.
63
+ * @protected
64
+ * @type {Planet}
65
+ */
66
+ this._planet = null;
67
+
68
+ this._geoid =
69
+ options.geoid ||
70
+ new Geoid({
71
+ src: options.geoidSrc || null
72
+ });
73
+
74
+ this._isReady = false;
75
+
76
+ // const _ellToAltFn = [
77
+ // (lon, lat, alt, callback) => callback(alt),
78
+ // (lon, lat, alt, callback) => callback(alt - this._geoid.getHeight(lon, lat)),
79
+ // (lon, lat, alt, callback) => {
80
+
81
+ // let x = mercator.getTileX(lon, zoom),
82
+ // y = mercator.getTileY(lat, zoom);
83
+
84
+ // let mslAlt = alt - this._geoid.getHeight(lon, lat);
85
+
86
+ // if (true) {
87
+
88
+ // } else {
89
+
90
+ // }
91
+
92
+ // return callback(mslAlt);
93
+ // },
94
+ // ];
95
+ }
96
+
97
+ static checkNoDataValue(noDataValues, value) {
98
+ return binarySearchFast(noDataValues, value) !== -1;
99
+ }
100
+
101
+ isBlur() {
102
+ return false;
103
+ }
104
+
105
+ set maxNodeZoom(val) {
106
+ if (val > this.gridSizeByZoom.length - 1) {
107
+ val = this.gridSizeByZoom.length - 1;
108
+ }
109
+ this._maxNodeZoom = val;
110
+ }
111
+
112
+ get maxNodeZoom() {
113
+ return this._maxNodeZoom;
114
+ }
115
+
116
+ set geoid(geoid) {
117
+ this._geoid = geoid;
118
+ }
119
+
120
+ get geoid() {
121
+ return this._geoid;
122
+ }
123
+
124
+ getGeoid() {
125
+ return this._geoid;
126
+ }
127
+
128
+ /**
129
+ * Loads or creates segment elevation data.
130
+ * @public
131
+ * @virtual
132
+ * @param {Segment} segment - Segment to create elevation data.
133
+ */
134
+ handleSegmentTerrain(segment) {
135
+ segment.terrainIsLoading = false;
136
+ segment.terrainReady = true;
137
+ segment.terrainExists = true;
138
+ }
139
+
140
+ isReady() {
141
+ return this._isReady;
142
+ }
143
+
144
+ /**
145
+ * Abstract function
146
+ * @public
147
+ * @abstract
148
+ */
149
+ abortLoading() {
150
+ }
151
+
152
+ /**
153
+ * Abstract function
154
+ * @public
155
+ * @abstract
156
+ */
157
+ clearCache() {
158
+ }
159
+
160
+ getHeightAsync(lonLat, callback) {
161
+ callback(0);
162
+ return true;
163
+ }
164
+ }
165
+
166
+ export { EmptyTerrain };