@openglobus/og 0.15.4 → 0.16.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/README.md +4 -8
- package/css/og.css +1 -1
- package/dist/@openglobus/og.css +1 -1
- 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 +13 -14
- package/src/og/Globe.js +5 -2
- package/src/og/LonLat.js +224 -193
- package/src/og/Object3d.js +21 -2
- package/src/og/bv/index.js +2 -2
- package/src/og/camera/Camera.js +4 -16
- package/src/og/camera/PlanetCamera.js +15 -15
- package/src/og/control/KeyboardNavigation.js +153 -169
- package/src/og/control/MouseNavigation.js +0 -20
- package/src/og/control/RulerSwitcher.js +2 -2
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/ZoomControl.js +2 -2
- package/src/og/control/heightRuler/HeightRulerScene.js +6 -2
- package/src/og/control/index.js +5 -2
- package/src/og/control/ruler/RulerScene.js +11 -8
- package/src/og/control/timeline/TimelineControl.js +5 -3
- package/src/og/control/timeline/TimelineModel.js +4 -0
- package/src/og/control/timeline/TimelineView.js +10 -3
- package/src/og/control/visibleExtent/Segment.js +36 -42
- package/src/og/ellipsoid/Ellipsoid.js +41 -11
- package/src/og/entity/Entity.js +3 -3
- package/src/og/entity/EntityCollection.js +2 -2
- package/src/og/entity/Label.js +1 -1
- package/src/og/entity/Polyline.js +4 -2
- package/src/og/index.js +4 -7
- package/src/og/layer/CanvasTiles.js +70 -23
- package/src/og/layer/GeoImage.js +40 -18
- package/src/og/layer/Vector.js +21 -17
- package/src/og/layer/WMS.js +2 -2
- package/src/og/layer/XYZ.js +2 -2
- package/src/og/math.js +2 -1
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +26 -0
- package/src/og/quadTree/EntityCollectionNode.js +8 -2
- package/src/og/quadTree/Node.js +44 -50
- package/src/og/quadTree/index.js +2 -0
- package/src/og/renderer/Renderer.js +14 -1
- package/src/og/scene/Planet.js +12 -8
- package/src/og/scene/index.js +3 -3
- package/src/og/segment/Segment.js +125 -120
- package/src/og/terrain/EmptyTerrain.js +19 -7
- package/src/og/terrain/GlobusTerrain.js +23 -18
- package/src/og/terrain/MapboxTerrain.js +7 -8
- package/src/og/terrain/index.js +4 -4
- package/src/og/utils/objParser.js +227 -0
- package/src/og/utils/shared.js +9 -0
- package/src/og/webgl/Handler.js +1 -3
- package/types/Globe.d.ts +2 -0
- package/types/LonLat.d.ts +20 -1
- package/types/Object3d.d.ts +2 -0
- package/types/Popup.d.ts +1 -1
- package/types/bv/index.d.ts +2 -2
- package/types/camera/PlanetCamera.d.ts +1 -8
- package/types/camera/index.d.ts +2 -2
- package/types/control/GeoImageDragControl.d.ts +1 -1
- package/types/control/LayerAnimation.d.ts +1 -1
- package/types/control/Lighting.d.ts +2 -2
- package/types/control/heightRuler/HeightRulerScene.d.ts +1 -1
- package/types/control/index.d.ts +3 -2
- package/types/control/ruler/RulerScene.d.ts +5 -4
- package/types/control/selection/SelectionScene.d.ts +3 -3
- package/types/control/timeline/TimelineControl.d.ts +10 -0
- package/types/control/timeline/TimelineModel.d.ts +33 -0
- package/types/control/timeline/TimelineView.d.ts +57 -0
- package/types/control/timeline/timelineUtils.d.ts +9 -0
- package/types/ellipsoid/Ellipsoid.d.ts +27 -8
- package/types/ellipsoid/index.d.ts +2 -2
- package/types/entity/Entity.d.ts +3 -3
- package/types/entity/EntityCollection.d.ts +2 -2
- package/types/entity/Label.d.ts +1 -1
- package/types/entity/Polyline.d.ts +1 -0
- package/types/index.d.ts +45 -46
- package/types/layer/CanvasTiles.d.ts +2 -1
- package/types/layer/GeoImage.d.ts +7 -1
- package/types/layer/GeoTexture2d.d.ts +1 -1
- package/types/layer/Vector.d.ts +3 -3
- package/types/layer/XYZ.d.ts +1 -1
- package/types/layer/index.d.ts +9 -9
- package/types/math/Line2.d.ts +1 -1
- package/types/math/Line3.d.ts +1 -1
- package/types/math/index.d.ts +10 -10
- package/types/mercator.d.ts +1 -1
- package/types/quadTree/EPSG4326QuadTreeStrategy.d.ts +3 -0
- package/types/quadTree/EntityCollectionNode.d.ts +1 -1
- package/types/quadTree/index.d.ts +2 -0
- package/types/renderer/Renderer.d.ts +2 -2
- package/types/scene/Axes.d.ts +1 -1
- package/types/scene/SkyBox.d.ts +1 -1
- package/types/scene/index.d.ts +3 -3
- package/types/segment/Segment.d.ts +11 -14
- package/types/shaders/atmos.d.ts +1 -1
- package/types/shaders/billboard.d.ts +1 -1
- package/types/shaders/depth.d.ts +1 -1
- package/types/shaders/label.d.ts +1 -1
- package/types/shaders/pickingMask.d.ts +1 -1
- package/types/shaders/pointCloud.d.ts +1 -1
- package/types/shaders/polyline.d.ts +1 -1
- package/types/shaders/ray.d.ts +1 -1
- package/types/shaders/screenFrame.d.ts +1 -1
- package/types/shaders/skybox.d.ts +1 -1
- package/types/shaders/toneMapping.d.ts +1 -1
- package/types/terrain/BilTerrain.d.ts +1 -0
- package/types/terrain/EmptyTerrain.d.ts +13 -2
- package/types/terrain/GlobusTerrain.d.ts +2 -1
- package/types/terrain/MapboxTerrain.d.ts +1 -3
- package/types/terrain/index.d.ts +4 -4
- package/types/ui/Button.d.ts +1 -1
- package/types/ui/ButtonGroup.d.ts +12 -0
- package/types/ui/Dialog.d.ts +2 -2
- package/types/ui/Slider.d.ts +1 -1
- package/types/ui/ToggleButton.d.ts +1 -1
- package/types/ui/View.d.ts +1 -1
- package/types/utils/GeoImageCreator.d.ts +2 -2
- package/types/utils/ImagesCacheManager.d.ts +1 -1
- package/types/utils/Loader.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +1 -1
- package/types/utils/objParser.d.ts +8 -0
- package/types/utils/shared.d.ts +6 -0
- package/types/webgl/Handler.d.ts +2 -2
- package/src/og/index.core.js +0 -116
- package/src/og/index.webgl.js +0 -17
- package/types/index.core.d.ts +0 -65
- package/types/index.webgl.d.ts +0 -7
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export function objParser(text){
|
|
2
|
+
const objPositions = [[0, 0, 0]];
|
|
3
|
+
const objTexcoords = [[0, 0]];
|
|
4
|
+
const objNormals = [[0, 0, 0]];
|
|
5
|
+
|
|
6
|
+
// same order as `f` indices
|
|
7
|
+
const objVertexData = [
|
|
8
|
+
objPositions,
|
|
9
|
+
objTexcoords,
|
|
10
|
+
objNormals,
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
// same order as `f` indices
|
|
14
|
+
let vertexData = [
|
|
15
|
+
[], // positions
|
|
16
|
+
[], // texcoords
|
|
17
|
+
[], // normals
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const materialLibs = [];
|
|
21
|
+
const geometries = [];
|
|
22
|
+
let geometry;
|
|
23
|
+
let groups = ['default'];
|
|
24
|
+
let material = 'default';
|
|
25
|
+
let object = 'default';
|
|
26
|
+
|
|
27
|
+
const noop = () => {};
|
|
28
|
+
|
|
29
|
+
function newGeometry() {
|
|
30
|
+
// If there is an existing geometry and it's
|
|
31
|
+
// not empty then start a new one.
|
|
32
|
+
if (geometry && geometry.data.vertices.length) {
|
|
33
|
+
geometry = undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function setGeometry() {
|
|
38
|
+
if (!geometry) {
|
|
39
|
+
const vertices = [];
|
|
40
|
+
const textures = [];
|
|
41
|
+
const normals = [];
|
|
42
|
+
vertexData = [
|
|
43
|
+
vertices,
|
|
44
|
+
textures,
|
|
45
|
+
normals,
|
|
46
|
+
];
|
|
47
|
+
geometry = {
|
|
48
|
+
object,
|
|
49
|
+
groups,
|
|
50
|
+
material,
|
|
51
|
+
data: {
|
|
52
|
+
vertices,
|
|
53
|
+
textures,
|
|
54
|
+
normals,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
geometries.push(geometry);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function addVertex(vert) {
|
|
62
|
+
const ptn = vert.split('/');
|
|
63
|
+
ptn.forEach((objIndexStr, i) => {
|
|
64
|
+
if (!objIndexStr) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const objIndex = parseInt(objIndexStr);
|
|
68
|
+
const index = objIndex + (objIndex >= 0 ? 0 : objVertexData[i].length);
|
|
69
|
+
vertexData[i].push(...objVertexData[i][index]);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const keywords = {
|
|
74
|
+
v(parts) {
|
|
75
|
+
objPositions.push(parts.map(parseFloat));
|
|
76
|
+
},
|
|
77
|
+
vn(parts) {
|
|
78
|
+
objNormals.push(parts.map(parseFloat));
|
|
79
|
+
},
|
|
80
|
+
vt(parts) {
|
|
81
|
+
// should check for missing v and extra w?
|
|
82
|
+
objTexcoords.push(parts.map(parseFloat));
|
|
83
|
+
},
|
|
84
|
+
f(parts) {
|
|
85
|
+
setGeometry();
|
|
86
|
+
const numTriangles = parts.length - 2;
|
|
87
|
+
for (let tri = 0; tri < numTriangles; ++tri) {
|
|
88
|
+
addVertex(parts[0]);
|
|
89
|
+
addVertex(parts[tri + 1]);
|
|
90
|
+
addVertex(parts[tri + 2]);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
s: noop, // smoothing group
|
|
94
|
+
mtllib(parts, unparsedArgs) {
|
|
95
|
+
// the spec says there can be multiple filenames here
|
|
96
|
+
// but many exist with spaces in a single filename
|
|
97
|
+
materialLibs.push(unparsedArgs);
|
|
98
|
+
},
|
|
99
|
+
usemtl(parts, unparsedArgs) {
|
|
100
|
+
material = unparsedArgs;
|
|
101
|
+
newGeometry();
|
|
102
|
+
},
|
|
103
|
+
g(parts) {
|
|
104
|
+
groups = parts;
|
|
105
|
+
newGeometry();
|
|
106
|
+
},
|
|
107
|
+
o(parts, unparsedArgs) {
|
|
108
|
+
object = unparsedArgs;
|
|
109
|
+
newGeometry();
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const keywordRE = /(\w*)(?: )*(.*)/;
|
|
114
|
+
const lines = text.split('\n');
|
|
115
|
+
for (let lineNo = 0; lineNo < lines.length; ++lineNo) {
|
|
116
|
+
const line = lines[lineNo].trim();
|
|
117
|
+
if (line === '' || line.startsWith('#')) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const m = keywordRE.exec(line);
|
|
121
|
+
if (!m) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const [, keyword, unparsedArgs] = m;
|
|
125
|
+
const parts = line.split(/\s+/).slice(1);
|
|
126
|
+
const handler = keywords[keyword];
|
|
127
|
+
if (!handler) {
|
|
128
|
+
console.warn('unhandled keyword:', keyword); // eslint-disable-line no-console
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
handler(parts, unparsedArgs);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// remove any arrays that have no entries.
|
|
135
|
+
for (const geometry of geometries) {
|
|
136
|
+
geometry.data = Object.fromEntries(
|
|
137
|
+
Object.entries(geometry.data).filter(([, array]) => array.length > 0));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
geometries,
|
|
142
|
+
materialLibs,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function transformLeftToRightCoordinateSystem(objData) {
|
|
147
|
+
const convertedGeometries = objData.geometries.map(geometry => {
|
|
148
|
+
const vertices = geometry.data.vertices;
|
|
149
|
+
const normals = geometry.data.normals;
|
|
150
|
+
const textures = geometry.data.textures;
|
|
151
|
+
rotateObject(geometry.data, 0)
|
|
152
|
+
const convertedVertices = [];
|
|
153
|
+
const convertedNormals = [];
|
|
154
|
+
const convertedTextures = [];
|
|
155
|
+
|
|
156
|
+
// Convert positions
|
|
157
|
+
for (let i = 0; i < vertices.length; i += 3) {
|
|
158
|
+
const x = vertices[i];
|
|
159
|
+
const y = vertices[i + 1];
|
|
160
|
+
const z = vertices[i + 2];
|
|
161
|
+
convertedVertices.push(x, y, z);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Convert normals
|
|
165
|
+
for (let i = 0; i < normals.length; i += 3) {
|
|
166
|
+
const x = normals[i];
|
|
167
|
+
const y = normals[i + 1];
|
|
168
|
+
const z = normals[i + 2];
|
|
169
|
+
convertedNormals.push(x, y, -z);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Convert textures
|
|
173
|
+
for (let i = 0; i < textures.length; i += 2) {
|
|
174
|
+
const s = textures[i];
|
|
175
|
+
const t = 1 - textures[i + 1];
|
|
176
|
+
convertedTextures.push(s, t);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
object: geometry.object,
|
|
181
|
+
groups: geometry.groups,
|
|
182
|
+
material: geometry.material,
|
|
183
|
+
data: {
|
|
184
|
+
vertices: convertedVertices,
|
|
185
|
+
normals: convertedNormals,
|
|
186
|
+
textures: convertedTextures
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
geometries: convertedGeometries,
|
|
193
|
+
materialLibs: objData.materialLibs
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function rotateObject(obj, angle) {
|
|
198
|
+
const cosA = Math.cos(angle);
|
|
199
|
+
const sinA = Math.sin(angle);
|
|
200
|
+
|
|
201
|
+
const vertices = obj.vertices;
|
|
202
|
+
const normals = obj.normals;
|
|
203
|
+
|
|
204
|
+
for (let i = 0; i < vertices.length; i += 3) {
|
|
205
|
+
const x = vertices[i];
|
|
206
|
+
const y = vertices[i + 1];
|
|
207
|
+
const z = vertices[i + 2];
|
|
208
|
+
|
|
209
|
+
vertices[i] = x * cosA + z * sinA;
|
|
210
|
+
vertices[i + 1] = y;
|
|
211
|
+
vertices[i + 2] = -x * sinA + z * cosA;
|
|
212
|
+
|
|
213
|
+
const nx = normals[i];
|
|
214
|
+
const ny = normals[i + 1];
|
|
215
|
+
const nz = normals[i + 2];
|
|
216
|
+
|
|
217
|
+
normals[i] = nx * cosA + nz * sinA;
|
|
218
|
+
normals[i + 1] = ny;
|
|
219
|
+
normals[i + 2] = -nx * sinA + nz * cosA;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
vertices: vertices,
|
|
224
|
+
normals: normals
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
package/src/og/utils/shared.js
CHANGED
|
@@ -958,4 +958,13 @@ export async function loadImage(url) {
|
|
|
958
958
|
image.src = url;
|
|
959
959
|
return image;
|
|
960
960
|
});
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Gets image is loaded
|
|
965
|
+
* @param {HTMLImageElement} image
|
|
966
|
+
* @returns {boolean} Returns true is the image is loaded
|
|
967
|
+
*/
|
|
968
|
+
export function isImageLoaded(image) {
|
|
969
|
+
return image.complete && image.naturalHeight !== 0;
|
|
961
970
|
}
|
package/src/og/webgl/Handler.js
CHANGED
|
@@ -291,7 +291,7 @@ class Handler {
|
|
|
291
291
|
/**
|
|
292
292
|
* Creates NEAREST filter texture.
|
|
293
293
|
* @public
|
|
294
|
-
* @param {
|
|
294
|
+
* @param {HTMLCanvasElement | Image} image - Image or Canvas object.
|
|
295
295
|
* @returns {Object} - WebGL texture object.
|
|
296
296
|
*/
|
|
297
297
|
createTexture_n_webgl1(image, internalFormat, texture) {
|
|
@@ -934,8 +934,6 @@ class Handler {
|
|
|
934
934
|
*/
|
|
935
935
|
start() {
|
|
936
936
|
if (!this._requestAnimationFrameId && this._initialized) {
|
|
937
|
-
this._lastAnimationFrameTime = window.performance.now();
|
|
938
|
-
this.defaultClock.setDate(new Date());
|
|
939
937
|
this._animationFrameCallback();
|
|
940
938
|
}
|
|
941
939
|
}
|
package/types/Globe.d.ts
CHANGED
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
* @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
|
|
44
44
|
* @param {Number} [options.loadingBatchSize=12] -
|
|
45
45
|
* @param {Number} [options.quadTreeStrategyPrototype] - Prototype of quadTree. QuadTreeStrategy for Earth is default.
|
|
46
|
+
* @param {Number} [options.msaa] - MSAA antialiasing parameter: 2,4,8,16. Default is 4.
|
|
47
|
+
* @param {Number} [options.dpi] - Device pixel ratio. Default is current screen DPI.
|
|
46
48
|
*/
|
|
47
49
|
export class Globe {
|
|
48
50
|
static set _staticCounter(arg: any);
|
package/types/LonLat.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ export class LonLat {
|
|
|
20
20
|
* @returns {LonLat} -
|
|
21
21
|
*/
|
|
22
22
|
static createFromArray(arr: Array<number>): LonLat;
|
|
23
|
+
/**
|
|
24
|
+
* Create array from lonlat
|
|
25
|
+
* @param lonLat
|
|
26
|
+
* @returns {number[]}
|
|
27
|
+
*/
|
|
28
|
+
static toArray(lonLat: any): number[];
|
|
23
29
|
/**
|
|
24
30
|
* Converts degrees to mercator coordinates.
|
|
25
31
|
* @static
|
|
@@ -29,6 +35,14 @@ export class LonLat {
|
|
|
29
35
|
* @returns {LonLat} -
|
|
30
36
|
*/
|
|
31
37
|
static forwardMercator(lon: number, lat: number, height?: number): LonLat;
|
|
38
|
+
/**
|
|
39
|
+
* Converts degrees to mercator coordinates.
|
|
40
|
+
* @static
|
|
41
|
+
* @param {LonLat} lonLat - Input geodetic degree coordinates
|
|
42
|
+
* @param {LonLat} res - Output mercator coordinates
|
|
43
|
+
* @returns {LonLat} - Output mercator coordinates
|
|
44
|
+
*/
|
|
45
|
+
static forwardMercatorRes(lonLat: LonLat, res: LonLat): LonLat;
|
|
32
46
|
/**
|
|
33
47
|
* Converts mercator to degrees coordinates.
|
|
34
48
|
* @static
|
|
@@ -63,6 +77,11 @@ export class LonLat {
|
|
|
63
77
|
*/
|
|
64
78
|
public height: number;
|
|
65
79
|
isZero(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Create array from lonlat
|
|
82
|
+
* @returns {number[]}
|
|
83
|
+
*/
|
|
84
|
+
toArray(): number[];
|
|
66
85
|
/**
|
|
67
86
|
* Sets coordinates.
|
|
68
87
|
* @public
|
|
@@ -80,7 +99,7 @@ export class LonLat {
|
|
|
80
99
|
*/
|
|
81
100
|
public copy(lonLat?: LonLat): LonLat;
|
|
82
101
|
/**
|
|
83
|
-
* Clone the
|
|
102
|
+
* Clone the coordinates.
|
|
84
103
|
* @public
|
|
85
104
|
* @returns {LonLat} -
|
|
86
105
|
*/
|
package/types/Object3d.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export class Object3d {
|
|
|
9
9
|
static createCylinder(radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, isTop?: boolean, isBottom?: boolean, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
|
|
10
10
|
static createCube(length?: number, height?: number, depth?: number, xOffset?: number, yOffset?: number, zOffset?: number): Object3d;
|
|
11
11
|
static createArrow(back?: number, height?: number, front?: number): Object3d;
|
|
12
|
+
static loadObj(src: any): Promise<any>;
|
|
12
13
|
constructor(data: any);
|
|
13
14
|
_name: any;
|
|
14
15
|
_vertices: any;
|
|
@@ -23,6 +24,7 @@ export class Object3d {
|
|
|
23
24
|
color: any[] | Float32Array;
|
|
24
25
|
_indices: any;
|
|
25
26
|
_normals: any;
|
|
27
|
+
set src(arg: string);
|
|
26
28
|
get src(): string;
|
|
27
29
|
get name(): any;
|
|
28
30
|
get vertices(): any;
|
package/types/Popup.d.ts
CHANGED
package/types/bv/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Box } from
|
|
2
|
-
import { Sphere } from
|
|
1
|
+
import { Box } from './Box.js';
|
|
2
|
+
import { Sphere } from './Sphere.js';
|
|
3
3
|
export { Box, Sphere };
|
|
@@ -68,13 +68,6 @@ export class PlanetCamera extends Camera {
|
|
|
68
68
|
* @type {quadTree.Node}
|
|
69
69
|
*/
|
|
70
70
|
protected _insideSegment: quadTree.Node;
|
|
71
|
-
/**
|
|
72
|
-
* Coordinates that depends on what segment class we are fling over.
|
|
73
|
-
* It can be WGS84 or Mercator coordinates. Gets in og.quadTree.Node
|
|
74
|
-
* @protected
|
|
75
|
-
* @type {LonLat}
|
|
76
|
-
*/
|
|
77
|
-
protected _insideSegmentPosition: LonLat;
|
|
78
71
|
slope: number;
|
|
79
72
|
_keyLock: Key;
|
|
80
73
|
_framesArr: any[];
|
|
@@ -215,7 +208,7 @@ export class PlanetCamera extends Camera {
|
|
|
215
208
|
* @public
|
|
216
209
|
*/
|
|
217
210
|
public checkFly(): void;
|
|
218
|
-
checkTerrainCollision():
|
|
211
|
+
checkTerrainCollision(): Vec3;
|
|
219
212
|
getSurfaceVisibleDistance(d: any): number;
|
|
220
213
|
getHeading(): number;
|
|
221
214
|
isVisible(poi: any): boolean;
|
package/types/camera/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Camera } from
|
|
2
|
-
import { PlanetCamera } from
|
|
1
|
+
import { Camera } from './Camera.js';
|
|
2
|
+
import { PlanetCamera } from './PlanetCamera.js';
|
|
3
3
|
export { Camera, PlanetCamera };
|
|
@@ -70,4 +70,4 @@ export class LayerAnimation extends Control {
|
|
|
70
70
|
_setCurrentIndexAsync(index: number, forceVisibility?: boolean, stopPropagation?: boolean): void;
|
|
71
71
|
}
|
|
72
72
|
import { Control } from "./Control.js";
|
|
73
|
-
import { Events } from
|
|
73
|
+
import { Events } from '../Events.js';
|
|
@@ -36,6 +36,6 @@ export class Lighting extends Control {
|
|
|
36
36
|
}
|
|
37
37
|
import { Control } from "./Control.js";
|
|
38
38
|
import { ToggleButton } from "../ui/ToggleButton.js";
|
|
39
|
-
import { Dialog } from
|
|
40
|
-
import { View } from
|
|
39
|
+
import { Dialog } from '../ui/Dialog.js';
|
|
40
|
+
import { View } from '../ui/View.js';
|
|
41
41
|
import { Slider } from "../ui/Slider.js";
|
package/types/control/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Control } from "./Control.js";
|
|
2
2
|
import { CompassButton } from "./CompassButton.js";
|
|
3
|
-
import { DebugInfo } from "./DebugInfo";
|
|
3
|
+
import { DebugInfo } from "./DebugInfo.js";
|
|
4
4
|
import { EarthNavigation } from "./EarthNavigation.js";
|
|
5
5
|
import { EarthCoordinates } from "./EarthCoordinates.js";
|
|
6
6
|
import { GeoImageDragControl } from "./GeoImageDragControl.js";
|
|
@@ -21,4 +21,5 @@ import { HeightRuler } from "./heightRuler/HeightRuler.js";
|
|
|
21
21
|
import { SimpleSkyBackground } from "./SimpleSkyBackground.js";
|
|
22
22
|
import { Selection } from "./selection/Selection.js";
|
|
23
23
|
import { LayerAnimation } from "./LayerAnimation.js";
|
|
24
|
-
|
|
24
|
+
import { TimelineControl } from "./timeline/TimelineControl.js";
|
|
25
|
+
export { Control, CompassButton, DebugInfo, EarthNavigation, EarthCoordinates, GeoImageDragControl, KeyboardNavigation, LayerSwitcher, MouseNavigation, ToggleWireframe, TouchNavigation, SimpleNavigation, ShowFps, ScaleControl, Sun, ZoomControl, MouseWheelZoomControl, Lighting, Ruler, HeightRuler, SimpleSkyBackground, Selection, LayerAnimation, TimelineControl };
|
|
@@ -37,6 +37,7 @@ export class RulerScene extends RenderNode {
|
|
|
37
37
|
_onCornerEnter(e: any): void;
|
|
38
38
|
_onCornerLeave(e: any): void;
|
|
39
39
|
_onLdblclick(): void;
|
|
40
|
+
setVisibility(visibility: any): void;
|
|
40
41
|
_onLclick(e: any): void;
|
|
41
42
|
_timeout: any;
|
|
42
43
|
_drawLine(startLonLat: any, endLonLat: any, startPos: any): void;
|
|
@@ -45,7 +46,7 @@ export class RulerScene extends RenderNode {
|
|
|
45
46
|
isCornersPositionChanged(): boolean;
|
|
46
47
|
get ellipsoid(): any;
|
|
47
48
|
}
|
|
48
|
-
import { RenderNode } from
|
|
49
|
-
import { Vec2 } from
|
|
50
|
-
import { Vector } from
|
|
51
|
-
import { Entity } from
|
|
49
|
+
import { RenderNode } from '../../scene/RenderNode.js';
|
|
50
|
+
import { Vec2 } from '../../math/Vec2.js';
|
|
51
|
+
import { Vector } from '../../layer/Vector.js';
|
|
52
|
+
import { Entity } from '../../entity/Entity.js';
|
|
@@ -28,6 +28,6 @@ export class SelectionScene extends RenderNode {
|
|
|
28
28
|
clear(): void;
|
|
29
29
|
get ellipsoid(): any;
|
|
30
30
|
}
|
|
31
|
-
import { RenderNode } from
|
|
32
|
-
import { Entity } from
|
|
33
|
-
import { Vector } from
|
|
31
|
+
import { RenderNode } from '../../scene/RenderNode.js';
|
|
32
|
+
import { Entity } from '../../entity/Entity.js';
|
|
33
|
+
import { Vector } from '../../layer/Vector.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class TimelineControl extends Control {
|
|
2
|
+
constructor(options?: {});
|
|
3
|
+
_timelineView: TimelineView;
|
|
4
|
+
_toggleBtn: ToggleButton;
|
|
5
|
+
_dialog: Dialog;
|
|
6
|
+
}
|
|
7
|
+
import { Control } from '../Control.js';
|
|
8
|
+
import { TimelineView } from './TimelineView.js';
|
|
9
|
+
import { ToggleButton } from "../../ui/ToggleButton.js";
|
|
10
|
+
import { Dialog } from "../../ui/Dialog.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class TimelineModel {
|
|
2
|
+
constructor(options?: {});
|
|
3
|
+
_events: Events;
|
|
4
|
+
_current: any;
|
|
5
|
+
_rangeStart: any;
|
|
6
|
+
_rangeEnd: any;
|
|
7
|
+
_range: number;
|
|
8
|
+
_minDate: any;
|
|
9
|
+
_maxDate: any;
|
|
10
|
+
multiplier: any;
|
|
11
|
+
_requestAnimationFrameId: number;
|
|
12
|
+
_prevNow: number;
|
|
13
|
+
dt: number;
|
|
14
|
+
on(eventName: any, callback: any, sender: any): void;
|
|
15
|
+
off(eventName: any, callback: any): void;
|
|
16
|
+
play(): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
stopped(): boolean;
|
|
19
|
+
_animationFrameCallback(): void;
|
|
20
|
+
_frame(): void;
|
|
21
|
+
set current(arg: any);
|
|
22
|
+
get current(): any;
|
|
23
|
+
get range(): number;
|
|
24
|
+
set(rangeStart: any, rangeEnd: any): void;
|
|
25
|
+
set rangeStart(arg: any);
|
|
26
|
+
get rangeStart(): any;
|
|
27
|
+
set rangeEnd(arg: any);
|
|
28
|
+
get rangeEnd(): any;
|
|
29
|
+
get rangeStartTime(): any;
|
|
30
|
+
get rangeEndTime(): any;
|
|
31
|
+
get currentTime(): any;
|
|
32
|
+
}
|
|
33
|
+
import { Events } from '../../Events.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class TimelineView extends View {
|
|
2
|
+
fillStyle: any;
|
|
3
|
+
_frameEl: any;
|
|
4
|
+
_currentEl: any;
|
|
5
|
+
_canvasEl: HTMLCanvasElement;
|
|
6
|
+
_ctx: CanvasRenderingContext2D;
|
|
7
|
+
_isMouseOver: boolean;
|
|
8
|
+
_isDragging: boolean;
|
|
9
|
+
_isCurrentDragging: boolean;
|
|
10
|
+
_isCurrentMouseOver: boolean;
|
|
11
|
+
_minWidth: number;
|
|
12
|
+
_canvasScale: number;
|
|
13
|
+
_millisecondsInPixel: number;
|
|
14
|
+
_clickPosX: number;
|
|
15
|
+
_clickRangeStart: Date;
|
|
16
|
+
_clickRangeEnd: Date;
|
|
17
|
+
_clickCurrentDate: Date;
|
|
18
|
+
_clickTime: number;
|
|
19
|
+
_clickDelay: number;
|
|
20
|
+
_onResizeObserver_: any;
|
|
21
|
+
_resizeObserver: ResizeObserver;
|
|
22
|
+
_pauseBtn: ToggleButton;
|
|
23
|
+
_playBtn: ToggleButton;
|
|
24
|
+
_buttons: ButtonGroup;
|
|
25
|
+
_visibility: any;
|
|
26
|
+
_onResizeObserver(): void;
|
|
27
|
+
set canvasScale(arg: number);
|
|
28
|
+
get canvasScale(): number;
|
|
29
|
+
resize(): void;
|
|
30
|
+
render(): TimelineView;
|
|
31
|
+
$controls: any;
|
|
32
|
+
setVisibility(visibility: any): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
play(): void;
|
|
35
|
+
pause(): void;
|
|
36
|
+
playBack(): void;
|
|
37
|
+
_onMouseWheel(e: any): void;
|
|
38
|
+
_onMouseWheelFF(e: any): void;
|
|
39
|
+
_zoom(pointerTime: any, pointerCenterOffsetX: any, dir: any): void;
|
|
40
|
+
_onMouseDown(e: any): void;
|
|
41
|
+
_onMouseUp(e: any): void;
|
|
42
|
+
_onMouseEnter(): void;
|
|
43
|
+
_onMouseOut(): void;
|
|
44
|
+
_onCurrentMouseEnter(): void;
|
|
45
|
+
_onCurrentMouseOut(): void;
|
|
46
|
+
_onMouseMove(e: any): void;
|
|
47
|
+
get clientWidth(): number;
|
|
48
|
+
get clientHeight(): number;
|
|
49
|
+
_resize(): void;
|
|
50
|
+
getOffsetbyTime(milliseconds: any): number;
|
|
51
|
+
_clearCanvas(): void;
|
|
52
|
+
_drawCurrent(): void;
|
|
53
|
+
draw(): void;
|
|
54
|
+
}
|
|
55
|
+
import { View } from '../../ui/View.js';
|
|
56
|
+
import { ToggleButton } from "../../ui/ToggleButton.js";
|
|
57
|
+
import { ButtonGroup } from "../../ui/ButtonGroup.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function addSeconds(date: any, seconds: any): Date;
|
|
2
|
+
export function dateToStr(date: any, showTime?: boolean, showMilliseconds?: boolean): string;
|
|
3
|
+
export function createCanvasHTML(): HTMLCanvasElement;
|
|
4
|
+
export function getNearestTimeLeft(t: any, div: any): number;
|
|
5
|
+
export function drawNotch(ctx: any, xOffset?: number, size?: number, thickness?: number, color?: string): void;
|
|
6
|
+
export function drawText(ctx: any, text: any, x: any, y: any, font: string, fillStyle: string, align: string, baseLine: string, rotDeg: any): void;
|
|
7
|
+
export function getScale(seconds: any): number[];
|
|
8
|
+
export const SCALES: number[][];
|
|
9
|
+
export const MONTHS: string[];
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* @param {number} polarSize - Polar ellipsoid size.
|
|
6
6
|
*/
|
|
7
7
|
export class Ellipsoid {
|
|
8
|
+
/**
|
|
9
|
+
* Returns angle between to bearin angles
|
|
10
|
+
* @param {number} a - First bearing angle
|
|
11
|
+
* @param {number} b - Second bearing angle
|
|
12
|
+
* @returns {number}
|
|
13
|
+
*/
|
|
14
|
+
static getAngleBetweenTwoBearings(a: number, b: number): number;
|
|
8
15
|
static getRelativeBearing(a: any, b: any): number;
|
|
9
16
|
/**
|
|
10
17
|
* Returns the midpoint between two points on the great circle.
|
|
@@ -88,22 +95,22 @@ export class Ellipsoid {
|
|
|
88
95
|
*/
|
|
89
96
|
public getPolarSize(): number;
|
|
90
97
|
/**
|
|
91
|
-
* Gets cartesian ECEF from Wgs84 geodetic
|
|
98
|
+
* Gets cartesian ECEF from Wgs84 geodetic coordinates.
|
|
92
99
|
* @public
|
|
93
|
-
* @param {LonLat} lonlat - Degrees geodetic
|
|
100
|
+
* @param {LonLat} lonlat - Degrees geodetic coordinates.
|
|
94
101
|
* @returns {Vec3} -
|
|
95
102
|
*/
|
|
96
103
|
public lonLatToCartesian(lonlat: LonLat): Vec3;
|
|
97
104
|
/**
|
|
98
|
-
* Gets cartesian ECEF from Wgs84 geodetic
|
|
105
|
+
* Gets cartesian ECEF from Wgs84 geodetic coordinates.
|
|
99
106
|
* @public
|
|
100
|
-
* @param {LonLat} lonlat - Degrees geodetic
|
|
107
|
+
* @param {LonLat} lonlat - Degrees geodetic coordinates.
|
|
101
108
|
* @param {Vec3} res - Output result.
|
|
102
109
|
* @returns {Vec3} -
|
|
103
110
|
*/
|
|
104
111
|
public lonLatToCartesianRes(lonlat: LonLat, res: Vec3): Vec3;
|
|
105
112
|
/**
|
|
106
|
-
* Gets cartesian ECEF from Wgs84 geodetic
|
|
113
|
+
* Gets cartesian ECEF from Wgs84 geodetic coordinates.
|
|
107
114
|
* @public
|
|
108
115
|
* @param {Number} lon - Longitude.
|
|
109
116
|
* @param {Number} lat - Latitude.
|
|
@@ -112,17 +119,29 @@ export class Ellipsoid {
|
|
|
112
119
|
*/
|
|
113
120
|
public geodeticToCartesian(lon: number, lat: number, height?: number): Vec3;
|
|
114
121
|
/**
|
|
115
|
-
* Gets Wgs84 geodetic
|
|
122
|
+
* Gets Wgs84 geodetic coordinates from cartesian ECEF.
|
|
116
123
|
* @public
|
|
117
124
|
* @param {Vec3} p - Cartesian coordinates.
|
|
118
125
|
* @returns {LonLat} -
|
|
119
126
|
*/
|
|
120
127
|
public projToSurface(p: Vec3): LonLat;
|
|
121
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Converts 3d cartesian coordinates to geodetic
|
|
130
|
+
* @param {Vec3} cart - Cartesian coordinates
|
|
131
|
+
* @returns {LonLat} - Geodetic coordinates
|
|
132
|
+
*/
|
|
133
|
+
cartesianToLonLat(cart: Vec3): LonLat;
|
|
134
|
+
/**
|
|
135
|
+
* Converts 3d cartesian coordinates to geodetic
|
|
136
|
+
* @param {Vec3} cart - Cartesian coordinates
|
|
137
|
+
* @param {LonLat} res - Link geodetic coordinates variable
|
|
138
|
+
* @returns {LonLat} - Geodetic coordinates
|
|
139
|
+
*/
|
|
140
|
+
cartesianToLonLatRes(cart: Vec3, res: LonLat): LonLat;
|
|
122
141
|
/**
|
|
123
142
|
* Gets ellipsoid surface normal.
|
|
124
143
|
* @public
|
|
125
|
-
* @param {Vec3} coord - Spatial
|
|
144
|
+
* @param {Vec3} coord - Spatial coordinates.
|
|
126
145
|
* @return {Vec3} -
|
|
127
146
|
*/
|
|
128
147
|
public getSurfaceNormal3v(coord: Vec3): Vec3;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Ellipsoid } from
|
|
2
|
-
import { wgs84 } from
|
|
1
|
+
import { Ellipsoid } from './Ellipsoid.js';
|
|
2
|
+
import { wgs84 } from './wgs84.js';
|
|
3
3
|
export { Ellipsoid, wgs84 };
|