@openglobus/og 0.13.6 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.13.6",
3
+ "version": "0.13.7",
4
4
  "description": "[OpenGlobus](http://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
5
5
  "directories": {
6
6
  "example": "./sandbox"
package/src/og/Extent.js CHANGED
@@ -350,15 +350,7 @@ export class Extent {
350
350
 
351
351
  toString() {
352
352
  return (
353
- "[" +
354
- this.southWest.lon +
355
- ", " +
356
- this.southWest.lat +
357
- ", " +
358
- this.northEast.lon +
359
- ", " +
360
- this.northEast.lat +
361
- "]"
353
+ `[${this.southWest.lon.toFixed(5)}, ${this.southWest.lat.toFixed(5)}, ${this.northEast.lon.toFixed(5)}, ${this.northEast.lat.toFixed(5)}]`
362
354
  );
363
355
  }
364
356
  }
@@ -79,13 +79,16 @@ class DebugInfo extends Control {
79
79
  label: "maxZoom/minZoom",
80
80
  frame: () => p.maxCurrZoom + " / " + p.minCurrZoom
81
81
  },
82
+ {
83
+ label: "viewExtent",
84
+ frame: () => p.getViewExtent().toString()
85
+ },
82
86
  {
83
87
  label: "height/alt (km)",
84
88
  frame: () =>
85
- `<div style="width:190px">${
86
- (p.camera._lonLat.height / 1000.0).toFixed(2) +
87
- " / " +
88
- (p.camera.getAltitude() / 1000.0).toFixed(2)
89
+ `<div style="width:190px">${(p.camera._lonLat.height / 1000.0).toFixed(2) +
90
+ " / " +
91
+ (p.camera.getAltitude() / 1000.0).toFixed(2)
89
92
  }</div>`
90
93
  },
91
94
  {
@@ -108,6 +111,14 @@ class DebugInfo extends Control {
108
111
  {
109
112
  label: "-------------------------"
110
113
  },
114
+ {
115
+ label: "_renderCompleted / renderCompletedActivated",
116
+ frame: () => `${p._renderCompleted} / ${p._renderCompletedActivated}`
117
+ },
118
+ {
119
+ label: "_terrainCompleted / terrainCompletedActivated",
120
+ frame: () => `${p._terrainCompleted} / ${p._terrainCompletedActivated}`
121
+ },
111
122
  {
112
123
  label: "PlainWorker",
113
124
  frame: () => p._plainSegmentWorker._pendingQueue.length
@@ -1,64 +1,36 @@
1
- /**
2
- * @module og/control/EarthCoordinates
3
- */
1
+ 'use strict';
4
2
 
5
- "use strict";
6
-
7
- import { Control } from "./Control.js";
8
-
9
- function dec2deg(base) {
10
- var t;
11
- var degrees = base < 0 ? Math.ceil(base) : Math.floor(base);
12
- var minutes = Math.floor((t = Math.abs(base - degrees) * 60));
13
- var seconds = Math.floor((t - minutes) * 6000);
14
- seconds = seconds / 100.0;
15
- return (
16
- numToFixedString(degrees, 3) +
17
- "\u00B0" +
18
- numToFixedString(minutes, 2) +
19
- "\u0027" +
20
- numToFixedString(seconds.toFixed(2), 2) +
21
- "\u0022"
22
- );
23
- }
3
+ import * as units from '../utils/units.js';
4
+ import { heightMode } from '../utils/units.js';
5
+ import { Control } from './Control.js';
6
+ import { throttle } from '../utils/shared.js';
7
+ import { LonLat } from '../LonLat.js';
24
8
 
25
- function numToFixedString(num, fixed) {
26
- var dl = num.toString().split(".")[0].length;
27
- var white = "&nbsp;";
28
- for (var i = dl; i < fixed; i++) {
29
- white += "&nbsp;&nbsp;";
30
- }
31
- return white + num.toString();
32
- }
9
+ const DECIMAL_TEMPLATE =
10
+ `<div class="og-lat-side"></div><div class="og-lat-val"></div>
11
+ <div class="og-lon-side"></div><div class="og-lon-val"></div>
12
+ <div class="og-height"></div>
13
+ <div class="og-units-height"></div>`;
33
14
 
34
- function toDecimal(ll) {
35
- return ll.lat.toFixed(5) + ", " + ll.lon.toFixed(5);
36
- }
15
+ const DEGREE_TEMPLATE =
16
+ `<div class="og-lat-side"></div><div class="og-lat-val"></div>
17
+ <div class="og-lon-side"></div><div class="og-lon-val"></div>
18
+ <div class="og-height"></div>
19
+ <div class="og-units-height"></div>`;
37
20
 
38
- function toDegrees(ll) {
39
- return dec2deg(ll.lat) + ", " + dec2deg(ll.lon);
40
- }
21
+ const CENTER_SVG = '<svg width="12" height="12"><g><path stroke-width="1" stroke-opacity="1" d="M6 0L6 12M0 6L12 6" stroke="#337ab7"></path></g></svg>';
41
22
 
42
- function toMercator(ll) {
43
- var m = ll.forwardMercator();
44
- return m.lat.toFixed(5) + ", " + m.lon.toFixed(5);
45
- }
46
-
47
- const DisplayTypesConverters = [toDecimal, toDegrees, toMercator];
23
+ const TYPE_HTML = [DECIMAL_TEMPLATE, DEGREE_TEMPLATE];
48
24
 
49
25
  /**
50
26
  * Control displays mouse or screen center Earth coordinates.
51
27
  * @class
52
- * @extends {Control}
28
+ * @extends {og.control.Control}
53
29
  * @param {Object} [options] - Options:
54
30
  * @param {Boolean} [options.center] - Earth coordiantes by screen center otherwise mouse pointer. False is default.
55
31
  * @param {Boolean} [options.type] - Coordinates shown: 0 - is decimal degrees, 1 - degrees, 2 - mercator geodetic coordinates.
56
32
  */
57
33
  class EarthCoordinates extends Control {
58
- /**
59
- *
60
- * @param {Object} [options] - Options:
61
- */
62
34
  constructor(options) {
63
35
  super(options);
64
36
 
@@ -69,154 +41,173 @@ class EarthCoordinates extends Control {
69
41
  * @private
70
42
  * @type {Boolean}
71
43
  */
72
- this._displayType = options.type || 0;
44
+ this._type = options.type || 0;
73
45
 
74
- /**
75
- * Current coordinates type converter.
76
- * @private
77
- * @function
78
- */
79
- this._converter = DisplayTypesConverters[0];
46
+ this._TYPE_FUNC = [this._SHOW_DECIMAL, this._SHOW_DEGREE];
80
47
 
81
- /**
82
- * Display dom element.
83
- * @private
84
- * @type {Object}
85
- */
86
- this._display = null;
48
+ this._showFn = null;
87
49
 
88
50
  /**
89
- * Screen center or mouse pointer coordinates show flag.
90
- * @private
91
- * @type {Boolean}
51
+ * Current position.
52
+ * @public
53
+ * @type {og.Vec3}
92
54
  */
55
+ this._lonLat = new LonLat();
93
56
 
94
- var pad = false;
95
- if (
96
- /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
97
- navigator.userAgent
98
- )
99
- ) {
100
- pad = true;
101
- }
57
+ this._latSideEl = null;
58
+ this._lonSideEl = null;
59
+ this._latValEl = null;
60
+ this._lonValEl = null;
61
+ this._heightEl = null;
102
62
 
103
- this._center = options.center || pad;
63
+ this._altUnitVal = options.altitudeUnit || "m";
64
+ this._heightModeVal = options.heightMode || "ell";
104
65
 
105
- this._centerDiv = null;
66
+ this._altUnit = units[this._altUnitVal];
67
+ this._heightMode = heightMode[this._heightModeVal];
106
68
 
107
- /**
108
- * Current position.
109
- * @public
110
- * @type {Vec3}
111
- */
112
- this.position = null;
69
+ this._centerMode = options.centerMode || false;
113
70
  }
114
71
 
115
- oninit() {
116
- this._display = document.createElement("div");
117
- this._display.className = "ogEarthCoordinatesControl";
118
- var that = this;
72
+ _SHOW_DECIMAL(ll) {
73
+ if (ll) {
74
+ let lat = ll.lat,
75
+ lon = ll.lon;
119
76
 
120
- function _refresh(el) {
121
- if (that._displayType >= DisplayTypesConverters.length) {
122
- that._displayType = 0;
77
+ if (lat >= 0) {
78
+ this._latSideEl.innerHTML = 'N';
79
+ } else {
80
+ this._latSideEl.innerHTML = 'S';
123
81
  }
124
82
 
125
- if (that._displayType == 0) {
126
- el.style.width = "275px";
127
- } else if (that._displayType == 1) {
128
- el.style.width = "355px";
129
- } else if (that._displayType == 2) {
130
- el.style.width = "350px";
83
+ if (lon >= 0) {
84
+ this._lonSideEl.innerHTML = 'E';
85
+ } else {
86
+ this._lonSideEl.innerHTML = 'W';
131
87
  }
132
- that._converter = DisplayTypesConverters[that._displayType];
133
- that._showPosition();
88
+
89
+ this._latValEl.innerHTML = Math.abs(lat).toFixed(5) + '°';
90
+ this._lonValEl.innerHTML = Math.abs(lon).toFixed(5) + '°';
134
91
  }
92
+ }
135
93
 
136
- this._display.onclick = function (e) {
137
- that._displayType += 1;
138
- _refresh(this);
139
- };
94
+ _SHOW_DEGREE(ll) {
95
+ if (ll) {
96
+ let lat = ll.lat,
97
+ lon = ll.lon;
140
98
 
141
- this.renderer.div.appendChild(this._display);
99
+ if (lat >= 0) {
100
+ this._latSideEl.innerHTML = 'N';
101
+ } else {
102
+ this._latSideEl.innerHTML = 'S';
103
+ }
104
+
105
+ if (lon >= 0) {
106
+ this._lonSideEl.innerHTML = 'E';
107
+ } else {
108
+ this._lonSideEl.innerHTML = 'W';
109
+ }
142
110
 
143
- _refresh(this._display);
111
+ let t = 0;
144
112
 
145
- this._centerDiv = document.createElement("div");
146
- this._centerDiv.className = "ogCenterIcon";
147
- this._centerDiv.innerHTML =
148
- '<svg width="12" height="12"><g><path stroke-width="1" stroke-opacity="1" d="M6 0L6 12M0 6L12 6" stroke="#009DFF"></path></g></svg>';
149
- this.renderer.div.appendChild(this._centerDiv);
113
+ let deg = lat < 0 ? Math.ceil(lat) : Math.floor(lat);
114
+ let min = Math.floor(t = Math.abs((lat - deg)) * 60);
115
+ let sec = Math.floor((t - min) * 6000) / 100.0;
116
+ this._latValEl.innerHTML = Math.abs(deg) + '°' + min + "'" + sec.toFixed(0) + '"';
150
117
 
151
- if (this._center) {
152
- this.renderer.activeCamera.events.on("moveend", this._grabCoordinates, this);
153
- this._centerDiv.style.display = "block";
154
- } else {
155
- this.renderer.events.on("mousemove", this._onMouseMove, this);
156
- this._centerDiv.style.display = "none";
118
+ deg = lon < 0 ? Math.ceil(lon) : Math.floor(lon);
119
+ min = Math.floor(t = Math.abs((lon - deg)) * 60);
120
+ sec = Math.floor((t - min) * 6000) / 100.0;
121
+ this._lonValEl.innerHTML = Math.abs(deg) + '°' + min + "'" + sec.toFixed(0) + '"';
157
122
  }
158
123
  }
159
124
 
160
- /**
161
- * Sets coordinates capturing type.
162
- * @public
163
- * @param {Boolean} center - True - capture screen center, false - mouse pointer.
164
- */
165
- setCenter(center) {
166
- if (center != this._center) {
167
- this._center = center;
168
- if (center) {
169
- this.renderer.events.off("mousemove", this._onMouseMove);
170
- this.renderer.activeCamera.events.on("moveend", this._grabCoordinates, this);
171
- this._centerDiv.style.display = "block";
172
- } else {
173
- this.renderer.events.off("draw", this._draw);
174
- this.renderer.events.on("mousemove", this._onMouseMove, this);
175
- this._centerDiv.style.display = "none";
176
- }
125
+ _createCenterEl() {
126
+ let el = document.createElement('div');
127
+ el.className = 'og-center-icon';
128
+ el.innerHTML = CENTER_SVG;
129
+ return el;
130
+ }
131
+
132
+ _updateUnits() {
133
+ this._heightMode = heightMode[this._heightModeVal];
134
+ this._altUnit = units[this._altUnitVal];
135
+ this._el.querySelector(".og-units-height").innerHTML = units.toString(this._altUnit);
136
+ this._showHeight();
137
+ }
138
+
139
+ _refreshCoordinates() {
140
+
141
+ if (this._type >= this._TYPE_FUNC.length) {
142
+ this._type = 0;
177
143
  }
144
+
145
+ this._el.innerHTML = TYPE_HTML[this._type];
146
+
147
+ this._latSideEl = this._el.querySelector(".og-lat-side");
148
+ this._lonSideEl = this._el.querySelector(".og-lon-side");
149
+ this._latValEl = this._el.querySelector(".og-lat-val");
150
+ this._lonValEl = this._el.querySelector(".og-lon-val");
151
+ this._heightEl = this._el.querySelector(".og-height");
152
+
153
+ this._showFn = this._TYPE_FUNC[this._type];
154
+ this._showFn(this._lonLat);
178
155
  }
179
156
 
180
- _showPosition() {
181
- if (this.position) {
182
- this.position.height =
183
- this.position.height > 10000 || this.position.height < -10000
184
- ? 0
185
- : this.position.height;
186
- this._display.innerHTML =
187
- "Lat/Lon: " +
188
- this._converter(this.position) +
189
- " h(m): " +
190
- (this.position.height > 0
191
- ? "~" + (Math.round(this.position.height) / 1000).toFixed(3) * 1000
192
- : "-");
157
+ oninit() {
158
+ this._el = document.createElement('div');
159
+ this._el.classList.add("og-coordinates");
160
+
161
+ this.renderer.div.appendChild(this._el);
162
+
163
+ this._el.addEventListener("click", () => {
164
+ this._type++;
165
+ this._refreshCoordinates();
166
+ this._updateUnits();
167
+ this._showHeight();
168
+ });
169
+
170
+ if (this._centerMode) {
171
+ this.renderer.div.appendChild(this._createCenterEl());
172
+ this.renderer.activeCamera.events.on("moveend", this._grabCoordinates, this);
173
+ this.renderer.activeCamera.events.on("moveend", throttle((e) => this._showHeight(), 400, true), this);
193
174
  } else {
194
- this._display.innerHTML = "Lat/Lon: " + "_____________________";
175
+ this.renderer.events.on("mousemove", this._grabCoordinates, this);
176
+ this.renderer.events.on("mousestop", throttle((e) => this._showHeight(), 400, true), this);
195
177
  }
196
- }
197
178
 
198
- _grabCoordinates() {
199
- var r = this.renderer;
200
- this.position = this.planet.getLonLatFromPixelTerrain(r.handler.getCenter());
201
- this._showPosition();
179
+ this._refreshCoordinates();
180
+
181
+ this._updateUnits();
202
182
  }
203
183
 
204
- _onMouseMove() {
205
- var r = this.renderer;
206
- var ms = r.events.mouseState;
207
- if (
208
- !(ms.leftButtonDown || ms.rightButtonDown) &&
209
- r.controlsBag.scaleRot <= 0 &&
210
- !r.activeCamera._flying
211
- ) {
212
- this.position = this.planet.getLonLatFromPixelTerrain(ms, true);
213
- this._showPosition();
184
+ _grabCoordinates(px) {
185
+ let scrPx;
186
+ if (this._centerMode) {
187
+ scrPx = r.handler.getCenter();
188
+ } else {
189
+ scrPx = px;
214
190
  }
191
+ let r = this.renderer;
192
+ this._lonLat = this.planet.getLonLatFromPixelTerrain(scrPx);
193
+ this._showFn(this._lonLat);
215
194
  }
216
- }
217
195
 
218
- export function earthCoordinates(options) {
219
- return new EarthCoordinates(options);
196
+ async _showHeight() {
197
+ if (this._lonLat) {
198
+ let alt = 0;
199
+ this._heightEl.style.opacity = 0.7;
200
+ if (this._heightMode === heightMode.ell) {
201
+ alt = await this.planet.getHeightAboveELL(this._lonLat);
202
+ alt = units.convertExt(true, units.m, this._altUnit, alt);
203
+ } else if (this._heightMode === heightMode.msl) {
204
+ alt = await this.planet.getHeightDefault(this._lonLat);
205
+ alt = units.convertExt(true, units.m, this._altUnit, alt);
206
+ }
207
+ this._heightEl.style.opacity = 1.0;
208
+ this._heightEl.innerHTML = alt.toString();
209
+ }
210
+ }
220
211
  }
221
212
 
222
213
  export { EarthCoordinates };
@@ -98,14 +98,14 @@ class CanvasTiles extends Layer {
98
98
  * @public
99
99
  * @param {boolean} visibility - Layer visibility.
100
100
  */
101
- setVisibility(visibility) {
101
+ setVisibility(visibility) {
102
102
  if (visibility !== this._visibility) {
103
103
  super.setVisibility(visibility);
104
104
 
105
105
  if (!visibility) {
106
106
  this.abortLoading();
107
107
  }
108
- }
108
+ }
109
109
  }
110
110
 
111
111
  /**
@@ -203,7 +203,7 @@ class CanvasTiles extends Layer {
203
203
  this._exec(pmat);
204
204
  }
205
205
  }
206
- } else if (this._counter === 0) {
206
+ } else if (this._counter === 0 && this._planet._terrainCompletedActivated) {
207
207
  this.events.dispatch(this.events.loadend);
208
208
  }
209
209
  }
@@ -227,21 +227,21 @@ class CanvasTiles extends Layer {
227
227
  applyMaterial(material) {
228
228
  if (material.isReady) {
229
229
  return [0, 0, 1, 1];
230
- } else {
231
-
230
+ } else {
231
+
232
232
  var segment = material.segment;
233
233
  var pn = segment.node,
234
234
  notEmpty = false;
235
-
235
+
236
236
  if (segment.passReady && !material.isLoading) {
237
- this.loadMaterial(material);
237
+ this.loadMaterial(material);
238
238
  }
239
239
 
240
240
  var mId = this._id;
241
241
  var psegm = material;
242
242
  while (pn.parentNode) {
243
243
  pn = pn.parentNode;
244
- psegm = pn.segment.materials[mId];
244
+ psegm = pn.segment.materials[mId];
245
245
  if (psegm && psegm.isReady) {
246
246
  notEmpty = true;
247
247
  break;
@@ -162,6 +162,7 @@ class XYZ extends Layer {
162
162
 
163
163
  this._planet._tileLoader.load(
164
164
  {
165
+ sender: this,
165
166
  src: this._getHTTPRequestString(material.segment),
166
167
  type: "imageBitmap",
167
168
  filter: () =>
@@ -185,7 +186,8 @@ class XYZ extends Layer {
185
186
  material.textureNotExists();
186
187
  }
187
188
  }
188
- }
189
+ },
190
+ this._id
189
191
  );
190
192
  } else {
191
193
  material.textureNotExists();
@@ -303,7 +305,7 @@ class XYZ extends Layer {
303
305
  clearMaterial(material) {
304
306
  if (material.isReady && material.textureExists) {
305
307
  !material.texture.default &&
306
- material.segment.handler.gl.deleteTexture(material.texture);
308
+ material.segment.handler.gl.deleteTexture(material.texture);
307
309
  material.texture = null;
308
310
 
309
311
  if (material.image) {
@@ -404,6 +404,7 @@ class Node {
404
404
 
405
405
  if (!this.segment.terrainReady) {
406
406
  this.planet._renderCompleted = false;
407
+ this.planet._terrainCompleted = false;
407
408
  }
408
409
 
409
410
  let k = 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();
@@ -692,10 +705,10 @@ export class Planet extends RenderNode {
692
705
  !this._indexesCache[i][j] && (this._indexesCache[i][j] = new Array(TABLESIZE));
693
706
  for (var k = 0; k <= TABLESIZE; k++) {
694
707
  !this._indexesCache[i][j][k] &&
695
- (this._indexesCache[i][j][k] = new Array(TABLESIZE));
708
+ (this._indexesCache[i][j][k] = new Array(TABLESIZE));
696
709
  for (var m = 0; m <= TABLESIZE; m++) {
697
710
  !this._indexesCache[i][j][k][m] &&
698
- (this._indexesCache[i][j][k][m] = new Array(TABLESIZE));
711
+ (this._indexesCache[i][j][k][m] = new Array(TABLESIZE));
699
712
  for (var q = 0; q <= TABLESIZE; q++) {
700
713
  let ptr = {
701
714
  buffer: null
@@ -723,6 +736,7 @@ export class Planet extends RenderNode {
723
736
 
724
737
  this.renderer.events.on("resize", () => {
725
738
  this._renderCompletedActivated = false;
739
+ this._terrainCompletedActivated = false;
726
740
  });
727
741
 
728
742
  // Initialize texture coordinates buffer pool
@@ -1156,6 +1170,17 @@ export class Planet extends RenderNode {
1156
1170
  this._renderCompletedActivated = false;
1157
1171
  }
1158
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;
1159
1184
  }
1160
1185
 
1161
1186
  /**
@@ -1807,4 +1832,20 @@ export class Planet extends RenderNode {
1807
1832
  }
1808
1833
  }
1809
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
+ }
1810
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);
@@ -156,6 +156,11 @@ class EmptyTerrain {
156
156
  */
157
157
  clearCache() {
158
158
  }
159
+
160
+ getHeightAsync(lonLat, callback) {
161
+ callback(0);
162
+ return true;
163
+ }
159
164
  }
160
165
 
161
166
  export { EmptyTerrain };