astro-viewer 3.0.0 → 3.2.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.
Files changed (127) hide show
  1. package/dist/astroviewer.cjs +3082 -1410
  2. package/dist/astroviewer.js +1 -1
  3. package/dist/astroviewer.min.js +1 -1
  4. package/lib-esm/AstroSphere.d.ts +40 -16
  5. package/lib-esm/AstroSphere.js +359 -93
  6. package/lib-esm/AstroViewer.d.ts +20 -5
  7. package/lib-esm/AstroViewer.js +50 -0
  8. package/lib-esm/Camera.js +28 -14
  9. package/lib-esm/Config.d.ts +2 -0
  10. package/lib-esm/Config.js +15 -1
  11. package/lib-esm/Global.js +12 -0
  12. package/lib-esm/index.d.ts +8 -4
  13. package/lib-esm/index.js +17 -3
  14. package/lib-esm/model/AbstractSkyEntity.d.ts +1 -0
  15. package/lib-esm/model/AbstractSkyEntity.js +12 -0
  16. package/lib-esm/model/AstroGL.js +12 -0
  17. package/lib-esm/model/ColorMaps.js +12 -0
  18. package/lib-esm/model/MetadataColumn.js +12 -0
  19. package/lib-esm/model/MetadataManager.d.ts +1 -0
  20. package/lib-esm/model/MetadataManager.js +16 -1
  21. package/lib-esm/model/Point.d.ts +9 -1
  22. package/lib-esm/model/Point.js +30 -0
  23. package/lib-esm/model/Point2D.js +12 -0
  24. package/lib-esm/model/Source.js +12 -0
  25. package/lib-esm/model/SphereFoV.d.ts +30 -0
  26. package/lib-esm/model/SphereFoV.js +196 -0
  27. package/lib-esm/model/catalogues/CatalogueGL.js +12 -0
  28. package/lib-esm/model/catalogues/CatalogueProps.js +13 -1
  29. package/lib-esm/model/earth/{wmts/WMTSAdapter.d.ts → WMTSAdapter.d.ts} +2 -1
  30. package/lib-esm/model/earth/{wmts/WMTSAdapter.js → WMTSAdapter.js} +12 -0
  31. package/lib-esm/model/earth/XYZAnchestorTile.d.ts +17 -0
  32. package/lib-esm/model/earth/XYZAnchestorTile.js +87 -0
  33. package/lib-esm/model/earth/{types.d.ts → XYZConfig.d.ts} +6 -17
  34. package/lib-esm/model/earth/XYZConfig.js +13 -0
  35. package/lib-esm/model/earth/XYZFoVHelper.d.ts +12 -0
  36. package/lib-esm/model/earth/XYZFoVHelper.js +138 -0
  37. package/lib-esm/model/earth/XYZMap.d.ts +31 -0
  38. package/lib-esm/model/earth/XYZMap.js +208 -0
  39. package/lib-esm/model/earth/XYZMapDescriptor.d.ts +29 -0
  40. package/lib-esm/model/earth/XYZMapDescriptor.js +77 -0
  41. package/lib-esm/model/earth/XYZMeshBuilder.d.ts +1 -1
  42. package/lib-esm/model/earth/XYZMeshBuilder.js +13 -2
  43. package/lib-esm/model/earth/XYZTile.d.ts +20 -21
  44. package/lib-esm/model/earth/XYZTile.js +82 -102
  45. package/lib-esm/model/earth/XYZTileBuffer.d.ts +24 -26
  46. package/lib-esm/model/earth/XYZTileBuffer.js +60 -70
  47. package/lib-esm/model/earth/XYZTileRequestScheduler.d.ts +1 -1
  48. package/lib-esm/model/earth/XYZTileRequestScheduler.js +13 -2
  49. package/lib-esm/model/earth/XYZTypes.d.ts +24 -0
  50. package/lib-esm/model/earth/XYZTypes.js +13 -0
  51. package/lib-esm/model/earth/XYZVisibleTilesManager.d.ts +16 -27
  52. package/lib-esm/model/earth/XYZVisibleTilesManager.js +61 -192
  53. package/lib-esm/model/footprints/Footprint.d.ts +4 -1
  54. package/lib-esm/model/footprints/Footprint.js +30 -2
  55. package/lib-esm/model/footprints/FootprintProps.js +13 -1
  56. package/lib-esm/model/footprints/FootprintSetGL.d.ts +4 -2
  57. package/lib-esm/model/footprints/FootprintSetGL.js +21 -6
  58. package/lib-esm/model/grid/EquatorialGrid.d.ts +2 -1
  59. package/lib-esm/model/grid/EquatorialGrid.js +30 -12
  60. package/lib-esm/model/grid/GridTextHelper.d.ts +10 -19
  61. package/lib-esm/model/grid/GridTextHelper.js +70 -67
  62. package/lib-esm/model/grid/HealpixGrid.d.ts +4 -4
  63. package/lib-esm/model/grid/HealpixGrid.js +24 -8
  64. package/lib-esm/model/grid/LonLatGrid.d.ts +43 -0
  65. package/lib-esm/model/grid/LonLatGrid.js +309 -0
  66. package/lib-esm/model/hips/AllSky.js +12 -0
  67. package/lib-esm/model/hips/AncestorTile.js +12 -0
  68. package/lib-esm/model/hips/FoVHelper.d.ts +5 -2
  69. package/lib-esm/model/hips/FoVHelper.js +52 -3
  70. package/lib-esm/model/hips/HiPS.d.ts +2 -0
  71. package/lib-esm/model/hips/HiPS.js +38 -14
  72. package/lib-esm/model/hips/HiPSConfig.d.ts +13 -0
  73. package/lib-esm/model/hips/HiPSDescriptor.js +12 -0
  74. package/lib-esm/model/hips/Tile.d.ts +1 -0
  75. package/lib-esm/model/hips/Tile.js +15 -0
  76. package/lib-esm/model/hips/TileBuffer.d.ts +5 -0
  77. package/lib-esm/model/hips/TileBuffer.js +61 -0
  78. package/lib-esm/model/hips/VisibleTilesManager.js +12 -0
  79. package/lib-esm/model/tap/TapMetadata.js +12 -0
  80. package/lib-esm/model/tap/TapMetadataList.js +12 -0
  81. package/lib-esm/model/tap/TapRepo.js +12 -0
  82. package/lib-esm/model/terra/TerraFootprintSetGL.d.ts +6 -0
  83. package/lib-esm/model/terra/TerraFootprintSetGL.js +54 -0
  84. package/lib-esm/model/terra/TerraPointSetGL.js +12 -0
  85. package/lib-esm/services/SesameService.js +11 -3
  86. package/lib-esm/services/helpers.js +12 -0
  87. package/lib-esm/services/hipsNodeService.js +12 -0
  88. package/lib-esm/services/parse-hipslist.js +12 -0
  89. package/lib-esm/services/queryCatalogueByFoV.js +13 -1
  90. package/lib-esm/services/queryFootprintSetByFov.js +13 -1
  91. package/lib-esm/services/tapRepoService.js +13 -1
  92. package/lib-esm/services/types.js +12 -0
  93. package/lib-esm/shader/CatalogueShaderProgram.js +12 -0
  94. package/lib-esm/shader/FootprintShaderProgram.js +12 -0
  95. package/lib-esm/shader/GridShaderManager.js +12 -0
  96. package/lib-esm/shader/HiPSShaderProgram.js +12 -0
  97. package/lib-esm/shader/ShaderManager.js +12 -1
  98. package/lib-esm/shader/ShaderManagerMutliHiPS.js +12 -1
  99. package/lib-esm/shader/XYZShaderProgram.d.ts +14 -1
  100. package/lib-esm/shader/XYZShaderProgram.js +127 -2
  101. package/lib-esm/utils/CoordsType.d.ts +2 -1
  102. package/lib-esm/utils/CoordsType.js +13 -0
  103. package/lib-esm/utils/FoVUtils.js +12 -0
  104. package/lib-esm/utils/GeoJSONParser.d.ts +19 -0
  105. package/lib-esm/utils/GeoJSONParser.js +112 -0
  106. package/lib-esm/utils/GeomUtils.js +12 -0
  107. package/lib-esm/utils/MouseHelper.js +12 -0
  108. package/lib-esm/utils/PerspectiveMatrixManager.js +16 -1
  109. package/lib-esm/utils/RayPickingUtils.js +12 -0
  110. package/lib-esm/utils/STCSParser.d.ts +7 -3
  111. package/lib-esm/utils/STCSParser.js +27 -9
  112. package/lib-esm/utils/ShaderUtility.js +13 -1
  113. package/lib-esm/utils/Utils.js +12 -0
  114. package/lib-esm/utils/XYZRayPickingUtils.d.ts +27 -0
  115. package/lib-esm/utils/XYZRayPickingUtils.js +226 -0
  116. package/package.json +2 -2
  117. package/lib-esm/model/FoV.d.ts +0 -62
  118. package/lib-esm/model/FoV.js +0 -274
  119. package/lib-esm/model/earth/XYZAncestorMeshCache.d.ts +0 -10
  120. package/lib-esm/model/earth/XYZAncestorMeshCache.js +0 -31
  121. package/lib-esm/model/earth/XYZLayer.d.ts +0 -31
  122. package/lib-esm/model/earth/XYZLayer.js +0 -231
  123. package/lib-esm/model/earth/XYZTileProvider.d.ts +0 -29
  124. package/lib-esm/model/earth/XYZTileProvider.js +0 -187
  125. package/lib-esm/model/earth/wmts/types.d.ts +0 -1
  126. package/lib-esm/model/earth/wmts/types.js +0 -1
  127. /package/lib-esm/model/{earth/types.js → hips/HiPSConfig.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { HiPSDescriptor } from './model/hips/HiPSDescriptor.js';
2
- import { FoV } from './model/FoV.js';
2
+ import { SphereFoV } from './model/SphereFoV.js';
3
3
  import { Point } from './model/Point.js';
4
4
  import { CatalogueGL } from './model/catalogues/CatalogueGL.js';
5
5
  import type { CameraChangedDetail, PointCoordinates } from './AstroSphere.js';
@@ -9,8 +9,9 @@ import Camera from './Camera.js';
9
9
  import { ReadonlyMat4 } from 'gl-matrix';
10
10
  import { ColorMap, ColorMapName } from './model/ColorMaps.js';
11
11
  import { HiPS } from './model/hips/HiPS.js';
12
- import { XYZLayer } from './model/earth/XYZLayer.js';
13
- import type { WMTSLayerConfig, XYZDebugStats, XYZLayerConfig } from './model/earth/types.js';
12
+ import type { WMTSLayerConfig, XYZDebugStats, XYZLayerConfig } from './model/earth/XYZConfig.js';
13
+ import type { HiPSDebugStats } from './model/hips/HiPSConfig.js';
14
+ import { XYZMap } from './model/earth/XYZMap.js';
14
15
  import { TerraPointSetGL } from './model/terra/TerraPointSetGL.js';
15
16
  import { TerraFootprintSetGL } from './model/terra/TerraFootprintSetGL.js';
16
17
  export declare class AstroViewer {
@@ -49,21 +50,26 @@ export declare class AstroViewer {
49
50
  getDefaultHiPSURL(): string;
50
51
  activateHiPS(hipsDescriptor: HiPSDescriptor): void;
51
52
  activateXYZ(config: XYZLayerConfig): void;
53
+ activateXYZ2(config: XYZLayerConfig & {
54
+ name?: string;
55
+ }): void;
52
56
  activateWMTS(config: WMTSLayerConfig): void;
53
57
  setXYZMaxConcurrentRequests(value: number): void;
54
58
  getXYZMaxConcurrentRequests(): number;
55
59
  getXYZDebugStats(): XYZDebugStats;
60
+ getHiPSDebugStats(): HiPSDebugStats | null;
56
61
  loadHiPS(baseUrl: string): Promise<string>;
57
62
  changeColorMap(colorMapName: ColorMapName): void;
58
63
  changeCustomColorMap(colorMap: ColorMap): void;
59
64
  getActiveHiPS(): HiPS | null;
60
- getActiveXYZ(): XYZLayer | null;
65
+ getActiveXYZ(): XYZMap | null;
61
66
  setCamera(camera: Camera): void;
62
67
  setCameraPosition(pos: [number, number, number]): void;
63
68
  setCameraMatrix(viewMatrix: Float32Array): void;
64
69
  restoreAstroViewerState(detail: CameraChangedDetail, applyColorMap: boolean): void;
65
70
  getCurrentAstroViewerStatus(): CameraChangedDetail | null;
66
71
  goTo(raDeg: number, decDeg: number): void;
72
+ getActiveCoordinateMode(): 'equatorial' | 'galactic' | 'lonlat';
67
73
  getCenterCoordinates(): PointCoordinates | undefined;
68
74
  getCoordinatesFromMouse(): PointCoordinates | undefined;
69
75
  setModelMatrix(modelMatrix: ReadonlyMat4): void;
@@ -71,7 +77,16 @@ export declare class AstroViewer {
71
77
  isHealpixGridVisible(): boolean;
72
78
  toggleEquatorialGrid(): void;
73
79
  isEquatorialGridVisible(): boolean;
74
- getFoV(): FoV;
80
+ toggleLonLatGrid(): boolean;
81
+ isLonLatGridVisible(): boolean;
82
+ setEastWestRotationLocked(locked: boolean): void;
83
+ isEastWestRotationLocked(): boolean;
84
+ setNorthSouthRotationLocked(locked: boolean): void;
85
+ isNorthSouthRotationLocked(): boolean;
86
+ resetAxesOrientation(): void;
87
+ setKeepCameraNorthUp(enabled: boolean): void;
88
+ isKeepCameraNorthUp(): boolean;
89
+ getFoV(): SphereFoV;
75
90
  getFoVPolygon(): Point[];
76
91
  changeFoV(deg: number): void;
77
92
  changeFoV2(deg: number): void;
@@ -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 AstroSphere from './AstroSphere.js';
3
15
  import { HiPSDescriptor } from './model/hips/HiPSDescriptor.js';
@@ -6,6 +18,7 @@ import { FootprintSetGL } from './model/footprints/FootprintSetGL.js';
6
18
  import { bootSetup } from './Config.js';
7
19
  import ColorMaps from './model/ColorMaps.js';
8
20
  import { xyzTileRequestScheduler } from './model/earth/XYZTileRequestScheduler.js';
21
+ import { XYZMapDescriptor } from './model/earth/XYZMapDescriptor.js';
9
22
  import { TerraPointSetGL } from './model/terra/TerraPointSetGL.js';
10
23
  import { TerraFootprintSetGL } from './model/terra/TerraFootprintSetGL.js';
11
24
  // & {
@@ -116,6 +129,10 @@ export class AstroViewer {
116
129
  activateXYZ(config) {
117
130
  this.astroSphere.activateXYZ(config);
118
131
  }
132
+ activateXYZ2(config) {
133
+ const descriptor = new XYZMapDescriptor(config.name ?? 'XYZ Earth2 Layer', config.urlTemplate, config.minZoom ?? 0, config.maxZoom ?? 8, config.segmentsPerSide ?? 48, config.maxCachedTiles ?? 384, 8, config.urlResolver);
134
+ this.astroSphere.activateXYZ2(descriptor);
135
+ }
119
136
  activateWMTS(config) {
120
137
  this.astroSphere.activateWMTS(config);
121
138
  }
@@ -128,6 +145,9 @@ export class AstroViewer {
128
145
  getXYZDebugStats() {
129
146
  return this.astroSphere.getXYZDebugStats();
130
147
  }
148
+ getHiPSDebugStats() {
149
+ return this.astroSphere.getHiPSDebugStats();
150
+ }
131
151
  async loadHiPS(baseUrl) {
132
152
  const hipsUrl = baseUrl.endsWith('/') ? baseUrl : baseUrl + '/';
133
153
  const resp = await fetch(hipsUrl + 'properties');
@@ -174,6 +194,9 @@ export class AstroViewer {
174
194
  // console.log(`AstroViewer.goTo goto(${raDeg}, ${decDeg})`)
175
195
  this.astroSphere.goTo(raDeg, decDeg);
176
196
  }
197
+ getActiveCoordinateMode() {
198
+ return this.astroSphere.getActiveCoordinateMode();
199
+ }
177
200
  getCenterCoordinates() {
178
201
  return this.astroSphere.getCentralPointCoordinates();
179
202
  }
@@ -200,6 +223,33 @@ export class AstroViewer {
200
223
  // return equatorialGridSingleton.isVisible()
201
224
  return this.astroSphere.equatorialGrid.isVisible();
202
225
  }
226
+ toggleLonLatGrid() {
227
+ return this.astroSphere.toggleLonLatGrid();
228
+ }
229
+ isLonLatGridVisible() {
230
+ return this.astroSphere.isLonLatGridVisible();
231
+ }
232
+ setEastWestRotationLocked(locked) {
233
+ this.astroSphere.setEastWestRotationLocked(locked);
234
+ }
235
+ isEastWestRotationLocked() {
236
+ return this.astroSphere.isEastWestRotationLocked();
237
+ }
238
+ setNorthSouthRotationLocked(locked) {
239
+ this.astroSphere.setNorthSouthRotationLocked(locked);
240
+ }
241
+ isNorthSouthRotationLocked() {
242
+ return this.astroSphere.isNorthSouthRotationLocked();
243
+ }
244
+ resetAxesOrientation() {
245
+ this.astroSphere.resetAxesOrientation();
246
+ }
247
+ setKeepCameraNorthUp(enabled) {
248
+ this.astroSphere.setKeepCameraNorthUp(enabled);
249
+ }
250
+ isKeepCameraNorthUp() {
251
+ return this.astroSphere.isKeepCameraNorthUp();
252
+ }
203
253
  // FOV
204
254
  getFoV() {
205
255
  return this.astroSphere.getFoV();
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);
@@ -63,13 +84,11 @@ class Camera {
63
84
  toggleInsideSphere() {
64
85
  // if (inside !== global.insideSphere) {
65
86
  // global.insideSphere = inside;
87
+ this.insideSphere = global.insideSphere;
66
88
  if (global.insideSphere) {
67
- if (this.cam_pos[2] <= 2) {
68
- this.cam_pos[2] = -2 + this.cam_pos[2];
69
- }
70
- else {
71
- this.cam_pos[2] = -0.005;
72
- }
89
+ this.cam_pos[0] = 0;
90
+ this.cam_pos[1] = 0;
91
+ this.cam_pos[2] = -0.005;
73
92
  }
74
93
  else {
75
94
  this.cam_pos[2] = 2.0 + this.cam_pos[2];
@@ -200,10 +219,6 @@ class Camera {
200
219
  const totRot = Math.sqrt(phi * phi + theta * theta);
201
220
  if (totRot === 0)
202
221
  return;
203
- // If both X and Y rotations are locked, nothing to do
204
- if (this.lockRotX && this.lockRotY) {
205
- return;
206
- }
207
222
  const pos = this.getCameraPosition();
208
223
  const dist2Center = Math.sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]);
209
224
  const distanceFromSurface = Math.max(dist2Center - 1, 1e-6);
@@ -214,9 +229,8 @@ class Camera {
214
229
  const normalizedFoV = Math.min(1, this.FoV / 18);
215
230
  const fovFactor = 0.06 + 1.55 * Math.pow(normalizedFoV, 0.52);
216
231
  const usedRot = ((totRot * distanceFactor * fovFactor) / 1.9) * this.rotationSensitivity;
217
- // Build an axis from phi/theta, but zero components that are locked
218
- let axisX = this.lockRotX ? 0 : theta;
219
- let axisY = this.lockRotY ? 0 : phi;
232
+ let axisX = theta;
233
+ let axisY = phi;
220
234
  const axisLen = Math.sqrt(axisX * axisX + axisY * axisY);
221
235
  // If after locking we have no axis left, do nothing
222
236
  if (axisLen === 0) {
@@ -5,6 +5,8 @@ export interface BootSetup {
5
5
  defaultHips: string;
6
6
  camera_fov_deg: number;
7
7
  camera_fov_rad: number;
8
+ inside_camera_fov_deg: number;
9
+ inside_camera_fov_rad: number;
8
10
  camera_near_plane: number;
9
11
  camera_far_plane: number;
10
12
  corsProxyUrl: string;
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/",
@@ -17,6 +29,8 @@ export const bootSetup = {
17
29
  defaultHips: "",
18
30
  camera_fov_deg: 34,
19
31
  camera_fov_rad: 34 * Math.PI / 180.0,
32
+ inside_camera_fov_deg: 60,
33
+ inside_camera_fov_rad: 60 * Math.PI / 180.0,
20
34
  camera_near_plane: 0.00001,
21
35
  camera_far_plane: 2.5,
22
36
  corsProxyUrl: "http://localhost:4000/",
@@ -27,5 +41,5 @@ export const bootSetup = {
27
41
  version: "Astrobrowser v1.0.0",
28
42
  debug: false,
29
43
  insideView: false,
30
- showViewfinder: false,
44
+ showViewfinder: true,
31
45
  };
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';
@@ -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/FoV.js';
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';
@@ -11,11 +12,14 @@ export { MetadataColumn, MetadataInit, ColumnType } from './model/MetadataColumn
11
12
  export { Point, SphericalOpts, AstroOpts, PointInitOpts, CartesianOpts } from './model/Point.js';
12
13
  export { FoVUtils } from './utils/FoVUtils.js';
13
14
  export { CoordsType } from './utils/CoordsType.js';
15
+ export { default as GeoJSONParser } from './utils/GeoJSONParser.js';
16
+ export type { ParsedGeoJSONFeature, GeoJSONProperties } from './utils/GeoJSONParser.js';
14
17
  export { ColorMaps, COLOR_MAP_SAMPLE_COUNT, createColorMapFromSamples } from './model/ColorMaps.js';
15
18
  export type { ColorMap, ColorMapName } from './model/ColorMaps.js';
16
19
  export { HiPS } from './model/hips/HiPS.js';
17
- export { XYZLayer } from './model/earth/XYZLayer.js';
18
- export { WMTSAdapter } from './model/earth/wmts/WMTSAdapter.js';
19
- export type { XYZLayerConfig, XYZTileCoord, XYZTileMesh, WMTSLayerConfig, WMTSRequestEncoding } from './model/earth/types.js';
20
+ export { XYZMap } from './model/earth/XYZMap.js';
21
+ export { WMTSAdapter } from './model/earth/WMTSAdapter.js';
22
+ export type { XYZLayerConfig, WMTSLayerConfig, WMTSRequestEncoding } from './model/earth/XYZConfig.js';
23
+ export type { XYZTileCoord, XYZTileMesh } from './model/earth/XYZTypes.js';
20
24
  export { Source } from './model/Source.js';
21
25
  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/FoV.js';
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';
@@ -10,10 +23,11 @@ export { MetadataColumn, ColumnType } from './model/MetadataColumn.js';
10
23
  export { Point } from './model/Point.js';
11
24
  export { FoVUtils } from './utils/FoVUtils.js';
12
25
  export { CoordsType } from './utils/CoordsType.js';
26
+ export { default as GeoJSONParser } from './utils/GeoJSONParser.js';
13
27
  export { ColorMaps, COLOR_MAP_SAMPLE_COUNT, createColorMapFromSamples } from './model/ColorMaps.js';
14
28
  export { HiPS } from './model/hips/HiPS.js';
15
- export { XYZLayer } from './model/earth/XYZLayer.js';
16
- export { WMTSAdapter } from './model/earth/wmts/WMTSAdapter.js';
29
+ export { XYZMap } from './model/earth/XYZMap.js';
30
+ export { WMTSAdapter } from './model/earth/WMTSAdapter.js';
17
31
  export { Source } from './model/Source.js';
18
32
  export { Footprint } from './model/footprints/Footprint.js';
19
33
  console.log('astroviewer UMD loaded');
@@ -19,6 +19,7 @@ export interface SkyEntityDrawInput {
19
19
  phi: number;
20
20
  theta: number;
21
21
  }>;
22
+ cameraMoving?: boolean;
22
23
  }
23
24
  export declare abstract class AbstractSkyEntity {
24
25
  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
  */
@@ -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) {
@@ -34,6 +34,7 @@ export declare class MetadataManager {
34
34
  get shapeColumnList(): MetadataColumn[];
35
35
  set selectedRaColumn(columnName: string);
36
36
  set selectedDecColumn(columnName: string);
37
+ set selectedOutlineColumn(columnName: string);
37
38
  set selectedHueColumn(columnName: string);
38
39
  set selectedShapeColumn(columnName: string);
39
40
  set selectedNameColumn(columnName: string);
@@ -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";
@@ -98,6 +110,9 @@ export class MetadataManager {
98
110
  set selectedDecColumn(columnName) {
99
111
  this._selectedDecColumn = this._decColumnList.find(c => c.name === columnName) || this._selectedDecColumn;
100
112
  }
113
+ set selectedOutlineColumn(columnName) {
114
+ this._selectedOutlineColumn = this._outlineColumnList.find(c => c.name === columnName) || this._selectedOutlineColumn;
115
+ }
101
116
  set selectedHueColumn(columnName) {
102
117
  this._selectedHueColumn = this._hueColumnList.find(c => c.name === columnName);
103
118
  }
@@ -105,7 +120,7 @@ export class MetadataManager {
105
120
  this._selectedShapeColumn = this._shapeColumnList.find(c => c.name === columnName);
106
121
  }
107
122
  set selectedNameColumn(columnName) {
108
- this._selectedNameColumn = this._shapeColumnList.find(c => c.name === columnName);
123
+ this._selectedNameColumn = this._columns.find(c => c.name === columnName);
109
124
  }
110
125
  resetShapeColumn() {
111
126
  this._selectedShapeColumn = undefined;
@@ -9,11 +9,15 @@ export type AstroOpts = {
9
9
  raDeg: number;
10
10
  decDeg: number;
11
11
  };
12
+ export type GeographicOpts = {
13
+ lonDeg: number;
14
+ latDeg: number;
15
+ };
12
16
  export type SphericalOpts = {
13
17
  phiDeg: number;
14
18
  thetaDeg: number;
15
19
  };
16
- export type PointInitOpts = CartesianOpts | AstroOpts | SphericalOpts;
20
+ export type PointInitOpts = CartesianOpts | AstroOpts | GeographicOpts | SphericalOpts;
17
21
  export declare class Point {
18
22
  private _x;
19
23
  private _y;
@@ -24,6 +28,7 @@ export declare class Point {
24
28
  private _raRad;
25
29
  private _decRad;
26
30
  private _raDecDeg;
31
+ private _lonLatDeg?;
27
32
  constructor(in_options: PointInitOpts, in_type: CoordsType);
28
33
  private computeAstroCoords;
29
34
  private computeCartesianCoords;
@@ -47,6 +52,9 @@ export declare class Point {
47
52
  get raDeg(): number;
48
53
  get decDeg(): number;
49
54
  get raDecDeg(): [number, number];
55
+ get lonDeg(): number;
56
+ get latDeg(): number;
57
+ get lonLatDeg(): [number, number];
50
58
  toADQL(): string;
51
59
  toString(): string;
52
60
  }
@@ -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
  */
@@ -16,6 +28,7 @@ export class Point {
16
28
  _raRad;
17
29
  _decRad;
18
30
  _raDecDeg;
31
+ _lonLatDeg;
19
32
  constructor(in_options, in_type) {
20
33
  this._xyz = [0, 0, 0];
21
34
  this._raDecDeg = [0, 0];
@@ -47,6 +60,20 @@ export class Point {
47
60
  this._z = Number(z.toFixed(MAX_DECIMALS));
48
61
  this._xyz = [this._x, this._y, this._z];
49
62
  }
63
+ else if (in_type === CoordsType.GEOGRAPHIC) {
64
+ const { lonDeg, latDeg } = in_options;
65
+ this._lonLatDeg = [Number(lonDeg), Number(latDeg)];
66
+ this._raDeg = this._lonLatDeg[0];
67
+ this._decDeg = this._lonLatDeg[1];
68
+ this._raDecDeg = [this._raDeg, this._decDeg];
69
+ this._raRad = (this._raDeg * Math.PI) / 180;
70
+ this._decRad = (this._decDeg * Math.PI) / 180;
71
+ const [x, y, z] = this.computeCartesianCoords();
72
+ this._x = Number(x.toFixed(MAX_DECIMALS));
73
+ this._y = Number(y.toFixed(MAX_DECIMALS));
74
+ this._z = Number(z.toFixed(MAX_DECIMALS));
75
+ this._xyz = [this._x, this._y, this._z];
76
+ }
50
77
  else if (in_type === CoordsType.SPHERICAL) {
51
78
  // Not implemented in original; keep behavior
52
79
  console.log(`${CoordsType.SPHERICAL} not implemented yet`);
@@ -123,6 +150,9 @@ export class Point {
123
150
  get raDeg() { return this._raDeg; }
124
151
  get decDeg() { return this._decDeg; }
125
152
  get raDecDeg() { return this._raDecDeg; }
153
+ get lonDeg() { return this._lonLatDeg?.[0] ?? this._raDeg; }
154
+ get latDeg() { return this._lonLatDeg?.[1] ?? this._decDeg; }
155
+ get lonLatDeg() { return this._lonLatDeg ?? [this._raDeg, this._decDeg]; }
126
156
  toADQL() {
127
157
  return `${this._raDecDeg[0]},${this._raDecDeg[1]}`;
128
158
  }
@@ -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;
@@ -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
+ }