@openglobus/og 0.11.5 → 0.11.6
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 +5 -7
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +18 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +0 -1
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +0 -1
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +22 -12
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/ellipsoid/Ellipsoid.js +148 -56
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +65 -14
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +310 -64
- package/src/og/entity/Entity.js +39 -1
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +53 -18
- package/src/og/entity/LabelHandler.js +42 -244
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -16
- package/src/og/layer/GeoImage.js +6 -6
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +3 -3
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -16
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +60 -30
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +31 -17
- package/src/og/renderer/Renderer.js +23 -6
- package/src/og/renderer/RendererEvents.js +1 -1
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +2 -2
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shapes/BaseShape.js +107 -35
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/utils/TextureAtlas.js +16 -18
- package/src/og/utils/shared.js +1 -1
- package/src/og/webgl/Handler.js +68 -49
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +2 -2
- package/types/Extent.d.ts +1 -1
- package/types/Rectangle.d.ts +1 -1
- package/types/ajax.d.ts +1 -1
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +1 -1
- package/types/camera/Camera.d.ts +5 -5
- package/types/camera/Frustum.d.ts +6 -6
- package/types/camera/PlanetCamera.d.ts +8 -8
- package/types/control/Control.d.ts +1 -1
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Sun.d.ts +1 -1
- package/types/entity/BaseBillboard.d.ts +15 -8
- package/types/entity/Entity.d.ts +24 -9
- package/types/entity/EntityCollection.d.ts +15 -9
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +1 -1
- package/types/entity/GeometryHandler.d.ts +1 -1
- package/types/entity/Label.d.ts +3 -3
- package/types/entity/LabelHandler.d.ts +2 -0
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +1 -1
- package/types/entity/Polyline.d.ts +5 -5
- package/types/entity/Ray.d.ts +1 -1
- package/types/entity/Strip.d.ts +1 -1
- package/types/layer/BaseGeoImage.d.ts +3 -3
- package/types/layer/CanvasTiles.d.ts +5 -5
- package/types/layer/GeoImage.d.ts +1 -1
- package/types/layer/GeoVideo.d.ts +1 -1
- package/types/layer/Layer.d.ts +5 -5
- package/types/layer/Vector.d.ts +9 -9
- package/types/layer/XYZ.d.ts +3 -3
- package/types/light/LightSource.d.ts +7 -7
- package/types/math/Plane.d.ts +1 -1
- package/types/math/Ray.d.ts +1 -1
- package/types/math/Vec2.d.ts +34 -34
- package/types/math/Vec3.d.ts +1 -1
- package/types/math/Vec4.d.ts +1 -1
- package/types/math/coder.d.ts +1 -1
- package/types/math.d.ts +1 -1
- package/types/proj/Proj.d.ts +2 -2
- package/types/quadTree/Node.d.ts +1 -1
- package/types/renderer/Renderer.d.ts +12 -10
- package/types/renderer/RendererEvents.d.ts +1 -1
- package/types/scene/BaseNode.d.ts +4 -4
- package/types/scene/Planet.d.ts +40 -40
- package/types/scene/RenderNode.d.ts +9 -9
- package/types/segment/Segment.d.ts +9 -9
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +5 -5
- package/types/terrain/EmptyTerrain.d.ts +2 -2
- package/types/terrain/GlobusTerrain.d.ts +4 -4
- package/types/utils/TextureAtlas.d.ts +4 -4
- package/types/utils/shared.d.ts +9 -9
- package/types/webgl/Framebuffer.d.ts +1 -1
- package/types/webgl/Handler.d.ts +16 -7
- package/types/webgl/Multisample.d.ts +2 -2
- package/types/webgl/Program.d.ts +6 -0
- package/types/webgl/ProgramController.d.ts +1 -1
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
* @module og/entity/EntityCollection
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import * as math from
|
|
8
|
-
import { BillboardHandler } from
|
|
9
|
-
import { Events } from
|
|
10
|
-
import { LabelHandler } from
|
|
11
|
-
import { PolylineHandler } from
|
|
12
|
-
import { RayHandler } from
|
|
13
|
-
import { PointCloudHandler } from
|
|
14
|
-
import { StripHandler } from
|
|
15
|
-
import { ShapeHandler } from
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import * as math from "../math.js";
|
|
8
|
+
import { BillboardHandler } from "./BillboardHandler.js";
|
|
9
|
+
import { Events } from "../Events.js";
|
|
10
|
+
import { LabelHandler } from "./LabelHandler.js";
|
|
11
|
+
import { PolylineHandler } from "./PolylineHandler.js";
|
|
12
|
+
import { RayHandler } from "./RayHandler.js";
|
|
13
|
+
import { PointCloudHandler } from "./PointCloudHandler.js";
|
|
14
|
+
import { StripHandler } from "./StripHandler.js";
|
|
15
|
+
import { ShapeHandler } from "./ShapeHandler.js";
|
|
16
|
+
import { GeoObjectHandler } from "./GeoObjectHandler.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* An observable collection of og.Entity instances where each entity has a unique id.
|
|
@@ -65,7 +66,6 @@ import { ShapeHandler } from './ShapeHandler.js';
|
|
|
65
66
|
*/
|
|
66
67
|
class EntityCollection {
|
|
67
68
|
constructor(options) {
|
|
68
|
-
|
|
69
69
|
options = options || {};
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -101,14 +101,16 @@ class EntityCollection {
|
|
|
101
101
|
* @public
|
|
102
102
|
* @type {Number}
|
|
103
103
|
*/
|
|
104
|
-
this.polygonOffsetFactor =
|
|
104
|
+
this.polygonOffsetFactor =
|
|
105
|
+
options.polygonOffsetFactor != undefined ? options.polygonOffsetFactor : 0.0;
|
|
105
106
|
|
|
106
107
|
/**
|
|
107
108
|
* Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
|
|
108
109
|
* @public
|
|
109
110
|
* @type {Number}
|
|
110
111
|
*/
|
|
111
|
-
this.polygonOffsetUnits =
|
|
112
|
+
this.polygonOffsetUnits =
|
|
113
|
+
options.polygonOffsetUnits != undefined ? options.polygonOffsetUnits : 0.0;
|
|
112
114
|
|
|
113
115
|
/**
|
|
114
116
|
* Billboards handler
|
|
@@ -159,6 +161,13 @@ class EntityCollection {
|
|
|
159
161
|
*/
|
|
160
162
|
this.stripHandler = new StripHandler(this);
|
|
161
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Geo object handler
|
|
166
|
+
* @public
|
|
167
|
+
* @type {og.GeoObjectHandler}
|
|
168
|
+
*/
|
|
169
|
+
this.geoObjectHandler = new GeoObjectHandler(this);
|
|
170
|
+
|
|
162
171
|
if (options.pickingEnabled != undefined) {
|
|
163
172
|
this.setPickingEnabled(options.pickingEnabled);
|
|
164
173
|
}
|
|
@@ -268,6 +277,7 @@ class EntityCollection {
|
|
|
268
277
|
this.shapeHandler.pickingEnabled = enable;
|
|
269
278
|
this.pointCloudHandler.pickingEnabled = enable;
|
|
270
279
|
this.stripHandler.pickingEnabled = enable;
|
|
280
|
+
this.geoObjectHandler.pickingEnabled = enable;
|
|
271
281
|
}
|
|
272
282
|
|
|
273
283
|
/**
|
|
@@ -293,7 +303,6 @@ class EntityCollection {
|
|
|
293
303
|
}
|
|
294
304
|
|
|
295
305
|
_addRecursively(entity) {
|
|
296
|
-
|
|
297
306
|
// billboard
|
|
298
307
|
entity.billboard && this.billboardHandler.add(entity.billboard);
|
|
299
308
|
|
|
@@ -315,6 +324,9 @@ class EntityCollection {
|
|
|
315
324
|
// strip
|
|
316
325
|
entity.strip && this.stripHandler.add(entity.strip);
|
|
317
326
|
|
|
327
|
+
//geoObject
|
|
328
|
+
entity.geoObject && this.geoObjectHandler.add(entity.geoObject);
|
|
329
|
+
|
|
318
330
|
this.events.dispatch(this.events.entityadd, entity);
|
|
319
331
|
|
|
320
332
|
for (var i = 0; i < entity.childrenNodes.length; i++) {
|
|
@@ -369,7 +381,10 @@ class EntityCollection {
|
|
|
369
381
|
* @returns {boolean} -
|
|
370
382
|
*/
|
|
371
383
|
belongs(entity) {
|
|
372
|
-
return (
|
|
384
|
+
return (
|
|
385
|
+
entity._entityCollection &&
|
|
386
|
+
this._renderNodeIndex === entity._entityCollection._renderNodeIndex
|
|
387
|
+
);
|
|
373
388
|
}
|
|
374
389
|
|
|
375
390
|
_removeRecursively(entity) {
|
|
@@ -397,6 +412,9 @@ class EntityCollection {
|
|
|
397
412
|
// strip
|
|
398
413
|
entity.strip && this.stripHandler.remove(entity.strip);
|
|
399
414
|
|
|
415
|
+
// geoObject
|
|
416
|
+
entity.geoObject && this.geoObjectHandler.remove(entity.geoObject);
|
|
417
|
+
|
|
400
418
|
for (var i = 0; i < entity.childrenNodes.length; i++) {
|
|
401
419
|
this._removeRecursively(entity.childrenNodes[i]);
|
|
402
420
|
}
|
|
@@ -493,13 +511,13 @@ class EntityCollection {
|
|
|
493
511
|
* @param {RenderNode} renderNode
|
|
494
512
|
*/
|
|
495
513
|
bindRenderNode(renderNode) {
|
|
496
|
-
|
|
497
514
|
if (renderNode.renderer) {
|
|
498
|
-
|
|
499
515
|
this.billboardHandler.setRenderer(renderNode.renderer);
|
|
500
516
|
this.labelHandler.setRenderer(renderNode.renderer);
|
|
501
517
|
this.rayHandler.setRenderer(renderNode.renderer);
|
|
502
518
|
|
|
519
|
+
this.geoObjectHandler.setRenderNode(renderNode);
|
|
520
|
+
|
|
503
521
|
this.shapeHandler.setRenderNode(renderNode);
|
|
504
522
|
this.polylineHandler.setRenderNode(renderNode);
|
|
505
523
|
this.pointCloudHandler.setRenderNode(renderNode);
|
|
@@ -542,9 +560,10 @@ class EntityCollection {
|
|
|
542
560
|
*/
|
|
543
561
|
updateLabelsFontAtlas() {
|
|
544
562
|
if (this.renderNode) {
|
|
545
|
-
var l = this.labelHandler._billboards;
|
|
546
|
-
|
|
547
|
-
|
|
563
|
+
var l = [].concat(this.labelHandler._billboards);
|
|
564
|
+
this.labelHandler._billboards = [];
|
|
565
|
+
for (var i = 0; i < l.length; i++) {
|
|
566
|
+
this.labelHandler.assignFontAtlas(l[i]);
|
|
548
567
|
}
|
|
549
568
|
}
|
|
550
569
|
}
|
|
@@ -558,7 +577,11 @@ class EntityCollection {
|
|
|
558
577
|
if (this._renderNodeIndex !== -1) {
|
|
559
578
|
this.renderNode.entityCollections.splice(this._renderNodeIndex, 1);
|
|
560
579
|
// reindex in the renderNode
|
|
561
|
-
for (
|
|
580
|
+
for (
|
|
581
|
+
var i = this._renderNodeIndex;
|
|
582
|
+
i < this.renderNode.entityCollections.length;
|
|
583
|
+
i++
|
|
584
|
+
) {
|
|
562
585
|
this.renderNode.entityCollections._renderNodeIndex = i;
|
|
563
586
|
}
|
|
564
587
|
}
|
|
@@ -595,7 +618,6 @@ class EntityCollection {
|
|
|
595
618
|
* @public
|
|
596
619
|
*/
|
|
597
620
|
clear() {
|
|
598
|
-
|
|
599
621
|
// TODO: Optimize by replace delete
|
|
600
622
|
// code to the clearEntity function.
|
|
601
623
|
this.billboardHandler.clear();
|
|
@@ -605,6 +627,7 @@ class EntityCollection {
|
|
|
605
627
|
this.rayHandler.clear();
|
|
606
628
|
this.pointCloudHandler.clear();
|
|
607
629
|
this.stripHandler.clear();
|
|
630
|
+
this.geoObjectHandler.clear();
|
|
608
631
|
|
|
609
632
|
var i = this._entities.length;
|
|
610
633
|
while (i--) {
|
|
@@ -833,4 +856,4 @@ const EVENT_NAMES = [
|
|
|
833
856
|
"touchenter"
|
|
834
857
|
];
|
|
835
858
|
|
|
836
|
-
export { EntityCollection };
|
|
859
|
+
export { EntityCollection };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module og/shape/BaseShape
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import { Quat, Vec3 } from "../math/index.js";
|
|
8
|
+
import { MAX32, RADIANS, lerp } from "../math.js";
|
|
9
|
+
import { LonLat } from "../LonLat.js";
|
|
10
|
+
import * as utils from "../utils/shared.js";
|
|
11
|
+
import { Planet } from "../scene/Planet.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @class
|
|
15
|
+
* @param {Object} options - Geo object parameters:
|
|
16
|
+
* @param {og.Vec3} [options.position] - Geo object position.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
class GeoObject {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
options = options || {};
|
|
22
|
+
|
|
23
|
+
this.scale = options.scale || 0.02;
|
|
24
|
+
this.scaleByDistance = new Float32Array(options.scaleByDistance || [MAX32, MAX32, MAX32]);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Geo object center cartesian position.
|
|
28
|
+
* @protected
|
|
29
|
+
* @type {og.Vec3}
|
|
30
|
+
*/
|
|
31
|
+
this._position = utils.createVector3(options.position);
|
|
32
|
+
|
|
33
|
+
this._positionHigh = new Vec3();
|
|
34
|
+
|
|
35
|
+
this._positionLow = new Vec3();
|
|
36
|
+
|
|
37
|
+
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
38
|
+
|
|
39
|
+
this._pitch = options.pitch || 0.0;
|
|
40
|
+
this._yaw = options.yaw || 0.0;
|
|
41
|
+
this._roll = options.roll || 0.0;
|
|
42
|
+
|
|
43
|
+
this._planet = options.planet || null;
|
|
44
|
+
this._lonLatAlt = new LonLat(0, 0, 100000);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* RGBA color.
|
|
48
|
+
* @protected
|
|
49
|
+
* @type {og.Vec4}
|
|
50
|
+
*/
|
|
51
|
+
this._color = utils.createColorRGBA(options.color);
|
|
52
|
+
|
|
53
|
+
this._direction = new Vec3(0, 0, 0);
|
|
54
|
+
|
|
55
|
+
this._handler = null;
|
|
56
|
+
this._handlerIndex = -1;
|
|
57
|
+
this._vertices = options.vertices;
|
|
58
|
+
this._normals = options.normals;
|
|
59
|
+
this._indices = options.indices;
|
|
60
|
+
this.instanced = options.instanced;
|
|
61
|
+
this.tag = options.tag || "none";
|
|
62
|
+
if (options.indices) {
|
|
63
|
+
this._indicesCount = options.indices.length;
|
|
64
|
+
}
|
|
65
|
+
if (options.vertices) {
|
|
66
|
+
this._verticesCount = Math.floor(options.vertices.length / 3);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get planet() {
|
|
71
|
+
return this._handler && this._handler._planet;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get renderer() {
|
|
75
|
+
return this.planet && this.planet.renderer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Sets geo object opacity.
|
|
80
|
+
* @public
|
|
81
|
+
* @param {number} a - Billboard opacity.
|
|
82
|
+
*/
|
|
83
|
+
setOpacity(a) {
|
|
84
|
+
this._color.w = a;
|
|
85
|
+
this.setColor(this._color.x, this._color.y, this._color.z, a);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Sets RGBA color. Each channel from 0.0 to 1.0.
|
|
90
|
+
* @public
|
|
91
|
+
* @param {number} r - Red.
|
|
92
|
+
* @param {number} g - Green.
|
|
93
|
+
* @param {number} b - Blue.
|
|
94
|
+
* @param {number} a - Alpha.
|
|
95
|
+
*/
|
|
96
|
+
setColor(r, g, b, a) {
|
|
97
|
+
this._color.x = r;
|
|
98
|
+
this._color.y = g;
|
|
99
|
+
this._color.z = b;
|
|
100
|
+
a != undefined && (this._color.w = a);
|
|
101
|
+
this._handler && this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Sets RGBA color. Each channel from 0.0 to 1.0.
|
|
106
|
+
* @public
|
|
107
|
+
* @param {og.Vec4} color - RGBA vector.
|
|
108
|
+
*/
|
|
109
|
+
setColor4v(color) {
|
|
110
|
+
this._color.x = color.x;
|
|
111
|
+
this._color.y = color.y;
|
|
112
|
+
this._color.z = color.z;
|
|
113
|
+
color.w != undefined && (this._color.w = color.w);
|
|
114
|
+
this._handler && this._handler.setRgbaArr(this._handlerIndex, color);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Sets geo object visibility.
|
|
119
|
+
* @public
|
|
120
|
+
* @param {boolean} visibility - Visibility flag.
|
|
121
|
+
*/
|
|
122
|
+
setVisibility(visibility) {
|
|
123
|
+
this._visibility = visibility;
|
|
124
|
+
this._handler && this._handler.setVisibility(this._handlerIndex, visibility);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns geo object visibility.
|
|
129
|
+
* @public
|
|
130
|
+
* @returns {boolean}
|
|
131
|
+
*/
|
|
132
|
+
getVisibility() {
|
|
133
|
+
return this._visibility;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
setLonLat(lon, lat, alt) {
|
|
137
|
+
this._lonLatAlt.lon = lon;
|
|
138
|
+
this._lonLatAlt.lat = lat;
|
|
139
|
+
this._lonLatAlt.height = alt;
|
|
140
|
+
this._handler._planet.ellipsoid.lonLatToCartesianRes(this._lonLatAlt, this._position);
|
|
141
|
+
this.setPosition3v(this._position);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Sets geoObject position.
|
|
146
|
+
* @public
|
|
147
|
+
* @param {number} x - X coordinate.
|
|
148
|
+
* @param {number} y - Y coordinate.
|
|
149
|
+
* @param {number} z - Z coordinate.
|
|
150
|
+
*/
|
|
151
|
+
setPosition(x, y, z) {
|
|
152
|
+
this._position.x = x;
|
|
153
|
+
this._position.y = y;
|
|
154
|
+
this._position.z = z;
|
|
155
|
+
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
156
|
+
this._handler &&
|
|
157
|
+
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
158
|
+
this.updateDirection();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Sets billboard position.
|
|
163
|
+
* @public
|
|
164
|
+
* @param {og.Vec3} position - Cartesian coordinates.
|
|
165
|
+
*/
|
|
166
|
+
setPosition3v(position) {
|
|
167
|
+
this._position.x = position.x;
|
|
168
|
+
this._position.y = position.y;
|
|
169
|
+
this._position.z = position.z;
|
|
170
|
+
Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
|
|
171
|
+
this._handler &&
|
|
172
|
+
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
173
|
+
this.updateDirection();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setYaw(yaw) {
|
|
177
|
+
this._yaw = yaw;
|
|
178
|
+
this.updateDirection();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
setPitch(pitch) {
|
|
182
|
+
this._pitch = pitch;
|
|
183
|
+
this._handler && this._handler.setPitchRollArr(this._handlerIndex, pitch, this._roll);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setRoll(roll) {
|
|
187
|
+
this._roll = roll;
|
|
188
|
+
this._handler && this._handler.setPitchRollArr(this._handlerIndex, this._pitch, roll);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
setScale(scale) {
|
|
192
|
+
this.scale = scale;
|
|
193
|
+
this._handler && this._handler.setScaleArr(this._handlerIndex, scale);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Removes geo object from handler.
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
remove() {
|
|
201
|
+
this._entity = null;
|
|
202
|
+
this._handler && this._handler.remove(this);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Sets billboard picking color.
|
|
207
|
+
* @public
|
|
208
|
+
* @param {og.Vec3} color - Picking color.
|
|
209
|
+
*/
|
|
210
|
+
setPickingColor3v(color) {
|
|
211
|
+
this._handler && this._handler.setPickingColorArr(this._handlerIndex, color);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
updateDirection() {
|
|
215
|
+
if (this._entity && this._entity.renderNode && this._entity.renderNode.ellipsoid) {
|
|
216
|
+
this._entity.renderNode.ellipsoid.lonLatToCartesianRes(this._lonLatAlt, this._position);
|
|
217
|
+
}
|
|
218
|
+
this._qNorthFrame = Planet.getBearingNorthRotationQuat(this._position);
|
|
219
|
+
|
|
220
|
+
let qq = Quat.yRotation(this._yaw * RADIANS)
|
|
221
|
+
.mul(this._qNorthFrame)
|
|
222
|
+
.conjugate();
|
|
223
|
+
this._direction = qq.mulVec3(new Vec3(0.0, 0.0, -1.0)).normalize();
|
|
224
|
+
this._handler && this._handler.setDirectionArr(this._handlerIndex, this._direction);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { GeoObject };
|