From e0bdd5569869dfb6b79040a08d1cfbb9db1d72f2 Mon Sep 17 00:00:00 2001 From: tboch Date: Wed, 9 Dec 2015 08:45:51 +0000 Subject: [PATCH] added getShareURL, getEmbedCode, setFov --- src/js/Aladin.js | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/js/Aladin.js b/src/js/Aladin.js index f5fb29c0..e831f00f 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -390,7 +390,7 @@ Aladin = (function() { }; // @API - Aladin.prototype.setFoV = function(fovDegrees) { + Aladin.prototype.setFoV = Aladin.prototype.setFov = function(fovDegrees) { this.view.setZoom(fovDegrees); }; @@ -1190,6 +1190,44 @@ A.catalog = function(options) { return new cds.Catalog(options); }; +// @API +/* + * return a URL allowing to share the current view + */ +Aladin.prototype.getShareURL = function() { + var radec = this.getRaDec(); + var coo = new Coo(); + coo.prec = 7; + coo.lon = radec[0]; + coo.lat = radec[1]; + return 'http://aladin.u-strasbg.fr/AladinLite/?target=' + encodeURIComponent(coo.format('s')) + + '&fov=' + this.getFov()[0].toFixed(2) + '&survey=' + encodeURIComponent(this.getBaseImageLayer().id); +}; + +// @API +/* + * return, as a string, the HTML embed code + */ +Aladin.prototype.getEmbedCode = function() { + var radec = this.getRaDec(); + var coo = new Coo(); + coo.prec = 7; + coo.lon = radec[0]; + coo.lat = radec[1]; + + var survey = this.getBaseImageLayer().id; + var fov = this.getFov()[0]; + var s = ''; + s += '\n'; + s += '\n'; + s += '
\n'; + s += '\n'; + s += ''; + return s; +}; + // @API /* * Creates remotely a HiPS from a FITS image URL and displays it