fix #228, complete the api doc to help the user understand the edge, fill and perimeter booleans

This commit is contained in:
Matthieu Baumann
2025-02-14 09:55:10 +01:00
parent ac880608af
commit bf12e85c70
5 changed files with 20 additions and 19 deletions

View File

@@ -14,10 +14,10 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/CDS_P_DSS2_color", showReticle: true, showSurveyStackControl: true, showOverlayStackControl: false, projection: "TAN", target: '15 16 57.636 -60 55 7.49', showProjectionControl: true, realFullscreen: true, showZoomControl: true, showSimbadPointerControl: true, showShareControl: true, showContextMenu: true, showCooGridControl: true, fullScreen: true, showCooGrid: true, fov: 180, log: false});
var moc_0_99 = A.MOCFromURL("./data/gw/gw_0.9.fits",{ name: "GW 90%", color: "#ff0000", opacity: 0.0, lineWidth: 10, fill: false, perimeter: true});
var moc_0_95 = A.MOCFromURL("./data/gw/gw_0.6.fits",{ name: "GW 60%", color: "#00ff00", opacity: 0.5, lineWidth: 3, fill: true, perimeter: true});
var moc_0_5 = A.MOCFromURL("./data/gw/gw_0.3.fits",{ name: "GW 30%", color: "#00ffff", opacity: 0.5, lineWidth: 3, fill: true, perimeter: true});
var moc_0_2 = A.MOCFromURL("./data/gw/gw_0.1.fits",{ name: "GW 10%", color: "#ff00ff", opacity: 0.5, lineWidth: 3, fill: true, perimeter: true});
var moc_0_99 = A.MOCFromURL("./data/gw/gw_0.9.fits",{ name: "GW 90%", color: "#ff0000", opacity: 0.7, lineWidth: 10, fill: false, perimeter: true});
var moc_0_95 = A.MOCFromURL("./data/gw/gw_0.6.fits",{ name: "GW 60%", color: "#00ff00", opacity: 0.3, lineWidth: 3, fill: false, perimeter: true});
var moc_0_5 = A.MOCFromURL("./data/gw/gw_0.3.fits",{ name: "GW 30%", color: "#00ffff", opacity: 0.2, lineWidth: 3, fill: true, perimeter: true});
var moc_0_2 = A.MOCFromURL("./data/gw/gw_0.1.fits",{ name: "GW 10%", color: "#ff00ff", opacity: 0.1, lineWidth: 3});
aladin.addMOC(moc_0_99);
aladin.addMOC(moc_0_95);

View File

@@ -24,7 +24,7 @@
//var json = {"3":[517],
//"4":[2065, 2067]};
var moc = A.MOCFromJSON(json, {opacity: 0.25, color: 'magenta', lineWidth: 1, adaptativeDisplay: false});
var moc = A.MOCFromJSON(json, {opacity: 0.5, color: 'magenta', lineWidth: 1, adaptativeDisplay: false});
aladin.addMOC(moc);
});
</script>

View File

@@ -20,7 +20,7 @@
console.log(moc.serialize("json"))
});
var moc10 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=11&fmt=fits', {color: '#ffffff', perimeter: true, fillColor: '#aabbcc', opacity: 0.3, lineWidth: 3});
var moc10 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=11&fmt=fits', {color: '#ffffff', perimeter: true, fill:true, fillColor: '#aabbcc', opacity: 0.3, lineWidth: 3});
var moc9 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=4&fmt=fits', {color: '#00ff00', opacity: 0.5, lineWidth: 3, perimeter: true});
aladin.addMOC(moc11);

View File

@@ -42,7 +42,7 @@ impl MOC {
}
};
let color = parse_color(hex_color, 1.0);
let color = parse_color(hex_color, opacity);
let fill_color = parse_color(fill_color, opacity);
Self {

View File

@@ -20,13 +20,14 @@ import { ALEvent } from "./events/ALEvent.js";
* @description Options for configuring a MOC (Multi-Order-Coverage).
*
* @property {string} [name="MOC"] - The name of the catalog.
* @property {string} [color] - The color of the MOC HEALPix cell edges.
* @property {string} [fillColor] - A filling color of the MOC HEALPix cells.
* @property {string} [fill=false] - Fill the MOC with `options.fillColor`
* @property {string} [edge=true] - Draw the edges of the HEALPix cells with `options.color`.
* @property {string} [color] - The color of the MOC HEALPix cell edges. Is used only if `perimeter` is true or `edge` is true
* @property {string} [fillColor] - The filling of the MOC.
* @property {string} [fill=false] - Draw the filled MOC with `options.fillColor`.
* @property {Boolean} [perimeter=false] - Draw the perimeter of the MOC only with `options.color`.
* @property {string} [edge=!fill && !perimeter] - Draw the edges of the HEALPix cells with `options.color`.
The HEALPix cell edges compositing the MOC will be drawn if `fill` and `perimeter` are false
* @property {number} [lineWidth=3] - The line width in pixels
* @property {Boolean} [perimeter=false] - A filling color of the MOC HEALPix cells.
* @property {number} [opacity=1.0] - The opacity of the MOC
* @property {number} [opacity=1.0] - The opacity of the colors
*/
export let MOC = (function() {
@@ -59,7 +60,11 @@ export let MOC = (function() {
this.perimeter = false;
}
this.opacity = options.opacity || 1;
if (options && options.opacity !== undefined) {
this.opacity = options.opacity;
} else {
this.opacity = 1.0;
}
if (options && options.fill) {
this.fill = true;
@@ -67,17 +72,13 @@ export let MOC = (function() {
this.fill = false;
}
if (options && options.opacity) {
this.fill = true;
}
if (options && options.edge) {
this.edge = true;
} else {
this.edge = false;
}
if (!this.fill && !this.perimeter && options && !options.edge) {
if (!this.fill && !this.perimeter && !this.edge) {
this.edge = true;
}