mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-25 04:16:55 -08:00
Compare commits
10 Commits
hips-akari
...
fix-circle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac4af8fb18 | ||
|
|
279f93c4ba | ||
|
|
5d6e113c19 | ||
|
|
2f9a1f297d | ||
|
|
0d2c0889a1 | ||
|
|
0cbd0c9f23 | ||
|
|
16a1e808a2 | ||
|
|
7b718eae96 | ||
|
|
221132ee1a | ||
|
|
f796a4c036 |
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ export let DefaultActionsForContextMenu = (function () {
|
||||
const a = aladinInstance;
|
||||
|
||||
const selectObjects = (selection) => {
|
||||
console.log(selection)
|
||||
a.view.selectObjects(selection);
|
||||
};
|
||||
return [
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -346,6 +346,7 @@ export let Ellipse = (function() {
|
||||
|
||||
Ellipse.prototype.intersectsBBox = function(x, y, w, h) {
|
||||
// todo
|
||||
return false;
|
||||
};
|
||||
|
||||
return Ellipse;
|
||||
|
||||
Reference in New Issue
Block a user