mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 15:49:18 -08:00
fix pixel res filtering
This commit is contained in:
@@ -31,7 +31,14 @@
|
||||
selectionColor: 'white',
|
||||
// Footprint associated to sources
|
||||
shape: (s) => {
|
||||
|
||||
// discard drawing a vector for big pm
|
||||
let totalPmSquared = s.data.pmra*s.data.pmra + s.data.pmdec*s.data.pmdec;
|
||||
if (totalPmSquared > 6) {
|
||||
return;
|
||||
}
|
||||
|
||||
let color = rainbowColorMap((totalPmSquared - 2.5) / 2)
|
||||
|
||||
// Compute the mean of pm over the catalog sources
|
||||
if (!pmraMean || !pmdecMean) {
|
||||
pmraMean = 0, pmdecMean = 0;
|
||||
@@ -46,27 +53,14 @@
|
||||
pmdecMean /= numSources
|
||||
}
|
||||
|
||||
console.log("mean", pmraMean, pmdecMean)
|
||||
|
||||
let dra = +s.data.pmra - pmraMean;
|
||||
let ddec = +s.data.pmdec - pmdecMean;
|
||||
|
||||
// discard drawing a vector for big pm
|
||||
|
||||
|
||||
let totalPmSquared = s.data.pmra*s.data.pmra + s.data.pmdec*s.data.pmdec;
|
||||
if (totalPmSquared > 6) {
|
||||
return;
|
||||
}
|
||||
|
||||
let color = rainbowColorMap((totalPmSquared - 2.5) / 2)
|
||||
|
||||
return A.vector(
|
||||
s.ra,
|
||||
s.dec,
|
||||
s.ra + dra,
|
||||
s.dec + ddec,
|
||||
null,
|
||||
{lineWidth: 3, color}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
fov: 1,
|
||||
showContextMenu: true,
|
||||
showZoomControl: true,
|
||||
showSettingsControl: true,
|
||||
showSimbadPointerControl: true,
|
||||
samp: true,
|
||||
});
|
||||
// define custom draw function
|
||||
|
||||
|
||||
@@ -298,15 +298,14 @@ A.ellipse = function (ra, dec, radiusRaDeg, radiusDecDeg, rotationDeg, options)
|
||||
* @param {number} dec1 - Declination (Dec) coordinate of the center in degrees.
|
||||
* @param {number} ra2 - Right Ascension (RA) coordinate of the center in degrees.
|
||||
* @param {number} dec2 - Declination (Dec) coordinate of the center in degrees.
|
||||
* @param {CooFrame} [frame] - Frame in which the coordinates are given. If none, the frame used is icrs/j2000.
|
||||
* @param {ShapeOptions} options - Options for configuring the vector.
|
||||
*
|
||||
* @returns {Line}
|
||||
*/
|
||||
A.vector = function (ra1, dec1, ra2, dec2, frame, options) {
|
||||
A.vector = function (ra1, dec1, ra2, dec2, options) {
|
||||
options['arrow'] = true;
|
||||
|
||||
return A.line(ra1, dec1, ra2, dec2, frame, options);
|
||||
return A.line(ra1, dec1, ra2, dec2, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,7 +184,7 @@ export class HiPSBrowserBox extends Box {
|
||||
self.filterBox._show({
|
||||
position: {
|
||||
nextTo: filterBtn,
|
||||
direction: "right",
|
||||
direction: "bottom",
|
||||
aladin,
|
||||
},
|
||||
});
|
||||
@@ -194,6 +194,8 @@ export class HiPSBrowserBox extends Box {
|
||||
},
|
||||
});
|
||||
|
||||
let filterNumberElt = document.createElement("div");
|
||||
|
||||
super(
|
||||
{
|
||||
close: true,
|
||||
@@ -208,7 +210,7 @@ export class HiPSBrowserBox extends Box {
|
||||
classList: ['aladin-HiPS-browser-box'],
|
||||
content: Layout.vertical([
|
||||
Layout.horizontal(["Search:", searchDropdown, infoCurrentHiPSBtn]),
|
||||
Layout.horizontal(["Filter:", Layout.horizontal([filterEnabler, filterBtn])]),
|
||||
Layout.horizontal(["Filter:", Layout.horizontal([filterEnabler, filterBtn, filterNumberElt])]),
|
||||
]),
|
||||
...options,
|
||||
},
|
||||
@@ -220,6 +222,7 @@ export class HiPSBrowserBox extends Box {
|
||||
self._filterHiPSList(params);
|
||||
},
|
||||
})
|
||||
this.filterNumberElt = filterNumberElt;
|
||||
this.filterBox._hide();
|
||||
|
||||
this.searchDropdown = searchDropdown;
|
||||
@@ -231,24 +234,30 @@ export class HiPSBrowserBox extends Box {
|
||||
self = this;
|
||||
|
||||
this.filterCallback = (HiPS, params) => {
|
||||
if (!HiPS.obs_regime || (
|
||||
params.regime &&
|
||||
HiPS.obs_regime &&
|
||||
params.regime.toLowerCase() !==
|
||||
HiPS.obs_regime.toLowerCase()
|
||||
)) {
|
||||
return false;
|
||||
if (params.regime) {
|
||||
if (!HiPS.obs_regime)
|
||||
return false;
|
||||
|
||||
if (params.regime.toLowerCase() !== HiPS.obs_regime.toLowerCase()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(params.spatial) && HiPS.ID && !(params.spatial.includes(HiPS.ID))) {
|
||||
return false;
|
||||
}
|
||||
if (params.spatial) {
|
||||
if (!HiPS.ID)
|
||||
return false;
|
||||
|
||||
if (!HiPS.hips_tile_width || !HiPS.hips_order)
|
||||
return false;
|
||||
if (Array.isArray(params.spatial) && !(params.spatial.includes(HiPS.ID))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (params.resolution) {
|
||||
let pixelHEALPixOrder = Math.log2(HiPS.hips_tile_width) + HiPS.hips_order;
|
||||
if (!HiPS.hips_tile_width || !HiPS.hips_order) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let pixelHEALPixOrder = Math.log2(HiPS.hips_tile_width) + (+HiPS.hips_order);
|
||||
let resPixel = Math.sqrt(Math.PI / (3*Math.pow(4, pixelHEALPixOrder)));
|
||||
|
||||
if (resPixel > params.resolution)
|
||||
@@ -284,7 +293,6 @@ export class HiPSBrowserBox extends Box {
|
||||
|
||||
// This method is executed only if the filter is enabled
|
||||
_filterHiPSList(params) {
|
||||
console.log("update dropdown")
|
||||
let self = this;
|
||||
let HiPSIDs = [];
|
||||
|
||||
@@ -302,6 +310,7 @@ export class HiPSBrowserBox extends Box {
|
||||
}
|
||||
|
||||
self.searchDropdown.update({ options: HiPSIDs });
|
||||
self.filterNumberElt.innerHTML = HiPSIDs.length + "/" + Object.keys(HiPSBrowserBox.HiPSList).length;
|
||||
}
|
||||
|
||||
_hide() {
|
||||
|
||||
@@ -225,6 +225,9 @@ export class HiPSFilterBox extends Box {
|
||||
enable(enable) {
|
||||
this.on = enable;
|
||||
|
||||
if (this.on)
|
||||
this._requestMOCServer();
|
||||
|
||||
this._triggerFilteringCallback();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user