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.
- package/dist/astroviewer.cjs +3082 -1410
- package/dist/astroviewer.js +1 -1
- package/dist/astroviewer.min.js +1 -1
- package/lib-esm/AstroSphere.d.ts +40 -16
- package/lib-esm/AstroSphere.js +359 -93
- package/lib-esm/AstroViewer.d.ts +20 -5
- package/lib-esm/AstroViewer.js +50 -0
- package/lib-esm/Camera.js +28 -14
- package/lib-esm/Config.d.ts +2 -0
- package/lib-esm/Config.js +15 -1
- package/lib-esm/Global.js +12 -0
- package/lib-esm/index.d.ts +8 -4
- package/lib-esm/index.js +17 -3
- package/lib-esm/model/AbstractSkyEntity.d.ts +1 -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.d.ts +1 -0
- package/lib-esm/model/MetadataManager.js +16 -1
- package/lib-esm/model/Point.d.ts +9 -1
- package/lib-esm/model/Point.js +30 -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 +196 -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} +6 -17
- package/lib-esm/model/earth/XYZConfig.js +13 -0
- package/lib-esm/model/earth/XYZFoVHelper.d.ts +12 -0
- package/lib-esm/model/earth/XYZFoVHelper.js +138 -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.d.ts +4 -1
- package/lib-esm/model/footprints/Footprint.js +30 -2
- package/lib-esm/model/footprints/FootprintProps.js +13 -1
- package/lib-esm/model/footprints/FootprintSetGL.d.ts +4 -2
- package/lib-esm/model/footprints/FootprintSetGL.js +21 -6
- package/lib-esm/model/grid/EquatorialGrid.d.ts +2 -1
- package/lib-esm/model/grid/EquatorialGrid.js +30 -12
- 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 +24 -8
- package/lib-esm/model/grid/LonLatGrid.d.ts +43 -0
- package/lib-esm/model/grid/LonLatGrid.js +309 -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.d.ts +5 -2
- package/lib-esm/model/hips/FoVHelper.js +52 -3
- package/lib-esm/model/hips/HiPS.d.ts +2 -0
- package/lib-esm/model/hips/HiPS.js +38 -14
- package/lib-esm/model/hips/HiPSConfig.d.ts +13 -0
- package/lib-esm/model/hips/HiPSDescriptor.js +12 -0
- package/lib-esm/model/hips/Tile.d.ts +1 -0
- package/lib-esm/model/hips/Tile.js +15 -0
- package/lib-esm/model/hips/TileBuffer.d.ts +5 -0
- package/lib-esm/model/hips/TileBuffer.js +61 -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 +6 -0
- package/lib-esm/model/terra/TerraFootprintSetGL.js +54 -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.d.ts +2 -1
- package/lib-esm/utils/CoordsType.js +13 -0
- package/lib-esm/utils/FoVUtils.js +12 -0
- package/lib-esm/utils/GeoJSONParser.d.ts +19 -0
- package/lib-esm/utils/GeoJSONParser.js +112 -0
- package/lib-esm/utils/GeomUtils.js +12 -0
- package/lib-esm/utils/MouseHelper.js +12 -0
- package/lib-esm/utils/PerspectiveMatrixManager.js +16 -1
- package/lib-esm/utils/RayPickingUtils.js +12 -0
- package/lib-esm/utils/STCSParser.d.ts +7 -3
- package/lib-esm/utils/STCSParser.js +27 -9
- 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 +2 -2
- 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/wmts/types.d.ts +0 -1
- package/lib-esm/model/earth/wmts/types.js +0 -1
- /package/lib-esm/model/{earth/types.js → hips/HiPSConfig.js} +0 -0
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import global from '../../Global.js';
|
|
2
|
-
const MAX_MERCATOR_LAT = 85.0511287798066;
|
|
3
|
-
export class XYZTileProvider {
|
|
4
|
-
_config;
|
|
5
|
-
constructor(config) {
|
|
6
|
-
this._config = config;
|
|
7
|
-
}
|
|
8
|
-
get config() {
|
|
9
|
-
return this._config;
|
|
10
|
-
}
|
|
11
|
-
get minZoom() {
|
|
12
|
-
return Math.max(0, Math.floor(this._config.minZoom ?? 0));
|
|
13
|
-
}
|
|
14
|
-
get maxZoom() {
|
|
15
|
-
return Math.max(this.minZoom, Math.floor(this._config.maxZoom ?? 6));
|
|
16
|
-
}
|
|
17
|
-
getInitialTiles() {
|
|
18
|
-
return this.getVisibleTilesAtZoom(1, null, [], [], 1);
|
|
19
|
-
}
|
|
20
|
-
getTileUrl(tile) {
|
|
21
|
-
if (this._config.urlResolver) {
|
|
22
|
-
return this._config.urlResolver(tile);
|
|
23
|
-
}
|
|
24
|
-
const effectiveY = this.getEffectiveTileY(tile);
|
|
25
|
-
const subdomain = this.getSubdomain(tile);
|
|
26
|
-
return this._config.urlTemplate
|
|
27
|
-
.replace(/\{z\}/g, String(tile.z))
|
|
28
|
-
.replace(/\{x\}/g, String(tile.x))
|
|
29
|
-
.replace(/\{y\}/g, String(effectiveY))
|
|
30
|
-
.replace(/\{s\}/g, subdomain);
|
|
31
|
-
}
|
|
32
|
-
resolveZoom(fovDeg) {
|
|
33
|
-
const safeFov = Math.max(0.01, Math.min(180, fovDeg));
|
|
34
|
-
const targetTileWidthDeg = Math.max(0.01, safeFov / 2);
|
|
35
|
-
const rawZoom = Math.ceil(Math.log2(360 / targetTileWidthDeg));
|
|
36
|
-
return this.clampZoom(rawZoom);
|
|
37
|
-
}
|
|
38
|
-
clampZoom(zoom) {
|
|
39
|
-
return Math.max(this.minZoom, Math.min(this.maxZoom, zoom));
|
|
40
|
-
}
|
|
41
|
-
getEffectiveTileY(tile) {
|
|
42
|
-
if (!this._config.flipY) {
|
|
43
|
-
return tile.y;
|
|
44
|
-
}
|
|
45
|
-
const dim = 2 ** tile.z;
|
|
46
|
-
return dim - 1 - tile.y;
|
|
47
|
-
}
|
|
48
|
-
getSubdomain(tile) {
|
|
49
|
-
const subdomains = this._config.subdomains ?? [];
|
|
50
|
-
if (subdomains.length === 0) {
|
|
51
|
-
return '';
|
|
52
|
-
}
|
|
53
|
-
const index = Math.abs(tile.x + tile.y + tile.z) % subdomains.length;
|
|
54
|
-
return subdomains[index] ?? '';
|
|
55
|
-
}
|
|
56
|
-
getVisibleTilesAtZoom(z, centerSphericalDeg, fovPolygon, viewportSphericalSamples, padding = 1) {
|
|
57
|
-
const dim = 2 ** z;
|
|
58
|
-
const center = this.resolveViewCenter(null, centerSphericalDeg);
|
|
59
|
-
const normalizedCenterLon = this.normalizeLonAround(center.lonDeg, center.lonDeg);
|
|
60
|
-
const polygonPoints = fovPolygon.length > 0
|
|
61
|
-
? fovPolygon.map((point) => ({
|
|
62
|
-
lonDeg: this.normalizeLonAround(point.raDeg > 180 ? point.raDeg - 360 : point.raDeg, normalizedCenterLon),
|
|
63
|
-
latDeg: point.decDeg,
|
|
64
|
-
}))
|
|
65
|
-
: [center];
|
|
66
|
-
const samplePoints = viewportSphericalSamples.map((sample) => ({
|
|
67
|
-
lonDeg: this.normalizeLonAround(sample.phi > 180 ? sample.phi - 360 : sample.phi, normalizedCenterLon),
|
|
68
|
-
latDeg: 90 - sample.theta,
|
|
69
|
-
}));
|
|
70
|
-
const coveragePoints = [center, ...polygonPoints, ...samplePoints];
|
|
71
|
-
let minLon = normalizedCenterLon;
|
|
72
|
-
let maxLon = normalizedCenterLon;
|
|
73
|
-
let minLat = center.latDeg;
|
|
74
|
-
let maxLat = center.latDeg;
|
|
75
|
-
for (const point of coveragePoints) {
|
|
76
|
-
minLon = Math.min(minLon, point.lonDeg);
|
|
77
|
-
maxLon = Math.max(maxLon, point.lonDeg);
|
|
78
|
-
minLat = Math.min(minLat, point.latDeg);
|
|
79
|
-
maxLat = Math.max(maxLat, point.latDeg);
|
|
80
|
-
}
|
|
81
|
-
const adaptivePadding = Math.max(padding, Math.min(3, Math.max(1, Math.ceil(z / 3))));
|
|
82
|
-
const minX = Math.floor(((minLon + 180) / 360) * dim) - adaptivePadding;
|
|
83
|
-
const maxX = Math.floor(((maxLon + 180) / 360) * dim) + adaptivePadding;
|
|
84
|
-
const minY = Math.floor(this.latToTileY(maxLat, z)) - adaptivePadding;
|
|
85
|
-
const maxY = Math.floor(this.latToTileY(minLat, z)) + adaptivePadding;
|
|
86
|
-
const tiles = [];
|
|
87
|
-
for (let x = minX; x <= maxX; x++) {
|
|
88
|
-
for (let y = minY; y <= maxY; y++) {
|
|
89
|
-
tiles.push({
|
|
90
|
-
z,
|
|
91
|
-
x: this.wrapTileX(x, dim),
|
|
92
|
-
y: this.clampTileY(y, dim),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
for (const point of coveragePoints) {
|
|
97
|
-
const centerTileX = Math.floor(((point.lonDeg + 180) / 360) * dim);
|
|
98
|
-
const centerTileY = Math.floor(this.latToTileY(point.latDeg, z));
|
|
99
|
-
for (let dx = -adaptivePadding; dx <= adaptivePadding; dx++) {
|
|
100
|
-
for (let dy = -adaptivePadding; dy <= adaptivePadding; dy++) {
|
|
101
|
-
tiles.push({
|
|
102
|
-
z,
|
|
103
|
-
x: this.wrapTileX(centerTileX + dx, dim),
|
|
104
|
-
y: this.clampTileY(centerTileY + dy, dim),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return this.deduplicateTiles(tiles);
|
|
110
|
-
}
|
|
111
|
-
tileFromSpherical(zoom, sphericalDeg) {
|
|
112
|
-
const lonDeg = sphericalDeg.phi > 180 ? sphericalDeg.phi - 360 : sphericalDeg.phi;
|
|
113
|
-
const latDeg = 90 - sphericalDeg.theta;
|
|
114
|
-
const dim = 2 ** zoom;
|
|
115
|
-
const x = Math.floor(((lonDeg + 180) / 360) * dim);
|
|
116
|
-
const y = Math.floor(this.latToTileY(latDeg, zoom));
|
|
117
|
-
return {
|
|
118
|
-
z: zoom,
|
|
119
|
-
x: this.wrapTileX(x, dim),
|
|
120
|
-
y: this.clampTileY(y, dim),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
getNeighborTiles(tile, ring = 1) {
|
|
124
|
-
const dim = 2 ** tile.z;
|
|
125
|
-
const neighbors = [];
|
|
126
|
-
for (let dx = -ring; dx <= ring; dx++) {
|
|
127
|
-
for (let dy = -ring; dy <= ring; dy++) {
|
|
128
|
-
neighbors.push({
|
|
129
|
-
z: tile.z,
|
|
130
|
-
x: this.wrapTileX(tile.x + dx, dim),
|
|
131
|
-
y: this.clampTileY(tile.y + dy, dim),
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return this.deduplicateTiles(neighbors);
|
|
136
|
-
}
|
|
137
|
-
deduplicateTiles(tiles) {
|
|
138
|
-
const unique = new Map();
|
|
139
|
-
for (const tile of tiles) {
|
|
140
|
-
unique.set(`${tile.z}/${tile.x}/${tile.y}`, tile);
|
|
141
|
-
}
|
|
142
|
-
return Array.from(unique.values());
|
|
143
|
-
}
|
|
144
|
-
resolveViewCenter(camera, centerSphericalDeg) {
|
|
145
|
-
if (centerSphericalDeg) {
|
|
146
|
-
return {
|
|
147
|
-
lonDeg: centerSphericalDeg.phi > 180 ? centerSphericalDeg.phi - 360 : centerSphericalDeg.phi,
|
|
148
|
-
latDeg: 90 - centerSphericalDeg.theta,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
if (!camera) {
|
|
152
|
-
return { lonDeg: 0, latDeg: 0 };
|
|
153
|
-
}
|
|
154
|
-
const [x, y, z] = camera.getCameraPosition();
|
|
155
|
-
const len = Math.hypot(x, y, z);
|
|
156
|
-
if (!Number.isFinite(len) || len === 0) {
|
|
157
|
-
return { lonDeg: 0, latDeg: 0 };
|
|
158
|
-
}
|
|
159
|
-
const scale = global.insideSphere ? 1 / len : -1 / len;
|
|
160
|
-
const vx = x * scale;
|
|
161
|
-
const vy = y * scale;
|
|
162
|
-
const vz = z * scale;
|
|
163
|
-
const lonDeg = (Math.atan2(vy, vx) * 180) / Math.PI;
|
|
164
|
-
const latDeg = (Math.asin(Math.max(-1, Math.min(1, vz))) * 180) / Math.PI;
|
|
165
|
-
return { lonDeg, latDeg };
|
|
166
|
-
}
|
|
167
|
-
latToTileY(latDeg, z) {
|
|
168
|
-
const lat = Math.max(-MAX_MERCATOR_LAT, Math.min(MAX_MERCATOR_LAT, latDeg));
|
|
169
|
-
const latRad = (lat * Math.PI) / 180;
|
|
170
|
-
const n = 2 ** z;
|
|
171
|
-
return ((1 - Math.asinh(Math.tan(latRad)) / Math.PI) / 2) * n;
|
|
172
|
-
}
|
|
173
|
-
wrapTileX(x, dim) {
|
|
174
|
-
return ((x % dim) + dim) % dim;
|
|
175
|
-
}
|
|
176
|
-
normalizeLonAround(lonDeg, referenceLonDeg) {
|
|
177
|
-
let lon = lonDeg;
|
|
178
|
-
while (lon - referenceLonDeg > 180)
|
|
179
|
-
lon -= 360;
|
|
180
|
-
while (lon - referenceLonDeg < -180)
|
|
181
|
-
lon += 360;
|
|
182
|
-
return lon;
|
|
183
|
-
}
|
|
184
|
-
clampTileY(y, dim) {
|
|
185
|
-
return Math.max(0, Math.min(dim - 1, y));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|