@openglobus/og 0.13.7 → 0.13.8

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 (50) hide show
  1. package/dist/@openglobus/og.esm.js +2 -2
  2. package/dist/@openglobus/og.esm.js.map +1 -1
  3. package/dist/@openglobus/og.umd.js +2 -2
  4. package/dist/@openglobus/og.umd.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/og/Object3d.js +384 -0
  7. package/src/og/arial.js +1705 -1703
  8. package/src/og/camera/Camera.js +640 -640
  9. package/src/og/control/EarthCoordinates.js +1 -1
  10. package/src/og/control/LayerAnimation.js +115 -0
  11. package/src/og/control/MouseNavigation.js +460 -460
  12. package/src/og/control/Sun.js +170 -170
  13. package/src/og/control/ZoomControl.js +0 -2
  14. package/src/og/control/index.js +3 -1
  15. package/src/og/control/ruler/Ruler.js +43 -0
  16. package/src/og/control/ruler/RulerScene.js +370 -0
  17. package/src/og/control/visibleExtent/Segment.js +1 -4
  18. package/src/og/ellipsoid/Ellipsoid.js +19 -0
  19. package/src/og/entity/Entity.js +1 -1
  20. package/src/og/entity/GeoObject.js +1 -1
  21. package/src/og/entity/LabelHandler.js +1 -0
  22. package/src/og/layer/Layer.js +23 -40
  23. package/src/og/layer/Vector.js +80 -14
  24. package/src/og/layer/XYZ.js +4 -0
  25. package/src/og/math/Vec3.js +1 -1
  26. package/src/og/math.js +4 -4
  27. package/src/og/quadTree/Node.js +1 -1
  28. package/src/og/renderer/Renderer.js +1 -2
  29. package/src/og/res/images.js +0 -2
  30. package/src/og/scene/Planet.js +3 -2
  31. package/src/og/segment/Segment.js +0 -8
  32. package/src/og/shaders/label.js +30 -42
  33. package/src/og/utils/FontAtlas.js +1 -2
  34. package/src/og/utils/Loader.js +160 -153
  35. package/src/og/utils/VectorTileCreator.js +1 -1
  36. package/src/og/webgl/ProgramController.js +143 -143
  37. package/types/Object3d.d.ts +21 -0
  38. package/types/arial.d.ts +1 -0
  39. package/types/control/Sun.d.ts +1 -1
  40. package/types/control/index.d.ts +2 -1
  41. package/types/control/ruler/Ruler.d.ts +13 -0
  42. package/types/control/ruler/RulerScene.d.ts +48 -0
  43. package/types/ellipsoid/Ellipsoid.d.ts +8 -0
  44. package/types/layer/Layer.d.ts +23 -31
  45. package/types/layer/Vector.d.ts +2 -0
  46. package/types/layer/XYZ.d.ts +1 -0
  47. package/types/math.d.ts +1 -1
  48. package/types/res/images.d.ts +0 -1
  49. package/types/scene/Planet.d.ts +2 -2
  50. package/types/utils/Loader.d.ts +1 -0
@@ -0,0 +1,370 @@
1
+ 'use strict';
2
+
3
+ import * as math from '../../math.js';
4
+ import { RenderNode } from '../../scene/RenderNode.js';
5
+ import { Events } from '../../Events.js';
6
+ import { LonLat } from '../../LonLat.js';
7
+ import { Vec3 } from '../../math/Vec3.js';
8
+ import { Vec2 } from '../../math/Vec2.js';
9
+ import { Vector } from '../../layer/Vector.js';
10
+ import { Entity } from '../../entity/Entity.js';
11
+ import { Ellipsoid } from '../../ellipsoid/Ellipsoid.js';
12
+ import { Object3d } from '../../Object3d.js';
13
+
14
+ const OUTLINE_COUNT = 120;
15
+
16
+ const MAX_SCALE = 0.005;
17
+ const MIN_SCALE = 0.001;
18
+ const MAX_SCALE_HEIGHT = 3000.0;
19
+ const MIN_SCALE_HEIGHT = 19000000.0;
20
+
21
+ function distanceFormat(v) {
22
+ if (v > 1000) {
23
+ return `${(v / 1000).toFixed(1)} km`;
24
+ } else if (v > 9) {
25
+ return `${Math.round(v)} m`;
26
+ } else {
27
+ return `${v.toFixed(1)} m`;
28
+ }
29
+ }
30
+
31
+ class RulerScene extends RenderNode {
32
+ constructor(options = {}) {
33
+ super(options.name);
34
+
35
+ this.events = new Events(EVENT_NAMES);
36
+
37
+ this._ignoreTerrain = options.ignoreTerrain != undefined ? options.ignoreTerrain : true;
38
+
39
+ this._planet = options.planet || null;
40
+
41
+ this._startLonLat = null;
42
+ this._preventClick = false;
43
+ this._stopDrawing = false;
44
+
45
+ this._pickedCorner = null;
46
+ this._startPos = null;
47
+ this._startClick = new Vec2();
48
+
49
+ this._heading = 0;
50
+
51
+ this._propsLabel = new Entity({
52
+ 'name': 'propsLabel',
53
+ 'label': {
54
+ text: "",
55
+ size: 11,
56
+ color: "rgba(455,455,455,1.0)",
57
+ outlineColor: "rgba(0,0,0,0.34)",
58
+ outline: 0.23,
59
+ align: "center",
60
+ offset: [0, 18]
61
+ }
62
+ });
63
+
64
+ this._propsLabel.label.setVisibility(false);
65
+
66
+ this._trackEntity = new Entity({
67
+ polyline: {
68
+ path3v: [],
69
+ thickness: 3.8,
70
+ color: "rgb(455,455,455)",
71
+ isClosed: false
72
+ }
73
+ });
74
+
75
+ this._trackEntity.polyline.altitude = 0.01;
76
+
77
+ let obj3d = Object3d.createCylinder(1.1, 0, 2.7, 20, 1, true, false, 0, 0, 0)
78
+
79
+ this._cornerEntity = [
80
+ new Entity({
81
+ geoObject: {
82
+ scale: 1,
83
+ instanced: true,
84
+ tag: "ruler",
85
+ color: "rgb(0,305,0)",
86
+ vertices: obj3d.vertices,
87
+ indices: obj3d.indexes,
88
+ normals: obj3d.normals
89
+ },
90
+ properties: {
91
+ name: "start"
92
+ }
93
+ }),
94
+ new Entity({
95
+ geoObject: {
96
+ scale: 1,
97
+ instanced: true,
98
+ tag: "ruler",
99
+ color: "rgb(455,0,0)",
100
+ vertices: obj3d.vertices,
101
+ indices: obj3d.indexes,
102
+ normals: obj3d.normals
103
+ },
104
+ properties: {
105
+ name: "end"
106
+ }
107
+
108
+ })
109
+ ];
110
+
111
+ this._trackLayer = new Vector("track", {
112
+ entities: [this._trackEntity, this._propsLabel],
113
+ pickingEnabled: false,
114
+ polygonOffsetUnits: -1.0,
115
+ relativeToGround: true
116
+ });
117
+
118
+ this._cornersLayer = new Vector("corners", {
119
+ entities: [this._cornerEntity[0], this._cornerEntity[1]],
120
+ pickingEnabled: true
121
+ });
122
+ }
123
+
124
+ set ignoreTerrain(v) {
125
+ this._ignoreTerrain = v;
126
+ if (v) {
127
+ //...redraw line
128
+ }
129
+ }
130
+
131
+ bindPlanet(planet) {
132
+ this._planet = planet;
133
+ }
134
+
135
+ init() {
136
+ this._activate();
137
+ }
138
+
139
+ onremove() {
140
+ this._deactivate();
141
+ }
142
+
143
+ _activate() {
144
+ this._propsLabel.label.setVisibility(false);
145
+ this._onLclick_ = this._onLclick.bind(this);
146
+ this.renderer.events.on("lclick", this._onLclick_, this);
147
+ this._onMouseMove_ = this._onMouseMove.bind(this);
148
+ this.renderer.events.on("mousemove", this._onMouseMove_, this);
149
+ this._onLdblclick_ = this._onLdblclick.bind(this);
150
+ this.renderer.events.on("ldblclick", this._onLdblclick_, this);
151
+
152
+ this._onCornerEnter_ = this._onCornerEnter.bind(this);
153
+ this._cornersLayer.events.on("mouseenter", this._onCornerEnter_, this);
154
+
155
+ this._onCornerLeave_ = this._onCornerLeave.bind(this);
156
+ this._cornersLayer.events.on("mouseleave", this._onCornerLeave_, this);
157
+
158
+ this._onCornerLdown_ = this._onCornerLdown.bind(this);
159
+ this._cornersLayer.events.on("ldown", this._onCornerLdown_, this);
160
+
161
+ this._onCornerLup_ = this._onCornerLup.bind(this);
162
+ this._cornersLayer.events.on("lup", this._onCornerLup, this);
163
+
164
+ this._planet.addLayer(this._trackLayer);
165
+ this._planet.addLayer(this._cornersLayer);
166
+ }
167
+
168
+ _deactivate() {
169
+ this._startLonLat = null;
170
+ this._preventClick = false;
171
+ this._stopDrawing = false;
172
+ this._pickedCorner = null;
173
+ this._trackLayer.remove();
174
+ this._cornersLayer.remove();
175
+ this.renderer.events.off("lclick", this._onLclick_);
176
+ this.renderer.events.off("mousemove", this._onMouseMove_);
177
+ this._cornersLayer.events.off("mouseenter", this._onCornerEnter_);
178
+ this._cornersLayer.events.off("mouseleave", this._onCornerLeave_);
179
+ this._cornersLayer.events.off("ldown", this._onCornerLdown_);
180
+ this._cornersLayer.events.off("lup", this._onCornerLup_);
181
+
182
+ this.clear();
183
+
184
+ this._onLclick_ = null;
185
+ this._onMouseMove_ = null;
186
+ this._onCornerLeave_ = null;
187
+ this._onCornerEnter_ = null;
188
+ this._onCornerLdown_ = null;
189
+ this._onCornerLup_ = null;
190
+ }
191
+
192
+ _onCornerLdown(e) {
193
+ if (!this._startLonLat) {
194
+ this.renderer.controls.mouseNavigation.deactivate();
195
+ this._startClick.set(e.x, e.y);
196
+ let coords = e.pickingObject.getCartesian();
197
+ this._startPos = this._planet.getPixelFromCartesian(coords);
198
+ this._pickedCorner = e.pickingObject;
199
+ if (e.pickingObject.properties.name == "start") {
200
+ this._anchorLonLat = this._cornerEntity[1].getLonLat().clone();
201
+ } else {
202
+ this._anchorLonLat = this._cornerEntity[0].getLonLat().clone();
203
+ }
204
+ }
205
+ }
206
+
207
+ _onCornerLup(e) {
208
+ if (this._pickedCorner) {
209
+ this.renderer.controls.mouseNavigation.activate();
210
+ this._pickedCorner = null;
211
+ this._anchorLonLat = null;
212
+ }
213
+ }
214
+
215
+ _onCornerEnter(e) {
216
+ e.renderer.handler.canvas.style.cursor = "pointer";
217
+ }
218
+
219
+ _onCornerLeave(e) {
220
+ e.renderer.handler.canvas.style.cursor = "default";
221
+ }
222
+
223
+ _onLdblclick() {
224
+ this._preventClick = true;
225
+ }
226
+
227
+ _onLclick(e) {
228
+ let startLonLat = this._planet.getLonLatFromPixelTerrain(e);
229
+ this._timeout = setTimeout(() => {
230
+ if (!this._preventClick) {
231
+ if (!this._startLonLat) {
232
+ this._stopDrawing = false;
233
+ this._propsLabel.label.setVisibility(false);
234
+ this._trackEntity.polyline.setPath3v([]);
235
+ this._cornerEntity[0].geoObject.setVisibility(true);
236
+ this._cornerEntity[1].geoObject.setVisibility(true);
237
+ this._startLonLat = startLonLat;
238
+ } else {
239
+ this._startLonLat = null;
240
+ }
241
+ }
242
+ this._preventClick = false;
243
+ this._stopDrawing = false;
244
+ clearTimeout(this._timeout);
245
+ }, 200);
246
+
247
+ if (this._startLonLat) {
248
+ this._stopDrawing = true;
249
+ }
250
+ }
251
+
252
+ _drawLine(startLonLat, endLonLat, startPos) {
253
+
254
+ if (!startPos) {
255
+ startPos = this._planet.ellipsoid.lonLatToCartesian(startLonLat);
256
+ }
257
+
258
+ let endPos = this._planet.ellipsoid.lonLatToCartesian(endLonLat);
259
+
260
+ let length = this._planet.ellipsoid.getGreatCircleDistance(startLonLat, endLonLat);
261
+ this._heading = Ellipsoid.getRhumbBearing(startLonLat, endLonLat);
262
+
263
+ let path = [];
264
+ let dir = endPos.sub(startPos);
265
+ let dist = dir.length();
266
+ dir.normalize();
267
+
268
+ for (let i = 0; i < OUTLINE_COUNT; i++) {
269
+ let f = dir.scaleTo(i * dist / OUTLINE_COUNT).addA(startPos);
270
+ path.push(f);
271
+ }
272
+ path.push(endPos);
273
+
274
+ this._trackEntity.polyline.setPath3v([path]);
275
+
276
+ if (this._ignoreTerrain) {
277
+ this._propsLabel.setCartesian3v(path[Math.floor(path.length / 2)]);
278
+ this._propsLabel.label.setText(`${distanceFormat(length)}, ${Math.round(this._heading)} deg`);
279
+ }
280
+ }
281
+
282
+ _onMouseMove(e) {
283
+ if (this._startLonLat && !this._stopDrawing) {
284
+ this._propsLabel.label.setVisibility(true);
285
+ let endLonLat = this._planet.getLonLatFromPixelTerrain(e);
286
+ if (!endLonLat) return;
287
+ this._drawLine(this._startLonLat, endLonLat);
288
+ } else if (this._pickedCorner) {
289
+ let newLonLat = this._planet.getLonLatFromPixelTerrain(e);
290
+ if (newLonLat) {
291
+ if (this._pickedCorner.properties.name === "start") {
292
+ this._drawLine(newLonLat, this._anchorLonLat);
293
+ } else {
294
+ this._drawLine(this._anchorLonLat, newLonLat);
295
+ }
296
+ }
297
+ }
298
+ }
299
+
300
+ clear() {
301
+ // удаляем трек
302
+ this._trackEntity.polyline.clear();
303
+ this._cornerEntity[0].geoObject.setVisibility(false);
304
+ this._cornerEntity[1].geoObject.setVisibility(false);
305
+ }
306
+
307
+ getScale(cart) {
308
+ let r = this.renderer;
309
+ let t = 1.0 - (r.activeCamera._lonLat.height - MAX_SCALE_HEIGHT) / (MIN_SCALE_HEIGHT - MAX_SCALE_HEIGHT);
310
+ let _distanceToCamera = cart.distance(r.activeCamera.eye);
311
+ return math.lerp(t < 0 ? 0 : t, MAX_SCALE, MIN_SCALE) * _distanceToCamera;
312
+ }
313
+
314
+ frame() {
315
+ let t = this._trackEntity.polyline.getPath3v()[0];
316
+ if (t) {
317
+ this._cornerEntity[0].setCartesian3v(t[0].clone());
318
+ this._cornerEntity[1].setCartesian3v(t[t.length - 1].clone());
319
+
320
+ this._cornerEntity[0].geoObject.setScale(this.getScale(this._cornerEntity[0].getCartesian()));
321
+ this._cornerEntity[1].geoObject.setScale(this.getScale(this._cornerEntity[1].getCartesian()));
322
+
323
+ if (!this._ignoreTerrain) {
324
+ let res = 0;
325
+ for (let i = 0, len = t.length - 1; i < len; i++) {
326
+ res += t[i + 1].distance(t[i]);
327
+ }
328
+
329
+ this._propsLabel.setCartesian3v(t[Math.floor(t.length / 2)]);
330
+ this._propsLabel.label.setText(`${distanceFormat(res)}, ${Math.round(this._heading)} deg`);
331
+ }
332
+ }
333
+ }
334
+
335
+ get ellipsoid() {
336
+ return this._planet ? this._planet.ellipsoid : null;
337
+ }
338
+ }
339
+
340
+ const EVENT_NAMES = [
341
+ "add",
342
+ "remove",
343
+ "mousemove",
344
+ "mouseenter",
345
+ "mouseleave",
346
+ "lclick",
347
+ "rclick",
348
+ "mclick",
349
+ "ldblclick",
350
+ "rdblclick",
351
+ "mdblclick",
352
+ "lup",
353
+ "rup",
354
+ "mup",
355
+ "ldown",
356
+ "rdown",
357
+ "mdown",
358
+ "lhold",
359
+ "rhold",
360
+ "mhold",
361
+ "mousewheel",
362
+ "touchmove",
363
+ "touchstart",
364
+ "touchend",
365
+ "doubletouch",
366
+ "touchleave",
367
+ "touchenter"
368
+ ];
369
+
370
+ export { RulerScene };
@@ -257,10 +257,7 @@ class Segment {
257
257
  * @returns {boolean} -
258
258
  */
259
259
  acceptForRendering(camera) {
260
- return (
261
- camera.projectedSize(this.bsphere.center, this._plainRadius) <
262
- 256 / this.planet._lodRatio
263
- );
260
+ return camera.projectedSize(this.bsphere.center, this._plainRadius) < (256 / this.planet._lodRatio);
264
261
  }
265
262
 
266
263
  /**
@@ -57,6 +57,25 @@ class Ellipsoid {
57
57
  return -Math.acos(d);
58
58
  }
59
59
 
60
+ /**
61
+ * Returns the distance travelling from ‘this’ point to destination point along a rhumb line.
62
+ *
63
+ * @param {LonLat} start coordinates.
64
+ * @param {LonLat} end coordinates
65
+ * @returns {number} Distance in m between this point and destination point (same units as radius).
66
+ */
67
+ rhumbDistanceTo(startLonLat, endLonLat) {
68
+ const f1 = startLonLat.lat * math.RADIANS;
69
+ const f2 = endLonLat.lat * math.RADIANS;
70
+ const df = f2 - f1;
71
+ let d = Math.abs(endLonLat.lon - startLonLat.lon) * math.RADIANS;
72
+ if (Math.abs(d) > Math.PI) d = d > 0 ? -(2 * Math.PI - d) : (2 * Math.PI + d);
73
+ const dd = Math.log(Math.tan(f2 / 2 + Math.PI / 4) / Math.tan(f1 / 2 + Math.PI / 4));
74
+ const q = Math.abs(dd) > 10e-12 ? df / dd : Math.cos(f1);
75
+ const t = Math.sqrt(df * df + q * q * d * d); // angular distance in radians
76
+ return t * this._a;
77
+ }
78
+
60
79
  /**
61
80
  * Returns the midpoint between two points on the great circle.
62
81
  * @param {LonLat} lonLat1 - Longitude/latitude of first point.
@@ -65,7 +65,7 @@ class Entity {
65
65
  * @public
66
66
  * @type {string}
67
67
  */
68
- this.properties.name = this.properties.name || options.name || "";
68
+ this.properties.name = this.properties.name != undefined ? this.properties.name : "";
69
69
 
70
70
  /**
71
71
  * Children entities.
@@ -20,7 +20,7 @@ class GeoObject {
20
20
  constructor(options) {
21
21
  options = options || {};
22
22
 
23
- this.scale = options.scale || 0.02;
23
+ this.scale = options.scale || 1.0;
24
24
  this.scaleByDistance = new Float32Array(options.scaleByDistance || [MAX32, MAX32, MAX32]);
25
25
 
26
26
  /**
@@ -205,6 +205,7 @@ class LabelHandler extends BillboardHandler {
205
205
  ec = this._entityCollection;
206
206
 
207
207
  gl.disable(gl.CULL_FACE);
208
+ //gl.disable(gl.DEPTH_TEST);
208
209
 
209
210
  gl.uniform1iv(shu.fontTextureArr, r.fontAtlas.samplerArr);
210
211
  gl.uniform4fv(shu.sdfParamsArr, r.fontAtlas.sdfParamsArr);
@@ -34,29 +34,29 @@ export const FADING_FACTOR = 0.29;
34
34
  * @fires og.Layer#visibilitychange
35
35
  * @fires og.Layer#add
36
36
  * @fires og.Layer#remove
37
- * @fires og.layer.Vector#mousemove
38
- * @fires og.layer.Vector#mouseenter
39
- * @fires og.layer.Vector#mouseleave
40
- * @fires og.layer.Vector#lclick
41
- * @fires og.layer.Vector#rclick
42
- * @fires og.layer.Vector#mclick
43
- * @fires og.layer.Vector#ldblclick
44
- * @fires og.layer.Vector#rdblclick
45
- * @fires og.layer.Vector#mdblclick
46
- * @fires og.layer.Vector#lup
47
- * @fires og.layer.Vector#rup
48
- * @fires og.layer.Vector#mup
49
- * @fires og.layer.Vector#ldown
50
- * @fires og.layer.Vector#rdown
51
- * @fires og.layer.Vector#mdown
52
- * @fires og.layer.Vector#lhold
53
- * @fires og.layer.Vector#rhold
54
- * @fires og.layer.Vector#mhold
55
- * @fires og.layer.Vector#mousewheel
56
- * @fires og.layer.Vector#touchmove
57
- * @fires og.layer.Vector#touchstart
58
- * @fires og.layer.Vector#touchend
59
- * @fires og.layer.Vector#doubletouch
37
+ * @fires og.layer.Layer#mousemove
38
+ * @fires og.layer.Layer#mouseenter
39
+ * @fires og.layer.Layer#mouseleave
40
+ * @fires og.layer.Layer#lclick
41
+ * @fires og.layer.Layer#rclick
42
+ * @fires og.layer.Layer#mclick
43
+ * @fires og.layer.Layer#ldblclick
44
+ * @fires og.layer.Layer#rdblclick
45
+ * @fires og.layer.Layer#mdblclick
46
+ * @fires og.layer.Layer#lup
47
+ * @fires og.layer.Layer#rup
48
+ * @fires og.layer.Layer#mup
49
+ * @fires og.layer.Layer#ldown
50
+ * @fires og.layer.Layer#rdown
51
+ * @fires og.layer.Layer#mdown
52
+ * @fires og.layer.Layer#lhold
53
+ * @fires og.layer.Layer#rhold
54
+ * @fires og.layer.Layer#mhold
55
+ * @fires og.layer.Layer#mousewheel
56
+ * @fires og.layer.Layer#touchmove
57
+ * @fires og.layer.Layer#touchstart
58
+ * @fires og.layer.Layer#touchend
59
+ * @fires og.layer.Layer#doubletouch
60
60
  */
61
61
  class Layer {
62
62
  constructor(name, options = {}) {
@@ -230,23 +230,6 @@ class Layer {
230
230
  this.__lcounter = n;
231
231
  }
232
232
 
233
- static get __requestsCounter() {
234
- return this.__reqcounter;
235
- }
236
-
237
- static set __requestsCounter(v) {
238
- this.__reqcounter = v;
239
- }
240
-
241
- /**
242
- * Maximum loading queries at one time.
243
- * @const
244
- * @type {number}
245
- */
246
- static get MAX_REQUESTS() {
247
- return 7;
248
- }
249
-
250
233
  get instanceName() {
251
234
  return "Layer";
252
235
  }
@@ -137,6 +137,11 @@ class Vector extends Layer {
137
137
  });
138
138
  this._bindEventsDefault(this._polylineEntityCollection);
139
139
 
140
+ this._geoObjectEntityCollection = new EntityCollection({
141
+ pickingEnabled: this.pickingEnabled
142
+ });
143
+ this._bindEventsDefault(this._geoObjectEntityCollection);
144
+
140
145
  this._geometryHandler = new GeometryHandler(this);
141
146
 
142
147
  this._entityCollectionsTree = null;
@@ -186,6 +191,7 @@ class Vector extends Layer {
186
191
  this._geometryHandler.assignHandler(planet.renderer.handler);
187
192
  this._polylineEntityCollection.addTo(planet, true);
188
193
  this._stripEntityCollection.addTo(planet, true);
194
+ this._geoObjectEntityCollection.addTo(planet, true);
189
195
  this.setEntities(this._entities);
190
196
  }
191
197
  return this;
@@ -285,6 +291,10 @@ class Vector extends Layer {
285
291
  this._polylineEntityCollection.add(entity);
286
292
  }
287
293
 
294
+ if (entity.geoObject) {
295
+ this._geoObjectEntityCollection.add(entity);
296
+ }
297
+
288
298
  if (entity.geometry) {
289
299
  this._hasImageryTiles = true;
290
300
  if (this._planet) {
@@ -412,20 +422,22 @@ class Vector extends Layer {
412
422
 
413
423
  this._polylineEntityCollection.setPickingEnabled(picking);
414
424
 
425
+ this._geoObjectEntityCollection.setPickingEnabled(picking);
426
+
415
427
  this._entityCollectionsTree &&
416
- this._entityCollectionsTree.traverseTree(function (node) {
417
- node.entityCollection.setPickingEnabled(picking);
418
- });
428
+ this._entityCollectionsTree.traverseTree(function (node) {
429
+ node.entityCollection.setPickingEnabled(picking);
430
+ });
419
431
 
420
432
  this._entityCollectionsTreeNorth &&
421
- this._entityCollectionsTreeNorth.traverseTree(function (node) {
422
- node.entityCollection.setPickingEnabled(picking);
423
- });
433
+ this._entityCollectionsTreeNorth.traverseTree(function (node) {
434
+ node.entityCollection.setPickingEnabled(picking);
435
+ });
424
436
 
425
437
  this._entityCollectionsTreeSouth &&
426
- this._entityCollectionsTreeSouth.traverseTree(function (node) {
427
- node.entityCollection.setPickingEnabled(picking);
428
- });
438
+ this._entityCollectionsTreeSouth.traverseTree(function (node) {
439
+ node.entityCollection.setPickingEnabled(picking);
440
+ });
429
441
  }
430
442
 
431
443
  /**
@@ -527,10 +539,10 @@ class Vector extends Layer {
527
539
 
528
540
  this._entities = new Array(temp.length);
529
541
 
530
- var entitiesForTree = [];
542
+ let entitiesForTree = [];
531
543
 
532
- for (var i = 0; i < temp.length; i++) {
533
- var ei = temp[i];
544
+ for (let i = 0; i < temp.length; i++) {
545
+ let ei = temp[i];
534
546
 
535
547
  ei._layer = this;
536
548
  ei._layerIndex = i;
@@ -539,6 +551,8 @@ class Vector extends Layer {
539
551
  this._stripEntityCollection.add(ei);
540
552
  } else if (ei.polyline || ei.ray) {
541
553
  this._polylineEntityCollection.add(ei);
554
+ } else if (ei.geoObject) {
555
+ this._geoObjectEntityCollection.add(ei);
542
556
  } else if (ei.billboard || ei.label || ei.shape) {
543
557
  entitiesForTree.push(ei);
544
558
  }
@@ -711,7 +725,7 @@ class Vector extends Layer {
711
725
  }
712
726
 
713
727
  _collectPolylineCollectionPASS(outArr) {
714
- var ec = this._polylineEntityCollection;
728
+ let ec = this._polylineEntityCollection;
715
729
 
716
730
  ec._fadingOpacity = this._fadingOpacity;
717
731
  ec.scaleByDistance = this.scaleByDistance;
@@ -762,6 +776,58 @@ class Vector extends Layer {
762
776
  }
763
777
  }
764
778
 
779
+ _collectGeoObjectCollectionPASS(outArr) {
780
+ let ec = this._geoObjectEntityCollection;
781
+
782
+ ec._fadingOpacity = this._fadingOpacity;
783
+ ec.scaleByDistance = this.scaleByDistance;
784
+ ec.pickingScale = this.pickingScale;
785
+ ec.polygonOffsetUnits = this.polygonOffsetUnits;
786
+
787
+ outArr.push(ec);
788
+
789
+ // if (this.clampToGround || this.relativeToGround) {
790
+ // let rtg = Number(this.relativeToGround);
791
+ //
792
+ // var nodes = this._planet._renderedNodes;
793
+ // var visibleExtent = this._planet.getViewExtent();
794
+ // var e = ec._entities;
795
+ // var e_i = e.length;
796
+ // let res = new Vec3();
797
+ //
798
+ // while (e_i--) {
799
+ // var p = e[e_i].polyline;
800
+ // if (visibleExtent.overlaps(p._extent)) {
801
+ // // TODO:this works only for mercator area.
802
+ // // needs to be working on poles.
803
+ // let coords = p._pathLonLatMerc,
804
+ // c_j = coords.length;
805
+ // while (c_j--) {
806
+ // var c_j_h = coords[c_j].length;
807
+ // while (c_j_h--) {
808
+ // let ll = coords[c_j][c_j_h],
809
+ // n_k = nodes.length;
810
+ // while (n_k--) {
811
+ // var seg = nodes[n_k].segment;
812
+ // if (seg._extent.isInside(ll)) {
813
+ // let cart = p._path3v[c_j][c_j_h];
814
+ // seg.getTerrainPoint(cart, ll, res);
815
+ // p.setPoint3v(
816
+ // res.addA(res.normal().scale((rtg && p.altitude) || 0.0)),
817
+ // c_j_h,
818
+ // c_j,
819
+ // true
820
+ // );
821
+ // break;
822
+ // }
823
+ // }
824
+ // }
825
+ // }
826
+ // }
827
+ // }
828
+ // }
829
+ }
830
+
765
831
  collectVisibleCollections(outArr) {
766
832
  var p = this._planet;
767
833
 
@@ -775,8 +841,8 @@ class Vector extends Layer {
775
841
 
776
842
  // Common collections first
777
843
  this._collectStripCollectionPASS(outArr);
778
-
779
844
  this._collectPolylineCollectionPASS(outArr);
845
+ this._collectGeoObjectCollectionPASS(outArr);
780
846
 
781
847
  // Merc nodes
782
848
  this._secondPASS = [];
@@ -92,6 +92,10 @@ class XYZ extends Layer {
92
92
  this._urlRewriteCallback = options.urlRewrite || null;
93
93
  }
94
94
 
95
+ get isIdle() {
96
+ return !this._planet || this._planet._tileLoader.isIdle(this);
97
+ }
98
+
95
99
  get instanceName() {
96
100
  return "XYZ";
97
101
  }