@openglobus/og 0.14.2 → 0.14.4

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.14.2",
3
+ "version": "0.14.4",
4
4
  "description": "[OpenGlobus](https://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"
@@ -321,7 +321,7 @@ class Camera {
321
321
  this._tanViewAngle_hradOneByHeight =
322
322
  this._tanViewAngle_hrad * this.renderer.handler._oneByHeight;
323
323
  var c = this.renderer.handler.canvas;
324
- this._projSizeConst = Math.min(c.clientWidth < 256 ? 256 : c.clientWidth, c.clientHeight < 256 ? 256 : c.clientHeight) / (angle * math.RADIANS);
324
+ this._projSizeConst = Math.min(c.clientWidth < 512 ? 512 : c.clientWidth, c.clientHeight < 512 ? 512 : c.clientHeight) / (angle * math.RADIANS);
325
325
  for (let i = 0, len = this.frustums.length; i < len; i++) {
326
326
  this.frustums[i].setProjectionMatrix(
327
327
  angle,
@@ -37,14 +37,14 @@ class PlanetCamera extends Camera {
37
37
  */
38
38
  constructor(planet, options) {
39
39
  super(planet.renderer, {
40
- frustums: [
41
- [1, 100 + 0.075],
42
- [100, 1000 + 0.075],
43
- [1000, 1e6 + 10000],
44
- [1e6, 1e9]
45
- ], //[[1, 1e3 + 100], [1e3, 1e6 + 10000], [1e6, 1e9]]*/
46
- ...options
47
- }
40
+ frustums: [
41
+ [1, 100 + 0.075],
42
+ [100, 1000 + 0.075],
43
+ [1000, 1e6 + 10000],
44
+ [1e6, 1e9]
45
+ ], //[[1, 1e3 + 100], [1e3, 1e6 + 10000], [1e6, 1e9]]*/
46
+ ...options
47
+ }
48
48
  );
49
49
  /**
50
50
  * Assigned camera's planet.
@@ -120,6 +120,11 @@ class PlanetCamera extends Camera {
120
120
  this._numFrames = 50;
121
121
  this._completeCallback = null;
122
122
  this._flying = false;
123
+ this._checkTerrainCollision = true;
124
+ }
125
+
126
+ setTerrainCollisionActivity(isActive) {
127
+ this._checkTerrainCollision = isActive;
123
128
  }
124
129
 
125
130
  /**
@@ -363,7 +368,10 @@ class PlanetCamera extends Camera {
363
368
  * @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
364
369
  * @param [frameCallback]
365
370
  */
366
- flyCartesian(cartesian, look = Vec3.ZERO, up = Vec3.UP, ampl = 1.0, completeCallback = () => { }, startCallback = () => { }, frameCallback = () => { }) {
371
+ flyCartesian(cartesian, look = Vec3.ZERO, up = Vec3.UP, ampl = 1.0, completeCallback = () => {
372
+ }, startCallback = () => {
373
+ }, frameCallback = () => {
374
+ }) {
367
375
 
368
376
  this.stopFlying();
369
377
 
@@ -620,7 +628,7 @@ class PlanetCamera extends Camera {
620
628
  this._insideSegmentPosition,
621
629
  this._terrainPoint
622
630
  );
623
- if (this._terrainAltitude < this.minAltitude) {
631
+ if (this._terrainAltitude < this.minAltitude && this._checkTerrainCollision) {
624
632
  this.setAltitude(this.minAltitude);
625
633
  }
626
634
  }
@@ -634,9 +642,9 @@ class PlanetCamera extends Camera {
634
642
  getHeading() {
635
643
  let u = this.eye.normal();
636
644
  let f = Vec3.proj_b_to_plane(
637
- this.slope >= 0.97 ? this.getUp() : this.getForward(),
638
- u
639
- ).normalize(),
645
+ this.slope >= 0.97 ? this.getUp() : this.getForward(),
646
+ u
647
+ ).normalize(),
640
648
  n = Vec3.proj_b_to_plane(Vec3.UP, u).normalize();
641
649
  let res = Math.sign(u.dot(f.cross(n))) * Math.acos(f.dot(n)) * math.DEGREES;
642
650
  if (res < 0.0) {
@@ -108,12 +108,16 @@ function isString(v) {
108
108
  }
109
109
 
110
110
  // Handles the click inside/outside a dialog - closes dialog when click outside
111
- export function btnClickHandler(btn_id, dialog_id, dialog_selector, btn_icon_id) {
111
+ export function btnClickHandler(btn_id, dialog_id, dialog_selector, btn_icon_id, callback) {
112
112
  let btn = isString(btn_id) ? document.getElementById(btn_id) : btn_id;
113
113
  let dialog = document.getElementById(dialog_id);
114
114
  btn.onclick = function (e) {
115
+
116
+ let off = true;
117
+
115
118
  if (this.classList.contains('og-OFF')) {
116
119
  // Turn to ON
120
+ off = false;
117
121
  allMenuBtnOFF();
118
122
  allDialogsHide();
119
123
  this.classList.remove('og-OFF');
@@ -137,10 +141,15 @@ export function btnClickHandler(btn_id, dialog_id, dialog_selector, btn_icon_id)
137
141
  }
138
142
  } else {
139
143
  // Turn to OFF
144
+ off = true;
140
145
  this.classList.add('og-OFF');
141
146
  if (dialog) {
142
147
  dialog.classList.add('og-hide');
143
148
  }
144
149
  }
150
+
151
+ if (callback && typeof callback === 'function'){
152
+ callback(off);
153
+ }
145
154
  }
146
- }
155
+ }
@@ -11,12 +11,15 @@ import { ToggleWireframe } from "./ToggleWireframe.js";
11
11
  import { TouchNavigation } from "./TouchNavigation.js";
12
12
  import { SimpleNavigation } from "./SimpleNavigation.js";
13
13
  import { Ruler } from "./ruler/Ruler.js";
14
+ import { Selection } from "./selection/Selection.js";
14
15
  import { ShowFps } from "./ShowFps.js";
15
16
  import { Sun } from "./Sun.js";
16
17
  import { ZoomControl } from "./ZoomControl.js";
17
18
  import { MouseWheelZoomControl } from "./MouseWheelZoomControl.js";
18
19
  import { Lighting } from "./Lighting.js";
19
20
  import { LayerAnimation } from "./LayerAnimation.js";
21
+ import { ScaleControl } from "./ScaleControl.js";
22
+ import { SimpleSkyBackground } from "./SimpleSkyBackground.js";
20
23
 
21
24
  export {
22
25
  Control,
@@ -32,10 +35,13 @@ export {
32
35
  TouchNavigation,
33
36
  SimpleNavigation,
34
37
  ShowFps,
38
+ ScaleControl,
35
39
  Sun,
36
40
  ZoomControl,
37
41
  MouseWheelZoomControl,
38
42
  Lighting,
39
43
  Ruler,
44
+ SimpleSkyBackground,
45
+ Selection,
40
46
  LayerAnimation
41
47
  };
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @module og/control/Selector
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { Control } from "../Control.js";
8
+ import { elementFactory, btnClickHandler } from "../UIhelpers.js";
9
+ import { SelectionScene } from "./SelectionScene.js";
10
+
11
+
12
+ /**
13
+ * Activate Selection
14
+ * @class
15
+ * @extends {Control}
16
+ * @param {Object} [options] - Control options.
17
+ * @param {Array} [options.activationIconClasses] - array with a list of classes to change the button icons
18
+ * @param {boolean} [options.ignoreTerrain=false].
19
+ * @param {function} options.onSelect - callback (extent) => {} where extent is selected extent array [minLon,minLat,maxLon,maxLat]
20
+ * @param {boolean} [options.autoSelectionHide=false] - clear selection rectangle after passing extent to callback
21
+ * @example:
22
+ * to use bootstrap icons, include
23
+ * <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css">
24
+ *
25
+ * new Selection({
26
+ * activationIconClasses: ['bi', 'bi-bounding-box-circles'],
27
+ * ignoreTerrain: false,
28
+ * autoSelectionHide:true,
29
+ * onSelect: (extent) => {
30
+ *
31
+ * var vectorSource = new ol.source.Vector({
32
+ * format: new GeoJSON(),
33
+ * url: function (extent) {
34
+ * return 'https://snap.ogs.trieste.it/geoserver/snap/ows?service=WFS&' +
35
+ * 'version=1.1.0&request=GetFeature&typename=snap:all_dataset_segy_view&' +
36
+ * 'outputFormat=application/json&srsname=EPSG:4326&' +
37
+ * 'bbox=' + extent.join(',') + ',EPSG:4326';
38
+ * },
39
+ * strategy: function (extent, resolution) {
40
+ * if (this.resolution && this.resolution != resolution) {
41
+ * this.loadedExtentsRtree_.clear();
42
+ * }
43
+ * return [extent];
44
+ * }
45
+ * });
46
+ *
47
+ * vectorSource.loadFeatures(extent);
48
+ *
49
+ * console.log(extent);
50
+ *
51
+ * }
52
+ * });
53
+ */
54
+ class Selection extends Control {
55
+ constructor(options = {}) {
56
+ super(options);
57
+ this._activationIconClasses = options.activationIconClasses || null;
58
+
59
+ this._selectorScene = new SelectionScene({
60
+ name: `selectionScene:${this._id}`,
61
+ ignoreTerrain: options.ignoreTerrain,
62
+ onSelect: options.onSelect,
63
+ autoSelectionHide: options.autoSelectionHide
64
+ });
65
+
66
+
67
+
68
+ }
69
+
70
+ set ignoreTerrain(v) {
71
+ this._selectorScene.ignoreTerrain = v;
72
+ }
73
+
74
+ oninit() {
75
+ this.createSelectorButton();
76
+
77
+
78
+
79
+ btnClickHandler('og-selection-menu-btn', null, null,
80
+ '#og-selection-menu-icon',
81
+ (off) => {
82
+ if (off){
83
+ this.deactivate();
84
+ } else {
85
+ this.activate();
86
+ }
87
+ });
88
+
89
+ this._selectorScene.bindPlanet(this.planet);
90
+ }
91
+
92
+ onactivate() {
93
+ this.renderer.addNode(this._selectorScene);
94
+ }
95
+
96
+ ondeactivate() {
97
+ this.renderer.removeNode(this._selectorScene);
98
+ }
99
+
100
+ createSelectorButton() {
101
+ let btnIcon =
102
+ elementFactory('div',
103
+ {id: 'og-selection-menu-icon', class: 'og-icon-holder'});
104
+
105
+ btnIcon.setAttribute("style", "font-size:24px; display: flex; justify-content: center; align-items: center; background: none !important");
106
+
107
+ if (this._activationIconClasses){
108
+ btnIcon.classList.add(... this._activationIconClasses);
109
+ } else {
110
+ let defaultIcon = document.createElement("span");
111
+ defaultIcon.setAttribute("style", "width: 24px;height: 24px;border: 1px solid black;");
112
+ btnIcon.appendChild(defaultIcon);
113
+ }
114
+
115
+ let btn = elementFactory('div', {
116
+ id: 'og-selection-menu-btn',
117
+ class: 'og-geo-image-dragger og-menu-btn og-OFF'
118
+ },btnIcon);
119
+
120
+ btn.setAttribute("style", "top: 116px; right: 12px");
121
+
122
+
123
+ this.renderer.div.appendChild(btn);
124
+ }
125
+
126
+ }
127
+
128
+ export { Selection };
@@ -0,0 +1,364 @@
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 SelectionScene 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._onSelect = options.onSelect || null;
40
+
41
+ this._autoSelectionHide = options.autoSelectionHide || false;
42
+
43
+ this._planet = options.planet || null;
44
+
45
+ this._startLonLat = null;
46
+
47
+ this._heading = 0;
48
+
49
+ this._propsLabel = new Entity({
50
+ 'name': 'propsLabel',
51
+ 'label': {
52
+ text: "",
53
+ size: 11,
54
+ color: "rgba(455,455,455,1.0)",
55
+ outlineColor: "rgba(0,0,0,0.34)",
56
+ outline: 0.23,
57
+ align: "center",
58
+ offset: [0, 18]
59
+ }
60
+ });
61
+
62
+ this._propsLabel.label.setVisibility(false);
63
+
64
+ this._trackEntity = new Entity({
65
+ polyline: {
66
+ path3v: [],
67
+ thickness: 3.8,
68
+ color: "rgb(455,455,455)",
69
+ isClosed: false
70
+ }
71
+ });
72
+
73
+ this._trackEntity.polyline.altitude = 0.01;
74
+
75
+ let obj3d = Object3d.createCylinder(1.1, 0, 2.7, 20, 1, true, false, 0, 0, 0)
76
+
77
+ this._cornerEntity = [
78
+ new Entity({
79
+ geoObject: {
80
+ scale: 1,
81
+ instanced: true,
82
+ tag: "ruler",
83
+ color: "rgb(0,305,0)",
84
+ vertices: obj3d.vertices,
85
+ indices: obj3d.indexes,
86
+ normals: obj3d.normals
87
+ },
88
+ properties: {
89
+ name: "start"
90
+ }
91
+ }),
92
+ new Entity({
93
+ geoObject: {
94
+ scale: 1,
95
+ instanced: true,
96
+ tag: "ruler",
97
+ color: "rgb(455,0,0)",
98
+ vertices: obj3d.vertices,
99
+ indices: obj3d.indexes,
100
+ normals: obj3d.normals
101
+ },
102
+ properties: {
103
+ name: "end"
104
+ }
105
+
106
+ })
107
+ ];
108
+
109
+ this._trackLayer = new Vector("track", {
110
+ entities: [this._trackEntity, this._propsLabel],
111
+ pickingEnabled: false,
112
+ polygonOffsetUnits: -1.0,
113
+ relativeToGround: true,
114
+ displayInLayerSwitcher: false
115
+ });
116
+
117
+ this._cornersLayer = new Vector("corners", {
118
+ entities: [this._cornerEntity[0], this._cornerEntity[1]],
119
+ pickingEnabled: true,
120
+ displayInLayerSwitcher: false
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
+
146
+ this._onMouseMove_ = this._onMouseMove.bind(this);
147
+ this.renderer.events.on("mousemove", this._onMouseMove_, this);
148
+
149
+ this._onMouseLdown_ = this._onMouseLdown.bind(this);
150
+ this.renderer.events.on("ldown", this._onMouseLdown_, this);
151
+
152
+ this._onMouseLup_ = this._onMouseLup.bind(this);
153
+ this.renderer.events.on("lup", this._onMouseLup_, this);
154
+
155
+ this._planet.addLayer(this._trackLayer);
156
+ this._planet.addLayer(this._cornersLayer);
157
+
158
+ }
159
+
160
+ _deactivate() {
161
+ this._startLonLat = null;
162
+ this._trackLayer.remove();
163
+ this._cornersLayer.remove();
164
+ this.renderer.events.off("mousemove", this._onMouseMove_);
165
+ this.renderer.events.off("ldown", this._onMouseLdown_);
166
+ this.renderer.events.off("lup", this._onMouseLup_);
167
+
168
+ this.clear();
169
+
170
+ this._onMouseMove_ = null;
171
+ this._onMouseLdown_ = null;
172
+ this._onMouseLup_ = null;
173
+ }
174
+
175
+ _onMouseLdown(e) {
176
+
177
+ //workaround to show pointer, because ogGrabbingPoiner keep !importanti which override pointer style
178
+ e.renderer.handler.canvas.classList.remove('ogGrabbingPoiner');
179
+
180
+ e.renderer.handler.canvas.style.cursor = 'pointer';
181
+
182
+ if (!this._startLonLat) {
183
+
184
+
185
+
186
+ this._propsLabel.label.setVisibility(false);
187
+
188
+ this._trackEntity.polyline.setPath3v([]);
189
+
190
+
191
+
192
+ this._cornerEntity[0].geoObject.setVisibility(true);
193
+ this._cornerEntity[1].geoObject.setVisibility(true);
194
+
195
+ this.renderer.controls.mouseNavigation.deactivate();
196
+ this._startLonLat = this._planet.getLonLatFromPixelTerrain(e);
197
+
198
+ let startPos = this._planet.ellipsoid.lonLatToCartesian(this._startLonLat);
199
+ this._cornerEntity[0].setCartesian3v(startPos);
200
+ this._cornerEntity[1].setCartesian3v(startPos);
201
+ }
202
+ }
203
+
204
+ _onMouseLup(e) {
205
+ if (this._startLonLat) {
206
+
207
+ this._pickedCorner = null;
208
+ this._anchorLonLat = null;
209
+
210
+ if (this._onSelect && typeof this._onSelect === 'function') {
211
+ let startLonLat = this._cornerEntity[0].getLonLat();
212
+ let endLonLat = this._cornerEntity[1].getLonLat();
213
+
214
+ let extent = [
215
+ Math.min(startLonLat.lon, endLonLat.lon),
216
+ Math.min(startLonLat.lat, endLonLat.lat),
217
+ Math.max(startLonLat.lon, endLonLat.lon),
218
+ Math.max(startLonLat.lat, endLonLat.lat)
219
+ ];
220
+ this._onSelect(extent);
221
+ }
222
+
223
+ if (this._autoSelectionHide) {
224
+ this.clear();
225
+ }
226
+
227
+ this._startLonLat = null;
228
+ }
229
+ e.renderer.handler.canvas.style.cursor = 'default';
230
+ this.renderer.controls.mouseNavigation.activate();
231
+ }
232
+
233
+ _drawLine(startLonLat, endLonLat, startPos) {
234
+
235
+ if (!startPos) {
236
+ startPos = this._planet.ellipsoid.lonLatToCartesian(startLonLat);
237
+ }
238
+
239
+ let endPos = this._planet.ellipsoid.lonLatToCartesian(endLonLat);
240
+
241
+ let length = this._planet.ellipsoid.getGreatCircleDistance(startLonLat, endLonLat);
242
+
243
+ this._heading = Ellipsoid.getRhumbBearing(startLonLat, endLonLat);
244
+
245
+ let path = [];
246
+
247
+
248
+ this._cornerEntity[0].setCartesian3v(startPos);
249
+ this._cornerEntity[1].setCartesian3v(endPos);
250
+
251
+
252
+ let corners = [
253
+ startPos,
254
+ this._planet.ellipsoid.lonLatToCartesian(new LonLat(endLonLat.lon, startLonLat.lat, startLonLat.height)),
255
+ endPos,
256
+ this._planet.ellipsoid.lonLatToCartesian(new LonLat(startLonLat.lon, endLonLat.lat, startLonLat.height)),
257
+ startPos
258
+ ];
259
+
260
+
261
+ path.push(startPos);
262
+
263
+ let createPath = (sideA, sideB) => {
264
+ let dir = sideB.sub(sideA);
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(sideA);
270
+ path.push(f);
271
+ }
272
+ };
273
+
274
+ for (let i = 0; i < corners.length - 1; i++) {
275
+ createPath(corners[i], corners[i + 1]);
276
+ }
277
+
278
+ this._trackEntity.polyline.setPath3v([path]);
279
+
280
+ if (this._ignoreTerrain) {
281
+ // this._propsLabel.setCartesian3v(path[Math.floor(path.length / 2)]);
282
+ // this._propsLabel.label.setText(`${distanceFormat(length)}, ${Math.round(this._heading)} deg`);
283
+ }
284
+ }
285
+
286
+ _onMouseMove(e) {
287
+ if (this._startLonLat) {
288
+ this._propsLabel.label.setVisibility(true);
289
+ let endLonLat = this._planet.getLonLatFromPixelTerrain(e);
290
+ if (!endLonLat)
291
+ return;
292
+ this._drawLine(this._startLonLat, endLonLat);
293
+ }
294
+ }
295
+
296
+ clear() {
297
+ this._trackEntity.polyline.clear();
298
+ this._cornerEntity[0].geoObject.setVisibility(false);
299
+ this._cornerEntity[1].geoObject.setVisibility(false);
300
+ }
301
+
302
+ getScale(cart) {
303
+ let r = this.renderer;
304
+ let t = 1.0 - (r.activeCamera._lonLat.height - MAX_SCALE_HEIGHT) / (MIN_SCALE_HEIGHT - MAX_SCALE_HEIGHT);
305
+ let _distanceToCamera = cart.distance(r.activeCamera.eye);
306
+ return math.lerp(t < 0 ? 0 : t, MAX_SCALE, MIN_SCALE) * _distanceToCamera;
307
+ }
308
+
309
+ frame() {
310
+ let t = this._trackEntity.polyline.getPath3v()[0];
311
+ if (t) {
312
+ this._cornerEntity[0].geoObject.setScale(this.getScale(this._cornerEntity[0].getCartesian()));
313
+ this._cornerEntity[1].geoObject.setScale(this.getScale(this._cornerEntity[1].getCartesian()));
314
+
315
+ if (!this._ignoreTerrain) {
316
+ let res = 0;
317
+ for (let i = 0, len = t.length - 1; i < len; i++) {
318
+ res += t[i + 1].distance(t[i]);
319
+ }
320
+
321
+ // this._propsLabel.setCartesian3v(t[Math.floor(t.length / 2)]);
322
+ // this._propsLabel.label.setText(`${distanceFormat(res)}, ${Math.round(this._heading)} deg`);
323
+ }
324
+
325
+
326
+ }
327
+ }
328
+
329
+ get ellipsoid() {
330
+ return this._planet ? this._planet.ellipsoid : null;
331
+ }
332
+ }
333
+
334
+ const EVENT_NAMES = [
335
+ "add",
336
+ "remove",
337
+ "mousemove",
338
+ "mouseenter",
339
+ "mouseleave",
340
+ "lclick",
341
+ "rclick",
342
+ "mclick",
343
+ "ldblclick",
344
+ "rdblclick",
345
+ "mdblclick",
346
+ "lup",
347
+ "rup",
348
+ "mup",
349
+ "ldown",
350
+ "rdown",
351
+ "mdown",
352
+ "lhold",
353
+ "rhold",
354
+ "mhold",
355
+ "mousewheel",
356
+ "touchmove",
357
+ "touchstart",
358
+ "touchend",
359
+ "doubletouch",
360
+ "touchleave",
361
+ "touchenter"
362
+ ];
363
+
364
+ export { SelectionScene };
@@ -359,9 +359,9 @@ class Ellipsoid {
359
359
  */
360
360
  projToSurface(p) {
361
361
 
362
- let pX = p.x,
363
- pY = p.y,
364
- pZ = p.z;
362
+ let pX = p.x || 0.0,
363
+ pY = p.y || 0.0,
364
+ pZ = p.z || 0.0;
365
365
 
366
366
  let invRadii2X = this._invRadii2.x,
367
367
  invRadii2Y = this._invRadii2.y,
@@ -621,4 +621,4 @@ class Ellipsoid {
621
621
  }
622
622
  }
623
623
 
624
- export { Ellipsoid };
624
+ export { Ellipsoid };
@@ -338,9 +338,9 @@ class Entity {
338
338
  setCartesian(x, y, z) {
339
339
  let p = this._cartesian;
340
340
 
341
- p.x = isNaN(x) ? 0 : x;
342
- p.y = isNaN(y) ? 0 : y;
343
- p.z = isNaN(z) ? 0 : z;
341
+ p.x = x || 0.0;
342
+ p.y = y || 0.0;
343
+ p.z = z || 0.0;
344
344
 
345
345
  // billboards
346
346
  this.billboard && this.billboard.setPosition3v(p);
@@ -382,9 +382,9 @@ class Entity {
382
382
  _setCartesian3vSilent(cartesian, skipLonLat) {
383
383
  let p = this._cartesian;
384
384
 
385
- p.x = cartesian.x;
386
- p.y = cartesian.y;
387
- p.z = cartesian.z;
385
+ p.x = cartesian.x || 0.0;
386
+ p.y = cartesian.y || 0.0;
387
+ p.z = cartesian.z || 0.0;
388
388
 
389
389
  // billboards
390
390
  this.billboard && this.billboard.setPosition3v(p);