astro-viewer 3.7.0 → 3.8.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 +368 -22
- package/dist/astroviewer.cjs.map +1 -1
- package/dist/astroviewer.js +369 -22
- package/dist/astroviewer.js.map +1 -1
- package/dist/astroviewer.min.js +1 -1
- package/dist/astroviewer.min.js.map +1 -1
- package/lib-esm/AstroSphere.d.ts +9 -1
- package/lib-esm/AstroSphere.d.ts.map +1 -1
- package/lib-esm/AstroSphere.js +79 -5
- package/lib-esm/AstroSphere.js.map +1 -1
- package/lib-esm/AstroViewer.d.ts +7 -0
- package/lib-esm/AstroViewer.d.ts.map +1 -1
- package/lib-esm/AstroViewer.js +28 -2
- package/lib-esm/AstroViewer.js.map +1 -1
- package/lib-esm/model/hips/AllSky.d.ts +0 -1
- package/lib-esm/model/hips/AllSky.d.ts.map +1 -1
- package/lib-esm/model/hips/AllSky.js +8 -7
- package/lib-esm/model/hips/AllSky.js.map +1 -1
- package/lib-esm/model/hips/AncestorTile.d.ts.map +1 -1
- package/lib-esm/model/hips/AncestorTile.js +7 -2
- package/lib-esm/model/hips/AncestorTile.js.map +1 -1
- package/lib-esm/model/hips/HiPS.d.ts +7 -0
- package/lib-esm/model/hips/HiPS.d.ts.map +1 -1
- package/lib-esm/model/hips/HiPS.js +40 -0
- package/lib-esm/model/hips/HiPS.js.map +1 -1
- package/lib-esm/model/hips/HiPSCoverage.d.ts +6 -1
- package/lib-esm/model/hips/HiPSCoverage.d.ts.map +1 -1
- package/lib-esm/model/hips/HiPSCoverage.js +20 -2
- package/lib-esm/model/hips/HiPSCoverage.js.map +1 -1
- package/lib-esm/model/hips/Tile.d.ts +0 -1
- package/lib-esm/model/hips/Tile.d.ts.map +1 -1
- package/lib-esm/model/hips/Tile.js +6 -2
- package/lib-esm/model/hips/Tile.js.map +1 -1
- package/lib-esm/model/hips/TileBuffer.d.ts.map +1 -1
- package/lib-esm/model/hips/TileBuffer.js +6 -0
- package/lib-esm/model/hips/TileBuffer.js.map +1 -1
- package/lib-esm/shader/HiPSShaderProgram.d.ts +2 -0
- package/lib-esm/shader/HiPSShaderProgram.d.ts.map +1 -1
- package/lib-esm/shader/HiPSShaderProgram.js +8 -0
- package/lib-esm/shader/HiPSShaderProgram.js.map +1 -1
- package/lib-esm/shader/ShaderManager.d.ts.map +1 -1
- package/lib-esm/shader/ShaderManager.js +7 -3
- package/lib-esm/shader/ShaderManager.js.map +1 -1
- package/package.json +1 -1
package/dist/astroviewer.cjs
CHANGED
|
@@ -3627,6 +3627,7 @@ class AstroSphere {
|
|
|
3627
3627
|
pointerDownY = null;
|
|
3628
3628
|
pointerDownAt = 0;
|
|
3629
3629
|
_activeHiPS = null;
|
|
3630
|
+
_activeHiPSLayers = [];
|
|
3630
3631
|
_activeXYZ2 = null;
|
|
3631
3632
|
_activeMeshHiPS = null;
|
|
3632
3633
|
_activeBaseLayer = null;
|
|
@@ -4129,12 +4130,69 @@ class AstroSphere {
|
|
|
4129
4130
|
}
|
|
4130
4131
|
this._activeHiPS.changeFormat(format);
|
|
4131
4132
|
}
|
|
4133
|
+
createHiPS(hipsDescriptor) {
|
|
4134
|
+
return new HiPS_js_1.HiPS(1, [0.0, 0.0, 0.0], 0, 0, hipsDescriptor, this._webgl, this._healpixGrid);
|
|
4135
|
+
}
|
|
4132
4136
|
activateHiPS(hipsDescriptor) {
|
|
4133
|
-
|
|
4134
|
-
|
|
4137
|
+
const tileBuffer = this._healpixGrid.visibleTilesManager.tileBuffer;
|
|
4138
|
+
for (const hips of this._activeHiPSLayers) {
|
|
4139
|
+
tileBuffer.removeHiPS(hips);
|
|
4135
4140
|
}
|
|
4136
|
-
this.
|
|
4141
|
+
this._activeHiPSLayers = [];
|
|
4142
|
+
const hips = this.createHiPS(hipsDescriptor);
|
|
4143
|
+
this._activeHiPSLayers.push(hips);
|
|
4144
|
+
this._activeHiPS = hips;
|
|
4137
4145
|
this._activeBaseLayer = "hips";
|
|
4146
|
+
return hips;
|
|
4147
|
+
}
|
|
4148
|
+
setHiPSOpacity(hips, opacity) {
|
|
4149
|
+
if (!this._activeHiPSLayers.includes(hips)) {
|
|
4150
|
+
throw new Error("HiPS layer is not active in this AstroSphere.");
|
|
4151
|
+
}
|
|
4152
|
+
hips.setOpacity(opacity);
|
|
4153
|
+
}
|
|
4154
|
+
addHiPS(hipsDescriptor) {
|
|
4155
|
+
const normalizeURL = (url) => String(url).replace(/\/+$/, "");
|
|
4156
|
+
const descriptorURL = normalizeURL(hipsDescriptor.url);
|
|
4157
|
+
const existing = this._activeHiPSLayers.find((hips) => normalizeURL(hips.baseURL) === descriptorURL);
|
|
4158
|
+
if (existing) {
|
|
4159
|
+
throw new Error(`HiPS already active: ${String(hipsDescriptor.url)}`);
|
|
4160
|
+
}
|
|
4161
|
+
const hips = this.createHiPS(hipsDescriptor);
|
|
4162
|
+
this._activeHiPSLayers.push(hips);
|
|
4163
|
+
this._activeHiPS = hips;
|
|
4164
|
+
this._activeBaseLayer = "hips";
|
|
4165
|
+
return hips;
|
|
4166
|
+
}
|
|
4167
|
+
removeHiPS(hips) {
|
|
4168
|
+
const index = this._activeHiPSLayers.indexOf(hips);
|
|
4169
|
+
if (index === -1) {
|
|
4170
|
+
return;
|
|
4171
|
+
}
|
|
4172
|
+
this._healpixGrid.visibleTilesManager.tileBuffer.removeHiPS(hips);
|
|
4173
|
+
this._activeHiPSLayers.splice(index, 1);
|
|
4174
|
+
if (this._activeHiPSLayers.length === 0) {
|
|
4175
|
+
this._activeHiPS = null;
|
|
4176
|
+
if (this._activeBaseLayer === "hips") {
|
|
4177
|
+
this._activeBaseLayer = null;
|
|
4178
|
+
}
|
|
4179
|
+
return;
|
|
4180
|
+
}
|
|
4181
|
+
if (this._activeHiPS === hips) {
|
|
4182
|
+
this._activeHiPS =
|
|
4183
|
+
this._activeHiPSLayers[this._activeHiPSLayers.length - 1];
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
removeAllHiPS() {
|
|
4187
|
+
const tileBuffer = this._healpixGrid.visibleTilesManager.tileBuffer;
|
|
4188
|
+
for (const hips of this._activeHiPSLayers) {
|
|
4189
|
+
tileBuffer.removeHiPS(hips);
|
|
4190
|
+
}
|
|
4191
|
+
this._activeHiPSLayers = [];
|
|
4192
|
+
this._activeHiPS = null;
|
|
4193
|
+
if (this._activeBaseLayer === "hips") {
|
|
4194
|
+
this._activeBaseLayer = null;
|
|
4195
|
+
}
|
|
4138
4196
|
}
|
|
4139
4197
|
activateXYZ(config) {
|
|
4140
4198
|
this.activateXYZ2(new XYZMapDescriptor_js_1.XYZMapDescriptor(config.name ?? "XYZ Earth2 Layer", config.urlTemplate, config.minZoom ?? 0, config.maxZoom ?? 8, config.segmentsPerSide ?? 48, config.maxCachedTiles ?? 384, 8, config.urlResolver));
|
|
@@ -4367,6 +4425,16 @@ class AstroSphere {
|
|
|
4367
4425
|
get activeHiPS() {
|
|
4368
4426
|
return this._activeHiPS;
|
|
4369
4427
|
}
|
|
4428
|
+
get activeHiPSLayers() {
|
|
4429
|
+
return this._activeHiPSLayers;
|
|
4430
|
+
}
|
|
4431
|
+
setActiveHiPS(hips) {
|
|
4432
|
+
if (!this._activeHiPSLayers.includes(hips)) {
|
|
4433
|
+
throw new Error("HiPS layer is not active in this AstroSphere.");
|
|
4434
|
+
}
|
|
4435
|
+
this._activeHiPS = hips;
|
|
4436
|
+
this._activeBaseLayer = "hips";
|
|
4437
|
+
}
|
|
4370
4438
|
get activeXYZ() {
|
|
4371
4439
|
return this._activeXYZ2;
|
|
4372
4440
|
}
|
|
@@ -4526,8 +4594,9 @@ class AstroSphere {
|
|
|
4526
4594
|
this._webgl.enable(this._webgl.CULL_FACE);
|
|
4527
4595
|
this._webgl.cullFace(Global_js_1.default.insideSphere ? this._webgl.FRONT : this._webgl.BACK);
|
|
4528
4596
|
this._webgl.blendFunc(this._webgl.SRC_ALPHA, this._webgl.ONE_MINUS_SRC_ALPHA);
|
|
4529
|
-
if (this._activeBaseLayer === "hips" && this.
|
|
4530
|
-
const
|
|
4597
|
+
if (this._activeBaseLayer === "hips" && this._activeHiPSLayers.length > 0) {
|
|
4598
|
+
const maxHiPSOrder = Math.max(...this._activeHiPSLayers.map((hips) => hips.maxOrder));
|
|
4599
|
+
const visibleOrder = Math.min(this._healpixGrid.visibleorder, maxHiPSOrder);
|
|
4531
4600
|
this._healpixGrid.visibleTilesManager.computeVisiblePixels(visibleOrder, this._webgl, this._camera, this._perspectiveMatrixManager.pMatrix);
|
|
4532
4601
|
}
|
|
4533
4602
|
if (this._activeBaseLayer === "meships" && this._activeMeshHiPS) {
|
|
@@ -4552,6 +4621,11 @@ class AstroSphere {
|
|
|
4552
4621
|
cameraMoving: cameraMovingForGrid,
|
|
4553
4622
|
};
|
|
4554
4623
|
if (this._activeBaseLayer === "hips") {
|
|
4624
|
+
for (const hips of this._activeHiPSLayers) {
|
|
4625
|
+
if (hips !== this._activeHiPS) {
|
|
4626
|
+
hips.draw(skyEntityDrawInput);
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4555
4629
|
this._activeHiPS?.draw(skyEntityDrawInput);
|
|
4556
4630
|
}
|
|
4557
4631
|
if (this._activeBaseLayer === "xyz") {
|
|
@@ -4886,15 +4960,41 @@ class AstroViewer {
|
|
|
4886
4960
|
this.astroSphere.activateMeshHiPS(desc);
|
|
4887
4961
|
return desc.name;
|
|
4888
4962
|
}
|
|
4889
|
-
|
|
4963
|
+
setActiveHiPS(hips) {
|
|
4964
|
+
this.astroSphere.setActiveHiPS(hips);
|
|
4965
|
+
}
|
|
4966
|
+
setHiPSOpacity(hips, opacity) {
|
|
4967
|
+
this.astroSphere.setHiPSOpacity(hips, opacity);
|
|
4968
|
+
}
|
|
4890
4969
|
changeColorMap(colorMapName) {
|
|
4891
4970
|
const colorMap = ColorMaps_js_1.default[colorMapName];
|
|
4892
|
-
// hips.changeColorMap(colorMap)
|
|
4893
4971
|
this.astroSphere.changeColorMap(colorMap);
|
|
4894
4972
|
}
|
|
4895
4973
|
changeCustomColorMap(colorMap) {
|
|
4896
4974
|
this.astroSphere.changeColorMap(colorMap);
|
|
4897
4975
|
}
|
|
4976
|
+
addHiPS(hipsDescriptor) {
|
|
4977
|
+
return this.astroSphere.addHiPS(hipsDescriptor);
|
|
4978
|
+
}
|
|
4979
|
+
async addHiPSFromUrl(baseUrl) {
|
|
4980
|
+
const hipsUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
|
|
4981
|
+
const resp = await fetch(hipsUrl + "properties");
|
|
4982
|
+
if (!resp.ok) {
|
|
4983
|
+
throw new Error(`HTTP ${resp.status} fetching properties`);
|
|
4984
|
+
}
|
|
4985
|
+
const propsText = await resp.text();
|
|
4986
|
+
const desc = new HiPSDescriptor_js_1.HiPSDescriptor(propsText, hipsUrl);
|
|
4987
|
+
return this.astroSphere.addHiPS(desc);
|
|
4988
|
+
}
|
|
4989
|
+
removeHiPS(hips) {
|
|
4990
|
+
this.astroSphere.removeHiPS(hips);
|
|
4991
|
+
}
|
|
4992
|
+
removeAllHiPS() {
|
|
4993
|
+
this.astroSphere.removeAllHiPS();
|
|
4994
|
+
}
|
|
4995
|
+
getActiveHiPSLayers() {
|
|
4996
|
+
return this.astroSphere.activeHiPSLayers;
|
|
4997
|
+
}
|
|
4898
4998
|
getActiveHiPS() {
|
|
4899
4999
|
return this.astroSphere.activeHiPS;
|
|
4900
5000
|
}
|
|
@@ -11915,7 +12015,7 @@ class AllSky {
|
|
|
11915
12015
|
_baseurl;
|
|
11916
12016
|
_isGalacticHips;
|
|
11917
12017
|
_order = 3;
|
|
11918
|
-
opacity = 1.0;
|
|
12018
|
+
// public opacity = 1.0;
|
|
11919
12019
|
_hipsShaderIndex = 0;
|
|
11920
12020
|
_texture = null;
|
|
11921
12021
|
_image;
|
|
@@ -12156,9 +12256,10 @@ class AllSky {
|
|
|
12156
12256
|
gl.activeTexture(gl.TEXTURE0 + this._hipsShaderIndex);
|
|
12157
12257
|
gl.bindTexture(gl.TEXTURE_2D, this._texture);
|
|
12158
12258
|
const factorLocation = this._hipsShaderProgram.locations.textureAlpha[this._hipsShaderIndex];
|
|
12159
|
-
if (factorLocation) {
|
|
12160
|
-
gl.uniform1f(factorLocation,
|
|
12259
|
+
if (factorLocation !== null) {
|
|
12260
|
+
gl.uniform1f(factorLocation, 1.0);
|
|
12161
12261
|
}
|
|
12262
|
+
this._hipsShaderProgram.setLayerOpacity(this._hips.opacity);
|
|
12162
12263
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBuffer);
|
|
12163
12264
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.vertexIndexBuffer);
|
|
12164
12265
|
gl.vertexAttribPointer(
|
|
@@ -12186,13 +12287,13 @@ class AllSky {
|
|
|
12186
12287
|
const allSkyTiles2Skip = [];
|
|
12187
12288
|
for (let i = 0; i < visibleTiles.length; i++) {
|
|
12188
12289
|
const tileno = visibleTiles[i];
|
|
12290
|
+
if (!this._hips.intersectsCoverage(childrenOrder, tileno)) {
|
|
12291
|
+
allSkyTiles2Skip.push(tileno);
|
|
12292
|
+
continue;
|
|
12293
|
+
}
|
|
12189
12294
|
const childTile = this._isGalacticHips
|
|
12190
12295
|
? this._tileBuffer.getGalTile(tileno, childrenOrder, this._hips)
|
|
12191
12296
|
: this._tileBuffer.getTile(tileno, childrenOrder, this._hips);
|
|
12192
|
-
// const childTile = this._isGalacticHips
|
|
12193
|
-
// ? newTileBuffer.getGalTile(tileno, childrenOrder, this._hips)
|
|
12194
|
-
// : newTileBuffer.getTile(tileno, childrenOrder, this._hips)
|
|
12195
|
-
// childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx)
|
|
12196
12297
|
childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx, this._hipsShaderProgram);
|
|
12197
12298
|
if (childTile.getReadyState()) {
|
|
12198
12299
|
allSkyTiles2Skip.push(tileno);
|
|
@@ -12492,16 +12593,21 @@ class AncestorTile {
|
|
|
12492
12593
|
return;
|
|
12493
12594
|
for (let c = 0; c < 4; c++) {
|
|
12494
12595
|
const childTileNo = (this._tileno << 2) + c;
|
|
12596
|
+
if (!this._hips.intersectsCoverage(childrenOrder, childTileNo)) {
|
|
12597
|
+
continue;
|
|
12598
|
+
}
|
|
12495
12599
|
const visibleChildren = visibleTilesMap.get(childrenOrder);
|
|
12496
12600
|
if (visibleChildren.includes(childTileNo)) {
|
|
12601
|
+
if (!this._hips.intersectsCoverage(childrenOrder, childTileNo)) {
|
|
12602
|
+
quadrantsToDraw.delete(c);
|
|
12603
|
+
continue;
|
|
12604
|
+
}
|
|
12497
12605
|
const childTile = this._isGalacticHips
|
|
12498
12606
|
? this._tileBuffer.getGalTile(childTileNo, childrenOrder, this._hips)
|
|
12499
12607
|
: this._tileBuffer.getTile(childTileNo, childrenOrder, this._hips);
|
|
12500
|
-
// childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx)
|
|
12501
12608
|
childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx, this._hipsShaderProgram);
|
|
12502
12609
|
if (childTile.getReadyState()) {
|
|
12503
12610
|
quadrantsToDraw.delete(c);
|
|
12504
|
-
// quadrantsToDraw.delete((childTile as any)._tileno - (this._tileno << 2))
|
|
12505
12611
|
}
|
|
12506
12612
|
}
|
|
12507
12613
|
}
|
|
@@ -12778,10 +12884,14 @@ const FoVHelper_js_1 = __webpack_require__(229);
|
|
|
12778
12884
|
const ColorMaps_js_1 = __importDefault(__webpack_require__(619));
|
|
12779
12885
|
const AncestorTile_js_1 = __importDefault(__webpack_require__(2885));
|
|
12780
12886
|
const AllSky_js_1 = __importDefault(__webpack_require__(2368));
|
|
12887
|
+
const HiPSCoverage_js_1 = __webpack_require__(9912);
|
|
12781
12888
|
class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
12782
12889
|
_ancestorTiles;
|
|
12783
12890
|
_allSkyTile;
|
|
12784
12891
|
_descriptor;
|
|
12892
|
+
_coverage;
|
|
12893
|
+
_coverageResolved = false;
|
|
12894
|
+
_opacity = 1.0;
|
|
12785
12895
|
_format;
|
|
12786
12896
|
_baseurl;
|
|
12787
12897
|
_maxorder;
|
|
@@ -12820,6 +12930,17 @@ class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
12820
12930
|
this._baseurl = descriptor.url;
|
|
12821
12931
|
this._maxorder = descriptor.maxOrder;
|
|
12822
12932
|
this._minorder = descriptor.minOrder;
|
|
12933
|
+
this._coverage = new HiPSCoverage_js_1.HiPSCoverage();
|
|
12934
|
+
void this._coverage
|
|
12935
|
+
.load(this._baseurl)
|
|
12936
|
+
.then(() => {
|
|
12937
|
+
this._coverageResolved = true;
|
|
12938
|
+
})
|
|
12939
|
+
.catch((error) => {
|
|
12940
|
+
console.warn(`[HiPS] Coverage unavailable for ${this._baseurl}; continuing without MOC filtering.`, error);
|
|
12941
|
+
this._coverage.clear();
|
|
12942
|
+
this._coverageResolved = true;
|
|
12943
|
+
});
|
|
12823
12944
|
if (this.isGalacticHips) {
|
|
12824
12945
|
this._healpixGrid.visibleTilesManager.tileBuffer.addGalHiPS(this);
|
|
12825
12946
|
}
|
|
@@ -12842,6 +12963,31 @@ class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
12842
12963
|
this._allSky = true;
|
|
12843
12964
|
this.initBaseTiles();
|
|
12844
12965
|
}
|
|
12966
|
+
setOpacity(opacity) {
|
|
12967
|
+
if (!Number.isFinite(opacity)) {
|
|
12968
|
+
throw new Error(`Invalid HiPS opacity: ${opacity}`);
|
|
12969
|
+
}
|
|
12970
|
+
this._opacity = Math.min(1, Math.max(0, opacity));
|
|
12971
|
+
}
|
|
12972
|
+
get opacity() {
|
|
12973
|
+
return this._opacity;
|
|
12974
|
+
}
|
|
12975
|
+
intersectsCoverage(order, pixel) {
|
|
12976
|
+
/*
|
|
12977
|
+
* While Moc.fits is being resolved, do not start tile requests.
|
|
12978
|
+
*
|
|
12979
|
+
* Once loading has completed:
|
|
12980
|
+
* - valid MOC -> filter using coverage
|
|
12981
|
+
* - unavailable MOC -> HiPSCoverage is cleared and normal loading resumes
|
|
12982
|
+
*/
|
|
12983
|
+
if (!this._coverageResolved) {
|
|
12984
|
+
return false;
|
|
12985
|
+
}
|
|
12986
|
+
return this._coverage.intersectsTile(order, pixel);
|
|
12987
|
+
}
|
|
12988
|
+
get coverageLoaded() {
|
|
12989
|
+
return this._coverage.loaded;
|
|
12990
|
+
}
|
|
12845
12991
|
initBaseTiles() {
|
|
12846
12992
|
this._ancestorTiles = [];
|
|
12847
12993
|
this._allSkyTile = null;
|
|
@@ -13053,6 +13199,183 @@ class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
13053
13199
|
exports.HiPS = HiPS;
|
|
13054
13200
|
|
|
13055
13201
|
|
|
13202
|
+
/***/ },
|
|
13203
|
+
|
|
13204
|
+
/***/ 9912
|
|
13205
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
13206
|
+
|
|
13207
|
+
var __webpack_unused_export__;
|
|
13208
|
+
|
|
13209
|
+
/*
|
|
13210
|
+
* AstroViewer
|
|
13211
|
+
* Copyright (C) Fabrizio Giordano
|
|
13212
|
+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-AstroViewer-Commercial
|
|
13213
|
+
*
|
|
13214
|
+
* AstroViewer is dual-licensed under the GNU Affero General Public License
|
|
13215
|
+
* version 3 and a separate commercial license.
|
|
13216
|
+
*
|
|
13217
|
+
* See LICENSE.md, LICENSE-AGPL.md, and LICENSE-COMMERCIAL.md for details.
|
|
13218
|
+
*/
|
|
13219
|
+
__webpack_unused_export__ = ({ value: true });
|
|
13220
|
+
exports.HiPSCoverage = void 0;
|
|
13221
|
+
const jsfitsio_1 = __webpack_require__(4971);
|
|
13222
|
+
class HiPSCoverage {
|
|
13223
|
+
intersec(intersec, arg1) {
|
|
13224
|
+
throw new Error("Method not implemented.");
|
|
13225
|
+
}
|
|
13226
|
+
ises(ises, expents, of, arg3) {
|
|
13227
|
+
throw new Error("Method not implemented.");
|
|
13228
|
+
}
|
|
13229
|
+
intersexpect(co, t, expe, arg3) {
|
|
13230
|
+
throw new Error("Method not implemented.");
|
|
13231
|
+
}
|
|
13232
|
+
intersectsT19(intersectsT19, arg1) {
|
|
13233
|
+
throw new Error("Method not implemented.");
|
|
13234
|
+
}
|
|
13235
|
+
_maxOrder = 0;
|
|
13236
|
+
_intervals = [];
|
|
13237
|
+
_loaded = false;
|
|
13238
|
+
get loaded() {
|
|
13239
|
+
return this._loaded;
|
|
13240
|
+
}
|
|
13241
|
+
get maxOrder() {
|
|
13242
|
+
return this._maxOrder;
|
|
13243
|
+
}
|
|
13244
|
+
get intervalCount() {
|
|
13245
|
+
return this._intervals.length;
|
|
13246
|
+
}
|
|
13247
|
+
clear() {
|
|
13248
|
+
this._maxOrder = 0;
|
|
13249
|
+
this._intervals = [];
|
|
13250
|
+
this._loaded = false;
|
|
13251
|
+
}
|
|
13252
|
+
async load(baseUrl) {
|
|
13253
|
+
const baseUrlString = baseUrl instanceof URL ? baseUrl.href : String(baseUrl);
|
|
13254
|
+
const normalizedBaseUrl = baseUrlString.endsWith("/")
|
|
13255
|
+
? baseUrlString
|
|
13256
|
+
: `${baseUrlString}/`;
|
|
13257
|
+
await this.loadMoc(`${normalizedBaseUrl}Moc.fits`);
|
|
13258
|
+
}
|
|
13259
|
+
async loadMoc(mocUrl) {
|
|
13260
|
+
this.clear();
|
|
13261
|
+
const fits = await jsfitsio_1.FITSParser.loadFITSFile(mocUrl);
|
|
13262
|
+
if (!fits) {
|
|
13263
|
+
throw new Error("Unable to load HiPS Moc.fits");
|
|
13264
|
+
}
|
|
13265
|
+
const mocHDU = fits.hdus.find((hdu) => hdu instanceof jsfitsio_1.BinaryTableHDU);
|
|
13266
|
+
if (!(mocHDU instanceof jsfitsio_1.BinaryTableHDU)) {
|
|
13267
|
+
throw new Error("HiPS Moc.fits does not contain a BINTABLE HDU.");
|
|
13268
|
+
}
|
|
13269
|
+
const mocOrderItem = mocHDU.header.findById("MOCORDER");
|
|
13270
|
+
if (!mocOrderItem) {
|
|
13271
|
+
throw new Error("HiPS Moc.fits does not define MOCORDER.");
|
|
13272
|
+
}
|
|
13273
|
+
const maxOrder = Number(mocOrderItem.value);
|
|
13274
|
+
if (!Number.isInteger(maxOrder) || maxOrder < 0) {
|
|
13275
|
+
throw new Error(`Invalid MOCORDER value: ${mocOrderItem.value}`);
|
|
13276
|
+
}
|
|
13277
|
+
this._maxOrder = maxOrder;
|
|
13278
|
+
const intervals = [];
|
|
13279
|
+
for (let row = 0; row < mocHDU.rowCount; row++) {
|
|
13280
|
+
const rawUniq = mocHDU.getCell(row, "UNIQ");
|
|
13281
|
+
if (typeof rawUniq !== "number" ||
|
|
13282
|
+
!Number.isInteger(rawUniq) ||
|
|
13283
|
+
rawUniq < 4) {
|
|
13284
|
+
throw new Error(`Invalid MOC UNIQ value at row ${row}: ${String(rawUniq)}`);
|
|
13285
|
+
}
|
|
13286
|
+
const { order, pixel } = HiPSCoverage.decodeUniq(rawUniq);
|
|
13287
|
+
if (order > this._maxOrder) {
|
|
13288
|
+
throw new Error(`MOC cell order ${order} exceeds MOCORDER ${this._maxOrder}.`);
|
|
13289
|
+
}
|
|
13290
|
+
const scale = 4 ** (this._maxOrder - order);
|
|
13291
|
+
intervals.push({
|
|
13292
|
+
first: pixel * scale,
|
|
13293
|
+
last: (pixel + 1) * scale - 1,
|
|
13294
|
+
});
|
|
13295
|
+
}
|
|
13296
|
+
this._intervals = HiPSCoverage.mergeIntervals(intervals);
|
|
13297
|
+
this._loaded = true;
|
|
13298
|
+
}
|
|
13299
|
+
intersectsTile(order, pixel) {
|
|
13300
|
+
if (!this._loaded) {
|
|
13301
|
+
return true;
|
|
13302
|
+
}
|
|
13303
|
+
if (!Number.isInteger(order) ||
|
|
13304
|
+
order < 0 ||
|
|
13305
|
+
!Number.isInteger(pixel) ||
|
|
13306
|
+
pixel < 0) {
|
|
13307
|
+
return false;
|
|
13308
|
+
}
|
|
13309
|
+
let first;
|
|
13310
|
+
let last;
|
|
13311
|
+
if (order <= this._maxOrder) {
|
|
13312
|
+
const scale = 4 ** (this._maxOrder - order);
|
|
13313
|
+
first = pixel * scale;
|
|
13314
|
+
last = (pixel + 1) * scale - 1;
|
|
13315
|
+
}
|
|
13316
|
+
else {
|
|
13317
|
+
/*
|
|
13318
|
+
* At orders finer than the MOC resolution, reduce the tile
|
|
13319
|
+
* to its ancestor at MOCORDER.
|
|
13320
|
+
*/
|
|
13321
|
+
const shift = 2 * (order - this._maxOrder);
|
|
13322
|
+
const ancestor = Math.floor(pixel / 2 ** shift);
|
|
13323
|
+
first = ancestor;
|
|
13324
|
+
last = ancestor;
|
|
13325
|
+
}
|
|
13326
|
+
return this.intersectsInterval(first, last);
|
|
13327
|
+
}
|
|
13328
|
+
intersectsInterval(first, last) {
|
|
13329
|
+
let low = 0;
|
|
13330
|
+
let high = this._intervals.length - 1;
|
|
13331
|
+
while (low <= high) {
|
|
13332
|
+
const middle = Math.floor((low + high) / 2);
|
|
13333
|
+
const interval = this._intervals[middle];
|
|
13334
|
+
if (interval.last < first) {
|
|
13335
|
+
low = middle + 1;
|
|
13336
|
+
continue;
|
|
13337
|
+
}
|
|
13338
|
+
if (interval.first > last) {
|
|
13339
|
+
high = middle - 1;
|
|
13340
|
+
continue;
|
|
13341
|
+
}
|
|
13342
|
+
return true;
|
|
13343
|
+
}
|
|
13344
|
+
return false;
|
|
13345
|
+
}
|
|
13346
|
+
static decodeUniq(uniq) {
|
|
13347
|
+
let order = 0;
|
|
13348
|
+
while (4 ** (order + 2) <= uniq) {
|
|
13349
|
+
order++;
|
|
13350
|
+
}
|
|
13351
|
+
const base = 4 ** (order + 1);
|
|
13352
|
+
return {
|
|
13353
|
+
order,
|
|
13354
|
+
pixel: uniq - base,
|
|
13355
|
+
};
|
|
13356
|
+
}
|
|
13357
|
+
static mergeIntervals(intervals) {
|
|
13358
|
+
if (intervals.length === 0) {
|
|
13359
|
+
return [];
|
|
13360
|
+
}
|
|
13361
|
+
intervals.sort((a, b) => a.first - b.first);
|
|
13362
|
+
const merged = [{ ...intervals[0] }];
|
|
13363
|
+
for (let i = 1; i < intervals.length; i++) {
|
|
13364
|
+
const current = intervals[i];
|
|
13365
|
+
const previous = merged[merged.length - 1];
|
|
13366
|
+
if (current.first <= previous.last + 1) {
|
|
13367
|
+
previous.last = Math.max(previous.last, current.last);
|
|
13368
|
+
}
|
|
13369
|
+
else {
|
|
13370
|
+
merged.push({ ...current });
|
|
13371
|
+
}
|
|
13372
|
+
}
|
|
13373
|
+
return merged;
|
|
13374
|
+
}
|
|
13375
|
+
}
|
|
13376
|
+
exports.HiPSCoverage = HiPSCoverage;
|
|
13377
|
+
|
|
13378
|
+
|
|
13056
13379
|
/***/ },
|
|
13057
13380
|
|
|
13058
13381
|
/***/ 5087
|
|
@@ -13254,7 +13577,7 @@ class Tile {
|
|
|
13254
13577
|
vertexIndices = new Uint16Array();
|
|
13255
13578
|
vertexIndexBuffer;
|
|
13256
13579
|
_tileBuffer;
|
|
13257
|
-
opacity = 1.0;
|
|
13580
|
+
// public opacity = 1.0;
|
|
13258
13581
|
_webgl;
|
|
13259
13582
|
_visibleTileManager;
|
|
13260
13583
|
// private _hipsShaderProgram
|
|
@@ -13600,8 +13923,9 @@ class Tile {
|
|
|
13600
13923
|
gl.bindTexture(gl.TEXTURE_2D, this._texture);
|
|
13601
13924
|
const factorLocation = locations.textureAlpha[this._hipsShaderIndex];
|
|
13602
13925
|
if (factorLocation) {
|
|
13603
|
-
gl.uniform1f(factorLocation,
|
|
13926
|
+
gl.uniform1f(factorLocation, 1.0);
|
|
13604
13927
|
}
|
|
13928
|
+
hipsShaderProgram.setLayerOpacity(this._hips.opacity);
|
|
13605
13929
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.vertexIndexBuffer);
|
|
13606
13930
|
const elemno = this.vertexIndices.length;
|
|
13607
13931
|
const indexType = this.vertexIndices instanceof Uint32Array
|
|
@@ -13625,6 +13949,9 @@ class Tile {
|
|
|
13625
13949
|
const childTileNo = (this._tileno << 2) + c;
|
|
13626
13950
|
const list = visibleTilesMap.get(childrenOrder);
|
|
13627
13951
|
if (list.includes(childTileNo)) {
|
|
13952
|
+
if (!this._hips.intersectsCoverage(childrenOrder, childTileNo)) {
|
|
13953
|
+
continue;
|
|
13954
|
+
}
|
|
13628
13955
|
const childTile = this._isGalacticHips
|
|
13629
13956
|
? this._tileBuffer.getGalTile(childTileNo, childrenOrder, this._hips)
|
|
13630
13957
|
: this._tileBuffer.getTile(childTileNo, childrenOrder, this._hips);
|
|
@@ -13715,6 +14042,9 @@ class TileBuffer {
|
|
|
13715
14042
|
if (order > hips.maxOrder) {
|
|
13716
14043
|
continue;
|
|
13717
14044
|
}
|
|
14045
|
+
if (!hips.intersectsCoverage(order, tileno)) {
|
|
14046
|
+
continue;
|
|
14047
|
+
}
|
|
13718
14048
|
this.getTile(tileno, order, hips);
|
|
13719
14049
|
}
|
|
13720
14050
|
}
|
|
@@ -13724,6 +14054,9 @@ class TileBuffer {
|
|
|
13724
14054
|
if (order > hips.maxOrder) {
|
|
13725
14055
|
continue;
|
|
13726
14056
|
}
|
|
14057
|
+
if (!hips.intersectsCoverage(order, tileno)) {
|
|
14058
|
+
continue;
|
|
14059
|
+
}
|
|
13727
14060
|
this.getGalTile(tileno, order, hips);
|
|
13728
14061
|
}
|
|
13729
14062
|
}
|
|
@@ -16437,6 +16770,7 @@ class HiPSShaderProgram {
|
|
|
16437
16770
|
textureMode: new Array(8).fill(null),
|
|
16438
16771
|
dataMin: new Array(8).fill(null),
|
|
16439
16772
|
dataMax: new Array(8).fill(null),
|
|
16773
|
+
layerOpacity: null,
|
|
16440
16774
|
clorMapIdx: null,
|
|
16441
16775
|
vertexPositionAttribute: -1,
|
|
16442
16776
|
textureCoordAttribute: -1,
|
|
@@ -16452,6 +16786,13 @@ class HiPSShaderProgram {
|
|
|
16452
16786
|
gl.useProgram(this._shaderProgram);
|
|
16453
16787
|
return this._shaderProgram;
|
|
16454
16788
|
}
|
|
16789
|
+
setLayerOpacity(opacity) {
|
|
16790
|
+
const gl = this._webgl;
|
|
16791
|
+
this.locations.layerOpacity = gl.getUniformLocation(this.shaderProgram, "uLayerOpacity");
|
|
16792
|
+
if (this.locations.layerOpacity !== null) {
|
|
16793
|
+
gl.uniform1f(this.locations.layerOpacity, opacity);
|
|
16794
|
+
}
|
|
16795
|
+
}
|
|
16455
16796
|
setRuntimeColorMap(colorMap) {
|
|
16456
16797
|
this._runtimeColorMap = colorMap;
|
|
16457
16798
|
}
|
|
@@ -16986,6 +17327,7 @@ class ShaderManager {
|
|
|
16986
17327
|
|
|
16987
17328
|
in vec2 vTextureCoord;
|
|
16988
17329
|
|
|
17330
|
+
uniform float uLayerOpacity;
|
|
16989
17331
|
uniform float uFactor0;
|
|
16990
17332
|
uniform float uFactor1;
|
|
16991
17333
|
uniform float uFactor2;
|
|
@@ -17042,7 +17384,7 @@ class ShaderManager {
|
|
|
17042
17384
|
sampleHiPSTexture7(vTextureCoord).rgb * uFactor7;
|
|
17043
17385
|
}
|
|
17044
17386
|
|
|
17045
|
-
fragColor = vec4(finalColor,
|
|
17387
|
+
fragColor = vec4(finalColor, uLayerOpacity);
|
|
17046
17388
|
}`;
|
|
17047
17389
|
}
|
|
17048
17390
|
static hipsGrayscaleFS() {
|
|
@@ -17051,6 +17393,7 @@ class ShaderManager {
|
|
|
17051
17393
|
|
|
17052
17394
|
in vec2 vTextureCoord;
|
|
17053
17395
|
|
|
17396
|
+
uniform float uLayerOpacity;
|
|
17054
17397
|
uniform float uFactor0;
|
|
17055
17398
|
uniform float uFactor1;
|
|
17056
17399
|
uniform float uFactor2;
|
|
@@ -17115,13 +17458,15 @@ class ShaderManager {
|
|
|
17115
17458
|
finalColor += color7.rgb * uFactor7;
|
|
17116
17459
|
}
|
|
17117
17460
|
|
|
17118
|
-
fragColor = vec4(finalColor,
|
|
17461
|
+
fragColor = vec4(finalColor, uLayerOpacity);
|
|
17119
17462
|
}`;
|
|
17120
17463
|
}
|
|
17121
17464
|
static hipsColorMapFS() {
|
|
17122
17465
|
return `#version 300 es
|
|
17123
17466
|
precision mediump float;
|
|
17124
17467
|
|
|
17468
|
+
uniform float uLayerOpacity;
|
|
17469
|
+
|
|
17125
17470
|
in vec2 vTextureCoord;
|
|
17126
17471
|
|
|
17127
17472
|
layout (std140) uniform colormap {
|
|
@@ -17214,7 +17559,7 @@ class ShaderManager {
|
|
|
17214
17559
|
) * uFactor7;
|
|
17215
17560
|
}
|
|
17216
17561
|
|
|
17217
|
-
fragColor = vec4(finalColor,
|
|
17562
|
+
fragColor = vec4(finalColor, uLayerOpacity);
|
|
17218
17563
|
}`;
|
|
17219
17564
|
}
|
|
17220
17565
|
static hipsSamplerGLSL(index) {
|
|
@@ -19783,11 +20128,12 @@ function findCircleThroughTwoPoints(points, q1, q2) {
|
|
|
19783
20128
|
|
|
19784
20129
|
// EXPORTS
|
|
19785
20130
|
__webpack_require__.d(__webpack_exports__, {
|
|
20131
|
+
BinaryTableHDU: () => (/* reexport */ BinaryTableHDU),
|
|
19786
20132
|
FITSHeaderManager: () => (/* reexport */ FITSHeaderManager),
|
|
19787
20133
|
FITSParser: () => (/* reexport */ FITSParser)
|
|
19788
20134
|
});
|
|
19789
20135
|
|
|
19790
|
-
// UNUSED EXPORTS: AsciiTableHDU,
|
|
20136
|
+
// UNUSED EXPORTS: AsciiTableHDU, FITSFile, FITSHDU, FITSHeaderItem, FITSWriter, ImageHDU, ParseHeader, ParsePayload, PrimaryHDU
|
|
19791
20137
|
|
|
19792
20138
|
;// ./node_modules/jsfitsio/lib-esm/model/FITSHeaderItem.js
|
|
19793
20139
|
/**
|