mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2026-01-15 14:34:28 -08:00
added getShareURL, getEmbedCode, setFov
This commit is contained in:
@@ -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 += '<link rel="stylesheet" href="http://aladin.u-strasbg.fr/AladinLite/api/v2/latest/aladin.min.css" />\n';
|
||||
s += '<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js" charset="utf-8"></script>\n';
|
||||
s += '<div id="aladin-lite-div" style="width:400px;height:400px;"></div>\n';
|
||||
s += '<script type="text/javascript" src="http://aladin.u-strasbg.fr/AladinLite/api/v2/latest/aladin.min.js" charset="utf-8"></script>\n';
|
||||
s += '<script type="text/javascript">\n';
|
||||
s += 'var aladin = A.aladin("#aladin-lite-div", {survey: "' + survey + 'P/DSS2/color", fov: ' + fov.toFixed(2) + ', target: "' + coo.format('s') + '"});\n';
|
||||
s += '</script>';
|
||||
return s;
|
||||
};
|
||||
|
||||
// @API
|
||||
/*
|
||||
* Creates remotely a HiPS from a FITS image URL and displays it
|
||||
|
||||
Reference in New Issue
Block a user