astro-viewer 3.9.0 → 3.10.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 +183 -112
- package/dist/astroviewer.cjs.map +1 -1
- package/dist/astroviewer.js +183 -112
- 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/AstroViewer.d.ts.map +1 -1
- package/lib-esm/AstroViewer.js +3 -3
- package/lib-esm/AstroViewer.js.map +1 -1
- package/lib-esm/Global.d.ts +3 -3
- package/lib-esm/Global.d.ts.map +1 -1
- package/lib-esm/Global.js +38 -16
- package/lib-esm/Global.js.map +1 -1
- package/lib-esm/model/Source.d.ts.map +1 -1
- package/lib-esm/model/Source.js +2 -1
- package/lib-esm/model/Source.js.map +1 -1
- package/lib-esm/model/catalogues/CatalogueGL.d.ts +8 -7
- package/lib-esm/model/catalogues/CatalogueGL.d.ts.map +1 -1
- package/lib-esm/model/catalogues/CatalogueGL.js +63 -86
- package/lib-esm/model/catalogues/CatalogueGL.js.map +1 -1
- package/lib-esm/model/footprints/FootprintSetGL.d.ts +1 -3
- package/lib-esm/model/footprints/FootprintSetGL.d.ts.map +1 -1
- package/lib-esm/model/footprints/FootprintSetGL.js +1 -3
- package/lib-esm/model/footprints/FootprintSetGL.js.map +1 -1
- package/lib-esm/model/hips/VisibleTilesManager.d.ts +6 -3
- package/lib-esm/model/hips/VisibleTilesManager.d.ts.map +1 -1
- package/lib-esm/model/hips/VisibleTilesManager.js.map +1 -1
- package/lib-esm/model/meships/MeshHiPS.d.ts +4 -4
- package/lib-esm/model/meships/MeshHiPS.d.ts.map +1 -1
- package/lib-esm/model/meships/MeshHiPS.js +28 -12
- package/lib-esm/model/meships/MeshHiPS.js.map +1 -1
- package/lib-esm/model/terra/TerraFootprintSetGL.d.ts +2 -0
- package/lib-esm/model/terra/TerraFootprintSetGL.d.ts.map +1 -1
- package/lib-esm/model/terra/TerraFootprintSetGL.js +19 -0
- package/lib-esm/model/terra/TerraFootprintSetGL.js.map +1 -1
- package/lib-esm/model/terra/TerraPointSetGL.d.ts +4 -0
- package/lib-esm/model/terra/TerraPointSetGL.d.ts.map +1 -1
- package/lib-esm/model/terra/TerraPointSetGL.js +36 -0
- package/lib-esm/model/terra/TerraPointSetGL.js.map +1 -1
- package/lib-esm/model/terra/TerraPolylineSetGL.d.ts +1 -3
- package/lib-esm/model/terra/TerraPolylineSetGL.d.ts.map +1 -1
- package/lib-esm/model/terra/TerraPolylineSetGL.js +1 -3
- package/lib-esm/model/terra/TerraPolylineSetGL.js.map +1 -1
- package/lib-esm/utils/MouseHelper.d.ts.map +1 -1
- package/lib-esm/utils/MouseHelper.js +2 -1
- package/lib-esm/utils/MouseHelper.js.map +1 -1
- package/package.json +1 -1
package/dist/astroviewer.js
CHANGED
|
@@ -4838,7 +4838,7 @@ class AstroViewer {
|
|
|
4838
4838
|
}
|
|
4839
4839
|
//FOOTPRINT
|
|
4840
4840
|
createFootprintSet(footprintSetName, footprintSetDescription, providerUrl, metadataManager) {
|
|
4841
|
-
return new FootprintSetGL_js_1.FootprintSetGL(footprintSetName, footprintSetDescription, providerUrl, metadataManager, this.webgl
|
|
4841
|
+
return new FootprintSetGL_js_1.FootprintSetGL(footprintSetName, footprintSetDescription, providerUrl, metadataManager, this.webgl);
|
|
4842
4842
|
}
|
|
4843
4843
|
showFootprintSet(footprintSet) {
|
|
4844
4844
|
this.astroSphere.showFootprintSet(footprintSet);
|
|
@@ -4863,7 +4863,7 @@ class AstroViewer {
|
|
|
4863
4863
|
this.astroSphere.deleteCatalogue(pointSet);
|
|
4864
4864
|
}
|
|
4865
4865
|
createTerraFootprintSet(footprintSetName, footprintSetDescription, providerUrl, metadataManager) {
|
|
4866
|
-
return new TerraFootprintSetGL_js_1.TerraFootprintSetGL(footprintSetName, footprintSetDescription, providerUrl, metadataManager, this.webgl
|
|
4866
|
+
return new TerraFootprintSetGL_js_1.TerraFootprintSetGL(footprintSetName, footprintSetDescription, providerUrl, metadataManager, this.webgl);
|
|
4867
4867
|
}
|
|
4868
4868
|
showTerraFootprintSet(footprintSet) {
|
|
4869
4869
|
this.astroSphere.showFootprintSet(footprintSet);
|
|
@@ -4875,7 +4875,7 @@ class AstroViewer {
|
|
|
4875
4875
|
this.astroSphere.deleteFootprintSet(footprintSet);
|
|
4876
4876
|
}
|
|
4877
4877
|
createTerraPolylineSet(polylineSetName, polylineSetDescription, providerUrl, metadataManager) {
|
|
4878
|
-
return new TerraPolylineSetGL_js_1.TerraPolylineSetGL(polylineSetName, polylineSetDescription, providerUrl, metadataManager, this.webgl
|
|
4878
|
+
return new TerraPolylineSetGL_js_1.TerraPolylineSetGL(polylineSetName, polylineSetDescription, providerUrl, metadataManager, this.webgl);
|
|
4879
4879
|
}
|
|
4880
4880
|
showTerraPolylineSet(polylineSet) {
|
|
4881
4881
|
this.astroSphere.showPolylineSet(polylineSet);
|
|
@@ -5777,7 +5777,7 @@ class Global {
|
|
|
5777
5777
|
// private _gl: GL | null;
|
|
5778
5778
|
_healpix;
|
|
5779
5779
|
// --- config/state flags ---
|
|
5780
|
-
_selectionnside;
|
|
5780
|
+
// private _selectionnside: number;
|
|
5781
5781
|
// private _healpix4footprints: boolean;
|
|
5782
5782
|
_useCORSProxy;
|
|
5783
5783
|
_corsProxyUrl;
|
|
@@ -5785,6 +5785,7 @@ class Global {
|
|
|
5785
5785
|
_debug;
|
|
5786
5786
|
_insideSphere;
|
|
5787
5787
|
_version;
|
|
5788
|
+
_selectionOrder;
|
|
5788
5789
|
constructor() {
|
|
5789
5790
|
this._useCORSProxy = Config_js_1.bootSetup.useCORSProxy;
|
|
5790
5791
|
this._corsProxyUrl = Config_js_1.bootSetup.corsProxyUrl;
|
|
@@ -5793,18 +5794,34 @@ class Global {
|
|
|
5793
5794
|
this._insideSphere = Config_js_1.bootSetup.insideView;
|
|
5794
5795
|
this._version = Config_js_1.bootSetup.version;
|
|
5795
5796
|
this._healpix = {};
|
|
5796
|
-
this._selectionnside = 32;
|
|
5797
|
+
// this._selectionnside = 32;
|
|
5798
|
+
this._selectionOrder = 5;
|
|
5799
|
+
}
|
|
5800
|
+
get selectionOrder() {
|
|
5801
|
+
return this._selectionOrder;
|
|
5797
5802
|
}
|
|
5798
5803
|
init() {
|
|
5799
|
-
console.log(
|
|
5804
|
+
console.log("Global.init()");
|
|
5800
5805
|
}
|
|
5801
5806
|
// --- getters/setters ---
|
|
5802
|
-
get version() {
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5807
|
+
get version() {
|
|
5808
|
+
return this._version;
|
|
5809
|
+
}
|
|
5810
|
+
set corsProxyUrl(url) {
|
|
5811
|
+
this._corsProxyUrl = url;
|
|
5812
|
+
}
|
|
5813
|
+
get corsProxyUrl() {
|
|
5814
|
+
return this._corsProxyUrl;
|
|
5815
|
+
}
|
|
5816
|
+
get useCORSProxy() {
|
|
5817
|
+
return this._useCORSProxy;
|
|
5818
|
+
}
|
|
5819
|
+
set useCORSProxy(enabled) {
|
|
5820
|
+
this._useCORSProxy = enabled;
|
|
5821
|
+
}
|
|
5822
|
+
get debug() {
|
|
5823
|
+
return this._debug;
|
|
5824
|
+
}
|
|
5808
5825
|
getHealpix(order) {
|
|
5809
5826
|
if (this._healpix[order] === undefined) {
|
|
5810
5827
|
// order is HEALPix "order" ⇒ nside = 2^order
|
|
@@ -5812,10 +5829,15 @@ class Global {
|
|
|
5812
5829
|
}
|
|
5813
5830
|
return this._healpix[order];
|
|
5814
5831
|
}
|
|
5815
|
-
get MAX_DECIMALS() {
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5832
|
+
get MAX_DECIMALS() {
|
|
5833
|
+
return this._maxDecimals;
|
|
5834
|
+
}
|
|
5835
|
+
set insideSphere(v) {
|
|
5836
|
+
this._insideSphere = v;
|
|
5837
|
+
}
|
|
5838
|
+
get insideSphere() {
|
|
5839
|
+
return this._insideSphere;
|
|
5840
|
+
}
|
|
5819
5841
|
}
|
|
5820
5842
|
const global = new Global();
|
|
5821
5843
|
exports["default"] = global;
|
|
@@ -7903,7 +7925,8 @@ class Source {
|
|
|
7903
7925
|
}
|
|
7904
7926
|
computeHealpixPixel() {
|
|
7905
7927
|
// Get Healpix instance from global
|
|
7906
|
-
const healpix =
|
|
7928
|
+
// const healpix: Healpix = global.getHealpix(global.nsideForSelection);
|
|
7929
|
+
const healpix = Global_js_1.default.getHealpix(Global_js_1.default.selectionOrder);
|
|
7907
7930
|
const vec3 = new healpix_1.Vec3(this._point.x, this._point.y, this._point.z);
|
|
7908
7931
|
const ptg = new healpix_1.Pointing(vec3, false);
|
|
7909
7932
|
this._h_pix = healpix.ang2pix(ptg, false);
|
|
@@ -8193,7 +8216,7 @@ class CatalogueGL {
|
|
|
8193
8216
|
_oldMouseCoords;
|
|
8194
8217
|
_metadataManager;
|
|
8195
8218
|
_isVisible = true;
|
|
8196
|
-
_shapeColor =
|
|
8219
|
+
_shapeColor = "#8F00FF";
|
|
8197
8220
|
_healpixDensityMap;
|
|
8198
8221
|
_providerUrl;
|
|
8199
8222
|
_catalogueShaderProgram;
|
|
@@ -8202,7 +8225,7 @@ class CatalogueGL {
|
|
|
8202
8225
|
this._webgl = webgl;
|
|
8203
8226
|
this._ready = false;
|
|
8204
8227
|
this._visibleTilesManager = visibleTilesManager;
|
|
8205
|
-
this.TYPE =
|
|
8228
|
+
this.TYPE = "SOURCE_CATALOGUE";
|
|
8206
8229
|
this._name = catalogueName;
|
|
8207
8230
|
this._description = catalogueDescription;
|
|
8208
8231
|
this._providerUrl = providerUrl;
|
|
@@ -8220,7 +8243,7 @@ class CatalogueGL {
|
|
|
8220
8243
|
this._oldMouseCoords = null;
|
|
8221
8244
|
this._healpixDensityMap = new Map();
|
|
8222
8245
|
// this.catalogueProps = new CatalogueProps(metadataManager, defaultColor);
|
|
8223
|
-
// call catalogueShaderProgram to init shaders if they are not yet initialised
|
|
8246
|
+
// call catalogueShaderProgram to init shaders if they are not yet initialised
|
|
8224
8247
|
this._catalogueShaderProgram = new CatalogueShaderProgram_js_1.CatalogueShaderProgram(this._webgl);
|
|
8225
8248
|
this._catalogueShaderProgram.shaderProgram;
|
|
8226
8249
|
// catalogueShaderProgram.shaderProgram
|
|
@@ -8265,7 +8288,7 @@ class CatalogueGL {
|
|
|
8265
8288
|
}
|
|
8266
8289
|
return {
|
|
8267
8290
|
min: Number(min),
|
|
8268
|
-
max: Number(max)
|
|
8291
|
+
max: Number(max),
|
|
8269
8292
|
};
|
|
8270
8293
|
}
|
|
8271
8294
|
get metadataManager() {
|
|
@@ -8314,7 +8337,7 @@ class CatalogueGL {
|
|
|
8314
8337
|
const raw = Number(source.getDetailByindex(idx));
|
|
8315
8338
|
const min = Number(minmax.min);
|
|
8316
8339
|
const max = Number(minmax.max);
|
|
8317
|
-
const norm = (raw - min) / Math.max(1e-12,
|
|
8340
|
+
const norm = (raw - min) / Math.max(1e-12, max - min);
|
|
8318
8341
|
const size = norm * (20 - 8) + 8;
|
|
8319
8342
|
source.shapeSize = size;
|
|
8320
8343
|
}
|
|
@@ -8351,7 +8374,7 @@ class CatalogueGL {
|
|
|
8351
8374
|
const raw = Number(source.getDetailByindex(idx));
|
|
8352
8375
|
const min = Number(minmax.min);
|
|
8353
8376
|
const max = Number(minmax.max);
|
|
8354
|
-
const norm = (raw - min) / Math.max(1e-12,
|
|
8377
|
+
const norm = (raw - min) / Math.max(1e-12, max - min);
|
|
8355
8378
|
// map [0,1] -> [1,-1]
|
|
8356
8379
|
source.brightnessFactor = -(norm * 2 - 1);
|
|
8357
8380
|
}
|
|
@@ -8381,7 +8404,7 @@ class CatalogueGL {
|
|
|
8381
8404
|
for (let j = 0; j < in_data.length; j++) {
|
|
8382
8405
|
const point = new Point_js_1.Point({
|
|
8383
8406
|
raDeg: in_data[j][raDataIndex],
|
|
8384
|
-
decDeg: in_data[j][decDataIndex]
|
|
8407
|
+
decDeg: in_data[j][decDataIndex],
|
|
8385
8408
|
}, CoordsType_js_1.CoordsType.ASTRO);
|
|
8386
8409
|
const source = new Source_js_1.Source(point, in_data[j]);
|
|
8387
8410
|
// Ensure optional fields exist
|
|
@@ -8452,7 +8475,8 @@ class CatalogueGL {
|
|
|
8452
8475
|
if (i >= 0) {
|
|
8453
8476
|
this.hoveredIndexes.splice(i, 1);
|
|
8454
8477
|
this.vertexCataloguePosition[base + 3] = 0.0; // not hovered
|
|
8455
|
-
this.vertexCataloguePosition[base + 4] =
|
|
8478
|
+
this.vertexCataloguePosition[base + 4] =
|
|
8479
|
+
this._sources[sIdx]?.shapeSize ?? CatalogueGL.STANDARD_SHAPE_SIZE;
|
|
8456
8480
|
}
|
|
8457
8481
|
}
|
|
8458
8482
|
}
|
|
@@ -8476,7 +8500,8 @@ class CatalogueGL {
|
|
|
8476
8500
|
if (i >= 0) {
|
|
8477
8501
|
this.selectedIndexes.splice(i, 1);
|
|
8478
8502
|
this.vertexCataloguePosition[base + 3] = 0.0; // not selected
|
|
8479
|
-
this.vertexCataloguePosition[base + 4] =
|
|
8503
|
+
this.vertexCataloguePosition[base + 4] =
|
|
8504
|
+
this._sources[sIdx]?.shapeSize ?? CatalogueGL.STANDARD_SHAPE_SIZE;
|
|
8480
8505
|
}
|
|
8481
8506
|
}
|
|
8482
8507
|
}
|
|
@@ -8507,9 +8532,11 @@ class CatalogueGL {
|
|
|
8507
8532
|
// hovered flag
|
|
8508
8533
|
this.vertexCataloguePosition[positionIndex + 3] = 0.0;
|
|
8509
8534
|
// size
|
|
8510
|
-
this.vertexCataloguePosition[positionIndex + 4] =
|
|
8535
|
+
this.vertexCataloguePosition[positionIndex + 4] =
|
|
8536
|
+
currSource.shapeSize ?? CatalogueGL.STANDARD_SHAPE_SIZE;
|
|
8511
8537
|
// brightness
|
|
8512
|
-
this.vertexCataloguePosition[positionIndex + 5] =
|
|
8538
|
+
this.vertexCataloguePosition[positionIndex + 5] =
|
|
8539
|
+
currSource.brightnessFactor ?? 0.0;
|
|
8513
8540
|
positionIndex += CatalogueGL.ELEM_SIZE;
|
|
8514
8541
|
}
|
|
8515
8542
|
this._webgl.bufferData(this._webgl.ARRAY_BUFFER, this.vertexCataloguePosition, this._webgl.STATIC_DRAW);
|
|
@@ -8543,50 +8570,8 @@ class CatalogueGL {
|
|
|
8543
8570
|
return 0.0001;
|
|
8544
8571
|
}
|
|
8545
8572
|
}
|
|
8546
|
-
checkClicking(in_mouseHelper) {
|
|
8547
|
-
if (in_mouseHelper.x == null || in_mouseHelper.y == null || in_mouseHelper.z == null) {
|
|
8548
|
-
console.log('CatalogueGL.checkClicking: missing mouse coords');
|
|
8549
|
-
return [];
|
|
8550
|
-
}
|
|
8551
|
-
const clickedIndexes = [];
|
|
8552
|
-
const mousePix = in_mouseHelper.computeNpix();
|
|
8553
|
-
if (mousePix != null && this._healpixDensityMap.has(mousePix)) {
|
|
8554
|
-
const candidates = this._healpixDensityMap.get(mousePix);
|
|
8555
|
-
const selR = this.getSelectionRadius();
|
|
8556
|
-
for (let i = 0; i < candidates.length; i++) {
|
|
8557
|
-
const sourceIdx = candidates[i];
|
|
8558
|
-
const source = this._sources[sourceIdx];
|
|
8559
|
-
if (!source)
|
|
8560
|
-
continue;
|
|
8561
|
-
const dx = source.point.x - in_mouseHelper.x;
|
|
8562
|
-
const dy = source.point.y - in_mouseHelper.y;
|
|
8563
|
-
const dz = source.point.z - in_mouseHelper.z;
|
|
8564
|
-
const dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
8565
|
-
if (dist <= selR) {
|
|
8566
|
-
clickedIndexes.push(sourceIdx);
|
|
8567
|
-
}
|
|
8568
|
-
}
|
|
8569
|
-
}
|
|
8570
|
-
return clickedIndexes;
|
|
8571
|
-
}
|
|
8572
|
-
// private setSelectedIndexes(nextSelected: number[]) {
|
|
8573
|
-
// const deduped = Array.from(new Set(nextSelected))
|
|
8574
|
-
// .filter((idx) => idx >= 0 && idx < this._sources.length);
|
|
8575
|
-
// if (this.vertexCataloguePosition.length) {
|
|
8576
|
-
// for (const prevIdx of this.selectedIndexes) {
|
|
8577
|
-
// if (deduped.includes(prevIdx)) continue;
|
|
8578
|
-
// const base = prevIdx * CatalogueGL.ELEM_SIZE;
|
|
8579
|
-
// if (base + 4 >= this.vertexCataloguePosition.length) continue;
|
|
8580
|
-
// if (!this.hoveredIndexes.includes(prevIdx) && !this.extHoveredIndexes.includes(prevIdx)) {
|
|
8581
|
-
// this.vertexCataloguePosition[base + 3] = 0.0;
|
|
8582
|
-
// }
|
|
8583
|
-
// this.vertexCataloguePosition[base + 4] = this._sources[prevIdx]?.shapeSize ?? CatalogueGL.STANDARD_SHAPE_SIZE;
|
|
8584
|
-
// }
|
|
8585
|
-
// }
|
|
8586
|
-
// this.selectedIndexes = deduped;
|
|
8587
|
-
// }
|
|
8588
8573
|
setSelectedIndexes(selectedIndex) {
|
|
8589
|
-
selectedIndex.forEach(idx => {
|
|
8574
|
+
selectedIndex.forEach((idx) => {
|
|
8590
8575
|
if (idx < 0 || idx >= this._sources.length)
|
|
8591
8576
|
return;
|
|
8592
8577
|
const base = idx * CatalogueGL.ELEM_SIZE;
|
|
@@ -8595,12 +8580,14 @@ class CatalogueGL {
|
|
|
8595
8580
|
if (this.selectedIndexes.includes(idx)) {
|
|
8596
8581
|
this.selectedIndexes.splice(this.selectedIndexes.indexOf(idx), 1);
|
|
8597
8582
|
this.vertexCataloguePosition[base + 3] = 0.0; // not selected
|
|
8598
|
-
this.vertexCataloguePosition[base + 4] =
|
|
8583
|
+
this.vertexCataloguePosition[base + 4] =
|
|
8584
|
+
this._sources[idx]?.shapeSize ?? CatalogueGL.STANDARD_SHAPE_SIZE;
|
|
8599
8585
|
}
|
|
8600
8586
|
else {
|
|
8601
8587
|
this.selectedIndexes.push(idx);
|
|
8602
8588
|
this.vertexCataloguePosition[base + 3] = 2.0; // selected
|
|
8603
|
-
this.vertexCataloguePosition[base + 4] =
|
|
8589
|
+
this.vertexCataloguePosition[base + 4] =
|
|
8590
|
+
this._sources[idx]?.shapeSize ?? CatalogueGL.STANDARD_SHAPE_SIZE;
|
|
8604
8591
|
}
|
|
8605
8592
|
});
|
|
8606
8593
|
}
|
|
@@ -8617,7 +8604,7 @@ class CatalogueGL {
|
|
|
8617
8604
|
};
|
|
8618
8605
|
}
|
|
8619
8606
|
const sources = [];
|
|
8620
|
-
pickedIndexes.forEach(idx => {
|
|
8607
|
+
pickedIndexes.forEach((idx) => {
|
|
8621
8608
|
const source = this._sources[idx];
|
|
8622
8609
|
if (source)
|
|
8623
8610
|
sources.push(source);
|
|
@@ -8647,7 +8634,7 @@ class CatalogueGL {
|
|
|
8647
8634
|
}
|
|
8648
8635
|
const selectionState = [];
|
|
8649
8636
|
const selectedSources = [];
|
|
8650
|
-
clickedIndexes.forEach(idx => {
|
|
8637
|
+
clickedIndexes.forEach((idx) => {
|
|
8651
8638
|
const source = this._sources[idx];
|
|
8652
8639
|
if (!source)
|
|
8653
8640
|
return;
|
|
@@ -8665,31 +8652,43 @@ class CatalogueGL {
|
|
|
8665
8652
|
const idx = this.hoveredIndexes[0];
|
|
8666
8653
|
return this._sources[idx] ?? null;
|
|
8667
8654
|
}
|
|
8668
|
-
|
|
8669
|
-
if (in_mouseHelper.x == null ||
|
|
8670
|
-
|
|
8671
|
-
|
|
8655
|
+
findNearestSourceIndex(in_mouseHelper) {
|
|
8656
|
+
if (in_mouseHelper.x == null ||
|
|
8657
|
+
in_mouseHelper.y == null ||
|
|
8658
|
+
in_mouseHelper.z == null) {
|
|
8659
|
+
return null;
|
|
8672
8660
|
}
|
|
8673
|
-
const hoveredIndexes = [];
|
|
8674
8661
|
const mousePix = in_mouseHelper.computeNpix();
|
|
8675
|
-
if (mousePix
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8662
|
+
if (mousePix == null)
|
|
8663
|
+
return null;
|
|
8664
|
+
const candidates = this._healpixDensityMap.get(mousePix);
|
|
8665
|
+
if (!candidates?.length)
|
|
8666
|
+
return null;
|
|
8667
|
+
const selR = this.getSelectionRadius();
|
|
8668
|
+
let nearestIndex = null;
|
|
8669
|
+
let nearestDistance = Number.POSITIVE_INFINITY;
|
|
8670
|
+
for (const sourceIdx of candidates) {
|
|
8671
|
+
const source = this._sources[sourceIdx];
|
|
8672
|
+
if (!source)
|
|
8673
|
+
continue;
|
|
8674
|
+
const dx = source.point.x - in_mouseHelper.x;
|
|
8675
|
+
const dy = source.point.y - in_mouseHelper.y;
|
|
8676
|
+
const dz = source.point.z - in_mouseHelper.z;
|
|
8677
|
+
const dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
8678
|
+
if (dist <= selR && dist < nearestDistance) {
|
|
8679
|
+
nearestDistance = dist;
|
|
8680
|
+
nearestIndex = sourceIdx;
|
|
8690
8681
|
}
|
|
8691
8682
|
}
|
|
8692
|
-
return
|
|
8683
|
+
return nearestIndex;
|
|
8684
|
+
}
|
|
8685
|
+
checkClicking(in_mouseHelper) {
|
|
8686
|
+
const nearestIndex = this.findNearestSourceIndex(in_mouseHelper);
|
|
8687
|
+
return nearestIndex == null ? [] : [nearestIndex];
|
|
8688
|
+
}
|
|
8689
|
+
checkHovering(in_mouseHelper) {
|
|
8690
|
+
const nearestIndex = this.findNearestSourceIndex(in_mouseHelper);
|
|
8691
|
+
return nearestIndex == null ? [] : [nearestIndex];
|
|
8693
8692
|
}
|
|
8694
8693
|
/**
|
|
8695
8694
|
* @param in_mMatrix Model matrix the current catalogue is associated to (e.g. HiPS matrix)
|
|
@@ -8736,7 +8735,8 @@ class CatalogueGL {
|
|
|
8736
8735
|
const base = this.hoveredIndexes[k] * CatalogueGL.ELEM_SIZE;
|
|
8737
8736
|
// if (this.vertexCataloguePosition[base + 3] == 2.0) continue; // selected, skip hover
|
|
8738
8737
|
this.vertexCataloguePosition[base + 3] = 0.0; // not hovered
|
|
8739
|
-
this.vertexCataloguePosition[base + 4] =
|
|
8738
|
+
this.vertexCataloguePosition[base + 4] =
|
|
8739
|
+
this._sources[this.hoveredIndexes[k]].shapeSize; // size
|
|
8740
8740
|
}
|
|
8741
8741
|
// Hover logic on mouse move
|
|
8742
8742
|
if (in_mouseHelper != null && in_mouseHelper.xyz !== this._oldMouseCoords) {
|
|
@@ -10373,11 +10373,9 @@ class FootprintSetGL {
|
|
|
10373
10373
|
_metadataManager;
|
|
10374
10374
|
_providerUrl;
|
|
10375
10375
|
_footprintShaderProgram;
|
|
10376
|
-
|
|
10377
|
-
constructor(fsetName, fsetDescription, providerUrl, metadataManager, webgl, visibleTilesManager) {
|
|
10376
|
+
constructor(fsetName, fsetDescription, providerUrl, metadataManager, webgl) {
|
|
10378
10377
|
this._webgl = webgl;
|
|
10379
10378
|
this._ready = false;
|
|
10380
|
-
this._visibleTilesManager = visibleTilesManager;
|
|
10381
10379
|
this.TYPE = "FOOTPRINT_SET";
|
|
10382
10380
|
this._name = fsetName;
|
|
10383
10381
|
this._description = fsetDescription;
|
|
@@ -14695,7 +14693,9 @@ class MeshHiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
14695
14693
|
const orders = Array.from(byOrder.keys()).sort((a, b) => a - b);
|
|
14696
14694
|
for (const order of orders) {
|
|
14697
14695
|
for (const coord of byOrder.get(order) ?? []) {
|
|
14698
|
-
this._tiles
|
|
14696
|
+
this._tiles
|
|
14697
|
+
.get(this.tileKey(coord))
|
|
14698
|
+
?.draw(pMatrix, vMatrix, mMatrix, this._descriptor.color, this._descriptor.wireframe);
|
|
14699
14699
|
}
|
|
14700
14700
|
}
|
|
14701
14701
|
if (wasCullFace)
|
|
@@ -14708,7 +14708,7 @@ class MeshHiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
14708
14708
|
getDebugStats() {
|
|
14709
14709
|
const tiles = Array.from(this._tiles.values());
|
|
14710
14710
|
return {
|
|
14711
|
-
activeBaseLayer:
|
|
14711
|
+
activeBaseLayer: "meships",
|
|
14712
14712
|
meshHiPSName: this._descriptor.name,
|
|
14713
14713
|
meshHiPSUrl: this._descriptor.baseUrl,
|
|
14714
14714
|
currentOrder: this._currentOrder,
|
|
@@ -14727,33 +14727,47 @@ class MeshHiPS extends AbstractSkyEntity_js_1.AbstractSkyEntity {
|
|
|
14727
14727
|
? byOrder.pixels
|
|
14728
14728
|
: [];
|
|
14729
14729
|
if (pixels.length > 0) {
|
|
14730
|
-
return pixels.map((ipix) => ({
|
|
14730
|
+
return pixels.map((ipix) => ({
|
|
14731
|
+
order: this._currentOrder,
|
|
14732
|
+
ipix,
|
|
14733
|
+
}));
|
|
14731
14734
|
}
|
|
14732
14735
|
const tileCount = 12 * 4 ** this._currentOrder;
|
|
14733
|
-
return Array.from({ length: tileCount }, (_, ipix) => ({
|
|
14736
|
+
return Array.from({ length: tileCount }, (_, ipix) => ({
|
|
14737
|
+
order: this._currentOrder,
|
|
14738
|
+
ipix,
|
|
14739
|
+
}));
|
|
14734
14740
|
}
|
|
14735
14741
|
resolveCoverageTiles(visibleTiles) {
|
|
14736
14742
|
const tiles = new Map();
|
|
14737
14743
|
const add = (coord) => {
|
|
14738
|
-
if (coord.order < this._descriptor.minOrder ||
|
|
14744
|
+
if (coord.order < this._descriptor.minOrder ||
|
|
14745
|
+
coord.order > this._descriptor.maxOrder) {
|
|
14739
14746
|
return;
|
|
14747
|
+
}
|
|
14740
14748
|
tiles.set(this.tileKey(coord), coord);
|
|
14741
14749
|
};
|
|
14742
14750
|
for (const coord of visibleTiles) {
|
|
14743
14751
|
add(coord);
|
|
14744
14752
|
for (let order = coord.order - 1; order >= this._descriptor.minOrder; order--) {
|
|
14745
14753
|
const shift = 2 * (coord.order - order);
|
|
14746
|
-
add({
|
|
14754
|
+
add({
|
|
14755
|
+
order,
|
|
14756
|
+
ipix: coord.ipix >> shift,
|
|
14757
|
+
});
|
|
14747
14758
|
}
|
|
14748
14759
|
}
|
|
14749
14760
|
const manager = this._healpixGrid.visibleTilesManager;
|
|
14750
14761
|
const ancestorsMap = manager?.ancestorsMap;
|
|
14751
14762
|
if (ancestorsMap) {
|
|
14752
14763
|
for (const [order, ipixes] of ancestorsMap) {
|
|
14753
|
-
if (order < this._descriptor.minOrder ||
|
|
14764
|
+
if (order < this._descriptor.minOrder ||
|
|
14765
|
+
order > this._descriptor.maxOrder) {
|
|
14754
14766
|
continue;
|
|
14755
|
-
|
|
14767
|
+
}
|
|
14768
|
+
for (const ipix of ipixes) {
|
|
14756
14769
|
add({ order, ipix });
|
|
14770
|
+
}
|
|
14757
14771
|
}
|
|
14758
14772
|
}
|
|
14759
14773
|
return Array.from(tiles.values());
|
|
@@ -16379,6 +16393,9 @@ function normalizeLongitudeDeg(longitudeDeg) {
|
|
|
16379
16393
|
*
|
|
16380
16394
|
* See LICENSE.md, LICENSE-AGPL.md, and LICENSE-COMMERCIAL.md for details.
|
|
16381
16395
|
*/
|
|
16396
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16397
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16398
|
+
};
|
|
16382
16399
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16383
16400
|
exports.TerraFootprintSetGL = void 0;
|
|
16384
16401
|
const FootprintSetGL_js_1 = __webpack_require__(592);
|
|
@@ -16387,6 +16404,8 @@ const Footprint_js_1 = __webpack_require__(2475);
|
|
|
16387
16404
|
const MetadataColumn_js_1 = __webpack_require__(1072);
|
|
16388
16405
|
const MetadataManager_js_1 = __webpack_require__(5403);
|
|
16389
16406
|
const MetadataColumn_js_2 = __webpack_require__(1072);
|
|
16407
|
+
const Point_js_1 = __webpack_require__(6553);
|
|
16408
|
+
const GeomUtils_js_1 = __importDefault(__webpack_require__(2930));
|
|
16390
16409
|
class TerraFootprintSetGL extends FootprintSetGL_js_1.FootprintSetGL {
|
|
16391
16410
|
_kind = 'TerraFootprintSetGL';
|
|
16392
16411
|
_coordsType = CoordsType_js_1.CoordsType.GEOGRAPHIC;
|
|
@@ -16405,6 +16424,23 @@ class TerraFootprintSetGL extends FootprintSetGL_js_1.FootprintSetGL {
|
|
|
16405
16424
|
this._ready = true;
|
|
16406
16425
|
this._bufferInitialised = false;
|
|
16407
16426
|
}
|
|
16427
|
+
checkSelection(mouseHelper) {
|
|
16428
|
+
if (mouseHelper.x == null || mouseHelper.y == null || mouseHelper.z == null)
|
|
16429
|
+
return;
|
|
16430
|
+
const hoverState = this;
|
|
16431
|
+
hoverState._hoveredFootprints = [];
|
|
16432
|
+
this.totHoveredPoints = 0;
|
|
16433
|
+
const mousePoint = new Point_js_1.Point({ x: mouseHelper.x, y: mouseHelper.y, z: mouseHelper.z }, CoordsType_js_1.CoordsType.CARTESIAN);
|
|
16434
|
+
for (const footprint of this.footprintPolygons) {
|
|
16435
|
+
if (!footprint.selectionObj)
|
|
16436
|
+
continue;
|
|
16437
|
+
if (GeomUtils_js_1.default.checkPointInsidePolygon5(footprint.selectionObj, mousePoint)) {
|
|
16438
|
+
hoverState._hoveredFootprints.push(footprint);
|
|
16439
|
+
this.totHoveredPoints += footprint.totPoints;
|
|
16440
|
+
}
|
|
16441
|
+
}
|
|
16442
|
+
this.initHoveringBuffer();
|
|
16443
|
+
}
|
|
16408
16444
|
createGeoJSONMetadataColumns(features) {
|
|
16409
16445
|
const names = new Set();
|
|
16410
16446
|
features.forEach(feature => Object.keys(feature.properties).forEach(name => names.add(name)));
|
|
@@ -16450,8 +16486,44 @@ exports.TerraFootprintSetGL = TerraFootprintSetGL;
|
|
|
16450
16486
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16451
16487
|
exports.TerraPointSetGL = void 0;
|
|
16452
16488
|
const CatalogueGL_js_1 = __webpack_require__(1232);
|
|
16489
|
+
const MetadataManager_js_1 = __webpack_require__(5403);
|
|
16490
|
+
const Point_js_1 = __webpack_require__(6553);
|
|
16491
|
+
const CoordsType_js_1 = __webpack_require__(8145);
|
|
16453
16492
|
class TerraPointSetGL extends CatalogueGL_js_1.CatalogueGL {
|
|
16454
16493
|
_kind = 'TerraPointSetGL';
|
|
16494
|
+
addSources(inData, columnsMeta) {
|
|
16495
|
+
this._ready = false;
|
|
16496
|
+
this._sources = [];
|
|
16497
|
+
const metadataManager = new MetadataManager_js_1.MetadataManager(columnsMeta);
|
|
16498
|
+
this._metadataManager = metadataManager;
|
|
16499
|
+
const lonDataIndex = metadataManager.selectedRaColumn?.index ?? -1;
|
|
16500
|
+
const latDataIndex = metadataManager.selectedDecColumn?.index ?? -1;
|
|
16501
|
+
if (lonDataIndex < 0 || latDataIndex < 0) {
|
|
16502
|
+
throw new Error(`(lon, lat) idx not defined (${lonDataIndex}, ${latDataIndex}) `);
|
|
16503
|
+
}
|
|
16504
|
+
for (const row of inData) {
|
|
16505
|
+
const point = new Point_js_1.Point({
|
|
16506
|
+
lonDeg: Number(row[lonDataIndex]),
|
|
16507
|
+
latDeg: Number(row[latDataIndex]),
|
|
16508
|
+
}, CoordsType_js_1.CoordsType.GEOGRAPHIC);
|
|
16509
|
+
this.addSource({
|
|
16510
|
+
point,
|
|
16511
|
+
details: row,
|
|
16512
|
+
healpixPixel: 0,
|
|
16513
|
+
shapeSize: CatalogueGL_js_1.CatalogueGL.STANDARD_SHAPE_SIZE,
|
|
16514
|
+
brightnessFactor: 3,
|
|
16515
|
+
getDetailByindex(index) {
|
|
16516
|
+
return index < 0 || index >= row.length ? undefined : row[index];
|
|
16517
|
+
},
|
|
16518
|
+
});
|
|
16519
|
+
}
|
|
16520
|
+
this._ready = true;
|
|
16521
|
+
this._bufferInitialised = false;
|
|
16522
|
+
}
|
|
16523
|
+
draw(inMatrix, inMouseHelper, viewMatrix, projectionMatrix) {
|
|
16524
|
+
this._oldMouseCoords = inMouseHelper?.xyz ?? null;
|
|
16525
|
+
super.draw(inMatrix, inMouseHelper, viewMatrix, projectionMatrix);
|
|
16526
|
+
}
|
|
16455
16527
|
}
|
|
16456
16528
|
exports.TerraPointSetGL = TerraPointSetGL;
|
|
16457
16529
|
|
|
@@ -16485,7 +16557,6 @@ class TerraPolylineSetGL {
|
|
|
16485
16557
|
_providerUrl;
|
|
16486
16558
|
_metadataManager;
|
|
16487
16559
|
_webgl;
|
|
16488
|
-
_visibleTilesManager;
|
|
16489
16560
|
static ELEM_SIZE = 3;
|
|
16490
16561
|
static BYTES_X_ELEM = new Float32Array().BYTES_PER_ELEMENT;
|
|
16491
16562
|
_kind = 'TerraPolylineSetGL';
|
|
@@ -16496,13 +16567,12 @@ class TerraPolylineSetGL {
|
|
|
16496
16567
|
paths = [];
|
|
16497
16568
|
renderSegments = [];
|
|
16498
16569
|
_polylineShaderProgram;
|
|
16499
|
-
constructor(_name, _description, _providerUrl, _metadataManager, _webgl
|
|
16570
|
+
constructor(_name, _description, _providerUrl, _metadataManager, _webgl) {
|
|
16500
16571
|
this._name = _name;
|
|
16501
16572
|
this._description = _description;
|
|
16502
16573
|
this._providerUrl = _providerUrl;
|
|
16503
16574
|
this._metadataManager = _metadataManager;
|
|
16504
16575
|
this._webgl = _webgl;
|
|
16505
|
-
this._visibleTilesManager = _visibleTilesManager;
|
|
16506
16576
|
this._polylineShaderProgram = new FootprintShaderProgram_js_1.FootprintShaderProgram(this._webgl);
|
|
16507
16577
|
}
|
|
16508
16578
|
addPath(points, metadata) {
|
|
@@ -18840,7 +18910,8 @@ class MouseHelper {
|
|
|
18840
18910
|
computeNpix() {
|
|
18841
18911
|
if (!this._xyz)
|
|
18842
18912
|
return null;
|
|
18843
|
-
const hp =
|
|
18913
|
+
// const hp: Healpix = global.getHealpix(global.nsideForSelection);
|
|
18914
|
+
const hp = Global_js_1.default.getHealpix(Global_js_1.default.selectionOrder);
|
|
18844
18915
|
const v = new healpix_1.Vec3(this._xyz[0], this._xyz[1], this._xyz[2]);
|
|
18845
18916
|
const ptg = new healpix_1.Pointing(v, false);
|
|
18846
18917
|
return hp.ang2pix(ptg, false);
|