@openglobus/og 0.13.5 → 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 (78) hide show
  1. package/css/og.css +66 -25
  2. package/dist/@openglobus/og.css +1 -1
  3. package/dist/@openglobus/og.esm.js +2 -2
  4. package/dist/@openglobus/og.esm.js.map +1 -1
  5. package/dist/@openglobus/og.umd.js +2 -2
  6. package/dist/@openglobus/og.umd.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/og/Events.js +188 -188
  9. package/src/og/Extent.js +1 -9
  10. package/src/og/Globe.js +1 -0
  11. package/src/og/Object3d.js +384 -0
  12. package/src/og/arial.js +1705 -1703
  13. package/src/og/camera/Camera.js +640 -640
  14. package/src/og/control/DebugInfo.js +15 -4
  15. package/src/og/control/EarthCoordinates.js +151 -160
  16. package/src/og/control/KeyboardNavigation.js +48 -2
  17. package/src/og/control/LayerAnimation.js +115 -0
  18. package/src/og/control/MouseNavigation.js +460 -460
  19. package/src/og/control/Sun.js +170 -170
  20. package/src/og/control/TouchNavigation.js +13 -13
  21. package/src/og/control/ZoomControl.js +1 -3
  22. package/src/og/control/index.js +3 -1
  23. package/src/og/control/ruler/Ruler.js +43 -0
  24. package/src/og/control/ruler/RulerScene.js +370 -0
  25. package/src/og/control/visibleExtent/Segment.js +1 -4
  26. package/src/og/ellipsoid/Ellipsoid.js +20 -1
  27. package/src/og/entity/Entity.js +1 -1
  28. package/src/og/entity/GeoObject.js +1 -1
  29. package/src/og/entity/LabelHandler.js +3 -2
  30. package/src/og/input/input.js +7 -1
  31. package/src/og/layer/CanvasTiles.js +8 -8
  32. package/src/og/layer/KML.js +181 -12
  33. package/src/og/layer/Layer.js +27 -42
  34. package/src/og/layer/Vector.js +80 -14
  35. package/src/og/layer/XYZ.js +8 -2
  36. package/src/og/math/Vec3.js +1 -1
  37. package/src/og/math.js +4 -4
  38. package/src/og/quadTree/Node.js +2 -1
  39. package/src/og/renderer/Renderer.js +1 -2
  40. package/src/og/renderer/RendererEvents.js +17 -3
  41. package/src/og/res/images.js +0 -2
  42. package/src/og/scene/Planet.js +92 -32
  43. package/src/og/segment/Segment.js +1 -8
  44. package/src/og/shaders/label.js +30 -42
  45. package/src/og/terrain/EmptyTerrain.js +164 -146
  46. package/src/og/terrain/Geoid.js +246 -241
  47. package/src/og/terrain/GlobusTerrain.js +23 -24
  48. package/src/og/terrain/MapboxTerrain.js +292 -294
  49. package/src/og/utils/FontAtlas.js +1 -2
  50. package/src/og/utils/Loader.js +160 -112
  51. package/src/og/utils/PlainSegmentWorker.js +38 -26
  52. package/src/og/utils/VectorTileCreator.js +1 -1
  53. package/src/og/utils/units.js +78 -0
  54. package/src/og/webgl/ProgramController.js +143 -143
  55. package/types/Object3d.d.ts +21 -0
  56. package/types/arial.d.ts +1 -0
  57. package/types/control/EarthCoordinates.d.ts +27 -30
  58. package/types/control/KeyboardNavigation.d.ts +3 -0
  59. package/types/control/Sun.d.ts +1 -1
  60. package/types/control/index.d.ts +2 -1
  61. package/types/control/ruler/Ruler.d.ts +13 -0
  62. package/types/control/ruler/RulerScene.d.ts +48 -0
  63. package/types/ellipsoid/Ellipsoid.d.ts +8 -0
  64. package/types/input/input.d.ts +6 -0
  65. package/types/layer/KML.d.ts +26 -1
  66. package/types/layer/Layer.d.ts +23 -31
  67. package/types/layer/Vector.d.ts +2 -0
  68. package/types/layer/XYZ.d.ts +1 -0
  69. package/types/math.d.ts +1 -1
  70. package/types/renderer/RendererEvents.d.ts +2 -0
  71. package/types/res/images.d.ts +0 -1
  72. package/types/scene/Planet.d.ts +12 -3
  73. package/types/terrain/EmptyTerrain.d.ts +4 -1
  74. package/types/terrain/Geoid.d.ts +1 -10
  75. package/types/terrain/GlobusTerrain.d.ts +0 -2
  76. package/types/terrain/MapboxTerrain.d.ts +1 -1
  77. package/types/utils/Loader.d.ts +4 -0
  78. package/types/utils/units.d.ts +20 -0
@@ -1,148 +1,166 @@
1
- /**
2
- * @module og/terrainProvider/EmptyTerrain
3
- */
4
-
5
- "use strict";
6
-
7
- import { binarySearchFast } from "../utils/shared.js";
8
-
9
- /**
10
- * Class represents terrain provider without elevation data.
11
- * @class
12
- */
13
- class EmptyTerrain {
14
- constructor(options = {}) {
15
- this.equalizeVertices = false;
16
-
1
+ /**
2
+ * @module og/terrainProvider/EmptyTerrain
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { binarySearchFast } from "../utils/shared.js";
8
+ import { Geoid } from "./Geoid.js";
9
+
10
+ /**
11
+ * Class represents terrain provider without elevation data.
12
+ * @class
13
+ */
14
+ class EmptyTerrain {
15
+ constructor(options = {}) {
16
+ this.equalizeVertices = false;
17
+
17
18
  this.equalizeNormals = false;
18
19
 
19
- this.isEmpty = true;
20
-
21
- /**
22
- * Provider name is "empty"
23
- * @public
24
- * @type {string}
25
- */
26
- this.name = "empty";
27
-
28
- /**
29
- * Minimal z-index value for segment elevation data handling.
30
- * @public
31
- * @type {number}
32
- */
33
- this.minZoom = 1000000;
34
-
35
- /**
36
- * Maximal z-index value for segment elevation data handling.
37
- * @public
38
- * @type {number}
39
- */
40
- this.maxZoom = 21;
41
-
42
- /**
43
- * @public
44
- * @type {Array.<number>}
45
- */
46
- this.gridSizeByZoom = options.gridSizeByZoom || [
47
- 32, 16, 16, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
48
- ];
49
- //this.gridSizeByZoom = options.gridSizeByZoom || [32, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2];
50
-
51
- this._maxNodeZoom = this.gridSizeByZoom.length - 1;
52
-
53
- /**
54
- * Elevation grid size. Currend is 2x2 is the smallest grid size.
55
- * @public
56
- * @type {number}
57
- */
58
- this.plainGridSize = 2;
59
-
60
- /**
61
- * Planet node.
62
- * @protected
63
- * @type {Planet}
64
- */
65
- this._planet = null;
66
-
67
- this._geoid = null;
68
-
69
- // const _ellToAltFn = [
70
- // (lon, lat, alt, callback) => callback(alt),
71
- // (lon, lat, alt, callback) => callback(alt - this._geoid.getHeight(lon, lat)),
72
- // (lon, lat, alt, callback) => {
73
-
74
- // let x = mercator.getTileX(lon, zoom),
75
- // y = mercator.getTileY(lat, zoom);
76
-
77
- // let mslAlt = alt - this._geoid.getHeight(lon, lat);
78
-
79
- // if (true) {
80
-
81
- // } else {
82
-
83
- // }
84
-
85
- // return callback(mslAlt);
86
- // },
87
- // ];
88
- }
89
-
90
- static checkNoDataValue(noDataValues, value) {
91
- return binarySearchFast(noDataValues, value) !== -1;
92
- }
93
-
94
- isBlur() {
95
- return false;
96
- }
97
-
98
- set maxNodeZoom(val) {
99
- if (val > this.gridSizeByZoom.length - 1) {
100
- val = this.gridSizeByZoom.length - 1;
101
- }
102
- this._maxNodeZoom = val;
103
- }
104
-
105
- get maxNodeZoom() {
106
- return this._maxNodeZoom;
107
- }
108
-
109
- set geoid(geoid) {
110
- this._geoid = geoid;
111
- }
112
-
113
- get geoid() {
114
- return this._geoid;
115
- }
116
-
117
- /**
118
- * Loads or creates segment elevation data.
119
- * @public
120
- * @virtual
121
- * @param {Segment} segment - Segment to create elevation data.
122
- */
123
- handleSegmentTerrain(segment) {
124
- segment.terrainIsLoading = false;
125
- segment.terrainReady = true;
126
- segment.terrainExists = true;
127
- }
128
-
129
- isReady() {
130
- return (this._geoid && this._geoid.model) || !this._geoid;
131
- }
132
-
133
- /**
134
- * Abstract function
135
- * @public
136
- * @abstract
137
- */
138
- abortLoading() {}
139
-
140
- /**
141
- * Abstract function
142
- * @public
143
- * @abstract
144
- */
145
- clearCache() {}
146
- }
147
-
148
- export { EmptyTerrain };
20
+ this.isEmpty = true;
21
+
22
+ /**
23
+ * Provider name is "empty"
24
+ * @public
25
+ * @type {string}
26
+ */
27
+ this.name = "empty";
28
+
29
+ /**
30
+ * Minimal z-index value for segment elevation data handling.
31
+ * @public
32
+ * @type {number}
33
+ */
34
+ this.minZoom = 1000000;
35
+
36
+ /**
37
+ * Maximal z-index value for segment elevation data handling.
38
+ * @public
39
+ * @type {number}
40
+ */
41
+ this.maxZoom = 21;
42
+
43
+ /**
44
+ * @public
45
+ * @type {Array.<number>}
46
+ */
47
+ this.gridSizeByZoom = options.gridSizeByZoom || [
48
+ 32, 16, 16, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
49
+ ];
50
+ //this.gridSizeByZoom = options.gridSizeByZoom || [32, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2];
51
+
52
+ this._maxNodeZoom = this.gridSizeByZoom.length - 1;
53
+
54
+ /**
55
+ * Elevation grid size. Currend is 2x2 is the smallest grid size.
56
+ * @public
57
+ * @type {number}
58
+ */
59
+ this.plainGridSize = 2;
60
+
61
+ /**
62
+ * Planet node.
63
+ * @protected
64
+ * @type {Planet}
65
+ */
66
+ this._planet = null;
67
+
68
+ this._geoid =
69
+ options.geoid ||
70
+ new Geoid({
71
+ src: options.geoidSrc || null
72
+ });
73
+
74
+ this._isReady = false;
75
+
76
+ // const _ellToAltFn = [
77
+ // (lon, lat, alt, callback) => callback(alt),
78
+ // (lon, lat, alt, callback) => callback(alt - this._geoid.getHeight(lon, lat)),
79
+ // (lon, lat, alt, callback) => {
80
+
81
+ // let x = mercator.getTileX(lon, zoom),
82
+ // y = mercator.getTileY(lat, zoom);
83
+
84
+ // let mslAlt = alt - this._geoid.getHeight(lon, lat);
85
+
86
+ // if (true) {
87
+
88
+ // } else {
89
+
90
+ // }
91
+
92
+ // return callback(mslAlt);
93
+ // },
94
+ // ];
95
+ }
96
+
97
+ static checkNoDataValue(noDataValues, value) {
98
+ return binarySearchFast(noDataValues, value) !== -1;
99
+ }
100
+
101
+ isBlur() {
102
+ return false;
103
+ }
104
+
105
+ set maxNodeZoom(val) {
106
+ if (val > this.gridSizeByZoom.length - 1) {
107
+ val = this.gridSizeByZoom.length - 1;
108
+ }
109
+ this._maxNodeZoom = val;
110
+ }
111
+
112
+ get maxNodeZoom() {
113
+ return this._maxNodeZoom;
114
+ }
115
+
116
+ set geoid(geoid) {
117
+ this._geoid = geoid;
118
+ }
119
+
120
+ get geoid() {
121
+ return this._geoid;
122
+ }
123
+
124
+ getGeoid() {
125
+ return this._geoid;
126
+ }
127
+
128
+ /**
129
+ * Loads or creates segment elevation data.
130
+ * @public
131
+ * @virtual
132
+ * @param {Segment} segment - Segment to create elevation data.
133
+ */
134
+ handleSegmentTerrain(segment) {
135
+ segment.terrainIsLoading = false;
136
+ segment.terrainReady = true;
137
+ segment.terrainExists = true;
138
+ }
139
+
140
+ isReady() {
141
+ return this._isReady;
142
+ }
143
+
144
+ /**
145
+ * Abstract function
146
+ * @public
147
+ * @abstract
148
+ */
149
+ abortLoading() {
150
+ }
151
+
152
+ /**
153
+ * Abstract function
154
+ * @public
155
+ * @abstract
156
+ */
157
+ clearCache() {
158
+ }
159
+
160
+ getHeightAsync(lonLat, callback) {
161
+ callback(0);
162
+ return true;
163
+ }
164
+ }
165
+
166
+ export { EmptyTerrain };