astro-viewer 2.0.0 → 3.1.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/dist/astroviewer.cjs +19832 -16986
- package/dist/astroviewer.js +1 -1
- package/dist/astroviewer.min.js +1 -1
- package/lib-esm/AstroSphere.d.ts +31 -2
- package/lib-esm/AstroSphere.js +267 -16
- package/lib-esm/AstroViewer.d.ts +33 -2
- package/lib-esm/AstroViewer.js +93 -0
- package/lib-esm/Camera.js +24 -8
- package/lib-esm/Config.js +12 -0
- package/lib-esm/Global.js +12 -0
- package/lib-esm/index.d.ts +8 -1
- package/lib-esm/index.js +18 -1
- package/lib-esm/model/AbstractSkyEntity.d.ts +10 -0
- package/lib-esm/model/AbstractSkyEntity.js +12 -0
- package/lib-esm/model/AstroGL.js +12 -0
- package/lib-esm/model/ColorMaps.js +12 -0
- package/lib-esm/model/MetadataColumn.js +12 -0
- package/lib-esm/model/MetadataManager.js +12 -0
- package/lib-esm/model/Point.js +12 -0
- package/lib-esm/model/Point2D.js +12 -0
- package/lib-esm/model/Source.js +12 -0
- package/lib-esm/model/SphereFoV.d.ts +30 -0
- package/lib-esm/model/SphereFoV.js +195 -0
- package/lib-esm/model/catalogues/CatalogueGL.js +12 -0
- package/lib-esm/model/catalogues/CatalogueProps.js +13 -1
- package/lib-esm/model/earth/WMTSAdapter.d.ts +12 -0
- package/lib-esm/model/earth/WMTSAdapter.js +97 -0
- package/lib-esm/model/earth/XYZAnchestorTile.d.ts +17 -0
- package/lib-esm/model/earth/XYZAnchestorTile.js +87 -0
- package/lib-esm/model/earth/XYZConfig.d.ts +72 -0
- package/lib-esm/model/earth/XYZConfig.js +13 -0
- package/lib-esm/model/earth/XYZFoVHelper.d.ts +9 -0
- package/lib-esm/model/earth/XYZFoVHelper.js +101 -0
- package/lib-esm/model/earth/XYZMap.d.ts +31 -0
- package/lib-esm/model/earth/XYZMap.js +208 -0
- package/lib-esm/model/earth/XYZMapDescriptor.d.ts +29 -0
- package/lib-esm/model/earth/XYZMapDescriptor.js +77 -0
- package/lib-esm/model/earth/XYZMeshBuilder.d.ts +6 -0
- package/lib-esm/model/earth/XYZMeshBuilder.js +108 -0
- package/lib-esm/model/earth/XYZTile.d.ts +38 -0
- package/lib-esm/model/earth/XYZTile.js +167 -0
- package/lib-esm/model/earth/XYZTileBuffer.d.ts +37 -0
- package/lib-esm/model/earth/XYZTileBuffer.js +139 -0
- package/lib-esm/model/earth/XYZTileRequestScheduler.d.ts +25 -0
- package/lib-esm/model/earth/XYZTileRequestScheduler.js +172 -0
- package/lib-esm/model/earth/XYZTypes.d.ts +24 -0
- package/lib-esm/model/earth/XYZTypes.js +13 -0
- package/lib-esm/model/earth/XYZVisibleTilesManager.d.ts +19 -0
- package/lib-esm/model/earth/XYZVisibleTilesManager.js +77 -0
- package/lib-esm/model/footprints/Footprint.js +12 -0
- package/lib-esm/model/footprints/FootprintProps.js +13 -1
- package/lib-esm/model/footprints/FootprintSetGL.js +13 -1
- package/lib-esm/model/grid/EquatorialGrid.js +20 -6
- package/lib-esm/model/grid/GridTextHelper.d.ts +10 -19
- package/lib-esm/model/grid/GridTextHelper.js +70 -67
- package/lib-esm/model/grid/HealpixGrid.d.ts +4 -4
- package/lib-esm/model/grid/HealpixGrid.js +19 -6
- package/lib-esm/model/grid/LonLatGrid.d.ts +40 -0
- package/lib-esm/model/grid/LonLatGrid.js +258 -0
- package/lib-esm/model/hips/AllSky.js +12 -0
- package/lib-esm/model/hips/AncestorTile.js +12 -0
- package/lib-esm/model/hips/FoVHelper.js +12 -0
- package/lib-esm/model/hips/HiPS.js +12 -9
- package/lib-esm/model/hips/HiPSDescriptor.js +12 -0
- package/lib-esm/model/hips/Tile.js +12 -0
- package/lib-esm/model/hips/TileBuffer.js +12 -0
- package/lib-esm/model/hips/VisibleTilesManager.js +12 -0
- package/lib-esm/model/tap/TapMetadata.js +12 -0
- package/lib-esm/model/tap/TapMetadataList.js +12 -0
- package/lib-esm/model/tap/TapRepo.js +12 -0
- package/lib-esm/model/terra/TerraFootprintSetGL.d.ts +4 -0
- package/lib-esm/model/terra/TerraFootprintSetGL.js +16 -0
- package/lib-esm/model/terra/TerraPointSetGL.d.ts +4 -0
- package/lib-esm/model/terra/TerraPointSetGL.js +16 -0
- package/lib-esm/services/SesameService.js +11 -3
- package/lib-esm/services/helpers.js +12 -0
- package/lib-esm/services/hipsNodeService.js +12 -0
- package/lib-esm/services/parse-hipslist.js +12 -0
- package/lib-esm/services/queryCatalogueByFoV.js +13 -1
- package/lib-esm/services/queryFootprintSetByFov.js +13 -1
- package/lib-esm/services/tapRepoService.js +13 -1
- package/lib-esm/services/types.js +12 -0
- package/lib-esm/shader/CatalogueShaderProgram.js +12 -0
- package/lib-esm/shader/FootprintShaderProgram.js +12 -0
- package/lib-esm/shader/GridShaderManager.js +12 -0
- package/lib-esm/shader/HiPSShaderProgram.js +12 -0
- package/lib-esm/shader/ShaderManager.js +12 -1
- package/lib-esm/shader/ShaderManagerMutliHiPS.js +12 -1
- package/lib-esm/shader/XYZShaderProgram.d.ts +33 -0
- package/lib-esm/shader/XYZShaderProgram.js +213 -0
- package/lib-esm/utils/CoordsType.js +12 -0
- package/lib-esm/utils/FoVUtils.js +12 -0
- package/lib-esm/utils/GeomUtils.js +12 -0
- package/lib-esm/utils/MouseHelper.js +12 -0
- package/lib-esm/utils/PerspectiveMatrixManager.js +12 -0
- package/lib-esm/utils/RayPickingUtils.js +12 -0
- package/lib-esm/utils/STCSParser.js +12 -0
- package/lib-esm/utils/ShaderUtility.js +13 -1
- package/lib-esm/utils/Utils.js +12 -0
- package/lib-esm/utils/XYZRayPickingUtils.d.ts +27 -0
- package/lib-esm/utils/XYZRayPickingUtils.js +226 -0
- package/package.json +1 -2
- package/lib-esm/model/FoV.d.ts +0 -62
- package/lib-esm/model/FoV.js +0 -274
package/lib-esm/Camera.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
/**
|
|
2
14
|
* @author Fabrizio Giordano (Fab)
|
|
3
15
|
*/
|
|
@@ -44,10 +56,19 @@ class Camera {
|
|
|
44
56
|
}
|
|
45
57
|
goToPhiTheta(ptDeg) {
|
|
46
58
|
const xyz = sphericalToCartesian(ptDeg.phi, ptDeg.theta, this.cam_pos[2]);
|
|
59
|
+
const targetDirection = vec3.normalize(vec3.create(), vec3.fromValues(xyz[0], xyz[1], xyz[2]));
|
|
60
|
+
const celestialNorth = vec3.fromValues(0.0, 0.0, 1.0);
|
|
61
|
+
const northProjection = vec3.scale(vec3.create(), targetDirection, vec3.dot(celestialNorth, targetDirection));
|
|
62
|
+
const cameraUp = vec3.subtract(vec3.create(), celestialNorth, northProjection);
|
|
63
|
+
if (vec3.length(cameraUp) < 1e-6) {
|
|
64
|
+
vec3.set(cameraUp, 0.0, 1.0, 0.0);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
vec3.normalize(cameraUp, cameraUp);
|
|
68
|
+
}
|
|
47
69
|
let cameraMatrix = mat4.create();
|
|
48
70
|
cameraMatrix = mat4.translate(cameraMatrix, cameraMatrix, vec3.fromValues(xyz[0], xyz[1], xyz[2]));
|
|
49
71
|
const focusPoint = [0.0, 0.0, 0.0];
|
|
50
|
-
const cameraUp = vec3.clone([0.0, 1.0, 0.0]);
|
|
51
72
|
const cameraPos = [cameraMatrix[12], cameraMatrix[13], cameraMatrix[14]];
|
|
52
73
|
cameraMatrix = mat4.targetTo(cameraMatrix, cameraPos, focusPoint, cameraUp);
|
|
53
74
|
this.R = mat4.clone(cameraMatrix);
|
|
@@ -200,10 +221,6 @@ class Camera {
|
|
|
200
221
|
const totRot = Math.sqrt(phi * phi + theta * theta);
|
|
201
222
|
if (totRot === 0)
|
|
202
223
|
return;
|
|
203
|
-
// If both X and Y rotations are locked, nothing to do
|
|
204
|
-
if (this.lockRotX && this.lockRotY) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
224
|
const pos = this.getCameraPosition();
|
|
208
225
|
const dist2Center = Math.sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]);
|
|
209
226
|
const distanceFromSurface = Math.max(dist2Center - 1, 1e-6);
|
|
@@ -214,9 +231,8 @@ class Camera {
|
|
|
214
231
|
const normalizedFoV = Math.min(1, this.FoV / 18);
|
|
215
232
|
const fovFactor = 0.06 + 1.55 * Math.pow(normalizedFoV, 0.52);
|
|
216
233
|
const usedRot = ((totRot * distanceFactor * fovFactor) / 1.9) * this.rotationSensitivity;
|
|
217
|
-
|
|
218
|
-
let
|
|
219
|
-
let axisY = this.lockRotY ? 0 : phi;
|
|
234
|
+
let axisX = theta;
|
|
235
|
+
let axisY = phi;
|
|
220
236
|
const axisLen = Math.sqrt(axisX * axisX + axisY * axisY);
|
|
221
237
|
// If after locking we have no axis left, do nothing
|
|
222
238
|
if (axisLen === 0) {
|
package/lib-esm/Config.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
export const hipsNodes = [
|
|
2
14
|
"https://skies.esac.esa.int/",
|
|
3
15
|
"https://alasky.cds.unistra.fr/",
|
package/lib-esm/Global.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
'use strict';
|
|
2
14
|
import { Healpix } from 'healpixjs';
|
|
3
15
|
import { bootSetup } from './Config.js';
|
package/lib-esm/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { AstroViewer } from './AstroViewer.js';
|
|
2
2
|
export { HiPSDescriptor } from './model/hips/HiPSDescriptor.js';
|
|
3
|
-
export { FoV } from './model/
|
|
3
|
+
export { SphereFoV as FoV } from './model/SphereFoV.js';
|
|
4
|
+
export { SphereFoV } from './model/SphereFoV.js';
|
|
4
5
|
export type { PointCoordinates, CameraChangedDetail } from './AstroSphere.js';
|
|
5
6
|
export { HoveredFootprintDetail, FootprintSetGL } from './model/footprints/FootprintSetGL.js';
|
|
6
7
|
export { CatalogueGL } from './model/catalogues/CatalogueGL.js';
|
|
8
|
+
export { TerraPointSetGL } from './model/terra/TerraPointSetGL.js';
|
|
9
|
+
export { TerraFootprintSetGL } from './model/terra/TerraFootprintSetGL.js';
|
|
7
10
|
export { MetadataManager } from './model/MetadataManager.js';
|
|
8
11
|
export { MetadataColumn, MetadataInit, ColumnType } from './model/MetadataColumn.js';
|
|
9
12
|
export { Point, SphericalOpts, AstroOpts, PointInitOpts, CartesianOpts } from './model/Point.js';
|
|
@@ -12,5 +15,9 @@ export { CoordsType } from './utils/CoordsType.js';
|
|
|
12
15
|
export { ColorMaps, COLOR_MAP_SAMPLE_COUNT, createColorMapFromSamples } from './model/ColorMaps.js';
|
|
13
16
|
export type { ColorMap, ColorMapName } from './model/ColorMaps.js';
|
|
14
17
|
export { HiPS } from './model/hips/HiPS.js';
|
|
18
|
+
export { XYZMap } from './model/earth/XYZMap.js';
|
|
19
|
+
export { WMTSAdapter } from './model/earth/WMTSAdapter.js';
|
|
20
|
+
export type { XYZLayerConfig, WMTSLayerConfig, WMTSRequestEncoding } from './model/earth/XYZConfig.js';
|
|
21
|
+
export type { XYZTileCoord, XYZTileMesh } from './model/earth/XYZTypes.js';
|
|
15
22
|
export { Source } from './model/Source.js';
|
|
16
23
|
export { Footprint } from './model/footprints/Footprint.js';
|
package/lib-esm/index.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
export { AstroViewer } from './AstroViewer.js';
|
|
2
14
|
export { HiPSDescriptor } from './model/hips/HiPSDescriptor.js';
|
|
3
|
-
export { FoV } from './model/
|
|
15
|
+
export { SphereFoV as FoV } from './model/SphereFoV.js';
|
|
16
|
+
export { SphereFoV } from './model/SphereFoV.js';
|
|
4
17
|
export { FootprintSetGL } from './model/footprints/FootprintSetGL.js';
|
|
5
18
|
export { CatalogueGL } from './model/catalogues/CatalogueGL.js';
|
|
19
|
+
export { TerraPointSetGL } from './model/terra/TerraPointSetGL.js';
|
|
20
|
+
export { TerraFootprintSetGL } from './model/terra/TerraFootprintSetGL.js';
|
|
6
21
|
export { MetadataManager } from './model/MetadataManager.js';
|
|
7
22
|
export { MetadataColumn, ColumnType } from './model/MetadataColumn.js';
|
|
8
23
|
export { Point } from './model/Point.js';
|
|
@@ -10,6 +25,8 @@ export { FoVUtils } from './utils/FoVUtils.js';
|
|
|
10
25
|
export { CoordsType } from './utils/CoordsType.js';
|
|
11
26
|
export { ColorMaps, COLOR_MAP_SAMPLE_COUNT, createColorMapFromSamples } from './model/ColorMaps.js';
|
|
12
27
|
export { HiPS } from './model/hips/HiPS.js';
|
|
28
|
+
export { XYZMap } from './model/earth/XYZMap.js';
|
|
29
|
+
export { WMTSAdapter } from './model/earth/WMTSAdapter.js';
|
|
13
30
|
export { Source } from './model/Source.js';
|
|
14
31
|
export { Footprint } from './model/footprints/Footprint.js';
|
|
15
32
|
console.log('astroviewer UMD loaded');
|
|
@@ -4,11 +4,21 @@
|
|
|
4
4
|
import { vec3, mat4, ReadonlyVec3, ReadonlyMat4 } from "gl-matrix";
|
|
5
5
|
import { HiPSShaderProgram } from '../shader/HiPSShaderProgram.js';
|
|
6
6
|
import Camera from "../Camera.js";
|
|
7
|
+
import { Point } from "./Point.js";
|
|
7
8
|
type GL = WebGLRenderingContext | WebGL2RenderingContext;
|
|
8
9
|
export interface SkyEntityDrawInput {
|
|
9
10
|
fovDeg?: number;
|
|
10
11
|
camera: Camera;
|
|
11
12
|
pMatrix: ReadonlyMat4;
|
|
13
|
+
centerSphericalDeg?: {
|
|
14
|
+
phi: number;
|
|
15
|
+
theta: number;
|
|
16
|
+
};
|
|
17
|
+
fovPolygon?: Point[];
|
|
18
|
+
viewportSphericalSamples?: Array<{
|
|
19
|
+
phi: number;
|
|
20
|
+
theta: number;
|
|
21
|
+
}>;
|
|
12
22
|
}
|
|
13
23
|
export declare abstract class AbstractSkyEntity {
|
|
14
24
|
refreshMe: boolean;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
/**
|
|
2
14
|
* @author Fabrizio Giordano (Fab)
|
|
3
15
|
*/
|
package/lib-esm/model/AstroGL.js
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
export {};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
export const COLOR_MAP_SAMPLE_COUNT = 256;
|
|
2
14
|
function validateColorChannel(name, values) {
|
|
3
15
|
if (!Array.isArray(values)) {
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
'use strict';
|
|
2
14
|
export var ColumnType;
|
|
3
15
|
(function (ColumnType) {
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
import { ColumnType } from "./MetadataColumn.js";
|
|
2
14
|
export class MetadataManager {
|
|
3
15
|
static STANDARD_SIZE = "STANDARD_SIZE";
|
package/lib-esm/model/Point.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
/**
|
|
2
14
|
* @author Fabrizio Giordano (Fab77)
|
|
3
15
|
*/
|
package/lib-esm/model/Point2D.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
class Point2D {
|
|
2
14
|
_x;
|
|
3
15
|
_y;
|
package/lib-esm/model/Source.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
'use strict';
|
|
2
14
|
import { Vec3, Pointing } from 'healpixjs';
|
|
3
15
|
import global from '../Global.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReadonlyMat4 } from 'gl-matrix';
|
|
2
|
+
import Camera from '../Camera.js';
|
|
3
|
+
import { AbstractSkyEntity } from './AbstractSkyEntity.js';
|
|
4
|
+
export declare class SphereFoV {
|
|
5
|
+
private static readonly MIN_FOV_DEG;
|
|
6
|
+
private fovXDeg;
|
|
7
|
+
private fovYDeg;
|
|
8
|
+
private ratio;
|
|
9
|
+
private _minFoV;
|
|
10
|
+
private _webgl;
|
|
11
|
+
private _lastModel;
|
|
12
|
+
private _lastCamera;
|
|
13
|
+
constructor(webgl: WebGL2RenderingContext);
|
|
14
|
+
getFoV(insideSphere: boolean, model: AbstractSkyEntity, camera: Camera, pMatrix: ReadonlyMat4): SphereFoV;
|
|
15
|
+
private computeRatio;
|
|
16
|
+
get minFoV(): number;
|
|
17
|
+
get xFoV(): number;
|
|
18
|
+
get yFoV(): number;
|
|
19
|
+
computeDistanceFromAngle(angleDeg: number): number;
|
|
20
|
+
changeMinFov(deg: number): void;
|
|
21
|
+
computeCameraPositionForMinFoV(targetMinFoVDeg: number): [number, number, number];
|
|
22
|
+
computeCameraPositionForFoV(targetFoVDeg: number): [number, number, number];
|
|
23
|
+
computeCameraPositionForAngularDiameter(targetAngularDiameterDeg: number): [number, number, number];
|
|
24
|
+
private computeAngle;
|
|
25
|
+
private computeAngularDistanceDeg;
|
|
26
|
+
private getIntersectionPointWithModel;
|
|
27
|
+
private getRayFromMouse;
|
|
28
|
+
private raySphere;
|
|
29
|
+
private mat4MultiplyVec4;
|
|
30
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
13
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
14
|
+
import { radToDeg } from '../utils/Utils.js';
|
|
15
|
+
export class SphereFoV {
|
|
16
|
+
static MIN_FOV_DEG = 1e-6;
|
|
17
|
+
fovXDeg = 180;
|
|
18
|
+
fovYDeg = 180;
|
|
19
|
+
ratio = 0;
|
|
20
|
+
_minFoV = 180;
|
|
21
|
+
_webgl;
|
|
22
|
+
_lastModel = null;
|
|
23
|
+
_lastCamera = null;
|
|
24
|
+
constructor(webgl) {
|
|
25
|
+
this._webgl = webgl;
|
|
26
|
+
}
|
|
27
|
+
getFoV(insideSphere, model, camera, pMatrix) {
|
|
28
|
+
this._lastModel = model;
|
|
29
|
+
this._lastCamera = camera;
|
|
30
|
+
const canvas = this._webgl.canvas;
|
|
31
|
+
if (!canvas) {
|
|
32
|
+
this.fovXDeg = 180;
|
|
33
|
+
this.fovYDeg = 180;
|
|
34
|
+
this._minFoV = this.minFoV;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
const rect = canvas.getBoundingClientRect();
|
|
38
|
+
const canvasWidth = rect.width;
|
|
39
|
+
const canvasHeight = rect.height;
|
|
40
|
+
this.fovXDeg = this.computeAngle(0, canvasHeight / 2, insideSphere, model, camera, pMatrix).angleDeg;
|
|
41
|
+
this.fovYDeg = this.computeAngle(canvasWidth / 2, 0, insideSphere, model, camera, pMatrix).angleDeg;
|
|
42
|
+
this._minFoV = this.minFoV;
|
|
43
|
+
this.ratio = this.computeRatio(camera);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
computeRatio(camera) {
|
|
47
|
+
const pos = camera.getCameraPosition();
|
|
48
|
+
const distanceFromCenter = Math.sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]);
|
|
49
|
+
return distanceFromCenter / this.fovYDeg;
|
|
50
|
+
}
|
|
51
|
+
get minFoV() {
|
|
52
|
+
const minFov = this.fovYDeg <= this.fovXDeg ? this.fovYDeg : this.fovXDeg;
|
|
53
|
+
this._minFoV = Math.max(minFov, SphereFoV.MIN_FOV_DEG);
|
|
54
|
+
return this._minFoV;
|
|
55
|
+
}
|
|
56
|
+
get xFoV() {
|
|
57
|
+
return this.fovXDeg;
|
|
58
|
+
}
|
|
59
|
+
get yFoV() {
|
|
60
|
+
return this.fovYDeg;
|
|
61
|
+
}
|
|
62
|
+
computeDistanceFromAngle(angleDeg) {
|
|
63
|
+
return angleDeg * this.ratio;
|
|
64
|
+
}
|
|
65
|
+
changeMinFov(deg) {
|
|
66
|
+
if (this.fovYDeg <= this.fovXDeg) {
|
|
67
|
+
this.fovYDeg = deg;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.fovXDeg = deg;
|
|
71
|
+
}
|
|
72
|
+
this.minFoV;
|
|
73
|
+
}
|
|
74
|
+
computeCameraPositionForMinFoV(targetMinFoVDeg) {
|
|
75
|
+
return this.computeCameraPositionForFoV(targetMinFoVDeg);
|
|
76
|
+
}
|
|
77
|
+
computeCameraPositionForFoV(targetFoVDeg) {
|
|
78
|
+
return this.computeCameraPositionForAngularDiameter(targetFoVDeg);
|
|
79
|
+
}
|
|
80
|
+
computeCameraPositionForAngularDiameter(targetAngularDiameterDeg) {
|
|
81
|
+
if (!this._lastModel || !this._lastCamera) {
|
|
82
|
+
return [0, 0, 0];
|
|
83
|
+
}
|
|
84
|
+
const eps = 1e-6;
|
|
85
|
+
const clamped = Math.max(eps, Math.min(180 - eps, targetAngularDiameterDeg));
|
|
86
|
+
const halfRad = (clamped * Math.PI) / 360.0;
|
|
87
|
+
const sinHalf = Math.sin(halfRad);
|
|
88
|
+
if (sinHalf <= 0) {
|
|
89
|
+
return [0, 0, 0];
|
|
90
|
+
}
|
|
91
|
+
const model = this._lastModel;
|
|
92
|
+
const camera = this._lastCamera;
|
|
93
|
+
const targetDistance = Math.max(model.radius / sinHalf, model.radius + 1e-4);
|
|
94
|
+
const camPos = camera.getCameraPosition();
|
|
95
|
+
const direction = vec3.fromValues(camPos[0] - model.center[0], camPos[1] - model.center[1], camPos[2] - model.center[2]);
|
|
96
|
+
if (vec3.length(direction) < eps) {
|
|
97
|
+
vec3.set(direction, 0, 0, 1);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
vec3.normalize(direction, direction);
|
|
101
|
+
}
|
|
102
|
+
return [
|
|
103
|
+
model.center[0] + direction[0] * targetDistance,
|
|
104
|
+
model.center[1] + direction[1] * targetDistance,
|
|
105
|
+
model.center[2] + direction[2] * targetDistance,
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
computeAngle(canvasX, canvasY, insideSphere, model, camera, pMatrix) {
|
|
109
|
+
const canvas = this._webgl.canvas;
|
|
110
|
+
const rect = canvas.getBoundingClientRect();
|
|
111
|
+
const centerHit = this.getIntersectionPointWithModel(rect.width / 2, rect.height / 2, model, camera, pMatrix);
|
|
112
|
+
const edgeHit = this.getIntersectionPointWithModel(canvasX, canvasY, model, camera, pMatrix);
|
|
113
|
+
if (!centerHit || !edgeHit) {
|
|
114
|
+
return { angleDeg: 180, distance: -1 };
|
|
115
|
+
}
|
|
116
|
+
const angleDeg = 2 * this.computeAngularDistanceDeg(centerHit.point, edgeHit.point);
|
|
117
|
+
return {
|
|
118
|
+
angleDeg: insideSphere ? 360 - angleDeg : angleDeg,
|
|
119
|
+
distance: edgeHit.distance,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
computeAngularDistanceDeg(a, b) {
|
|
123
|
+
const aNorm = vec3.normalize(vec3.create(), a);
|
|
124
|
+
const bNorm = vec3.normalize(vec3.create(), b);
|
|
125
|
+
const dot = vec3.dot(aNorm, bNorm);
|
|
126
|
+
const clamped = Math.min(1, Math.max(-1, dot));
|
|
127
|
+
return radToDeg(Math.acos(clamped));
|
|
128
|
+
}
|
|
129
|
+
getIntersectionPointWithModel(mouseX, mouseY, model, camera, pMatrix) {
|
|
130
|
+
const rayWorld = this.getRayFromMouse(mouseX, mouseY, pMatrix, camera.getCameraMatrix());
|
|
131
|
+
const distance = this.raySphere(camera.getCameraPosition(), rayWorld, model);
|
|
132
|
+
if (distance < 0) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const worldHit = vec3.create();
|
|
136
|
+
vec3.scale(worldHit, rayWorld, distance);
|
|
137
|
+
vec3.add(worldHit, camera.getCameraPosition(), worldHit);
|
|
138
|
+
const worldHit4 = [worldHit[0], worldHit[1], worldHit[2], 1.0];
|
|
139
|
+
const modelHit4 = [0, 0, 0, 0];
|
|
140
|
+
this.mat4MultiplyVec4(model.getModelMatrixInverse(), worldHit4, modelHit4);
|
|
141
|
+
return {
|
|
142
|
+
point: vec3.fromValues(modelHit4[0], modelHit4[1], modelHit4[2]),
|
|
143
|
+
distance,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
getRayFromMouse(mouseX, mouseY, pMatrix, vMatrix) {
|
|
147
|
+
const gl = this._webgl;
|
|
148
|
+
const canvas = gl.canvas;
|
|
149
|
+
const rect = canvas.getBoundingClientRect();
|
|
150
|
+
const x = (2.0 * mouseX) / rect.width - 1.0;
|
|
151
|
+
const y = 1.0 - (2.0 * mouseY) / rect.height;
|
|
152
|
+
const rayClip = [x, y, -1.0, 1.0];
|
|
153
|
+
const pInv = mat4.create();
|
|
154
|
+
mat4.invert(pInv, pMatrix);
|
|
155
|
+
const rayEye4 = [0, 0, 0, 0];
|
|
156
|
+
this.mat4MultiplyVec4(pInv, rayClip, rayEye4);
|
|
157
|
+
const rayEye = [rayEye4[0], rayEye4[1], -1.0, 0.0];
|
|
158
|
+
const vInv = mat4.create();
|
|
159
|
+
mat4.invert(vInv, vMatrix);
|
|
160
|
+
const rayWorld4 = [0, 0, 0, 0];
|
|
161
|
+
this.mat4MultiplyVec4(vInv, rayEye, rayWorld4);
|
|
162
|
+
const rayWorld = vec3.fromValues(rayWorld4[0], rayWorld4[1], rayWorld4[2]);
|
|
163
|
+
vec3.normalize(rayWorld, rayWorld);
|
|
164
|
+
return rayWorld;
|
|
165
|
+
}
|
|
166
|
+
raySphere(rayOrigWorld, rayDirectionWorld, sphere) {
|
|
167
|
+
let intersectionDistance = -1;
|
|
168
|
+
const L = vec3.create();
|
|
169
|
+
vec3.subtract(L, rayOrigWorld, sphere.center);
|
|
170
|
+
const b = vec3.dot(rayDirectionWorld, L);
|
|
171
|
+
const c = vec3.dot(L, L) - sphere.radius * sphere.radius;
|
|
172
|
+
const disc = b * b - c;
|
|
173
|
+
if (disc > 0.0) {
|
|
174
|
+
const s = Math.sqrt(disc);
|
|
175
|
+
const ta = -b + s;
|
|
176
|
+
const tb = -b - s;
|
|
177
|
+
if (ta >= 0.0 || tb >= 0.0) {
|
|
178
|
+
intersectionDistance = tb < 0.0 ? ta : Math.min(ta, tb);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (disc === 0.0) {
|
|
182
|
+
const t = -b;
|
|
183
|
+
if (t >= 0.0) {
|
|
184
|
+
intersectionDistance = t;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return intersectionDistance;
|
|
188
|
+
}
|
|
189
|
+
mat4MultiplyVec4(m, v, out) {
|
|
190
|
+
out[0] = m[0] * v[0] + m[4] * v[1] + m[8] * v[2] + m[12] * v[3];
|
|
191
|
+
out[1] = m[1] * v[0] + m[5] * v[1] + m[9] * v[2] + m[13] * v[3];
|
|
192
|
+
out[2] = m[2] * v[0] + m[6] * v[1] + m[10] * v[2] + m[14] * v[3];
|
|
193
|
+
out[3] = m[3] * v[0] + m[7] * v[1] + m[11] * v[2] + m[15] * v[3];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
1
13
|
import { Source } from '../Source.js';
|
|
2
14
|
import { Point } from '../Point.js';
|
|
3
15
|
import { CoordsType } from '../..//utils/CoordsType.js';
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AstroViewer
|
|
3
|
+
* Copyright (C) Fabrizio Giordano
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-AstroViewer-Dual-License
|
|
5
|
+
*
|
|
6
|
+
* This file is part of AstroViewer.
|
|
7
|
+
* AstroViewer is distributed under a dual-license model.
|
|
8
|
+
* Commercial use requires a separate commercial license.
|
|
9
|
+
* Non-commercial use is governed by LICENSE-NONCOMMERCIAL.md.
|
|
10
|
+
*
|
|
11
|
+
* See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for details.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
1
14
|
// // CatalogueProps.ts
|
|
2
15
|
// type UCD = string | undefined;
|
|
3
|
-
export {};
|
|
4
16
|
// import {Metadata} from "../tap/TapMetadata.js";
|
|
5
17
|
// import {TapMetadataList} from "../tap/TapMetadataList.js";
|
|
6
18
|
// function colName(col?: Metadata): string | undefined {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WMTSLayerConfig, XYZLayerConfig } from './XYZConfig.js';
|
|
2
|
+
import type { XYZTileCoord } from './XYZTypes.js';
|
|
3
|
+
export declare class WMTSAdapter {
|
|
4
|
+
private _config;
|
|
5
|
+
constructor(config: WMTSLayerConfig);
|
|
6
|
+
toXYZLayerConfig(): XYZLayerConfig;
|
|
7
|
+
private getInferredMaxZoom;
|
|
8
|
+
getTileUrl(tile: XYZTileCoord): string;
|
|
9
|
+
private buildRestUrl;
|
|
10
|
+
private buildKvpUrl;
|
|
11
|
+
private getCommonTokenValues;
|
|
12
|
+
}
|