Compare commits

..

10 Commits

Author SHA1 Message Date
Matthieu Baumann
ac4af8fb18 fix Circle::intersectBbox 2025-08-29 11:54:31 +02:00
Erik Mellegard
279f93c4ba Fix Circle intersectBBox 2025-06-13 10:14:15 +02:00
Matthieu Baumann
5d6e113c19 fix filterFn on footprints in catalogs: #301 2025-05-27 14:53:14 +02:00
Matthieu Baumann
2f9a1f297d impl #286: add eRosita to default HiPSList 2025-05-25 00:35:45 +02:00
Matthieu Baumann
0d2c0889a1 update playwright snapshots 2025-05-23 18:48:11 +02:00
Matthieu Baumann
0cbd0c9f23 fix test ci fmt 2025-05-23 18:48:11 +02:00
Matthieu Baumann
16a1e808a2 cargo fmt 2025-05-23 18:48:11 +02:00
Matthieu Baumann
7b718eae96 cargo clippy 2025-05-23 18:48:11 +02:00
Matthieu Baumann
221132ee1a remove warnings 2025-05-23 18:48:11 +02:00
Matthieu Baumann
f796a4c036 fix allsky retrieval and simplify hips rendering 2025-05-23 18:48:11 +02:00
8 changed files with 47 additions and 11 deletions

View File

@@ -33,10 +33,16 @@ var myFilterFunction = function(source) {
return color>colorThreshold;
}
aladin = A.aladin('#aladin-lite-div', {target: 'M 81', fov: 0.5, survey: 'CDS/P/SDSS9/color'});
var cat = A.catalogFromSimbad('M 81', 0.25, {onClick: 'showTable', verbosity: 3, filter: myFilterFunction});
aladin.addCatalog(cat);
aladin = A.aladin('#aladin-lite-div', {target: 'M 81', fov: 0.5, survey: 'CDS/P/SDSS9/color'});
var cat = A.catalogFromSimbad('M 81', 0.25, {
shape: (s) => {
return A.circle(s.ra, s.dec, 0.003, {lineWidth: 3});
},
onClick: 'showTable', verbosity: 3, filter: myFilterFunction
});
aladin.addCatalog(cat);
});
</script>
</body>

View File

@@ -1063,9 +1063,20 @@ export let Catalog = (function () {
var f;
for (let k = 0; k < this.footprints.length; k++) {
f = this.footprints[k];
if (this.filterFn && f.source) {
if(!this.filterFn(f.source)) {
f.hide()
} else {
f.show()
f.draw(ctx, this.view);
f.source.tooSmallFootprint = f.isTooSmall();
f.draw(ctx, this.view);
f.source.tooSmallFootprint = f.isTooSmall();
}
} else {
f.draw(ctx, this.view);
f.source.tooSmallFootprint = f.isTooSmall();
}
}
};

View File

@@ -45,7 +45,6 @@ export let DefaultActionsForContextMenu = (function () {
const a = aladinInstance;
const selectObjects = (selection) => {
console.log(selection)
a.view.selectObjects(selection);
};
return [

View File

@@ -12,6 +12,16 @@ export let HiPSList = (function () {
cooFrame: "equatorial",
startUrl: "https://alasky.cds.unistra.fr/DSS/DSSColor",
},
{
creatorDid: "ivo://erosita/dr1/rate/rgb",
id: "erosita/dr1/rate/rgb",
name: "eROSITA-DE DR1 RGB (0.2-0.5, 0.5-1.0, 1.0-2.0 keV) Rate Image",
maxOrder: 6,
tileSize: 512,
imgFormat: "png",
cooFrame: "equatorial",
startUrl: "https://erosita.mpe.mpg.de/dr1/erodat/static/hips/eRASS1_RGB_Rate_c010/"
},
{
creatorDid: "ivo://CDS/P/2MASS/color",
name: "2MASS colored",
@@ -202,7 +212,7 @@ export let HiPSList = (function () {
imgFormat: "jpeg",
minOrder: 3,
startUrl: "https://alasky.cds.unistra.fr/IPAC/IPAC_P_GLIMPSE360",
}
},
];
return HiPSList;

View File

@@ -251,7 +251,7 @@ export let Footprint= (function() {
return true;
}
}
return false;
return this.shapes.some((shape) => shape.intersectsBBox(x, y, w, h, view));
};
return Footprint;

View File

@@ -135,10 +135,12 @@ export class Selector {
}
// footprints
overlayItems = cat.getFootprints();
if (overlayItems) {
const {x, y, w, h} = selection.bbox();
for (var l = 0; l < overlayItems.length; l++) {
f = overlayItems[l];
if (f.intersectsBBox(x, y, w, h, view)) {
objListPerCatalog.push(f);
}

View File

@@ -322,10 +322,17 @@ export let Circle = (function() {
};
// From StackOverflow: https://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection
Circle.prototype.intersectsBBox = function(x, y, w, h) {
Circle.prototype.intersectsBBox = function(x, y, w, h, view) {
var centerXyview = view.aladin.world2pix(this.centerRaDec[0], this.centerRaDec[1]);
if (!centerXyview) {
return false;
}
// compute the absolute distance between the middle of the bbox
// and the center of the circle
const circleDistance = {
x: Math.abs(this.center.x - x),
y: Math.abs(this.center.y - y)
x: Math.abs(centerXyview[0] - (x + w/2)),
y: Math.abs(centerXyview[1] - (y + h/2))
};
if (circleDistance.x > (w/2 + this.radius)) { return false; }

View File

@@ -346,6 +346,7 @@ export let Ellipse = (function() {
Ellipse.prototype.intersectsBBox = function(x, y, w, h) {
// todo
return false;
};
return Ellipse;