@openglobus/og 0.13.5 → 0.13.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/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Events.js +188 -188
- package/src/og/Globe.js +1 -0
- package/src/og/control/KeyboardNavigation.js +48 -2
- package/src/og/control/TouchNavigation.js +13 -13
- package/src/og/control/ZoomControl.js +1 -1
- package/src/og/ellipsoid/Ellipsoid.js +1 -1
- package/src/og/entity/LabelHandler.js +2 -2
- package/src/og/input/input.js +7 -1
- package/src/og/layer/KML.js +181 -12
- package/src/og/layer/Layer.js +4 -2
- package/src/og/renderer/RendererEvents.js +17 -3
- package/src/og/scene/Planet.js +45 -27
- package/src/og/terrain/EmptyTerrain.js +159 -146
- package/src/og/terrain/Geoid.js +246 -241
- package/src/og/terrain/GlobusTerrain.js +17 -18
- package/src/og/terrain/MapboxTerrain.js +292 -294
- package/src/og/utils/PlainSegmentWorker.js +38 -26
- package/types/control/KeyboardNavigation.d.ts +3 -0
- package/types/input/input.d.ts +6 -0
- package/types/layer/KML.d.ts +26 -1
- package/types/renderer/RendererEvents.d.ts +2 -0
- package/types/scene/Planet.d.ts +5 -0
- package/types/terrain/EmptyTerrain.d.ts +3 -1
- package/types/terrain/Geoid.d.ts +1 -10
- package/types/terrain/GlobusTerrain.d.ts +0 -1
- package/types/terrain/MapboxTerrain.d.ts +1 -1
|
@@ -1,148 +1,161 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/terrainProvider/EmptyTerrain
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
import { binarySearchFast } from "../utils/shared.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
+
|
|
161
|
+
export { EmptyTerrain };
|