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.js
CHANGED
|
@@ -3638,6 +3638,7 @@ class AstroSphere {
|
|
|
3638
3638
|
pointerDownY = null;
|
|
3639
3639
|
pointerDownAt = 0;
|
|
3640
3640
|
_activeHiPS = null;
|
|
3641
|
+
_activeHiPSLayers = [];
|
|
3641
3642
|
_activeXYZ2 = null;
|
|
3642
3643
|
_activeMeshHiPS = null;
|
|
3643
3644
|
_activeBaseLayer = null;
|
|
@@ -4140,12 +4141,69 @@ class AstroSphere {
|
|
|
4140
4141
|
}
|
|
4141
4142
|
this._activeHiPS.changeFormat(format);
|
|
4142
4143
|
}
|
|
4144
|
+
createHiPS(hipsDescriptor) {
|
|
4145
|
+
return new HiPS_js_1.HiPS(1, [0.0, 0.0, 0.0], 0, 0, hipsDescriptor, this._webgl, this._healpixGrid);
|
|
4146
|
+
}
|
|
4143
4147
|
activateHiPS(hipsDescriptor) {
|
|
4144
|
-
|
|
4145
|
-
|
|
4148
|
+
const tileBuffer = this._healpixGrid.visibleTilesManager.tileBuffer;
|
|
4149
|
+
for (const hips of this._activeHiPSLayers) {
|
|
4150
|
+
tileBuffer.removeHiPS(hips);
|
|
4146
4151
|
}
|
|
4147
|
-
this.
|
|
4152
|
+
this._activeHiPSLayers = [];
|
|
4153
|
+
const hips = this.createHiPS(hipsDescriptor);
|
|
4154
|
+
this._activeHiPSLayers.push(hips);
|
|
4155
|
+
this._activeHiPS = hips;
|
|
4148
4156
|
this._activeBaseLayer = "hips";
|
|
4157
|
+
return hips;
|
|
4158
|
+
}
|
|
4159
|
+
setHiPSOpacity(hips, opacity) {
|
|
4160
|
+
if (!this._activeHiPSLayers.includes(hips)) {
|
|
4161
|
+
throw new Error("HiPS layer is not active in this AstroSphere.");
|
|
4162
|
+
}
|
|
4163
|
+
hips.setOpacity(opacity);
|
|
4164
|
+
}
|
|
4165
|
+
addHiPS(hipsDescriptor) {
|
|
4166
|
+
const normalizeURL = (url) => String(url).replace(/\/+$/, "");
|
|
4167
|
+
const descriptorURL = normalizeURL(hipsDescriptor.url);
|
|
4168
|
+
const existing = this._activeHiPSLayers.find((hips) => normalizeURL(hips.baseURL) === descriptorURL);
|
|
4169
|
+
if (existing) {
|
|
4170
|
+
throw new Error(`HiPS already active: ${String(hipsDescriptor.url)}`);
|
|
4171
|
+
}
|
|
4172
|
+
const hips = this.createHiPS(hipsDescriptor);
|
|
4173
|
+
this._activeHiPSLayers.push(hips);
|
|
4174
|
+
this._activeHiPS = hips;
|
|
4175
|
+
this._activeBaseLayer = "hips";
|
|
4176
|
+
return hips;
|
|
4177
|
+
}
|
|
4178
|
+
removeHiPS(hips) {
|
|
4179
|
+
const index = this._activeHiPSLayers.indexOf(hips);
|
|
4180
|
+
if (index === -1) {
|
|
4181
|
+
return;
|
|
4182
|
+
}
|
|
4183
|
+
this._healpixGrid.visibleTilesManager.tileBuffer.removeHiPS(hips);
|
|
4184
|
+
this._activeHiPSLayers.splice(index, 1);
|
|
4185
|
+
if (this._activeHiPSLayers.length === 0) {
|
|
4186
|
+
this._activeHiPS = null;
|
|
4187
|
+
if (this._activeBaseLayer === "hips") {
|
|
4188
|
+
this._activeBaseLayer = null;
|
|
4189
|
+
}
|
|
4190
|
+
return;
|
|
4191
|
+
}
|
|
4192
|
+
if (this._activeHiPS === hips) {
|
|
4193
|
+
this._activeHiPS =
|
|
4194
|
+
this._activeHiPSLayers[this._activeHiPSLayers.length - 1];
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
removeAllHiPS() {
|
|
4198
|
+
const tileBuffer = this._healpixGrid.visibleTilesManager.tileBuffer;
|
|
4199
|
+
for (const hips of this._activeHiPSLayers) {
|
|
4200
|
+
tileBuffer.removeHiPS(hips);
|
|
4201
|
+
}
|
|
4202
|
+
this._activeHiPSLayers = [];
|
|
4203
|
+
this._activeHiPS = null;
|
|
4204
|
+
if (this._activeBaseLayer === "hips") {
|
|
4205
|
+
this._activeBaseLayer = null;
|
|
4206
|
+
}
|
|
4149
4207
|
}
|
|
4150
4208
|
activateXYZ(config) {
|
|
4151
4209
|
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));
|
|
@@ -4378,6 +4436,16 @@ class AstroSphere {
|
|
|
4378
4436
|
get activeHiPS() {
|
|
4379
4437
|
return this._activeHiPS;
|
|
4380
4438
|
}
|
|
4439
|
+
get activeHiPSLayers() {
|
|
4440
|
+
return this._activeHiPSLayers;
|
|
4441
|
+
}
|
|
4442
|
+
setActiveHiPS(hips) {
|
|
4443
|
+
if (!this._activeHiPSLayers.includes(hips)) {
|
|
4444
|
+
throw new Error("HiPS layer is not active in this AstroSphere.");
|
|
4445
|
+
}
|
|
4446
|
+
this._activeHiPS = hips;
|
|
4447
|
+
this._activeBaseLayer = "hips";
|
|
4448
|
+
}
|
|
4381
4449
|
get activeXYZ() {
|
|
4382
4450
|
return this._activeXYZ2;
|
|
4383
4451
|
}
|
|
@@ -4537,8 +4605,9 @@ class AstroSphere {
|
|
|
4537
4605
|
this._webgl.enable(this._webgl.CULL_FACE);
|
|
4538
4606
|
this._webgl.cullFace(Global_js_1.default.insideSphere ? this._webgl.FRONT : this._webgl.BACK);
|
|
4539
4607
|
this._webgl.blendFunc(this._webgl.SRC_ALPHA, this._webgl.ONE_MINUS_SRC_ALPHA);
|
|
4540
|
-
if (this._activeBaseLayer === "hips" && this.
|
|
4541
|
-
const
|
|
4608
|
+
if (this._activeBaseLayer === "hips" && this._activeHiPSLayers.length > 0) {
|
|
4609
|
+
const maxHiPSOrder = Math.max(...this._activeHiPSLayers.map((hips) => hips.maxOrder));
|
|
4610
|
+
const visibleOrder = Math.min(this._healpixGrid.visibleorder, maxHiPSOrder);
|
|
4542
4611
|
this._healpixGrid.visibleTilesManager.computeVisiblePixels(visibleOrder, this._webgl, this._camera, this._perspectiveMatrixManager.pMatrix);
|
|
4543
4612
|
}
|
|
4544
4613
|
if (this._activeBaseLayer === "meships" && this._activeMeshHiPS) {
|
|
@@ -4563,6 +4632,11 @@ class AstroSphere {
|
|
|
4563
4632
|
cameraMoving: cameraMovingForGrid,
|
|
4564
4633
|
};
|
|
4565
4634
|
if (this._activeBaseLayer === "hips") {
|
|
4635
|
+
for (const hips of this._activeHiPSLayers) {
|
|
4636
|
+
if (hips !== this._activeHiPS) {
|
|
4637
|
+
hips.draw(skyEntityDrawInput);
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4566
4640
|
this._activeHiPS?.draw(skyEntityDrawInput);
|
|
4567
4641
|
}
|
|
4568
4642
|
if (this._activeBaseLayer === "xyz") {
|
|
@@ -4898,15 +4972,41 @@ class AstroViewer {
|
|
|
4898
4972
|
this.astroSphere.activateMeshHiPS(desc);
|
|
4899
4973
|
return desc.name;
|
|
4900
4974
|
}
|
|
4901
|
-
|
|
4975
|
+
setActiveHiPS(hips) {
|
|
4976
|
+
this.astroSphere.setActiveHiPS(hips);
|
|
4977
|
+
}
|
|
4978
|
+
setHiPSOpacity(hips, opacity) {
|
|
4979
|
+
this.astroSphere.setHiPSOpacity(hips, opacity);
|
|
4980
|
+
}
|
|
4902
4981
|
changeColorMap(colorMapName) {
|
|
4903
4982
|
const colorMap = ColorMaps_js_1.default[colorMapName];
|
|
4904
|
-
// hips.changeColorMap(colorMap)
|
|
4905
4983
|
this.astroSphere.changeColorMap(colorMap);
|
|
4906
4984
|
}
|
|
4907
4985
|
changeCustomColorMap(colorMap) {
|
|
4908
4986
|
this.astroSphere.changeColorMap(colorMap);
|
|
4909
4987
|
}
|
|
4988
|
+
addHiPS(hipsDescriptor) {
|
|
4989
|
+
return this.astroSphere.addHiPS(hipsDescriptor);
|
|
4990
|
+
}
|
|
4991
|
+
async addHiPSFromUrl(baseUrl) {
|
|
4992
|
+
const hipsUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
|
|
4993
|
+
const resp = await fetch(hipsUrl + "properties");
|
|
4994
|
+
if (!resp.ok) {
|
|
4995
|
+
throw new Error(`HTTP ${resp.status} fetching properties`);
|
|
4996
|
+
}
|
|
4997
|
+
const propsText = await resp.text();
|
|
4998
|
+
const desc = new HiPSDescriptor_js_1.HiPSDescriptor(propsText, hipsUrl);
|
|
4999
|
+
return this.astroSphere.addHiPS(desc);
|
|
5000
|
+
}
|
|
5001
|
+
removeHiPS(hips) {
|
|
5002
|
+
this.astroSphere.removeHiPS(hips);
|
|
5003
|
+
}
|
|
5004
|
+
removeAllHiPS() {
|
|
5005
|
+
this.astroSphere.removeAllHiPS();
|
|
5006
|
+
}
|
|
5007
|
+
getActiveHiPSLayers() {
|
|
5008
|
+
return this.astroSphere.activeHiPSLayers;
|
|
5009
|
+
}
|
|
4910
5010
|
getActiveHiPS() {
|
|
4911
5011
|
return this.astroSphere.activeHiPS;
|
|
4912
5012
|
}
|
|
@@ -11957,7 +12057,7 @@ class AllSky {
|
|
|
11957
12057
|
_baseurl;
|
|
11958
12058
|
_isGalacticHips;
|
|
11959
12059
|
_order = 3;
|
|
11960
|
-
opacity = 1.0;
|
|
12060
|
+
// public opacity = 1.0;
|
|
11961
12061
|
_hipsShaderIndex = 0;
|
|
11962
12062
|
_texture = null;
|
|
11963
12063
|
_image;
|
|
@@ -12198,9 +12298,10 @@ class AllSky {
|
|
|
12198
12298
|
gl.activeTexture(gl.TEXTURE0 + this._hipsShaderIndex);
|
|
12199
12299
|
gl.bindTexture(gl.TEXTURE_2D, this._texture);
|
|
12200
12300
|
const factorLocation = this._hipsShaderProgram.locations.textureAlpha[this._hipsShaderIndex];
|
|
12201
|
-
if (factorLocation) {
|
|
12202
|
-
gl.uniform1f(factorLocation,
|
|
12301
|
+
if (factorLocation !== null) {
|
|
12302
|
+
gl.uniform1f(factorLocation, 1.0);
|
|
12203
12303
|
}
|
|
12304
|
+
this._hipsShaderProgram.setLayerOpacity(this._hips.opacity);
|
|
12204
12305
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexPositionBuffer);
|
|
12205
12306
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.vertexIndexBuffer);
|
|
12206
12307
|
gl.vertexAttribPointer(
|
|
@@ -12228,13 +12329,13 @@ class AllSky {
|
|
|
12228
12329
|
const allSkyTiles2Skip = [];
|
|
12229
12330
|
for (let i = 0; i < visibleTiles.length; i++) {
|
|
12230
12331
|
const tileno = visibleTiles[i];
|
|
12332
|
+
if (!this._hips.intersectsCoverage(childrenOrder, tileno)) {
|
|
12333
|
+
allSkyTiles2Skip.push(tileno);
|
|
12334
|
+
continue;
|
|
12335
|
+
}
|
|
12231
12336
|
const childTile = this._isGalacticHips
|
|
12232
12337
|
? this._tileBuffer.getGalTile(tileno, childrenOrder, this._hips)
|
|
12233
12338
|
: this._tileBuffer.getTile(tileno, childrenOrder, this._hips);
|
|
12234
|
-
// const childTile = this._isGalacticHips
|
|
12235
|
-
// ? newTileBuffer.getGalTile(tileno, childrenOrder, this._hips)
|
|
12236
|
-
// : newTileBuffer.getTile(tileno, childrenOrder, this._hips)
|
|
12237
|
-
// childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx)
|
|
12238
12339
|
childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx, this._hipsShaderProgram);
|
|
12239
12340
|
if (childTile.getReadyState()) {
|
|
12240
12341
|
allSkyTiles2Skip.push(tileno);
|
|
@@ -12535,16 +12636,21 @@ class AncestorTile {
|
|
|
12535
12636
|
return;
|
|
12536
12637
|
for (let c = 0; c < 4; c++) {
|
|
12537
12638
|
const childTileNo = (this._tileno << 2) + c;
|
|
12639
|
+
if (!this._hips.intersectsCoverage(childrenOrder, childTileNo)) {
|
|
12640
|
+
continue;
|
|
12641
|
+
}
|
|
12538
12642
|
const visibleChildren = visibleTilesMap.get(childrenOrder);
|
|
12539
12643
|
if (visibleChildren.includes(childTileNo)) {
|
|
12644
|
+
if (!this._hips.intersectsCoverage(childrenOrder, childTileNo)) {
|
|
12645
|
+
quadrantsToDraw.delete(c);
|
|
12646
|
+
continue;
|
|
12647
|
+
}
|
|
12540
12648
|
const childTile = this._isGalacticHips
|
|
12541
12649
|
? this._tileBuffer.getGalTile(childTileNo, childrenOrder, this._hips)
|
|
12542
12650
|
: this._tileBuffer.getTile(childTileNo, childrenOrder, this._hips);
|
|
12543
|
-
// childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx)
|
|
12544
12651
|
childTile.draw(visibleOrder, visibleTilesMap, pMatrix, vMatrix, mMatrix, colorMapIdx, this._hipsShaderProgram);
|
|
12545
12652
|
if (childTile.getReadyState()) {
|
|
12546
12653
|
quadrantsToDraw.delete(c);
|
|
12547
|
-
// quadrantsToDraw.delete((childTile as any)._tileno - (this._tileno << 2))
|
|
12548
12654
|
}
|
|
12549
12655
|
}
|
|
12550
12656
|
}
|
|
@@ -12824,10 +12930,14 @@ const FoVHelper_js_1 = __webpack_require__(229);
|
|
|
12824
12930
|
const ColorMaps_js_1 = __importDefault(__webpack_require__(619));
|
|
12825
12931
|
const AncestorTile_js_1 = __importDefault(__webpack_require__(2885));
|
|
12826
12932
|
const AllSky_js_1 = __importDefault(__webpack_require__(2368));
|
|
12933
|
+
const HiPSCoverage_js_1 = __webpack_require__(9912);
|
|
12827
12934
|
class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
12828
12935
|
_ancestorTiles;
|
|
12829
12936
|
_allSkyTile;
|
|
12830
12937
|
_descriptor;
|
|
12938
|
+
_coverage;
|
|
12939
|
+
_coverageResolved = false;
|
|
12940
|
+
_opacity = 1.0;
|
|
12831
12941
|
_format;
|
|
12832
12942
|
_baseurl;
|
|
12833
12943
|
_maxorder;
|
|
@@ -12866,6 +12976,17 @@ class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
12866
12976
|
this._baseurl = descriptor.url;
|
|
12867
12977
|
this._maxorder = descriptor.maxOrder;
|
|
12868
12978
|
this._minorder = descriptor.minOrder;
|
|
12979
|
+
this._coverage = new HiPSCoverage_js_1.HiPSCoverage();
|
|
12980
|
+
void this._coverage
|
|
12981
|
+
.load(this._baseurl)
|
|
12982
|
+
.then(() => {
|
|
12983
|
+
this._coverageResolved = true;
|
|
12984
|
+
})
|
|
12985
|
+
.catch((error) => {
|
|
12986
|
+
console.warn(`[HiPS] Coverage unavailable for ${this._baseurl}; continuing without MOC filtering.`, error);
|
|
12987
|
+
this._coverage.clear();
|
|
12988
|
+
this._coverageResolved = true;
|
|
12989
|
+
});
|
|
12869
12990
|
if (this.isGalacticHips) {
|
|
12870
12991
|
this._healpixGrid.visibleTilesManager.tileBuffer.addGalHiPS(this);
|
|
12871
12992
|
}
|
|
@@ -12888,6 +13009,31 @@ class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
12888
13009
|
this._allSky = true;
|
|
12889
13010
|
this.initBaseTiles();
|
|
12890
13011
|
}
|
|
13012
|
+
setOpacity(opacity) {
|
|
13013
|
+
if (!Number.isFinite(opacity)) {
|
|
13014
|
+
throw new Error(`Invalid HiPS opacity: ${opacity}`);
|
|
13015
|
+
}
|
|
13016
|
+
this._opacity = Math.min(1, Math.max(0, opacity));
|
|
13017
|
+
}
|
|
13018
|
+
get opacity() {
|
|
13019
|
+
return this._opacity;
|
|
13020
|
+
}
|
|
13021
|
+
intersectsCoverage(order, pixel) {
|
|
13022
|
+
/*
|
|
13023
|
+
* While Moc.fits is being resolved, do not start tile requests.
|
|
13024
|
+
*
|
|
13025
|
+
* Once loading has completed:
|
|
13026
|
+
* - valid MOC -> filter using coverage
|
|
13027
|
+
* - unavailable MOC -> HiPSCoverage is cleared and normal loading resumes
|
|
13028
|
+
*/
|
|
13029
|
+
if (!this._coverageResolved) {
|
|
13030
|
+
return false;
|
|
13031
|
+
}
|
|
13032
|
+
return this._coverage.intersectsTile(order, pixel);
|
|
13033
|
+
}
|
|
13034
|
+
get coverageLoaded() {
|
|
13035
|
+
return this._coverage.loaded;
|
|
13036
|
+
}
|
|
12891
13037
|
initBaseTiles() {
|
|
12892
13038
|
this._ancestorTiles = [];
|
|
12893
13039
|
this._allSkyTile = null;
|
|
@@ -13099,6 +13245,184 @@ class HiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
13099
13245
|
exports.HiPS = HiPS;
|
|
13100
13246
|
|
|
13101
13247
|
|
|
13248
|
+
/***/ },
|
|
13249
|
+
|
|
13250
|
+
/***/ 9912
|
|
13251
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
13252
|
+
|
|
13253
|
+
"use strict";
|
|
13254
|
+
var __webpack_unused_export__;
|
|
13255
|
+
|
|
13256
|
+
/*
|
|
13257
|
+
* AstroViewer
|
|
13258
|
+
* Copyright (C) Fabrizio Giordano
|
|
13259
|
+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-AstroViewer-Commercial
|
|
13260
|
+
*
|
|
13261
|
+
* AstroViewer is dual-licensed under the GNU Affero General Public License
|
|
13262
|
+
* version 3 and a separate commercial license.
|
|
13263
|
+
*
|
|
13264
|
+
* See LICENSE.md, LICENSE-AGPL.md, and LICENSE-COMMERCIAL.md for details.
|
|
13265
|
+
*/
|
|
13266
|
+
__webpack_unused_export__ = ({ value: true });
|
|
13267
|
+
exports.HiPSCoverage = void 0;
|
|
13268
|
+
const jsfitsio_1 = __webpack_require__(1677);
|
|
13269
|
+
class HiPSCoverage {
|
|
13270
|
+
intersec(intersec, arg1) {
|
|
13271
|
+
throw new Error("Method not implemented.");
|
|
13272
|
+
}
|
|
13273
|
+
ises(ises, expents, of, arg3) {
|
|
13274
|
+
throw new Error("Method not implemented.");
|
|
13275
|
+
}
|
|
13276
|
+
intersexpect(co, t, expe, arg3) {
|
|
13277
|
+
throw new Error("Method not implemented.");
|
|
13278
|
+
}
|
|
13279
|
+
intersectsT19(intersectsT19, arg1) {
|
|
13280
|
+
throw new Error("Method not implemented.");
|
|
13281
|
+
}
|
|
13282
|
+
_maxOrder = 0;
|
|
13283
|
+
_intervals = [];
|
|
13284
|
+
_loaded = false;
|
|
13285
|
+
get loaded() {
|
|
13286
|
+
return this._loaded;
|
|
13287
|
+
}
|
|
13288
|
+
get maxOrder() {
|
|
13289
|
+
return this._maxOrder;
|
|
13290
|
+
}
|
|
13291
|
+
get intervalCount() {
|
|
13292
|
+
return this._intervals.length;
|
|
13293
|
+
}
|
|
13294
|
+
clear() {
|
|
13295
|
+
this._maxOrder = 0;
|
|
13296
|
+
this._intervals = [];
|
|
13297
|
+
this._loaded = false;
|
|
13298
|
+
}
|
|
13299
|
+
async load(baseUrl) {
|
|
13300
|
+
const baseUrlString = baseUrl instanceof URL ? baseUrl.href : String(baseUrl);
|
|
13301
|
+
const normalizedBaseUrl = baseUrlString.endsWith("/")
|
|
13302
|
+
? baseUrlString
|
|
13303
|
+
: `${baseUrlString}/`;
|
|
13304
|
+
await this.loadMoc(`${normalizedBaseUrl}Moc.fits`);
|
|
13305
|
+
}
|
|
13306
|
+
async loadMoc(mocUrl) {
|
|
13307
|
+
this.clear();
|
|
13308
|
+
const fits = await jsfitsio_1.FITSParser.loadFITSFile(mocUrl);
|
|
13309
|
+
if (!fits) {
|
|
13310
|
+
throw new Error("Unable to load HiPS Moc.fits");
|
|
13311
|
+
}
|
|
13312
|
+
const mocHDU = fits.hdus.find((hdu) => hdu instanceof jsfitsio_1.BinaryTableHDU);
|
|
13313
|
+
if (!(mocHDU instanceof jsfitsio_1.BinaryTableHDU)) {
|
|
13314
|
+
throw new Error("HiPS Moc.fits does not contain a BINTABLE HDU.");
|
|
13315
|
+
}
|
|
13316
|
+
const mocOrderItem = mocHDU.header.findById("MOCORDER");
|
|
13317
|
+
if (!mocOrderItem) {
|
|
13318
|
+
throw new Error("HiPS Moc.fits does not define MOCORDER.");
|
|
13319
|
+
}
|
|
13320
|
+
const maxOrder = Number(mocOrderItem.value);
|
|
13321
|
+
if (!Number.isInteger(maxOrder) || maxOrder < 0) {
|
|
13322
|
+
throw new Error(`Invalid MOCORDER value: ${mocOrderItem.value}`);
|
|
13323
|
+
}
|
|
13324
|
+
this._maxOrder = maxOrder;
|
|
13325
|
+
const intervals = [];
|
|
13326
|
+
for (let row = 0; row < mocHDU.rowCount; row++) {
|
|
13327
|
+
const rawUniq = mocHDU.getCell(row, "UNIQ");
|
|
13328
|
+
if (typeof rawUniq !== "number" ||
|
|
13329
|
+
!Number.isInteger(rawUniq) ||
|
|
13330
|
+
rawUniq < 4) {
|
|
13331
|
+
throw new Error(`Invalid MOC UNIQ value at row ${row}: ${String(rawUniq)}`);
|
|
13332
|
+
}
|
|
13333
|
+
const { order, pixel } = HiPSCoverage.decodeUniq(rawUniq);
|
|
13334
|
+
if (order > this._maxOrder) {
|
|
13335
|
+
throw new Error(`MOC cell order ${order} exceeds MOCORDER ${this._maxOrder}.`);
|
|
13336
|
+
}
|
|
13337
|
+
const scale = 4 ** (this._maxOrder - order);
|
|
13338
|
+
intervals.push({
|
|
13339
|
+
first: pixel * scale,
|
|
13340
|
+
last: (pixel + 1) * scale - 1,
|
|
13341
|
+
});
|
|
13342
|
+
}
|
|
13343
|
+
this._intervals = HiPSCoverage.mergeIntervals(intervals);
|
|
13344
|
+
this._loaded = true;
|
|
13345
|
+
}
|
|
13346
|
+
intersectsTile(order, pixel) {
|
|
13347
|
+
if (!this._loaded) {
|
|
13348
|
+
return true;
|
|
13349
|
+
}
|
|
13350
|
+
if (!Number.isInteger(order) ||
|
|
13351
|
+
order < 0 ||
|
|
13352
|
+
!Number.isInteger(pixel) ||
|
|
13353
|
+
pixel < 0) {
|
|
13354
|
+
return false;
|
|
13355
|
+
}
|
|
13356
|
+
let first;
|
|
13357
|
+
let last;
|
|
13358
|
+
if (order <= this._maxOrder) {
|
|
13359
|
+
const scale = 4 ** (this._maxOrder - order);
|
|
13360
|
+
first = pixel * scale;
|
|
13361
|
+
last = (pixel + 1) * scale - 1;
|
|
13362
|
+
}
|
|
13363
|
+
else {
|
|
13364
|
+
/*
|
|
13365
|
+
* At orders finer than the MOC resolution, reduce the tile
|
|
13366
|
+
* to its ancestor at MOCORDER.
|
|
13367
|
+
*/
|
|
13368
|
+
const shift = 2 * (order - this._maxOrder);
|
|
13369
|
+
const ancestor = Math.floor(pixel / 2 ** shift);
|
|
13370
|
+
first = ancestor;
|
|
13371
|
+
last = ancestor;
|
|
13372
|
+
}
|
|
13373
|
+
return this.intersectsInterval(first, last);
|
|
13374
|
+
}
|
|
13375
|
+
intersectsInterval(first, last) {
|
|
13376
|
+
let low = 0;
|
|
13377
|
+
let high = this._intervals.length - 1;
|
|
13378
|
+
while (low <= high) {
|
|
13379
|
+
const middle = Math.floor((low + high) / 2);
|
|
13380
|
+
const interval = this._intervals[middle];
|
|
13381
|
+
if (interval.last < first) {
|
|
13382
|
+
low = middle + 1;
|
|
13383
|
+
continue;
|
|
13384
|
+
}
|
|
13385
|
+
if (interval.first > last) {
|
|
13386
|
+
high = middle - 1;
|
|
13387
|
+
continue;
|
|
13388
|
+
}
|
|
13389
|
+
return true;
|
|
13390
|
+
}
|
|
13391
|
+
return false;
|
|
13392
|
+
}
|
|
13393
|
+
static decodeUniq(uniq) {
|
|
13394
|
+
let order = 0;
|
|
13395
|
+
while (4 ** (order + 2) <= uniq) {
|
|
13396
|
+
order++;
|
|
13397
|
+
}
|
|
13398
|
+
const base = 4 ** (order + 1);
|
|
13399
|
+
return {
|
|
13400
|
+
order,
|
|
13401
|
+
pixel: uniq - base,
|
|
13402
|
+
};
|
|
13403
|
+
}
|
|
13404
|
+
static mergeIntervals(intervals) {
|
|
13405
|
+
if (intervals.length === 0) {
|
|
13406
|
+
return [];
|
|
13407
|
+
}
|
|
13408
|
+
intervals.sort((a, b) => a.first - b.first);
|
|
13409
|
+
const merged = [{ ...intervals[0] }];
|
|
13410
|
+
for (let i = 1; i < intervals.length; i++) {
|
|
13411
|
+
const current = intervals[i];
|
|
13412
|
+
const previous = merged[merged.length - 1];
|
|
13413
|
+
if (current.first <= previous.last + 1) {
|
|
13414
|
+
previous.last = Math.max(previous.last, current.last);
|
|
13415
|
+
}
|
|
13416
|
+
else {
|
|
13417
|
+
merged.push({ ...current });
|
|
13418
|
+
}
|
|
13419
|
+
}
|
|
13420
|
+
return merged;
|
|
13421
|
+
}
|
|
13422
|
+
}
|
|
13423
|
+
exports.HiPSCoverage = HiPSCoverage;
|
|
13424
|
+
|
|
13425
|
+
|
|
13102
13426
|
/***/ },
|
|
13103
13427
|
|
|
13104
13428
|
/***/ 5087
|
|
@@ -13302,7 +13626,7 @@ class Tile {
|
|
|
13302
13626
|
vertexIndices = new Uint16Array();
|
|
13303
13627
|
vertexIndexBuffer;
|
|
13304
13628
|
_tileBuffer;
|
|
13305
|
-
opacity = 1.0;
|
|
13629
|
+
// public opacity = 1.0;
|
|
13306
13630
|
_webgl;
|
|
13307
13631
|
_visibleTileManager;
|
|
13308
13632
|
// private _hipsShaderProgram
|
|
@@ -13648,8 +13972,9 @@ class Tile {
|
|
|
13648
13972
|
gl.bindTexture(gl.TEXTURE_2D, this._texture);
|
|
13649
13973
|
const factorLocation = locations.textureAlpha[this._hipsShaderIndex];
|
|
13650
13974
|
if (factorLocation) {
|
|
13651
|
-
gl.uniform1f(factorLocation,
|
|
13975
|
+
gl.uniform1f(factorLocation, 1.0);
|
|
13652
13976
|
}
|
|
13977
|
+
hipsShaderProgram.setLayerOpacity(this._hips.opacity);
|
|
13653
13978
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.vertexIndexBuffer);
|
|
13654
13979
|
const elemno = this.vertexIndices.length;
|
|
13655
13980
|
const indexType = this.vertexIndices instanceof Uint32Array
|
|
@@ -13673,6 +13998,9 @@ class Tile {
|
|
|
13673
13998
|
const childTileNo = (this._tileno << 2) + c;
|
|
13674
13999
|
const list = visibleTilesMap.get(childrenOrder);
|
|
13675
14000
|
if (list.includes(childTileNo)) {
|
|
14001
|
+
if (!this._hips.intersectsCoverage(childrenOrder, childTileNo)) {
|
|
14002
|
+
continue;
|
|
14003
|
+
}
|
|
13676
14004
|
const childTile = this._isGalacticHips
|
|
13677
14005
|
? this._tileBuffer.getGalTile(childTileNo, childrenOrder, this._hips)
|
|
13678
14006
|
: this._tileBuffer.getTile(childTileNo, childrenOrder, this._hips);
|
|
@@ -13764,6 +14092,9 @@ class TileBuffer {
|
|
|
13764
14092
|
if (order > hips.maxOrder) {
|
|
13765
14093
|
continue;
|
|
13766
14094
|
}
|
|
14095
|
+
if (!hips.intersectsCoverage(order, tileno)) {
|
|
14096
|
+
continue;
|
|
14097
|
+
}
|
|
13767
14098
|
this.getTile(tileno, order, hips);
|
|
13768
14099
|
}
|
|
13769
14100
|
}
|
|
@@ -13773,6 +14104,9 @@ class TileBuffer {
|
|
|
13773
14104
|
if (order > hips.maxOrder) {
|
|
13774
14105
|
continue;
|
|
13775
14106
|
}
|
|
14107
|
+
if (!hips.intersectsCoverage(order, tileno)) {
|
|
14108
|
+
continue;
|
|
14109
|
+
}
|
|
13776
14110
|
this.getGalTile(tileno, order, hips);
|
|
13777
14111
|
}
|
|
13778
14112
|
}
|
|
@@ -16503,6 +16837,7 @@ class HiPSShaderProgram {
|
|
|
16503
16837
|
textureMode: new Array(8).fill(null),
|
|
16504
16838
|
dataMin: new Array(8).fill(null),
|
|
16505
16839
|
dataMax: new Array(8).fill(null),
|
|
16840
|
+
layerOpacity: null,
|
|
16506
16841
|
clorMapIdx: null,
|
|
16507
16842
|
vertexPositionAttribute: -1,
|
|
16508
16843
|
textureCoordAttribute: -1,
|
|
@@ -16518,6 +16853,13 @@ class HiPSShaderProgram {
|
|
|
16518
16853
|
gl.useProgram(this._shaderProgram);
|
|
16519
16854
|
return this._shaderProgram;
|
|
16520
16855
|
}
|
|
16856
|
+
setLayerOpacity(opacity) {
|
|
16857
|
+
const gl = this._webgl;
|
|
16858
|
+
this.locations.layerOpacity = gl.getUniformLocation(this.shaderProgram, "uLayerOpacity");
|
|
16859
|
+
if (this.locations.layerOpacity !== null) {
|
|
16860
|
+
gl.uniform1f(this.locations.layerOpacity, opacity);
|
|
16861
|
+
}
|
|
16862
|
+
}
|
|
16521
16863
|
setRuntimeColorMap(colorMap) {
|
|
16522
16864
|
this._runtimeColorMap = colorMap;
|
|
16523
16865
|
}
|
|
@@ -17054,6 +17396,7 @@ class ShaderManager {
|
|
|
17054
17396
|
|
|
17055
17397
|
in vec2 vTextureCoord;
|
|
17056
17398
|
|
|
17399
|
+
uniform float uLayerOpacity;
|
|
17057
17400
|
uniform float uFactor0;
|
|
17058
17401
|
uniform float uFactor1;
|
|
17059
17402
|
uniform float uFactor2;
|
|
@@ -17110,7 +17453,7 @@ class ShaderManager {
|
|
|
17110
17453
|
sampleHiPSTexture7(vTextureCoord).rgb * uFactor7;
|
|
17111
17454
|
}
|
|
17112
17455
|
|
|
17113
|
-
fragColor = vec4(finalColor,
|
|
17456
|
+
fragColor = vec4(finalColor, uLayerOpacity);
|
|
17114
17457
|
}`;
|
|
17115
17458
|
}
|
|
17116
17459
|
static hipsGrayscaleFS() {
|
|
@@ -17119,6 +17462,7 @@ class ShaderManager {
|
|
|
17119
17462
|
|
|
17120
17463
|
in vec2 vTextureCoord;
|
|
17121
17464
|
|
|
17465
|
+
uniform float uLayerOpacity;
|
|
17122
17466
|
uniform float uFactor0;
|
|
17123
17467
|
uniform float uFactor1;
|
|
17124
17468
|
uniform float uFactor2;
|
|
@@ -17183,13 +17527,15 @@ class ShaderManager {
|
|
|
17183
17527
|
finalColor += color7.rgb * uFactor7;
|
|
17184
17528
|
}
|
|
17185
17529
|
|
|
17186
|
-
fragColor = vec4(finalColor,
|
|
17530
|
+
fragColor = vec4(finalColor, uLayerOpacity);
|
|
17187
17531
|
}`;
|
|
17188
17532
|
}
|
|
17189
17533
|
static hipsColorMapFS() {
|
|
17190
17534
|
return `#version 300 es
|
|
17191
17535
|
precision mediump float;
|
|
17192
17536
|
|
|
17537
|
+
uniform float uLayerOpacity;
|
|
17538
|
+
|
|
17193
17539
|
in vec2 vTextureCoord;
|
|
17194
17540
|
|
|
17195
17541
|
layout (std140) uniform colormap {
|
|
@@ -17282,7 +17628,7 @@ class ShaderManager {
|
|
|
17282
17628
|
) * uFactor7;
|
|
17283
17629
|
}
|
|
17284
17630
|
|
|
17285
|
-
fragColor = vec4(finalColor,
|
|
17631
|
+
fragColor = vec4(finalColor, uLayerOpacity);
|
|
17286
17632
|
}`;
|
|
17287
17633
|
}
|
|
17288
17634
|
static hipsSamplerGLSL(index) {
|
|
@@ -19822,11 +20168,12 @@ function findCircleThroughTwoPoints(points, q1, q2) {
|
|
|
19822
20168
|
|
|
19823
20169
|
// EXPORTS
|
|
19824
20170
|
__webpack_require__.d(__webpack_exports__, {
|
|
20171
|
+
BinaryTableHDU: () => (/* reexport */ BinaryTableHDU),
|
|
19825
20172
|
FITSHeaderManager: () => (/* reexport */ FITSHeaderManager),
|
|
19826
20173
|
FITSParser: () => (/* reexport */ FITSParser)
|
|
19827
20174
|
});
|
|
19828
20175
|
|
|
19829
|
-
// UNUSED EXPORTS: AsciiTableHDU,
|
|
20176
|
+
// UNUSED EXPORTS: AsciiTableHDU, FITSFile, FITSHDU, FITSHeaderItem, FITSWriter, ImageHDU, ParseHeader, ParsePayload, PrimaryHDU
|
|
19830
20177
|
|
|
19831
20178
|
;// ./node_modules/jsfitsio/lib-esm/model/FITSHeaderItem.js
|
|
19832
20179
|
/**
|