Files
aladin-lite/src/js/Source.js
tboch 4baa137428
2015-04-17 08:43:34 +00:00

94 lines
2.5 KiB
JavaScript

// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
//
/******************************************************************************
* Aladin Lite project
*
* File Source
*
* Author: Thomas Boch[CDS]
*
*****************************************************************************/
cds.Source = (function() {
// constructor
cds.Source = function(ra, dec, data, options) {
this.ra = ra;
this.dec = dec;
this.data = data;
this.catalog = null;
this.marker = (options && options.marker) || false;
if (this.marker) {
this.popupTitle = (options && options.popupTitle) ? options.popupTitle : '';
this.popupDesc = (options && options.popupDesc) ? options.popupDesc : '';
}
this.isShowing = true;
this.isSelected = false;
};
cds.Source.prototype.setCatalog = function(catalog) {
this.catalog = catalog;
};
cds.Source.prototype.show = function() {
if (this.isShowing) {
return;
}
this.isShowing = true;
if (this.catalog) {
this.catalog.reportChange();
}
};
cds.Source.prototype.hide = function() {
if (! this.isShowing) {
return;
}
this.isShowing = false;
if (this.catalog) {
this.catalog.reportChange();
}
};
cds.Source.prototype.select = function() {
if (this.isSelected) {
return;
}
this.isSelected = true;
if (this.catalog) {
this.catalog.reportChange();
}
};
cds.Source.prototype.deselect = function() {
if (! this.isSelected) {
return;
}
this.isSelected = false;
if (this.catalog) {
this.catalog.reportChange();
}
};
return cds.Source;
})();