From d94a93c33f734a9bb066efe91a387a17036c4469 Mon Sep 17 00:00:00 2001 From: Matthieu Baumann Date: Wed, 9 Oct 2024 18:18:16 +0200 Subject: [PATCH] doc: add Image methods --- src/js/FiniteStateMachine/PolySelect.js | 3 + src/js/HiPS.js | 403 ++++++++++++----------- src/js/Image.js | 407 ++++++++++++++++-------- src/js/View.js | 4 +- src/js/vo/Datalink.js | 9 +- 5 files changed, 504 insertions(+), 322 deletions(-) diff --git a/src/js/FiniteStateMachine/PolySelect.js b/src/js/FiniteStateMachine/PolySelect.js index d2a50cd9..bd12895f 100644 --- a/src/js/FiniteStateMachine/PolySelect.js +++ b/src/js/FiniteStateMachine/PolySelect.js @@ -147,6 +147,9 @@ export class PolySelect extends FSM { let finish = () => { if (this.coos.length <= 2) { console.warn("Invalid selection, please draw at least a 3 vertices polygon") + + view.mustClearCatalog = true; + view.requestRedraw(); this.dispatch("off") return; } diff --git a/src/js/HiPS.js b/src/js/HiPS.js index 4a97ad4c..071a5360 100644 --- a/src/js/HiPS.js +++ b/src/js/HiPS.js @@ -445,141 +445,6 @@ export let HiPS = (function () { self._saveInCache(); } - HiPS.prototype.setView = function (view) { - let self = this; - - // do not allow to call setView multiple times otherwise - // the querying to the properties and the search to the best - // HiPS node will be done again for the same hiPS - if (this.view) { - return; - } - this.view = view; - - if (this.localFiles) { - // Fetch the properties file - self.query = (async () => { - // look for the properties file - await HiPSProperties.fetchFromFile(self.localFiles["properties"]) - .then((p) => { - self._parseProperties(p); - - self.url = "local"; - - delete self.localFiles["properties"] - }) - - return self; - })(); - - return; - } - - let isIncompleteOptions = true; - - // This is very dirty but it allows me to differentiate the location from whether it is an ID or a plain url - let isID = this.url.includes("P/") || this.url.includes("C/") - - if (this.imgFormat === "fits") { - // a fits is given - isIncompleteOptions = !( - this.maxOrder && - (!isID && this.url) && - this.imgFormat && - this.tileSize && - this.cooFrame && - this.numBitsPerPixel - ); - } else { - isIncompleteOptions = !( - this.maxOrder && - (!isID && this.url) && - this.imgFormat && - this.tileSize && - this.cooFrame - ); - } - - self.query = (async () => { - if (isIncompleteOptions) { - // ID typed url - if (self.startUrl && isID) { - // First download the properties from the start url - await HiPSProperties.fetchFromUrl(self.startUrl) - .then((p) => { - self._parseProperties(p); - }) - - try { - // the url stores a "CDS ID" we take it prioritaly - // if the url is null, take the id, this is for some tests - // to pass because some users might just give null as url param and a "CDS ID" as id param - let id = self.url || self.id; - - self.url = self.startUrl; - - setTimeout( - () => { - if (!self.added) - return; - - HiPSProperties.fetchFromID(id) - .then((p) => { - //self.url = self.startUrl; - self._fetchFasterUrlFromProperties(p); - }) - }, - 1000 - ); - } catch (e) { - throw e; - } - } else if (!this.startUrl && isID) { - try { - // the url stores a "CDS ID" we take it prioritaly - // if the url is null, take the id, this is for some tests - // to pass because some users might just give null as url param and a "CDS ID" as id param - let id = self.url || self.id; - - await HiPSProperties.fetchFromID(id) - .then((p) => { - self.url = p.hips_service_url; - - self._parseProperties(p); - self._fetchFasterUrlFromProperties(p); - }) - } catch (e) { - throw e; - } - } else { - await HiPSProperties.fetchFromUrl(self.url) - .then((p) => { - self._parseProperties(p); - }) - } - } else { - self._parseProperties({ - hips_order: this.maxOrder, - hips_service_url: this.url, - hips_tile_width: this.tileSize, - hips_frame: this.cooFrame - }) - } - - return self; - })() - }; - - /* Precondition: view is attached */ - HiPS.prototype._saveInCache = function () { - let self = this; - let hipsCache = this.view.aladin.hipsCache; - - if (hipsCache.contains(self.id)) { - hipsCache.append(self.id, this) - } - }; - /** * Checks if the HiPS represents a planetary body. * @@ -711,15 +576,12 @@ export let HiPS = (function () { * * @memberof HiPS * - * @param {boolean} [additive=false] - - * - * @description Two rendering modes are availables i.e. the default one and the additive one. - * When rendering this survey on top of the already rendered ones, the final color of the screen is computed like: - *
- *
opacity * this_survey_color + (1 - opacity) * already_rendered_color for the default mode - *
opacity * this_survey_color + already_rendered_color for the additive mode - *
- *
+ * @param {boolean} [additive=false] - When rendering this survey on top of the already rendered ones, the final color of the screen is computed like: + *
+ *
opacity * this_survey_color + (1 - opacity) * already_rendered_color for the default mode + *
opacity * this_survey_color + already_rendered_color for the additive mode + *
+ *
* Additive mode allows you to do linear survey color combination i.e. let's define 3 surveys named s1, s2, s3. Each could be associated to one color channel, i.e. s1 with red, s2 with green and s3 with the blue color channel. * If the additive blending mode is enabled, then the final pixel color of your screen will be: rgb = [s1_opacity * s1_color; s2_opacity * s2_color; s3_opacity * s3_color] */ @@ -779,6 +641,13 @@ export let HiPS = (function () { this.setOptions({minCut, maxCut}) }; + /** + * Returns the low and high cuts under the form of a 2 element array + * + * @memberof HiPS + * + * @returns {number[]} The low and high cut values for the HiPS. + */ HiPS.prototype.getCuts = function () { return this.colorCfg.getCuts(); }; @@ -858,6 +727,24 @@ export let HiPS = (function () { } }; + /** + * Set color options generic method for changing colormap, opacity, ... of the HiPS + * + * @memberof HiPS + * + * @param {Object} options + * @param {number} [options.opacity=1.0] - Opacity of the survey or image (value between 0 and 1). + * @param {string} [options.colormap="native"] - The colormap configuration for the survey or image. + * @param {string} [options.stretch="linear"] - The stretch configuration for the survey or image. + * @param {boolean} [options.reversed=false] - If true, the colormap is reversed; otherwise, it is not reversed. + * @param {number} [options.minCut] - The minimum cut value for the color configuration. If not given, 0.0 for JPEG/PNG surveys, the value of the property file for FITS surveys + * @param {number} [options.maxCut] - The maximum cut value for the color configuration. If not given, 1.0 for JPEG/PNG surveys, the value of the property file for FITS surveys + * @param {boolean} [options.additive=false] - If true, additive blending is applied; otherwise, it is not applied. + * @param {number} [options.gamma=1.0] - The gamma correction value for the color configuration. + * @param {number} [options.saturation=0.0] - The saturation value for the color configuration. + * @param {number} [options.brightness=0.0] - The brightness value for the color configuration. + * @param {number} [options.contrast=0.0] - The contrast value for the color configuration. + */ HiPS.prototype.setOptions = function(options) { this.colorCfg.setOptions(options); this.options = {...this.options, ...options}; @@ -865,7 +752,196 @@ export let HiPS = (function () { this._updateMetadata(); }; - HiPS.prototype.add = function (layer) { + /** + * Toggle the HiPS turning its opacity to 0 back and forth + * + * @memberof HiPS + */ + HiPS.prototype.toggle = function () { + const opacity = this.getOpacity() + if (opacity != 0.0) { + this.prevOpacity = opacity; + this.setOpacity(0.0); + } else { + this.setOpacity(this.prevOpacity); + } + }; + + /** + * Old method for setting the opacity use {@link HiPS#setOpacity} instead + * + * @memberof HiPS + * @deprecated + */ + HiPS.prototype.setAlpha = HiPS.prototype.setOpacity; + + // @api + HiPS.prototype.getColorCfg = function () { + return this.colorCfg; + }; + + /** + * Get the opacity of the HiPS layer + * + * @memberof HiPS + * + * @returns {number} The opacity of the layer + */ + HiPS.prototype.getOpacity = function () { + return this.colorCfg.getOpacity(); + }; + + HiPS.prototype.getAlpha = HiPS.prototype.getOpacity; + + /** + * Read a specific screen pixel value + * + * @todo This has not yet been implemented + * @memberof HiPS + * @param {number} x - x axis in screen pixels to probe + * @param {number} y - y axis in screen pixels to probe + * @returns {number} the value of that pixel + */ + HiPS.prototype.readPixel = function (x, y) { + return this.view.wasm.readPixel(x, y, this.layer); + }; + + HiPS.prototype._setView = function (view) { + let self = this; + + // do not allow to call setView multiple times otherwise + // the querying to the properties and the search to the best + // HiPS node will be done again for the same hiPS + if (this.view) { + return; + } + this.view = view; + + if (this.localFiles) { + // Fetch the properties file + self.query = (async () => { + // look for the properties file + await HiPSProperties.fetchFromFile(self.localFiles["properties"]) + .then((p) => { + self._parseProperties(p); + + self.url = "local"; + + delete self.localFiles["properties"] + }) + + return self; + })(); + + return; + } + + let isIncompleteOptions = true; + + // This is very dirty but it allows me to differentiate the location from whether it is an ID or a plain url + let isID = this.url.includes("P/") || this.url.includes("C/") + + if (this.imgFormat === "fits") { + // a fits is given + isIncompleteOptions = !( + this.maxOrder && + (!isID && this.url) && + this.imgFormat && + this.tileSize && + this.cooFrame && + this.numBitsPerPixel + ); + } else { + isIncompleteOptions = !( + this.maxOrder && + (!isID && this.url) && + this.imgFormat && + this.tileSize && + this.cooFrame + ); + } + + self.query = (async () => { + if (isIncompleteOptions) { + // ID typed url + if (self.startUrl && isID) { + // First download the properties from the start url + await HiPSProperties.fetchFromUrl(self.startUrl) + .then((p) => { + self._parseProperties(p); + }) + + try { + // the url stores a "CDS ID" we take it prioritaly + // if the url is null, take the id, this is for some tests + // to pass because some users might just give null as url param and a "CDS ID" as id param + let id = self.url || self.id; + + self.url = self.startUrl; + + setTimeout( + () => { + if (!self.added) + return; + + HiPSProperties.fetchFromID(id) + .then((p) => { + //self.url = self.startUrl; + self._fetchFasterUrlFromProperties(p); + }) + }, + 1000 + ); + } catch (e) { + throw e; + } + } else if (!this.startUrl && isID) { + try { + // the url stores a "CDS ID" we take it prioritaly + // if the url is null, take the id, this is for some tests + // to pass because some users might just give null as url param and a "CDS ID" as id param + let id = self.url || self.id; + + await HiPSProperties.fetchFromID(id) + .then((p) => { + self.url = p.hips_service_url; + + self._parseProperties(p); + self._fetchFasterUrlFromProperties(p); + }) + } catch (e) { + throw e; + } + } else { + await HiPSProperties.fetchFromUrl(self.url) + .then((p) => { + self._parseProperties(p); + }) + } + } else { + self._parseProperties({ + hips_order: this.maxOrder, + hips_service_url: this.url, + hips_tile_width: this.tileSize, + hips_frame: this.cooFrame + }) + } + + return self; + })() + }; + + /* Precondition: view is attached */ + HiPS.prototype._saveInCache = function () { + let self = this; + let hipsCache = this.view.aladin.hipsCache; + + if (hipsCache.contains(self.id)) { + hipsCache.append(self.id, this) + } + }; + + HiPS.prototype._add = function (layer) { this.layer = layer; let self = this; @@ -935,43 +1011,6 @@ export let HiPS = (function () { }); }; - // @api - HiPS.prototype.toggle = function () { - const opacity = this.getOpacity() - if (opacity != 0.0) { - this.prevOpacity = opacity; - this.setOpacity(0.0); - } else { - this.setOpacity(this.prevOpacity); - } - }; - - // @oldapi - HiPS.prototype.setAlpha = HiPS.prototype.setOpacity; - - HiPS.prototype.setColorCfg = function (colorCfg) { - this.colorCfg = colorCfg; - - this._updateMetadata(); - }; - - // @api - HiPS.prototype.getColorCfg = function () { - return this.colorCfg; - }; - - // @api - HiPS.prototype.getOpacity = function () { - return this.colorCfg.getOpacity(); - }; - - HiPS.prototype.getAlpha = HiPS.prototype.getOpacity; - - // @api - HiPS.prototype.readPixel = function (x, y) { - return this.view.wasm.readPixel(x, y, this.layer); - }; - HiPS.DEFAULT_SURVEY_ID = "P/DSS2/color"; return HiPS; diff --git a/src/js/Image.js b/src/js/Image.js index b6c74040..42f484fe 100644 --- a/src/js/Image.js +++ b/src/js/Image.js @@ -127,7 +127,7 @@ export let Image = (function () { * @param {ImageOptions} [options] - The option for the survey * */ - let Image = function(url, options) { + function Image(url, options) { // Name of the layer this.layer = null; this.added = false; @@ -149,66 +149,288 @@ export let Image = (function () { let self = this; this.query = Promise.resolve(self); - } + }; - Image.prototype = { - /* Precondition: view is already attached */ - _saveInCache: HiPS.prototype._saveInCache, + /** + * Returns the low and high cuts under the form of a 2 element array + * + * @memberof Image + * @method + * + * @returns {number[]} The low and high cut values. + */ + Image.prototype.getCuts = HiPS.prototype.getCuts; + + /** + * Sets the opacity factor + * + * @memberof Image + * @method + * @param {number} opacity - Opacity of the survey to set. Between 0 and 1 + */ + Image.prototype.setOpacity = HiPS.prototype.setOpacity; + + /** + * Set color options generic method for changing colormap, opacity, ... + * + * @memberof Image + * @method + * @param {Object} options + * @param {number} [options.opacity=1.0] - Opacity of the survey or image (value between 0 and 1). + * @param {string} [options.colormap="native"] - The colormap configuration for the survey or image. + * @param {string} [options.stretch="linear"] - The stretch configuration for the survey or image. + * @param {boolean} [options.reversed=false] - If true, the colormap is reversed; otherwise, it is not reversed. + * @param {number} [options.minCut] - The minimum cut value for the color configuration. If not given, 0.0 for JPEG/PNG surveys, the value of the property file for FITS surveys + * @param {number} [options.maxCut] - The maximum cut value for the color configuration. If not given, 1.0 for JPEG/PNG surveys, the value of the property file for FITS surveys + * @param {boolean} [options.additive=false] - If true, additive blending is applied; otherwise, it is not applied. + * @param {number} [options.gamma=1.0] - The gamma correction value for the color configuration. + * @param {number} [options.saturation=0.0] - The saturation value for the color configuration. + * @param {number} [options.brightness=0.0] - The brightness value for the color configuration. + * @param {number} [options.contrast=0.0] - The contrast value for the color configuration. + */ + Image.prototype.setOptions = HiPS.prototype.setOptions; // @api - getCuts: HiPS.prototype.getCuts, - - // @api - setOpacity: HiPS.prototype.setOpacity, + Image.prototype.setBlendingConfig = HiPS.prototype.setBlendingConfig; + + /** + * Set the colormap of an image + * + * @memberof Image + * @method + * @param {string} [colormap="grayscale"] - The colormap label to use. See {@link https://matplotlib.org/stable/users/explain/colors/colormaps.html|here} for more info about colormaps. + * Possible values are: + *
"blues" + *
"cividis" + *
"cubehelix" + *
"eosb" + *
"grayscale" + *
"inferno" + *
"magma" + *
"native" + *
"parula" + *
"plasma" + *
"rainbow" + *
"rdbu" + *
"rdylbu" + *
"redtemperature" + *
"sinebow" + *
"spectral" + *
"summer" + *
"viridis" + *
"ylgnbu" + *
"ylorbr" + *
"red" + *
"green" + *
"blue" + * @param {Object} [options] - Options for the colormap + * @param {string} [options.stretch] - Stretching function of the colormap. Possible values are 'linear', 'asinh', 'log', 'sqrt', 'pow'. If no given, will not change it. + * @param {boolean} [options.reversed=false] - Reverse the colormap axis. + */ + Image.prototype.setColormap = HiPS.prototype.setColormap; + + /** + * Set the cuts of the image + * + * @memberof Image + * @method + * @param {number} minCut - The low cut value. + * @param {number} maxCut - The high cut value. + */ + Image.prototype.setCuts = HiPS.prototype.setCuts; + + /** + * Sets the gamma correction factor. + * + * This method updates the gamma. + * + * @memberof Image + * @method + * @param {number} gamma - The saturation value to set for the image. Between 0.1 and 10 + */ + Image.prototype.setGamma = HiPS.prototype.setGamma; + + /** + * Sets the saturation. + * + * This method updates the saturation. + * + * @memberof Image + * @method + * @param {number} saturation - The saturation value. Between 0 and 1 + */ + Image.prototype.setSaturation = HiPS.prototype.setSaturation; + + /** + * Sets the brightness. + * + * This method updates the brightness. + * + * @memberof Image + * @method + * @param {number} brightness - The brightness value. Between 0 and 1 + */ + Image.prototype.setBrightness = HiPS.prototype.setBrightness; + + /** + * Sets the contrast. + * + * This method updates the contrast and triggers the update of metadata. + * + * @memberof Image + * @method + * @param {number} contrast - The contrast value. Between 0 and 1 + */ + Image.prototype.setContrast = HiPS.prototype.setContrast; + + /** + * Toggle the image turning its opacity to 0 back and forth + * + * @memberof Image + * @method + */ + Image.prototype.toggle = HiPS.prototype.toggle; + /** + * Old method for setting the opacity use {@link Image#setOpacity} instead + * + * @memberof Image + * @deprecated + */ + Image.prototype.setAlpha = HiPS.prototype.setOpacity; + + Image.prototype.getColorCfg = HiPS.prototype.getColorCfg; + + /** + * Get the opacity of the image layer + * + * @memberof HiPS + * + * @returns {number} The opacity of the layer + */ + Image.prototype.getOpacity = HiPS.prototype.getOpacity; + /** + * Use {@link Image#getOpacity} + * + * @memberof Image + * @method + * @deprecated + */ + Image.prototype.getAlpha = HiPS.prototype.getOpacity; + + /** + * Read a specific screen pixel value + * + * @todo This has not yet been implemented + * @memberof Image + * @method + * @param {number} x - x axis in screen pixels to probe + * @param {number} y - y axis in screen pixels to probe + * @returns {number} the value of that pixel + */ + Image.prototype.readPixel = HiPS.prototype.readPixel; + + + /** PRIVATE METHODS **/ + Image.prototype._setView = function (view) { + this.view = view; + this._saveInCache(); + }; + // FITS images does not mean to be used for storing planetary data + Image.prototype.isPlanetaryBody = function () { + return false; + }; // @api - setOptions: HiPS.prototype.setOptions, - // @api - setBlendingConfig: HiPS.prototype.setBlendingConfig, + Image.prototype.focusOn = function () { + // ensure the fits have been parsed + if (this.added) { + this.view.aladin.gotoRaDec(this.ra, this.dec); + this.view.aladin.setFoV(this.fov); + } + }; - // @api - setColormap: HiPS.prototype.setColormap, + /* Private method view is already attached */ + Image.prototype._saveInCache = HiPS.prototype._saveInCache; - // @api - setCuts: HiPS.prototype.setCuts, + // Private method for updating the view with the new meta + Image.prototype._updateMetadata = HiPS.prototype._updateMetadata; - // @api - setGamma: HiPS.prototype.setGamma, + Image.prototype._add = function (layer) { + this.layer = layer; - // @api - setSaturation: HiPS.prototype.setSaturation, + let self = this; + let promise; - setBrightness: HiPS.prototype.setBrightness, + if (this.imgFormat === 'fits') { + promise = this._addFITS(layer) + .catch(e => { + console.error(`Image located at ${this.url} could not be parsed as fits file. Is the imgFormat specified correct?`) + return Promise.reject(e) + }) + } else if (this.imgFormat === 'jpeg' || this.imgFormat === 'png') { + promise = this._addJPGOrPNG(layer) + .catch(e => { + console.error(`Image located at ${this.url} could not be parsed as a ${this.imgFormat} file. Is the imgFormat specified correct?`); + return Promise.reject(e) + }) + } else { + // imgformat not defined we will try first supposing it is a fits file and then use the jpg heuristic + promise = self._addFITS(layer) + .catch(e => { + return self._addJPGOrPNG(layer) + .catch(e => { + console.error(`Image located at ${self.url} could not be parsed as jpg/png/tif image file. Aborting...`) + return Promise.reject(e); + }) + }) + } - setContrast: HiPS.prototype.setContrast, + promise = promise.then((imageParams) => { + self.formats = [self.imgFormat]; - // @api - toggle: HiPS.prototype.toggle, - // @oldapi - setAlpha: HiPS.prototype.setOpacity, - - setColorCfg: HiPS.prototype.setColorCfg, - - // @api - getColorCfg: HiPS.prototype.getColorCfg, - - // @api - getOpacity: HiPS.prototype.getOpacity, - getAlpha: HiPS.prototype.getOpacity, - - // @api - readPixel: HiPS.prototype.readPixel, + // There is at least one entry in imageParams + self.added = true; + self._setView(self.view); - // Private method for updating the view with the new meta - _updateMetadata: HiPS.prototype._updateMetadata, + // Set the automatic computed cuts + let [minCut, maxCut] = self.getCuts(); + minCut = minCut || imageParams.min_cut; + maxCut = maxCut || imageParams.max_cut; + self.setCuts( + minCut, + maxCut + ); - setView: function (view) { - this.view = view; - this._saveInCache(); - }, + self.ra = imageParams.centered_fov.ra; + self.dec = imageParams.centered_fov.dec; + self.fov = imageParams.centered_fov.fov; + + // Call the success callback on the first HDU image parsed + if (self.successCallback) { + self.successCallback( + self.ra, + self.dec, + self.fov, + self + ); + } - _addFITS: function(layer) { + return self; + }) + .catch((e) => { + // This error result from a promise + // If I throw it, it will not be catched because + // it is run async + self.view.removeImageLayer(layer); + + return Promise.reject(e); + }); + + return promise; + }; + + Image.prototype._addFITS = function(layer) { let self = this; return Utils.fetch({ @@ -251,9 +473,9 @@ export let Image = (function () { return Promise.resolve(imageParams); }) - }, + }; - _addJPGOrPNG: function(layer) { + Image.prototype._addJPGOrPNG = function(layer) { let self = this; let img = document.createElement('img'); @@ -352,96 +574,7 @@ export let Image = (function () { .finally(() => { img.remove(); }); - }, - - add: function (layer) { - this.layer = layer; - - let self = this; - let promise; - - if (this.imgFormat === 'fits') { - promise = this._addFITS(layer) - .catch(e => { - console.error(`Image located at ${this.url} could not be parsed as fits file. Is the imgFormat specified correct?`) - return Promise.reject(e) - }) - } else if (this.imgFormat === 'jpeg' || this.imgFormat === 'png') { - promise = this._addJPGOrPNG(layer) - .catch(e => { - console.error(`Image located at ${this.url} could not be parsed as a ${this.imgFormat} file. Is the imgFormat specified correct?`); - return Promise.reject(e) - }) - } else { - // imgformat not defined we will try first supposing it is a fits file and then use the jpg heuristic - promise = self._addFITS(layer) - .catch(e => { - return self._addJPGOrPNG(layer) - .catch(e => { - console.error(`Image located at ${self.url} could not be parsed as jpg/png/tif image file. Aborting...`) - return Promise.reject(e); - }) - }) - } - - promise = promise.then((imageParams) => { - self.formats = [self.imgFormat]; - - // There is at least one entry in imageParams - self.added = true; - self.setView(self.view); - - // Set the automatic computed cuts - let [minCut, maxCut] = self.getCuts(); - minCut = minCut || imageParams.min_cut; - maxCut = maxCut || imageParams.max_cut; - self.setCuts( - minCut, - maxCut - ); - - self.ra = imageParams.centered_fov.ra; - self.dec = imageParams.centered_fov.dec; - self.fov = imageParams.centered_fov.fov; - - // Call the success callback on the first HDU image parsed - if (self.successCallback) { - self.successCallback( - self.ra, - self.dec, - self.fov, - self - ); - } - - return self; - }) - .catch((e) => { - // This error result from a promise - // If I throw it, it will not be catched because - // it is run async - self.view.removeImageLayer(layer); - - return Promise.reject(e); - }); - - return promise; - }, - - // FITS images does not mean to be used for storing planetary data - isPlanetaryBody: function () { - return false; - }, - - // @api - focusOn: function () { - // ensure the fits have been parsed - if (this.added) { - this.view.aladin.gotoRaDec(this.ra, this.dec); - this.view.aladin.setFoV(this.fov); - } - }, - }; + }; return Image; })(); diff --git a/src/js/View.js b/src/js/View.js index aabca3e2..a70edf1b 100644 --- a/src/js/View.js +++ b/src/js/View.js @@ -1668,7 +1668,7 @@ export let View = (function () { View.prototype.setOverlayImageLayer = function (imageLayer, layer = "overlay") { // set the view to the image layer object // do the properties query if needed - imageLayer.setView(this); + imageLayer._setView(this); // register its promise this.imageLayersBeingQueried.set(layer, imageLayer); @@ -1729,7 +1729,7 @@ export let View = (function () { // to the image layer objet (whether it is an HiPS or an Image) .then((imageLayer) => { // Add to the backend - const promise = imageLayer.add(layer); + const promise = imageLayer._add(layer); ALEvent.FETCH.dispatchedTo(document, {task}); return promise; diff --git a/src/js/vo/Datalink.js b/src/js/vo/Datalink.js index f09f8fef..5736952d 100644 --- a/src/js/vo/Datalink.js +++ b/src/js/vo/Datalink.js @@ -167,7 +167,14 @@ export let Datalink = (function() { let updateSlice = () => { let colorCfg = aladinInstance.getOverlayImageLayer(layer).getColorCfg(); let hips = aladinInstance.setOverlayImageLayer(cubeOnTheFlyUrl + idxSlice, layer) - hips.setColorCfg(colorCfg) + hips.setOptions({ + opacity: colorCfg.opacity, + minCut: colorCfg.minCut, + maxCut: colorCfg.maxCut, + colormap: colorCfg.colormap, + stretch: colorCfg.stretch, + reversed: colorCfg.reversed + }) slicer.update({ value: idxSlice,