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
|
@@ -1,10 +1,22 @@
|
|
|
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 { AbstractSkyEntity } from '../AbstractSkyEntity.js';
|
|
3
15
|
import global from '../../Global.js';
|
|
4
16
|
import { mat4, vec4 } from 'gl-matrix';
|
|
5
17
|
import { fovHelper } from '../hips/FoVHelper.js';
|
|
6
18
|
import { FoVUtils } from '../../utils/FoVUtils.js';
|
|
7
|
-
import {
|
|
19
|
+
import { SphereFoV } from '../SphereFoV.js';
|
|
8
20
|
import { CoordsType } from '../../utils/CoordsType.js';
|
|
9
21
|
import { Point } from '../Point.js';
|
|
10
22
|
import GridShaderManager from '../../shader/GridShaderManager.js';
|
|
@@ -22,7 +34,7 @@ export class HealpixGrid extends AbstractSkyEntity {
|
|
|
22
34
|
fragmentShader;
|
|
23
35
|
vertexShader;
|
|
24
36
|
defaultColor = '#ec0acaff';
|
|
25
|
-
gridText = new GridTextHelper();
|
|
37
|
+
gridText = new GridTextHelper('healpix');
|
|
26
38
|
// private _hipsShaderProgram: HiPSShaderProgram
|
|
27
39
|
_attribLocations = {
|
|
28
40
|
position: 0,
|
|
@@ -59,7 +71,7 @@ export class HealpixGrid extends AbstractSkyEntity {
|
|
|
59
71
|
this._vertexCataloguePositionBuffer = super.webgl.createBuffer();
|
|
60
72
|
this._indexBuffer = super.webgl.createBuffer();
|
|
61
73
|
this._vertexCataloguePosition = new Float32Array(0);
|
|
62
|
-
this._fovObj = new
|
|
74
|
+
this._fovObj = new SphereFoV(super.webgl);
|
|
63
75
|
}
|
|
64
76
|
get fovObj() {
|
|
65
77
|
return this._fovObj;
|
|
@@ -288,9 +300,10 @@ export class HealpixGrid extends AbstractSkyEntity {
|
|
|
288
300
|
// NDC divide
|
|
289
301
|
clipspace[0] /= clipspace[3];
|
|
290
302
|
clipspace[1] /= clipspace[3];
|
|
291
|
-
// clip
|
|
292
|
-
const
|
|
293
|
-
const
|
|
303
|
+
// clip -> CSS pixels
|
|
304
|
+
const canvasRect = gl.canvas.getBoundingClientRect();
|
|
305
|
+
const pixelX = canvasRect.left + (clipspace[0] * 0.5 + 0.5) * canvasRect.width;
|
|
306
|
+
const pixelY = canvasRect.top + (clipspace[1] * -0.5 + 0.5) * canvasRect.height;
|
|
294
307
|
this.gridText.addHPXDivSet(this._visibleorder + '/' + pixels[p], pixelX, pixelY);
|
|
295
308
|
// gridTextHelper.addHPXDivSet(this._visibleorder + '/' + pixels[p], pixelX, pixelY);
|
|
296
309
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AbstractSkyEntity, SkyEntityDrawInput } from '../AbstractSkyEntity.js';
|
|
2
|
+
import { SphereFoV } from '../SphereFoV.js';
|
|
3
|
+
export declare class LatLonGrid extends AbstractSkyEntity {
|
|
4
|
+
static ELEM_SIZE: number;
|
|
5
|
+
static BYTES_X_ELEM: number;
|
|
6
|
+
private _shaderProgram;
|
|
7
|
+
private _vertexShader;
|
|
8
|
+
private _fragmentShader;
|
|
9
|
+
private _attribLocations;
|
|
10
|
+
private _lonVertexPositionBuffer;
|
|
11
|
+
private _latVertexPositionBuffer;
|
|
12
|
+
private _lonStep;
|
|
13
|
+
private _latStep;
|
|
14
|
+
private _segmentStep;
|
|
15
|
+
private _fovObj;
|
|
16
|
+
private _fovDeg;
|
|
17
|
+
private _showGrid;
|
|
18
|
+
private _lonArray;
|
|
19
|
+
private _latArray;
|
|
20
|
+
private defaultColor;
|
|
21
|
+
private gridText;
|
|
22
|
+
constructor(radius: number, position: [number, number, number], xrad: number, yrad: number, name: string, webgl: WebGL2RenderingContext);
|
|
23
|
+
init(): void;
|
|
24
|
+
private initShaders;
|
|
25
|
+
private initBuffers;
|
|
26
|
+
private lonLatToCartesian;
|
|
27
|
+
private refresh;
|
|
28
|
+
refreshFoV(input: SkyEntityDrawInput): number;
|
|
29
|
+
getMinFoVDeg(): number;
|
|
30
|
+
getFoV(): SphereFoV;
|
|
31
|
+
isVisible(): boolean;
|
|
32
|
+
toggleShowGrid(): boolean;
|
|
33
|
+
setShowGrid(showGrid: boolean): void;
|
|
34
|
+
private enableShader;
|
|
35
|
+
draw(input: SkyEntityDrawInput): void;
|
|
36
|
+
private drawLabels;
|
|
37
|
+
private projectPointToScreen;
|
|
38
|
+
private roundToStep;
|
|
39
|
+
private normalizeLon;
|
|
40
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
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
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
14
|
+
import { mat4, vec4 } from 'gl-matrix';
|
|
15
|
+
import { AbstractSkyEntity } from '../AbstractSkyEntity.js';
|
|
16
|
+
import { xyzFovHelper } from '../earth/XYZFoVHelper.js';
|
|
17
|
+
import GridShaderManager from '../../shader/GridShaderManager.js';
|
|
18
|
+
import { colorHex2RGB, degToRad } from '../../utils/Utils.js';
|
|
19
|
+
import { SphereFoV } from '../SphereFoV.js';
|
|
20
|
+
import global from '../../Global.js';
|
|
21
|
+
import GridTextHelper from './GridTextHelper.js';
|
|
22
|
+
export class LatLonGrid extends AbstractSkyEntity {
|
|
23
|
+
static ELEM_SIZE = 3;
|
|
24
|
+
static BYTES_X_ELEM = new Float32Array().BYTES_PER_ELEMENT;
|
|
25
|
+
_shaderProgram;
|
|
26
|
+
_vertexShader;
|
|
27
|
+
_fragmentShader;
|
|
28
|
+
_attribLocations = {
|
|
29
|
+
position: 0,
|
|
30
|
+
};
|
|
31
|
+
_lonVertexPositionBuffer;
|
|
32
|
+
_latVertexPositionBuffer;
|
|
33
|
+
_lonStep = 10;
|
|
34
|
+
_latStep = 10;
|
|
35
|
+
_segmentStep = 1;
|
|
36
|
+
_fovObj;
|
|
37
|
+
_fovDeg = 180;
|
|
38
|
+
_showGrid = true;
|
|
39
|
+
_lonArray = [];
|
|
40
|
+
_latArray = [];
|
|
41
|
+
defaultColor = '#41d4d4';
|
|
42
|
+
gridText = new GridTextHelper('lonlat');
|
|
43
|
+
constructor(radius, position, xrad, yrad, name, webgl) {
|
|
44
|
+
super(radius, position, xrad, yrad, name, webgl);
|
|
45
|
+
this._fovObj = new SphereFoV(webgl);
|
|
46
|
+
this.init();
|
|
47
|
+
}
|
|
48
|
+
init() {
|
|
49
|
+
this.initGL(super.webgl);
|
|
50
|
+
const gl = super.webgl;
|
|
51
|
+
this._shaderProgram = gl.createProgram();
|
|
52
|
+
this.initShaders();
|
|
53
|
+
this._lonVertexPositionBuffer = gl.createBuffer();
|
|
54
|
+
this._latVertexPositionBuffer = gl.createBuffer();
|
|
55
|
+
this.initBuffers(this._fovDeg);
|
|
56
|
+
}
|
|
57
|
+
initShaders() {
|
|
58
|
+
const gl = super.webgl;
|
|
59
|
+
const fsSource = GridShaderManager.healpixGridFS();
|
|
60
|
+
this._fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
|
|
61
|
+
gl.shaderSource(this._fragmentShader, fsSource);
|
|
62
|
+
gl.compileShader(this._fragmentShader);
|
|
63
|
+
if (!gl.getShaderParameter(this._fragmentShader, gl.COMPILE_STATUS)) {
|
|
64
|
+
const log = gl.getShaderInfoLog(this._fragmentShader) || 'Unknown fragment shader error';
|
|
65
|
+
console.error(log);
|
|
66
|
+
alert(log);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const vsSource = GridShaderManager.healpixGridVS();
|
|
70
|
+
this._vertexShader = gl.createShader(gl.VERTEX_SHADER);
|
|
71
|
+
gl.shaderSource(this._vertexShader, vsSource);
|
|
72
|
+
gl.compileShader(this._vertexShader);
|
|
73
|
+
if (!gl.getShaderParameter(this._vertexShader, gl.COMPILE_STATUS)) {
|
|
74
|
+
const log = gl.getShaderInfoLog(this._vertexShader) || 'Unknown vertex shader error';
|
|
75
|
+
console.error(log);
|
|
76
|
+
alert(log);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
gl.attachShader(this._shaderProgram, this._vertexShader);
|
|
80
|
+
gl.attachShader(this._shaderProgram, this._fragmentShader);
|
|
81
|
+
gl.linkProgram(this._shaderProgram);
|
|
82
|
+
if (!gl.getProgramParameter(this._shaderProgram, gl.LINK_STATUS)) {
|
|
83
|
+
alert('Could not initialise shaders');
|
|
84
|
+
}
|
|
85
|
+
gl.useProgram(this._shaderProgram);
|
|
86
|
+
}
|
|
87
|
+
initBuffers(fovDeg) {
|
|
88
|
+
const steps = xyzFovHelper.getLonLatSteps(fovDeg);
|
|
89
|
+
this._lonStep = steps.lonStep;
|
|
90
|
+
this._latStep = steps.latStep;
|
|
91
|
+
this._segmentStep = Math.max(Math.min(this._lonStep, this._latStep), 0.25);
|
|
92
|
+
this._lonArray = [];
|
|
93
|
+
this._latArray = [];
|
|
94
|
+
for (let lon = -180; lon < 180; lon += this._lonStep) {
|
|
95
|
+
const vertices = [];
|
|
96
|
+
for (let lat = -90; lat <= 90; lat += this._segmentStep) {
|
|
97
|
+
vertices.push(...this.lonLatToCartesian(lon, Math.min(lat, 90)));
|
|
98
|
+
}
|
|
99
|
+
this._lonArray.push(new Float32Array(vertices));
|
|
100
|
+
}
|
|
101
|
+
for (let lat = -90 + this._latStep; lat < 90; lat += this._latStep) {
|
|
102
|
+
const vertices = [];
|
|
103
|
+
for (let lon = -180; lon <= 180; lon += this._segmentStep) {
|
|
104
|
+
vertices.push(...this.lonLatToCartesian(Math.min(lon, 180), lat));
|
|
105
|
+
}
|
|
106
|
+
this._latArray.push(new Float32Array(vertices));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
lonLatToCartesian(lonDeg, latDeg) {
|
|
110
|
+
const lonRad = degToRad(lonDeg);
|
|
111
|
+
const latRad = degToRad(latDeg);
|
|
112
|
+
const cosLat = Math.cos(latRad);
|
|
113
|
+
return [
|
|
114
|
+
cosLat * Math.cos(lonRad),
|
|
115
|
+
cosLat * Math.sin(lonRad),
|
|
116
|
+
Math.sin(latRad),
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
refresh(fovDeg) {
|
|
120
|
+
if (Math.abs(this._fovDeg - fovDeg) > 1e-6) {
|
|
121
|
+
this._fovDeg = fovDeg;
|
|
122
|
+
this.initBuffers(this._fovDeg);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
refreshFoV(input) {
|
|
126
|
+
if (!input.camera || !input.pMatrix)
|
|
127
|
+
return this._fovDeg;
|
|
128
|
+
this._fovObj.getFoV(global.insideSphere, this, input.camera, input.pMatrix);
|
|
129
|
+
this.refresh(this._fovObj.minFoV);
|
|
130
|
+
return this._fovObj.minFoV;
|
|
131
|
+
}
|
|
132
|
+
getMinFoVDeg() {
|
|
133
|
+
return this._fovObj.minFoV;
|
|
134
|
+
}
|
|
135
|
+
getFoV() {
|
|
136
|
+
return this._fovObj;
|
|
137
|
+
}
|
|
138
|
+
isVisible() {
|
|
139
|
+
return this._showGrid;
|
|
140
|
+
}
|
|
141
|
+
toggleShowGrid() {
|
|
142
|
+
this._showGrid = !this._showGrid;
|
|
143
|
+
return this._showGrid;
|
|
144
|
+
}
|
|
145
|
+
setShowGrid(showGrid) {
|
|
146
|
+
this._showGrid = showGrid;
|
|
147
|
+
}
|
|
148
|
+
enableShader(mMatrix, pMatrix, vMatrix) {
|
|
149
|
+
const gl = super.webgl;
|
|
150
|
+
gl.useProgram(this._shaderProgram);
|
|
151
|
+
const mvMatrix = mat4.create();
|
|
152
|
+
mat4.multiply(mvMatrix, vMatrix, mMatrix);
|
|
153
|
+
const uMVMatrixLoc = gl.getUniformLocation(this._shaderProgram, 'uMVMatrix');
|
|
154
|
+
const uPMatrixLoc = gl.getUniformLocation(this._shaderProgram, 'uPMatrix');
|
|
155
|
+
const uColor = gl.getUniformLocation(this._shaderProgram, 'u_fragcolor');
|
|
156
|
+
this._attribLocations.position = gl.getAttribLocation(this._shaderProgram, 'aCatPosition');
|
|
157
|
+
if (uMVMatrixLoc)
|
|
158
|
+
gl.uniformMatrix4fv(uMVMatrixLoc, false, mvMatrix);
|
|
159
|
+
if (uPMatrixLoc)
|
|
160
|
+
gl.uniformMatrix4fv(uPMatrixLoc, false, pMatrix);
|
|
161
|
+
if (uColor) {
|
|
162
|
+
const rgb = colorHex2RGB(this.defaultColor);
|
|
163
|
+
gl.uniform4f(uColor, rgb[0], rgb[1], rgb[2], 1.0);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
draw(input) {
|
|
167
|
+
if (!this._showGrid) {
|
|
168
|
+
this.gridText.resetDivSets();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const gl = super.webgl;
|
|
172
|
+
const camera = input.camera;
|
|
173
|
+
if (!camera)
|
|
174
|
+
return;
|
|
175
|
+
const pMatrix = input.pMatrix;
|
|
176
|
+
if (!pMatrix)
|
|
177
|
+
return;
|
|
178
|
+
this.refreshFoV(input);
|
|
179
|
+
const vMatrix = camera.getCameraMatrix();
|
|
180
|
+
if (!vMatrix)
|
|
181
|
+
return;
|
|
182
|
+
const mMatrix = this.getModelMatrix();
|
|
183
|
+
this.enableShader(mMatrix, pMatrix, vMatrix);
|
|
184
|
+
for (const lonLine of this._lonArray) {
|
|
185
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._lonVertexPositionBuffer);
|
|
186
|
+
gl.bufferData(gl.ARRAY_BUFFER, lonLine, gl.STATIC_DRAW);
|
|
187
|
+
gl.vertexAttribPointer(this._attribLocations.position, LatLonGrid.ELEM_SIZE, gl.FLOAT, false, 0, 0);
|
|
188
|
+
gl.enableVertexAttribArray(this._attribLocations.position);
|
|
189
|
+
gl.drawArrays(gl.LINE_STRIP, 0, lonLine.length / LatLonGrid.ELEM_SIZE);
|
|
190
|
+
}
|
|
191
|
+
for (const latLine of this._latArray) {
|
|
192
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._latVertexPositionBuffer);
|
|
193
|
+
gl.bufferData(gl.ARRAY_BUFFER, latLine, gl.STATIC_DRAW);
|
|
194
|
+
gl.vertexAttribPointer(this._attribLocations.position, LatLonGrid.ELEM_SIZE, gl.FLOAT, false, 0, 0);
|
|
195
|
+
gl.enableVertexAttribArray(this._attribLocations.position);
|
|
196
|
+
gl.drawArrays(gl.LINE_LOOP, 0, latLine.length / LatLonGrid.ELEM_SIZE);
|
|
197
|
+
}
|
|
198
|
+
this.drawLabels(input, mMatrix, pMatrix, vMatrix);
|
|
199
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
200
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
201
|
+
}
|
|
202
|
+
drawLabels(input, mMatrix, pMatrix, vMatrix) {
|
|
203
|
+
const center = input.centerSphericalDeg;
|
|
204
|
+
if (!center) {
|
|
205
|
+
this.gridText.resetDivSets();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const centerLon = this.normalizeLon(center.phi > 180 ? center.phi - 360 : center.phi);
|
|
209
|
+
const centerLat = 90 - center.theta;
|
|
210
|
+
const lonLine = this.normalizeLon(this.roundToStep(centerLon, this._lonStep));
|
|
211
|
+
const latLine = Math.max(-90 + this._latStep, Math.min(90 - this._latStep, this.roundToStep(centerLat, this._latStep)));
|
|
212
|
+
const lonLabelPoint = this.lonLatToCartesian(lonLine, Math.max(-80, Math.min(80, centerLat)));
|
|
213
|
+
const latLabelPoint = this.lonLatToCartesian(centerLon, latLine);
|
|
214
|
+
const lonScreen = this.projectPointToScreen(lonLabelPoint, mMatrix, pMatrix, vMatrix);
|
|
215
|
+
if (lonScreen) {
|
|
216
|
+
this.gridText.addLonLatDivSet(`${lonLine.toFixed(0)}° lon`, lonScreen.x, lonScreen.y, 'lon');
|
|
217
|
+
}
|
|
218
|
+
const latScreen = this.projectPointToScreen(latLabelPoint, mMatrix, pMatrix, vMatrix);
|
|
219
|
+
if (latScreen) {
|
|
220
|
+
this.gridText.addLonLatDivSet(`${latLine.toFixed(0)}° lat`, latScreen.x, latScreen.y, 'lat');
|
|
221
|
+
}
|
|
222
|
+
this.gridText.resetDivSets();
|
|
223
|
+
}
|
|
224
|
+
projectPointToScreen(point, mMatrix, pMatrix, vMatrix) {
|
|
225
|
+
const mvMatrix = mat4.create();
|
|
226
|
+
const mvpMatrix = mat4.create();
|
|
227
|
+
mat4.multiply(mvMatrix, vMatrix, mMatrix);
|
|
228
|
+
mat4.multiply(mvpMatrix, pMatrix, mvMatrix);
|
|
229
|
+
const clipspace = vec4.fromValues(point[0], point[1], point[2], 1);
|
|
230
|
+
vec4.transformMat4(clipspace, clipspace, mvpMatrix);
|
|
231
|
+
if (Math.abs(clipspace[3]) < 1e-6) {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
clipspace[0] /= clipspace[3];
|
|
235
|
+
clipspace[1] /= clipspace[3];
|
|
236
|
+
if (clipspace[0] < -1 || clipspace[0] > 1 || clipspace[1] < -1 || clipspace[1] > 1) {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
const canvasRect = super.webgl.canvas.getBoundingClientRect();
|
|
240
|
+
return {
|
|
241
|
+
x: canvasRect.left + (clipspace[0] * 0.5 + 0.5) * canvasRect.width,
|
|
242
|
+
y: canvasRect.top + (clipspace[1] * -0.5 + 0.5) * canvasRect.height,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
roundToStep(value, step) {
|
|
246
|
+
if (step <= 0)
|
|
247
|
+
return value;
|
|
248
|
+
return Math.round(value / step) * step;
|
|
249
|
+
}
|
|
250
|
+
normalizeLon(lonDeg) {
|
|
251
|
+
let lon = lonDeg;
|
|
252
|
+
while (lon < -180)
|
|
253
|
+
lon += 360;
|
|
254
|
+
while (lon > 180)
|
|
255
|
+
lon -= 360;
|
|
256
|
+
return lon;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
@@ -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 global from '../../Global.js';
|
|
3
15
|
export default class AllSky {
|
|
@@ -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 global from '../../Global.js';
|
|
3
15
|
import { fovHelper } from './FoVHelper.js';
|
|
@@ -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
|
// FoVHelper.ts
|
|
2
14
|
'use strict';
|
|
3
15
|
class FoVHelper {
|
|
@@ -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
|
/**
|
|
3
15
|
* @author Fabrizio Giordano (Fab77)
|
|
@@ -5,8 +17,6 @@
|
|
|
5
17
|
import { AbstractSkyEntity } from '../AbstractSkyEntity.js';
|
|
6
18
|
import { fovHelper } from './FoVHelper.js';
|
|
7
19
|
import ColorMaps from '../ColorMaps.js';
|
|
8
|
-
// import { hipsShaderProgram } from '../../shader/HiPSShaderProgram.js'
|
|
9
|
-
// import { HiPSShaderProgram } from '../../shader/HiPSShaderProgram.js'
|
|
10
20
|
import AncestorTile from './AncestorTile.js';
|
|
11
21
|
import AllSky from './AllSky.js';
|
|
12
22
|
export class HiPS extends AbstractSkyEntity {
|
|
@@ -33,10 +43,8 @@ export class HiPS extends AbstractSkyEntity {
|
|
|
33
43
|
constructor(radius, position, xrad, yrad, descriptor, webgl, healpixGrid) {
|
|
34
44
|
super(radius, position, xrad, yrad, descriptor.surveyName, webgl, descriptor.isGalactic);
|
|
35
45
|
this._descriptor = descriptor;
|
|
36
|
-
// this.initGL((global as any).gl as WebGL2RenderingContext)
|
|
37
46
|
this.initGL(webgl);
|
|
38
47
|
this._healpixGrid = healpixGrid;
|
|
39
|
-
// newTileBuffer.addHiPS(this)
|
|
40
48
|
this._healpixGrid.visibleTilesManager.tileBuffer.addHiPS(this);
|
|
41
49
|
// DEBUG logs kept from JS (optional)
|
|
42
50
|
// eslint-disable-next-line no-console
|
|
@@ -185,7 +193,6 @@ export class HiPS extends AbstractSkyEntity {
|
|
|
185
193
|
if (!pMatrix)
|
|
186
194
|
return;
|
|
187
195
|
this.refresh();
|
|
188
|
-
// const pMatrix = computePerspectiveMatrixSingleton.pMatrix as Float32Array
|
|
189
196
|
const mMatrix = this.getModelMatrix();
|
|
190
197
|
super.hipsShaderProgram.setRuntimeColorMap(this.colorMap);
|
|
191
198
|
if (this._allSky && this._allSkyTile) {
|
|
@@ -207,13 +214,9 @@ export class HiPS extends AbstractSkyEntity {
|
|
|
207
214
|
const order = this.isGalacticHips
|
|
208
215
|
? this._healpixGrid.visibleTilesManager.galVisibleTilesByOrder.order
|
|
209
216
|
: this._healpixGrid.visibleTilesManager.visibleTilesByOrder.order;
|
|
210
|
-
// ? visibleTilesManager.galVisibleTilesByOrder.order
|
|
211
|
-
// : visibleTilesManager.visibleTilesByOrder.order
|
|
212
217
|
const map = this.isGalacticHips
|
|
213
218
|
? this._healpixGrid.visibleTilesManager.galAncestorsMap
|
|
214
219
|
: this._healpixGrid.visibleTilesManager.ancestorsMap;
|
|
215
|
-
// ? visibleTilesManager.galAncestorsMap
|
|
216
|
-
// : visibleTilesManager.ancestorsMap
|
|
217
220
|
this._ancestorTiles.forEach((ancestor) => {
|
|
218
221
|
ancestor.draw(order, map, pMatrix, vMatrix, mMatrix, this.colorMapIdx);
|
|
219
222
|
});
|
|
@@ -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
|
// HiPSDescriptor.ts
|
|
2
14
|
'use strict';
|
|
3
15
|
export class HiPSDescriptor {
|
|
@@ -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
|
// Tile.ts
|
|
2
14
|
import global from '../../Global.js';
|
|
3
15
|
import { fovHelper } from './FoVHelper.js';
|
|
@@ -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
|
// TileBuffer.ts
|
|
2
14
|
import Tile from './Tile.js'; // adjust if your file is named differently
|
|
3
15
|
// export default class TileBuffer {
|
|
@@ -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 global from '../../Global.js';
|
|
2
14
|
import { Pointing, Vec3 } from 'healpixjs';
|
|
3
15
|
import RayPickingUtils from '../../utils/RayPickingUtils.js';
|
|
@@ -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
|
/**
|
|
3
15
|
* @author Fabrizio Giordano (Fab77)
|
|
@@ -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 class TapMetadataList {
|
|
3
15
|
_posEqRAMetaColumns; // ucd.includes('pos.eq.ra')
|
|
@@ -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 class TapRepo {
|
|
2
14
|
_adqlFunctionList;
|
|
3
15
|
_cataloguesList;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { FootprintSetGL } from '../footprints/FootprintSetGL.js';
|
|
14
|
+
export class TerraFootprintSetGL extends FootprintSetGL {
|
|
15
|
+
_kind = 'TerraFootprintSetGL';
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { CatalogueGL } from '../catalogues/CatalogueGL.js';
|
|
14
|
+
export class TerraPointSetGL extends CatalogueGL {
|
|
15
|
+
_kind = 'TerraPointSetGL';
|
|
16
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
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.
|
|
4
12
|
*/
|
|
5
13
|
class SesameService {
|
|
6
14
|
baseURL = 'https://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/-ox?';
|
|
@@ -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
|
// helpers.ts
|
|
2
14
|
export const toHttps = (url) => url.startsWith('http:') ? url.replace('http:', 'https:') : url;
|
|
3
15
|
export const urlJoin = (base, path) => new URL(path.replace(/^\/+/, ''), base).toString();
|