astro-viewer 3.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 +2505 -1335
- package/dist/astroviewer.js +1 -1
- package/dist/astroviewer.min.js +1 -1
- package/lib-esm/AstroSphere.d.ts +26 -6
- package/lib-esm/AstroSphere.js +215 -18
- package/lib-esm/AstroViewer.d.ts +18 -5
- package/lib-esm/AstroViewer.js +47 -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 +6 -4
- package/lib-esm/index.js +16 -3
- 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/{wmts/WMTSAdapter.d.ts → WMTSAdapter.d.ts} +2 -1
- package/lib-esm/model/earth/{wmts/WMTSAdapter.js → WMTSAdapter.js} +12 -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/{types.d.ts → XYZConfig.d.ts} +2 -17
- 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 +1 -1
- package/lib-esm/model/earth/XYZMeshBuilder.js +13 -2
- package/lib-esm/model/earth/XYZTile.d.ts +20 -21
- package/lib-esm/model/earth/XYZTile.js +82 -102
- package/lib-esm/model/earth/XYZTileBuffer.d.ts +24 -26
- package/lib-esm/model/earth/XYZTileBuffer.js +60 -70
- package/lib-esm/model/earth/XYZTileRequestScheduler.d.ts +1 -1
- package/lib-esm/model/earth/XYZTileRequestScheduler.js +13 -2
- 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 +16 -27
- package/lib-esm/model/earth/XYZVisibleTilesManager.js +61 -192
- 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 +12 -0
- 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.js +12 -0
- package/lib-esm/model/terra/TerraPointSetGL.js +12 -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 +14 -1
- package/lib-esm/shader/XYZShaderProgram.js +127 -2
- 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 -1
- package/lib-esm/model/FoV.d.ts +0 -62
- package/lib-esm/model/FoV.js +0 -274
- package/lib-esm/model/earth/XYZAncestorMeshCache.d.ts +0 -10
- package/lib-esm/model/earth/XYZAncestorMeshCache.js +0 -31
- package/lib-esm/model/earth/XYZLayer.d.ts +0 -31
- package/lib-esm/model/earth/XYZLayer.js +0 -231
- package/lib-esm/model/earth/XYZTileProvider.d.ts +0 -29
- package/lib-esm/model/earth/XYZTileProvider.js +0 -187
- package/lib-esm/model/earth/types.js +0 -1
- package/lib-esm/model/earth/wmts/types.d.ts +0 -1
- package/lib-esm/model/earth/wmts/types.js +0 -1
package/lib-esm/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
@@ -14,8 +15,9 @@ export { CoordsType } from './utils/CoordsType.js';
|
|
|
14
15
|
export { ColorMaps, COLOR_MAP_SAMPLE_COUNT, createColorMapFromSamples } from './model/ColorMaps.js';
|
|
15
16
|
export type { ColorMap, ColorMapName } from './model/ColorMaps.js';
|
|
16
17
|
export { HiPS } from './model/hips/HiPS.js';
|
|
17
|
-
export {
|
|
18
|
-
export { WMTSAdapter } from './model/earth/
|
|
19
|
-
export type { XYZLayerConfig,
|
|
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';
|
|
20
22
|
export { Source } from './model/Source.js';
|
|
21
23
|
export { Footprint } from './model/footprints/Footprint.js';
|
package/lib-esm/index.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
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';
|
|
6
19
|
export { TerraPointSetGL } from './model/terra/TerraPointSetGL.js';
|
|
@@ -12,8 +25,8 @@ export { FoVUtils } from './utils/FoVUtils.js';
|
|
|
12
25
|
export { CoordsType } from './utils/CoordsType.js';
|
|
13
26
|
export { ColorMaps, COLOR_MAP_SAMPLE_COUNT, createColorMapFromSamples } from './model/ColorMaps.js';
|
|
14
27
|
export { HiPS } from './model/hips/HiPS.js';
|
|
15
|
-
export {
|
|
16
|
-
export { WMTSAdapter } from './model/earth/
|
|
28
|
+
export { XYZMap } from './model/earth/XYZMap.js';
|
|
29
|
+
export { WMTSAdapter } from './model/earth/WMTSAdapter.js';
|
|
17
30
|
export { Source } from './model/Source.js';
|
|
18
31
|
export { Footprint } from './model/footprints/Footprint.js';
|
|
19
32
|
console.log('astroviewer UMD loaded');
|
|
@@ -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 {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { WMTSLayerConfig, XYZLayerConfig
|
|
1
|
+
import type { WMTSLayerConfig, XYZLayerConfig } from './XYZConfig.js';
|
|
2
|
+
import type { XYZTileCoord } from './XYZTypes.js';
|
|
2
3
|
export declare class WMTSAdapter {
|
|
3
4
|
private _config;
|
|
4
5
|
constructor(config: WMTSLayerConfig);
|
|
@@ -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
|
function replaceTokens(template, values) {
|
|
2
14
|
return Object.entries(values).reduce((result, [key, value]) => result.replace(new RegExp(`\\{${key}\\}`, 'g'), value), template);
|
|
3
15
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { XYZShaderProgram } from '../../shader/XYZShaderProgram.js';
|
|
2
|
+
import { XYZMeshBuilder } from './XYZMeshBuilder.js';
|
|
3
|
+
import { XYZTile } from './XYZTile.js';
|
|
4
|
+
import type { XYZTileCoord } from './XYZTypes.js';
|
|
5
|
+
type Mat4 = Float32Array;
|
|
6
|
+
export declare class XYZAnchestorTile extends XYZTile {
|
|
7
|
+
private _ancestorMeshBuilder;
|
|
8
|
+
private _ancestorWebgl;
|
|
9
|
+
private _segmentsPerSide;
|
|
10
|
+
private _meshCache;
|
|
11
|
+
constructor(coord: XYZTileCoord, url: string, webgl: WebGL2RenderingContext, shaderProgram: XYZShaderProgram, meshBuilder?: XYZMeshBuilder, segmentsPerSide?: number);
|
|
12
|
+
draw(pMatrixOrVisibleZoom: Mat4 | number, vMatrixOrVisibleTiles: Mat4 | XYZTileCoord[], mMatrixOrAncestorsMap: Mat4 | Map<string, XYZTileCoord>, colorMapIdxOrPMatrix: number | Mat4, vMatrix?: Mat4, mMatrix?: Mat4, colorMapIdx?: number): boolean;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
private getRemappedMesh;
|
|
15
|
+
private isAncestorOf;
|
|
16
|
+
}
|
|
17
|
+
export { XYZAnchestorTile as XYZAncestorTile };
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { XYZMeshBuilder } from './XYZMeshBuilder.js';
|
|
14
|
+
import { XYZTile } from './XYZTile.js';
|
|
15
|
+
export class XYZAnchestorTile extends XYZTile {
|
|
16
|
+
_ancestorMeshBuilder;
|
|
17
|
+
_ancestorWebgl;
|
|
18
|
+
_segmentsPerSide;
|
|
19
|
+
_meshCache = new Map();
|
|
20
|
+
constructor(coord, url, webgl, shaderProgram, meshBuilder = new XYZMeshBuilder(), segmentsPerSide = 16) {
|
|
21
|
+
super(coord, url, webgl, shaderProgram, meshBuilder, segmentsPerSide);
|
|
22
|
+
this._ancestorMeshBuilder = meshBuilder;
|
|
23
|
+
this._ancestorWebgl = webgl;
|
|
24
|
+
this._segmentsPerSide = segmentsPerSide;
|
|
25
|
+
}
|
|
26
|
+
draw(pMatrixOrVisibleZoom, vMatrixOrVisibleTiles, mMatrixOrAncestorsMap, colorMapIdxOrPMatrix, vMatrix, mMatrix, colorMapIdx) {
|
|
27
|
+
if (typeof pMatrixOrVisibleZoom !== 'number') {
|
|
28
|
+
return super.draw(pMatrixOrVisibleZoom, vMatrixOrVisibleTiles, mMatrixOrAncestorsMap, colorMapIdxOrPMatrix);
|
|
29
|
+
}
|
|
30
|
+
if (!vMatrix || !mMatrix || colorMapIdx === undefined) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const visibleZoom = pMatrixOrVisibleZoom;
|
|
34
|
+
const visibleTiles = vMatrixOrVisibleTiles;
|
|
35
|
+
const ancestorsMap = mMatrixOrAncestorsMap;
|
|
36
|
+
const pMatrix = colorMapIdxOrPMatrix;
|
|
37
|
+
let drawn = false;
|
|
38
|
+
if (visibleZoom <= this.coord.z) {
|
|
39
|
+
return super.draw(pMatrix, vMatrix, mMatrix, colorMapIdx);
|
|
40
|
+
}
|
|
41
|
+
for (const targetTile of visibleTiles) {
|
|
42
|
+
if (!this.isAncestorOf(targetTile)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const ancestorKey = `${this.coord.z}/${this.coord.x}/${this.coord.y}`;
|
|
46
|
+
if (!ancestorsMap.has(ancestorKey)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const mesh = this.getRemappedMesh(targetTile);
|
|
50
|
+
drawn = super.drawRemapped(mesh, pMatrix, vMatrix, mMatrix, colorMapIdx) || drawn;
|
|
51
|
+
}
|
|
52
|
+
return drawn;
|
|
53
|
+
}
|
|
54
|
+
dispose() {
|
|
55
|
+
for (const mesh of this._meshCache.values()) {
|
|
56
|
+
if (mesh.positionBuffer)
|
|
57
|
+
this._ancestorWebgl.deleteBuffer(mesh.positionBuffer);
|
|
58
|
+
if (mesh.uvBuffer)
|
|
59
|
+
this._ancestorWebgl.deleteBuffer(mesh.uvBuffer);
|
|
60
|
+
if (mesh.indexBuffer)
|
|
61
|
+
this._ancestorWebgl.deleteBuffer(mesh.indexBuffer);
|
|
62
|
+
}
|
|
63
|
+
this._meshCache.clear();
|
|
64
|
+
super.dispose();
|
|
65
|
+
}
|
|
66
|
+
getRemappedMesh(targetTile) {
|
|
67
|
+
const key = `${targetTile.z}/${targetTile.x}/${targetTile.y}->${this.coord.z}/${this.coord.x}/${this.coord.y}`;
|
|
68
|
+
const existing = this._meshCache.get(key);
|
|
69
|
+
if (existing) {
|
|
70
|
+
return existing;
|
|
71
|
+
}
|
|
72
|
+
const mesh = this._ancestorMeshBuilder.buildAncestorMesh(targetTile, this.coord, this._segmentsPerSide);
|
|
73
|
+
const uploaded = this._ancestorMeshBuilder.uploadMesh(mesh, this._ancestorWebgl);
|
|
74
|
+
this._meshCache.set(key, uploaded);
|
|
75
|
+
return uploaded;
|
|
76
|
+
}
|
|
77
|
+
isAncestorOf(targetTile) {
|
|
78
|
+
if (targetTile.z <= this.coord.z) {
|
|
79
|
+
return targetTile.z === this.coord.z
|
|
80
|
+
&& targetTile.x === this.coord.x
|
|
81
|
+
&& targetTile.y === this.coord.y;
|
|
82
|
+
}
|
|
83
|
+
const dz = targetTile.z - this.coord.z;
|
|
84
|
+
return (targetTile.x >> dz) === this.coord.x && (targetTile.y >> dz) === this.coord.y;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export { XYZAnchestorTile as XYZAncestorTile };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { XYZTileCoord } from './XYZTypes.js';
|
|
1
2
|
export type XYZLayerConfig = {
|
|
2
3
|
urlTemplate: string;
|
|
4
|
+
name?: string;
|
|
3
5
|
minZoom?: number;
|
|
4
6
|
maxZoom?: number;
|
|
5
7
|
segmentsPerSide?: number;
|
|
@@ -46,23 +48,6 @@ export type XYZDebugStats = {
|
|
|
46
48
|
layer: XYZLayerDebugStats | null;
|
|
47
49
|
requests: XYZRequestSchedulerDebugStats;
|
|
48
50
|
};
|
|
49
|
-
export type XYZTileCoord = {
|
|
50
|
-
z: number;
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
};
|
|
54
|
-
export type XYZTileMesh = {
|
|
55
|
-
positions: Float32Array;
|
|
56
|
-
uvs: Float32Array;
|
|
57
|
-
indices: Uint16Array | Uint32Array;
|
|
58
|
-
};
|
|
59
|
-
export type XYZTileGpuMesh = {
|
|
60
|
-
positionBuffer: WebGLBuffer | null;
|
|
61
|
-
uvBuffer: WebGLBuffer | null;
|
|
62
|
-
indexBuffer: WebGLBuffer | null;
|
|
63
|
-
indexCount: number;
|
|
64
|
-
indexType: number;
|
|
65
|
-
};
|
|
66
51
|
export type WMTSRequestEncoding = 'kvp' | 'rest';
|
|
67
52
|
export type WMTSLayerConfig = {
|
|
68
53
|
baseUrl: string;
|
|
@@ -0,0 +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
|
+
*/
|
|
13
|
+
export {};
|