@openglobus/og 0.21.0 → 0.22.0
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/lib/@openglobus/js/Globe.d.ts +4 -0
- package/lib/@openglobus/js/Object3d.d.ts +7 -2
- package/lib/@openglobus/js/camera/Camera.d.ts +2 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +58 -0
- package/lib/@openglobus/js/ellipsoid/Ellipsoid.d.ts +1 -1
- package/lib/@openglobus/js/ellipsoid/index.d.ts +4 -3
- package/lib/@openglobus/js/ellipsoid/mars.d.ts +6 -0
- package/lib/@openglobus/js/ellipsoid/moon.d.ts +6 -0
- package/lib/@openglobus/js/entity/Entity.d.ts +4 -2
- package/lib/@openglobus/js/entity/EntityCollection.d.ts +3 -2
- package/lib/@openglobus/js/entity/GeoObject.d.ts +6 -1
- package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +4 -0
- package/lib/@openglobus/js/entity/Label.d.ts +14 -0
- package/lib/@openglobus/js/entity/LabelHandler.d.ts +1 -1
- package/lib/@openglobus/js/index.d.ts +3 -3
- package/lib/@openglobus/js/layer/Vector.d.ts +12 -29
- package/lib/@openglobus/js/proj/equi.d.ts +9 -0
- package/lib/@openglobus/js/quadTree/{EPSG4326QuadTreeStrategy.d.ts → EPSG4326/EPSG4326QuadTreeStrategy.d.ts} +2 -2
- package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +5 -13
- package/lib/@openglobus/js/quadTree/EntityCollectionsTreeStrategy.d.ts +25 -0
- package/lib/@openglobus/js/quadTree/QuadTreeStrategy.d.ts +11 -0
- package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +18 -0
- package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +19 -0
- package/lib/@openglobus/js/quadTree/earth/EarthQuadTreeStrategy.d.ts +29 -0
- package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +17 -0
- package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +17 -0
- package/lib/@openglobus/js/quadTree/equi/EquiQuadTreeStrategy.d.ts +19 -0
- package/lib/@openglobus/js/quadTree/index.d.ts +6 -6
- package/lib/{js/quadTree → @openglobus/js/quadTree/wgs84}/Wgs84QuadTreeStrategy.d.ts +2 -2
- package/lib/@openglobus/js/renderer/Renderer.d.ts +2 -0
- package/lib/@openglobus/js/scene/Planet.d.ts +0 -27
- package/lib/@openglobus/js/segment/Segment.d.ts +0 -1
- package/lib/@openglobus/js/segment/SegmentLonLat.d.ts +0 -4
- package/lib/@openglobus/js/segment/{SegmentLonLatWgs84.d.ts → SegmentLonLatEqui.d.ts} +1 -1
- package/lib/@openglobus/js/terrain/RgbTerrain.d.ts +11 -0
- package/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/@openglobus/res/fonts/Ephesis-Regular.json +4648 -0
- package/lib/@openglobus/res/fonts/Ephesis-Regular.ttf.cfg +1282 -0
- package/lib/@openglobus/res/fonts/Ephesis-Regular.ttf.png +0 -0
- package/lib/js/Globe.d.ts +4 -0
- package/lib/js/Globe.js +6 -2
- package/lib/js/Object3d.d.ts +7 -2
- package/lib/js/Object3d.js +46 -6
- package/lib/js/camera/Camera.d.ts +2 -0
- package/lib/js/camera/Camera.js +8 -0
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +2 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +58 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +105 -0
- package/lib/js/ellipsoid/Ellipsoid.d.ts +1 -1
- package/lib/js/ellipsoid/Ellipsoid.js +1 -1
- package/lib/js/ellipsoid/index.d.ts +4 -3
- package/lib/js/ellipsoid/index.js +4 -3
- package/lib/js/ellipsoid/mars.d.ts +6 -0
- package/lib/js/ellipsoid/mars.js +6 -0
- package/lib/js/ellipsoid/moon.d.ts +6 -0
- package/lib/js/ellipsoid/moon.js +6 -0
- package/lib/js/entity/Entity.d.ts +4 -2
- package/lib/js/entity/Entity.js +4 -1
- package/lib/js/entity/EntityCollection.d.ts +3 -2
- package/lib/js/entity/EntityCollection.js +26 -2
- package/lib/js/entity/GeoObject.d.ts +6 -1
- package/lib/js/entity/GeoObject.js +9 -0
- package/lib/js/entity/GeoObjectHandler.d.ts +4 -0
- package/lib/js/entity/GeoObjectHandler.js +32 -1
- package/lib/js/entity/GeometryHandler.js +16 -14
- package/lib/js/entity/Label.d.ts +14 -0
- package/lib/js/entity/Label.js +24 -4
- package/lib/js/entity/LabelHandler.d.ts +1 -1
- package/lib/js/entity/LabelHandler.js +4 -4
- package/lib/js/entity/Polyline.js +1 -1
- package/lib/js/index.d.ts +3 -3
- package/lib/js/index.js +3 -3
- package/lib/js/layer/Layer.js +7 -4
- package/lib/js/layer/Vector.d.ts +12 -29
- package/lib/js/layer/Vector.js +36 -161
- package/lib/js/layer/XYZ.js +1 -1
- package/lib/js/proj/equi.d.ts +9 -0
- package/lib/js/proj/equi.js +9 -0
- package/lib/js/quadTree/{EPSG4326QuadTreeStrategy.d.ts → EPSG4326/EPSG4326QuadTreeStrategy.d.ts} +2 -2
- package/lib/js/quadTree/EPSG4326/EPSG4326QuadTreeStrategy.js +16 -0
- package/lib/js/quadTree/EntityCollectionNode.d.ts +5 -13
- package/lib/js/quadTree/EntityCollectionNode.js +18 -83
- package/lib/js/quadTree/EntityCollectionsTreeStrategy.d.ts +25 -0
- package/lib/js/quadTree/EntityCollectionsTreeStrategy.js +49 -0
- package/lib/js/quadTree/Node.js +6 -12
- package/lib/js/quadTree/QuadTreeStrategy.d.ts +11 -0
- package/lib/js/quadTree/QuadTreeStrategy.js +12 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +18 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +74 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +19 -0
- package/lib/js/quadTree/earth/EarthEntityCollectionsTreeStrategy.js +103 -0
- package/lib/js/quadTree/earth/EarthQuadTreeStrategy.d.ts +29 -0
- package/lib/js/quadTree/{EarthQuadTreeStrategy.js → earth/EarthQuadTreeStrategy.js} +29 -6
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +17 -0
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +70 -0
- package/lib/js/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +17 -0
- package/lib/js/quadTree/equi/EquiEntityCollectionsTreeStrategy.js +75 -0
- package/lib/js/quadTree/equi/EquiQuadTreeStrategy.d.ts +19 -0
- package/lib/js/quadTree/equi/EquiQuadTreeStrategy.js +62 -0
- package/lib/js/quadTree/index.d.ts +6 -6
- package/lib/js/quadTree/index.js +6 -6
- package/lib/{@openglobus/js/quadTree → js/quadTree/wgs84}/Wgs84QuadTreeStrategy.d.ts +2 -2
- package/lib/js/quadTree/wgs84/Wgs84QuadTreeStrategy.js +15 -0
- package/lib/js/renderer/Renderer.d.ts +2 -0
- package/lib/js/renderer/Renderer.js +2 -2
- package/lib/js/scene/Planet.d.ts +0 -27
- package/lib/js/scene/Planet.js +2 -9
- package/lib/js/segment/Segment.d.ts +0 -1
- package/lib/js/segment/Segment.js +0 -3
- package/lib/js/segment/SegmentLonLat.d.ts +0 -4
- package/lib/js/segment/SegmentLonLat.js +0 -11
- package/lib/js/segment/{SegmentLonLatWgs84.d.ts → SegmentLonLatEqui.d.ts} +1 -1
- package/lib/js/segment/{SegmentLonLatWgs84.js → SegmentLonLatEqui.js} +3 -1
- package/lib/js/shaders/geoObject.js +10 -5
- package/lib/js/shaders/polyline.js +8 -6
- package/lib/js/terrain/RgbTerrain.d.ts +11 -0
- package/lib/js/terrain/RgbTerrain.js +12 -1
- package/lib/js/utils/PlainSegmentWorker.js +3 -1
- package/lib/js/webgl/Handler.js +1 -1
- package/package.json +2 -2
- package/lib/@openglobus/js/quadTree/EarthQuadTreeStrategy.d.ts +0 -9
- package/lib/@openglobus/js/quadTree/MarsQuadTreeStrategy.d.ts +0 -11
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +0 -16
- package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +0 -9
- package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +0 -11
- package/lib/js/quadTree/MarsQuadTreeStrategy.js +0 -43
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +0 -15
|
@@ -11,6 +11,7 @@ const SIZE_BUFFER = 6;
|
|
|
11
11
|
const PICKINGCOLOR_BUFFER = 7;
|
|
12
12
|
const VISIBLE_BUFFER = 8;
|
|
13
13
|
const TEXCOORD_BUFFER = 9;
|
|
14
|
+
const TRANSLATE_BUFFER = 10;
|
|
14
15
|
function setParametersToArray(arr, index = 0, length = 0, itemSize = 1, ...params) {
|
|
15
16
|
const currIndex = index * length;
|
|
16
17
|
for (let i = currIndex, len = currIndex + length; i < len; i++) {
|
|
@@ -34,6 +35,7 @@ class InstanceData {
|
|
|
34
35
|
this._texture = null;
|
|
35
36
|
this._textureSrc = null;
|
|
36
37
|
this._sizeArr = [];
|
|
38
|
+
this._translateArr = [];
|
|
37
39
|
this._vertexArr = [];
|
|
38
40
|
this._positionHighArr = [];
|
|
39
41
|
this._positionLowArr = [];
|
|
@@ -45,6 +47,7 @@ class InstanceData {
|
|
|
45
47
|
this._visibleArr = [];
|
|
46
48
|
this._texCoordArr = [];
|
|
47
49
|
this._sizeBuffer = null;
|
|
50
|
+
this._translateBuffer = null;
|
|
48
51
|
this._vertexBuffer = null;
|
|
49
52
|
this._positionHighBuffer = null;
|
|
50
53
|
this._positionLowBuffer = null;
|
|
@@ -66,6 +69,7 @@ class InstanceData {
|
|
|
66
69
|
this._buffersUpdateCallbacks[VISIBLE_BUFFER] = this.createVisibleBuffer;
|
|
67
70
|
this._buffersUpdateCallbacks[TEXCOORD_BUFFER] = this.createTexCoordBuffer;
|
|
68
71
|
this._buffersUpdateCallbacks[QROT_BUFFER] = this.createQRotBuffer;
|
|
72
|
+
this._buffersUpdateCallbacks[TRANSLATE_BUFFER] = this.createTranslateBuffer;
|
|
69
73
|
this._changedBuffers = new Array(this._buffersUpdateCallbacks.length);
|
|
70
74
|
}
|
|
71
75
|
createTexture(image) {
|
|
@@ -77,6 +81,7 @@ class InstanceData {
|
|
|
77
81
|
this.numInstances = 0;
|
|
78
82
|
this.geoObjects = [];
|
|
79
83
|
this._sizeArr = [];
|
|
84
|
+
this._translateArr = [];
|
|
80
85
|
this._vertexArr = [];
|
|
81
86
|
this._positionHighArr = [];
|
|
82
87
|
this._positionLowArr = [];
|
|
@@ -97,6 +102,7 @@ class InstanceData {
|
|
|
97
102
|
h.deleteTexture(this._texture);
|
|
98
103
|
this._texture = null;
|
|
99
104
|
gl.deleteBuffer(this._sizeBuffer);
|
|
105
|
+
gl.deleteBuffer(this._translateBuffer);
|
|
100
106
|
gl.deleteBuffer(this._vertexBuffer);
|
|
101
107
|
gl.deleteBuffer(this._positionHighBuffer);
|
|
102
108
|
gl.deleteBuffer(this._positionLowBuffer);
|
|
@@ -109,6 +115,7 @@ class InstanceData {
|
|
|
109
115
|
gl.deleteBuffer(this._texCoordBuffer);
|
|
110
116
|
}
|
|
111
117
|
this._sizeBuffer = null;
|
|
118
|
+
this._translateBuffer = null;
|
|
112
119
|
this._vertexBuffer = null;
|
|
113
120
|
this._positionHighBuffer = null;
|
|
114
121
|
this._positionLowBuffer = null;
|
|
@@ -144,6 +151,15 @@ class InstanceData {
|
|
|
144
151
|
this._sizeArr = makeArrayTyped(this._sizeArr);
|
|
145
152
|
h.setStreamArrayBuffer(this._sizeBuffer, this._sizeArr);
|
|
146
153
|
}
|
|
154
|
+
createTranslateBuffer() {
|
|
155
|
+
let h = this._geoObjectHandler._planet.renderer.handler, numItems = this._translateArr.length / 3;
|
|
156
|
+
if (!this._translateBuffer || this._translateBuffer.numItems !== numItems) {
|
|
157
|
+
h.gl.deleteBuffer(this._translateBuffer);
|
|
158
|
+
this._translateBuffer = h.createStreamArrayBuffer(3, numItems);
|
|
159
|
+
}
|
|
160
|
+
this._translateArr = makeArrayTyped(this._translateArr);
|
|
161
|
+
h.setStreamArrayBuffer(this._translateBuffer, this._translateArr);
|
|
162
|
+
}
|
|
147
163
|
createTexCoordBuffer() {
|
|
148
164
|
const h = this._geoObjectHandler._planet.renderer.handler;
|
|
149
165
|
h.gl.deleteBuffer(this._texCoordBuffer);
|
|
@@ -344,6 +360,11 @@ class GeoObjectHandler {
|
|
|
344
360
|
y = scale.y;
|
|
345
361
|
z = scale.z;
|
|
346
362
|
tagData._sizeArr = concatArrays(tagData._sizeArr, setParametersToArray([], 0, itemSize, itemSize, x, y, z));
|
|
363
|
+
let translate = geoObject.getTranslate();
|
|
364
|
+
x = translate.x;
|
|
365
|
+
y = translate.y;
|
|
366
|
+
z = translate.z;
|
|
367
|
+
tagData._translateArr = concatArrays(tagData._translateArr, setParametersToArray([], 0, itemSize, itemSize, x, y, z));
|
|
347
368
|
}
|
|
348
369
|
_displayPASS() {
|
|
349
370
|
let r = this._planet.renderer, sh = r.handler.programs.geo_object, p = sh._program, u = p.uniforms, a = p.attributes, gl = r.handler.gl, ec = this._entityCollection;
|
|
@@ -370,6 +391,8 @@ class GeoObjectHandler {
|
|
|
370
391
|
gl.vertexAttribPointer(a.qRot, tagData._qRotBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
371
392
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._sizeBuffer);
|
|
372
393
|
gl.vertexAttribPointer(a.aScale, tagData._sizeBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
394
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._translateBuffer);
|
|
395
|
+
gl.vertexAttribPointer(a.aTranslate, tagData._translateBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
373
396
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._rgbaBuffer);
|
|
374
397
|
gl.vertexAttribPointer(a.aColor, tagData._rgbaBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
375
398
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._visibleBuffer);
|
|
@@ -405,7 +428,7 @@ class GeoObjectHandler {
|
|
|
405
428
|
let r = this._planet.renderer, sh = r.handler.programs.geo_object_picking, p = sh._program, u = p.uniforms, a = p.attributes, gl = r.handler.gl, ec = this._entityCollection;
|
|
406
429
|
sh.activate();
|
|
407
430
|
gl.uniform3fv(u.uScaleByDistance, ec.scaleByDistance);
|
|
408
|
-
gl.
|
|
431
|
+
gl.uniform3fv(u.pickingScale, ec.pickingScale);
|
|
409
432
|
gl.uniform3fv(u.eyePositionHigh, r.activeCamera.eyeHigh);
|
|
410
433
|
gl.uniform3fv(u.eyePositionLow, r.activeCamera.eyeLow);
|
|
411
434
|
gl.uniformMatrix4fv(u.projectionMatrix, false, r.activeCamera.getProjectionMatrix());
|
|
@@ -419,6 +442,8 @@ class GeoObjectHandler {
|
|
|
419
442
|
gl.vertexAttribPointer(a.qRot, tagData._qRotBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
420
443
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._sizeBuffer);
|
|
421
444
|
gl.vertexAttribPointer(a.aScale, tagData._sizeBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
445
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._translateBuffer);
|
|
446
|
+
gl.vertexAttribPointer(a.aTranslate, tagData._translateBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
422
447
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._pickingColorBuffer);
|
|
423
448
|
gl.vertexAttribPointer(a.aPickingColor, tagData._pickingColorBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
424
449
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._positionHighBuffer);
|
|
@@ -478,6 +503,11 @@ class GeoObjectHandler {
|
|
|
478
503
|
tagData._changedBuffers[SIZE_BUFFER] = true;
|
|
479
504
|
this._updateTag(tagData);
|
|
480
505
|
}
|
|
506
|
+
setTranslateArr(tagData, tagDataIndex, translate) {
|
|
507
|
+
setParametersToArray(tagData._translateArr, tagDataIndex, 3, 3, translate.x, translate.y, translate.z);
|
|
508
|
+
tagData._changedBuffers[TRANSLATE_BUFFER] = true;
|
|
509
|
+
this._updateTag(tagData);
|
|
510
|
+
}
|
|
481
511
|
_updateTag(dataTag) {
|
|
482
512
|
if (dataTag.isFree) {
|
|
483
513
|
dataTag.isFree = false;
|
|
@@ -566,6 +596,7 @@ class GeoObjectHandler {
|
|
|
566
596
|
tagData._qRotArr = spliceArray(tagData._qRotArr, tdi * 4, 4);
|
|
567
597
|
tagData._pickingColorArr = spliceArray(tagData._pickingColorArr, tdi * 3, 3);
|
|
568
598
|
tagData._sizeArr = spliceArray(tagData._sizeArr, tdi * 3, 3);
|
|
599
|
+
tagData._translateArr = spliceArray(tagData._translateArr, tdi * 3, 3);
|
|
569
600
|
tagData._visibleArr = spliceArray(tagData._visibleArr, tdi, 1);
|
|
570
601
|
geoObject._handlerIndex = -1;
|
|
571
602
|
geoObject._handler = null;
|
|
@@ -722,20 +722,22 @@ class GeometryHandler {
|
|
|
722
722
|
_deleteBuffers() {
|
|
723
723
|
if (this._layer._planet && this._layer._planet.renderer) {
|
|
724
724
|
let h = this._layer._planet.renderer.handler, gl = h.gl;
|
|
725
|
-
gl
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
725
|
+
if (gl) {
|
|
726
|
+
gl.deleteBuffer(this._polyVerticesHighBufferMerc);
|
|
727
|
+
gl.deleteBuffer(this._polyVerticesLowBufferMerc);
|
|
728
|
+
gl.deleteBuffer(this._polyIndexesBuffer);
|
|
729
|
+
gl.deleteBuffer(this._polyColorsBuffer);
|
|
730
|
+
gl.deleteBuffer(this._polyPickingColorsBuffer);
|
|
731
|
+
gl.deleteBuffer(this._lineVerticesHighBufferMerc);
|
|
732
|
+
gl.deleteBuffer(this._lineVerticesLowBufferMerc);
|
|
733
|
+
gl.deleteBuffer(this._lineIndexesBuffer);
|
|
734
|
+
gl.deleteBuffer(this._lineOrdersBuffer);
|
|
735
|
+
gl.deleteBuffer(this._lineColorsBuffer);
|
|
736
|
+
gl.deleteBuffer(this._linePickingColorsBuffer);
|
|
737
|
+
gl.deleteBuffer(this._lineThicknessBuffer);
|
|
738
|
+
gl.deleteBuffer(this._lineStrokeColorsBuffer);
|
|
739
|
+
gl.deleteBuffer(this._lineStrokesBuffer);
|
|
740
|
+
}
|
|
739
741
|
}
|
|
740
742
|
}
|
|
741
743
|
}
|
package/lib/js/entity/Label.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface ILabelParams extends IBaseBillboardParams {
|
|
|
11
11
|
outlineColor?: string | NumberArray4 | Vec4;
|
|
12
12
|
align?: string;
|
|
13
13
|
isRTL?: boolean;
|
|
14
|
+
letterSpacing?: number;
|
|
14
15
|
}
|
|
15
16
|
declare const ALIGN: Record<string, number>;
|
|
16
17
|
/**
|
|
@@ -84,6 +85,7 @@ declare class Label extends BaseBillboard {
|
|
|
84
85
|
*/
|
|
85
86
|
protected _fontAtlas: FontAtlas | null;
|
|
86
87
|
protected _isRTL: boolean;
|
|
88
|
+
protected _letterSpacing: number;
|
|
87
89
|
constructor(options?: ILabelParams);
|
|
88
90
|
/**
|
|
89
91
|
* Set label text.
|
|
@@ -92,6 +94,18 @@ declare class Label extends BaseBillboard {
|
|
|
92
94
|
* It can't be bigger than maximum labelHandler _maxLetters value.
|
|
93
95
|
*/
|
|
94
96
|
setText(text: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* Set text letter spacing.
|
|
99
|
+
* @public
|
|
100
|
+
* @param {number} spacing - Letter spacing.
|
|
101
|
+
*/
|
|
102
|
+
setLetterSpacing(letterSpacing: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* Returns label text letter spacing.
|
|
105
|
+
* @public
|
|
106
|
+
* @param {number} spacing - Letter spacing.
|
|
107
|
+
*/
|
|
108
|
+
getLetterSpacing(): number;
|
|
95
109
|
/**
|
|
96
110
|
* Change text direction.
|
|
97
111
|
* @public
|
package/lib/js/entity/Label.js
CHANGED
|
@@ -50,6 +50,7 @@ class Label extends BaseBillboard {
|
|
|
50
50
|
this._fontIndex = 0;
|
|
51
51
|
this._fontAtlas = null;
|
|
52
52
|
this._isRTL = options.isRTL || false;
|
|
53
|
+
this._letterSpacing = options.letterSpacing || 0;
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
56
|
* Set label text.
|
|
@@ -60,9 +61,28 @@ class Label extends BaseBillboard {
|
|
|
60
61
|
setText(text) {
|
|
61
62
|
this._text = text.toString();
|
|
62
63
|
if (this._isReady && this._handler) {
|
|
63
|
-
this._handler.setText(this._handlerIndex, text, this._fontIndex, this._align, this._isRTL);
|
|
64
|
+
this._handler.setText(this._handlerIndex, text, this._fontIndex, this._align, this._letterSpacing, this._isRTL);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Set text letter spacing.
|
|
69
|
+
* @public
|
|
70
|
+
* @param {number} spacing - Letter spacing.
|
|
71
|
+
*/
|
|
72
|
+
setLetterSpacing(letterSpacing) {
|
|
73
|
+
this._letterSpacing = letterSpacing;
|
|
74
|
+
if (this._isReady && this._handler) {
|
|
75
|
+
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, letterSpacing, this._isRTL);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns label text letter spacing.
|
|
80
|
+
* @public
|
|
81
|
+
* @param {number} spacing - Letter spacing.
|
|
82
|
+
*/
|
|
83
|
+
getLetterSpacing() {
|
|
84
|
+
return this._letterSpacing;
|
|
85
|
+
}
|
|
66
86
|
/**
|
|
67
87
|
* Change text direction.
|
|
68
88
|
* @public
|
|
@@ -71,7 +91,7 @@ class Label extends BaseBillboard {
|
|
|
71
91
|
setRtl(isRTL) {
|
|
72
92
|
this._isRTL = isRTL;
|
|
73
93
|
if (this._isReady && this._handler) {
|
|
74
|
-
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, this._isRTL);
|
|
94
|
+
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, this._letterSpacing, this._isRTL);
|
|
75
95
|
}
|
|
76
96
|
}
|
|
77
97
|
/**
|
|
@@ -90,7 +110,7 @@ class Label extends BaseBillboard {
|
|
|
90
110
|
setAlign(align) {
|
|
91
111
|
this._align = STR2ALIGN[align.trim().toLowerCase()];
|
|
92
112
|
if (this._isReady && this._handler) {
|
|
93
|
-
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, this._isRTL);
|
|
113
|
+
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, this._letterSpacing, this._isRTL);
|
|
94
114
|
}
|
|
95
115
|
else if (this._lockId !== LOCK_FREE) {
|
|
96
116
|
this._lockId = LOCK_UPDATE;
|
|
@@ -260,7 +280,7 @@ class Label extends BaseBillboard {
|
|
|
260
280
|
this._fontIndex = fontIndex;
|
|
261
281
|
if (this._isReady && this._handler) {
|
|
262
282
|
this._handler.setFontIndexArr(this._handlerIndex, this._fontIndex);
|
|
263
|
-
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, this._isRTL);
|
|
283
|
+
this._handler.setText(this._handlerIndex, this._text, this._fontIndex, this._align, this._letterSpacing, this._isRTL);
|
|
264
284
|
}
|
|
265
285
|
else if (this._lockId !== LOCK_FREE) {
|
|
266
286
|
this._lockId = LOCK_UPDATE;
|
|
@@ -43,7 +43,7 @@ declare class LabelHandler extends BaseBillboardHandler {
|
|
|
43
43
|
_displayPASS(): void;
|
|
44
44
|
protected _pickingPASS(): void;
|
|
45
45
|
protected _removeBillboard(label: Label): void;
|
|
46
|
-
setText(index: number, text: string, fontIndex: number, align: number, isRTL?: boolean): void;
|
|
46
|
+
setText(index: number, text: string, fontIndex: number, align: number, letterSpacing?: number, isRTL?: boolean): void;
|
|
47
47
|
setPositionArr(index: number, positionHigh: Vec3, positionLow: Vec3): void;
|
|
48
48
|
setPickingColorArr(index: number, color: Vec3): void;
|
|
49
49
|
setSizeArr(index: number, size: number): void;
|
|
@@ -302,7 +302,7 @@ class LabelHandler extends BaseBillboardHandler {
|
|
|
302
302
|
label._handler = null;
|
|
303
303
|
label._isReady = false;
|
|
304
304
|
}
|
|
305
|
-
setText(index, text, fontIndex, align, isRTL = false) {
|
|
305
|
+
setText(index, text, fontIndex, align, letterSpacing = 0, isRTL = false) {
|
|
306
306
|
text = text.normalize('NFKC');
|
|
307
307
|
let fa = this._renderer.fontAtlas.atlasesArr[fontIndex];
|
|
308
308
|
if (!fa)
|
|
@@ -380,14 +380,14 @@ class LabelHandler extends BaseBillboardHandler {
|
|
|
380
380
|
if (k && text[c + 1]) {
|
|
381
381
|
let kk = k[text[c + 1].charCodeAt(0)];
|
|
382
382
|
if (kk) {
|
|
383
|
-
offset += m.nAdvance + kk;
|
|
383
|
+
offset += m.nAdvance + kk + letterSpacing;
|
|
384
384
|
}
|
|
385
385
|
else {
|
|
386
|
-
offset += m.nAdvance;
|
|
386
|
+
offset += m.nAdvance + letterSpacing;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
else {
|
|
390
|
-
offset += m.nAdvance;
|
|
390
|
+
offset += m.nAdvance + letterSpacing;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
// 49/512 - font atlas left border letter offset
|
|
@@ -1444,7 +1444,7 @@ class Polyline {
|
|
|
1444
1444
|
// gl.uniform4fv(shu.color, [this.color.x, this.color.y, this.color.z, this.color.w * this._handler._entityCollection._fadingOpacity]);
|
|
1445
1445
|
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera.eyeHigh);
|
|
1446
1446
|
gl.uniform3fv(shu.eyePositionLow, r.activeCamera.eyeLow);
|
|
1447
|
-
gl.uniform2fv(shu.uFloatParams, [rn._planetRadius2 || 0.0, r.activeCamera
|
|
1447
|
+
//gl.uniform2fv(shu.uFloatParams, [(rn as Planet)._planetRadius2 || 0.0, r.activeCamera!._tanViewAngle_hradOneByHeight]);
|
|
1448
1448
|
gl.uniform2fv(shu.viewport, [r.handler.canvas.width, r.handler.canvas.height]);
|
|
1449
1449
|
gl.uniform1f(shu.thickness, this.thickness * 0.5);
|
|
1450
1450
|
gl.uniform1f(shu.opacity, this._opacity * ec._fadingOpacity);
|
package/lib/js/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import * as webgl from './webgl/index';
|
|
|
11
11
|
export * from './Globe';
|
|
12
12
|
import { Geoid } from './terrain/Geoid';
|
|
13
13
|
import { input } from './input/input';
|
|
14
|
-
import { Ellipsoid, wgs84 } from './ellipsoid/index';
|
|
14
|
+
import { Ellipsoid, wgs84, moon, mars } from './ellipsoid/index';
|
|
15
15
|
import { Camera, PlanetCamera } from './camera/index';
|
|
16
16
|
import { Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4 } from './math/index';
|
|
17
17
|
import { Renderer } from './renderer/Renderer';
|
|
@@ -23,11 +23,11 @@ import { LonLat } from './LonLat';
|
|
|
23
23
|
import { RenderNode } from './scene/RenderNode';
|
|
24
24
|
import { Planet } from './scene/Planet';
|
|
25
25
|
import { Popup } from './Popup';
|
|
26
|
-
import { EarthQuadTreeStrategy,
|
|
26
|
+
import { EarthQuadTreeStrategy, EquiQuadTreeStrategy, QuadTreeStrategy, quadTreeStrategyType, Wgs84QuadTreeStrategy } from './quadTree/index';
|
|
27
27
|
import { Object3d } from './Object3d';
|
|
28
28
|
import { Handler, Program, Framebuffer, Multisample } from './webgl/index';
|
|
29
29
|
import { Control } from './control/Control';
|
|
30
30
|
export * from './entity/index';
|
|
31
31
|
export * from './layer/index';
|
|
32
32
|
import { EmptyTerrain, GlobusTerrain, RgbTerrain, BilTerrain, GlobusRgbTerrain } from './terrain/index';
|
|
33
|
-
export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, terrain, layer, webgl, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, BilTerrain, Control, Camera, Ellipsoid, Planet, PlanetCamera, LightSource, Program, Handler, Multisample, Renderer, Clock, Events, Extent, LonLat, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy,
|
|
33
|
+
export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, moon, mars, terrain, layer, webgl, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, BilTerrain, Control, Camera, Ellipsoid, Planet, PlanetCamera, LightSource, Program, Handler, Multisample, Renderer, Clock, Events, Extent, LonLat, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy, EquiQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, Object3d };
|
package/lib/js/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as webgl from './webgl/index';
|
|
|
11
11
|
export * from './Globe';
|
|
12
12
|
import { Geoid } from './terrain/Geoid';
|
|
13
13
|
import { input } from './input/input';
|
|
14
|
-
import { Ellipsoid, wgs84 } from './ellipsoid/index';
|
|
14
|
+
import { Ellipsoid, wgs84, moon, mars } from './ellipsoid/index';
|
|
15
15
|
import { Camera, PlanetCamera } from './camera/index';
|
|
16
16
|
import { Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4 } from './math/index';
|
|
17
17
|
import { Renderer } from './renderer/Renderer';
|
|
@@ -23,11 +23,11 @@ import { LonLat } from './LonLat';
|
|
|
23
23
|
import { RenderNode } from './scene/RenderNode';
|
|
24
24
|
import { Planet } from './scene/Planet';
|
|
25
25
|
import { Popup } from './Popup';
|
|
26
|
-
import { EarthQuadTreeStrategy,
|
|
26
|
+
import { EarthQuadTreeStrategy, EquiQuadTreeStrategy, QuadTreeStrategy, quadTreeStrategyType, Wgs84QuadTreeStrategy } from './quadTree/index';
|
|
27
27
|
import { Object3d } from './Object3d';
|
|
28
28
|
import { Handler, Program, Framebuffer, Multisample } from './webgl/index';
|
|
29
29
|
import { Control } from './control/Control';
|
|
30
30
|
export * from './entity/index';
|
|
31
31
|
export * from './layer/index';
|
|
32
32
|
import { EmptyTerrain, GlobusTerrain, RgbTerrain, BilTerrain, GlobusRgbTerrain } from './terrain/index';
|
|
33
|
-
export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, terrain, layer, webgl, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, BilTerrain, Control, Camera, Ellipsoid, Planet, PlanetCamera, LightSource, Program, Handler, Multisample, Renderer, Clock, Events, Extent, LonLat, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy,
|
|
33
|
+
export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, moon, mars, terrain, layer, webgl, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, BilTerrain, Control, Camera, Ellipsoid, Planet, PlanetCamera, LightSource, Program, Handler, Multisample, Renderer, Clock, Events, Extent, LonLat, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy, EquiQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, Object3d };
|
package/lib/js/layer/Layer.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Extent } from "../Extent";
|
|
|
6
6
|
import { LonLat } from "../LonLat";
|
|
7
7
|
import { Material } from "./Material";
|
|
8
8
|
import { Vec3 } from "../math/Vec3";
|
|
9
|
-
const FADING_RATIO =
|
|
9
|
+
const FADING_RATIO = 30;
|
|
10
10
|
/**
|
|
11
11
|
* @class
|
|
12
12
|
* Base class; normally only used for creating subclasses and not instantiated in apps.
|
|
@@ -181,7 +181,7 @@ class Layer {
|
|
|
181
181
|
this._fadingFactor = (opacity - this._opacity) / FADING_RATIO;
|
|
182
182
|
}
|
|
183
183
|
else if (opacity < this._opacity) {
|
|
184
|
-
this._fadingFactor = (
|
|
184
|
+
this._fadingFactor = (this._opacity - opacity) / FADING_RATIO;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
else {
|
|
@@ -570,8 +570,11 @@ class Layer {
|
|
|
570
570
|
return false;
|
|
571
571
|
}
|
|
572
572
|
else {
|
|
573
|
-
this._fadingOpacity
|
|
574
|
-
|
|
573
|
+
this._fadingOpacity -= this._fadingFactor;
|
|
574
|
+
if (this._fadingOpacity <= 0) {
|
|
575
|
+
this._fadingOpacity = 0.0;
|
|
576
|
+
}
|
|
577
|
+
return false;
|
|
575
578
|
}
|
|
576
579
|
}
|
|
577
580
|
createMaterial(segment) {
|
package/lib/js/layer/Vector.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Entity, IEntityParams } from "../entity/Entity";
|
|
2
2
|
import { EntityCollection } from "../entity/EntityCollection";
|
|
3
|
-
import {
|
|
3
|
+
import { EntityCollectionsTreeStrategy } from "../quadTree/EntityCollectionsTreeStrategy";
|
|
4
4
|
import { EventsHandler } from "../Events";
|
|
5
5
|
import { GeometryHandler } from "../entity/GeometryHandler";
|
|
6
6
|
import { ILayerParams, Layer, LayerEventsList } from "./Layer";
|
|
7
7
|
import { NumberArray3 } from "../math/Vec3";
|
|
8
8
|
import { Planet } from "../scene/Planet";
|
|
9
|
-
import { QueueArray } from "../QueueArray";
|
|
10
9
|
import { Material } from "./Material";
|
|
11
10
|
import { NumberArray4 } from "../math/Vec4";
|
|
12
11
|
export interface IVectorParams extends ILayerParams {
|
|
@@ -16,7 +15,7 @@ export interface IVectorParams extends ILayerParams {
|
|
|
16
15
|
relativeToGround?: boolean;
|
|
17
16
|
clampToGround?: boolean;
|
|
18
17
|
async?: boolean;
|
|
19
|
-
pickingScale?: number;
|
|
18
|
+
pickingScale?: number | NumberArray3;
|
|
20
19
|
scaleByDistance?: NumberArray3;
|
|
21
20
|
labelMaxLetters?: number;
|
|
22
21
|
useLighting?: boolean;
|
|
@@ -75,13 +74,18 @@ declare class Vector extends Layer {
|
|
|
75
74
|
* @type {NumberArray3} - (exactly 3 entries)
|
|
76
75
|
*/
|
|
77
76
|
scaleByDistance: NumberArray3;
|
|
78
|
-
pickingScale:
|
|
77
|
+
pickingScale: Float32Array;
|
|
79
78
|
/**
|
|
80
79
|
* Asynchronous data handling before rendering.
|
|
81
80
|
* @public
|
|
82
81
|
* @type {boolean}
|
|
83
82
|
*/
|
|
84
83
|
async: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Maximum entities quantity in the tree node.
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
_nodeCapacity: number;
|
|
85
89
|
/**
|
|
86
90
|
* Clamp vector data to the ground.
|
|
87
91
|
* @public
|
|
@@ -94,34 +98,18 @@ declare class Vector extends Layer {
|
|
|
94
98
|
* @type {boolean}
|
|
95
99
|
*/
|
|
96
100
|
relativeToGround: boolean;
|
|
101
|
+
/** todo: combine into one */
|
|
97
102
|
protected _stripEntityCollection: EntityCollection;
|
|
98
103
|
protected _polylineEntityCollection: EntityCollection;
|
|
99
104
|
protected _geoObjectEntityCollection: EntityCollection;
|
|
100
105
|
_geometryHandler: GeometryHandler;
|
|
101
|
-
|
|
102
|
-
* Maximum entities quantity in the tree node.
|
|
103
|
-
* @public
|
|
104
|
-
*/
|
|
105
|
-
_nodeCapacity: number;
|
|
106
|
-
/**
|
|
107
|
-
* @todo: remove, or replace with node strategy
|
|
108
|
-
*/
|
|
109
|
-
protected _entityCollectionsTree: EntityCollectionNode | null;
|
|
110
|
-
protected _entityCollectionsTreeNorth: EntityCollectionNodeWGS84 | null;
|
|
111
|
-
protected _entityCollectionsTreeSouth: EntityCollectionNodeWGS84 | null;
|
|
112
|
-
_renderingNodes: Record<number, boolean>;
|
|
113
|
-
_renderingNodesNorth: Record<number, boolean>;
|
|
114
|
-
_renderingNodesSouth: Record<number, boolean>;
|
|
115
|
-
protected _counter: number;
|
|
116
|
-
protected _deferredEntitiesPendingQueue: QueueArray<EntityCollectionNode>;
|
|
117
|
-
protected _pendingsQueue: Entity[];
|
|
106
|
+
protected _entityCollectionsTreeStrategy: EntityCollectionsTreeStrategy | null;
|
|
118
107
|
/**
|
|
119
108
|
* Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
|
|
120
109
|
* @public
|
|
121
110
|
* @type {Number}
|
|
122
111
|
*/
|
|
123
112
|
polygonOffsetUnits: number;
|
|
124
|
-
_secondPASS: EntityCollectionNode[];
|
|
125
113
|
protected _labelMaxLetters: number;
|
|
126
114
|
protected _useLighting: boolean;
|
|
127
115
|
constructor(name?: string | null, options?: IVectorParams);
|
|
@@ -198,7 +186,7 @@ declare class Vector extends Layer {
|
|
|
198
186
|
*/
|
|
199
187
|
removeEntities(entities: Entity[]): this;
|
|
200
188
|
/**
|
|
201
|
-
*
|
|
189
|
+
* Clear the layer.
|
|
202
190
|
* @public
|
|
203
191
|
*/
|
|
204
192
|
clear(): void;
|
|
@@ -215,12 +203,9 @@ declare class Vector extends Layer {
|
|
|
215
203
|
* @returns {Vector} - Returns layer instance.
|
|
216
204
|
*/
|
|
217
205
|
setEntities(entities: Entity[]): this;
|
|
218
|
-
/**
|
|
219
|
-
* @todo: replace to a strategy node collecting algorithm
|
|
220
|
-
*/
|
|
221
206
|
protected _createEntityCollectionsTree(entitiesForTree: Entity[]): void;
|
|
222
207
|
/**
|
|
223
|
-
* @todo (refactoring) could be used in
|
|
208
|
+
* @todo (refactoring) could be used in something like bindEntityCollectionQuad(...)
|
|
224
209
|
* @param entityCollection
|
|
225
210
|
*/
|
|
226
211
|
_bindEventsDefault(entityCollection: EntityCollection): void;
|
|
@@ -228,8 +213,6 @@ declare class Vector extends Layer {
|
|
|
228
213
|
protected _collectPolylineCollectionPASS(outArr: EntityCollection[]): void;
|
|
229
214
|
protected _collectGeoObjectCollectionPASS(outArr: EntityCollection[]): void;
|
|
230
215
|
collectVisibleCollections(outArr: EntityCollection[]): void;
|
|
231
|
-
_queueDeferredNode(node: EntityCollectionNode): void;
|
|
232
|
-
protected _execDeferredNode(node: EntityCollectionNode): void;
|
|
233
216
|
/**
|
|
234
217
|
* Start to load tile material.
|
|
235
218
|
* @public
|