Commit a5b89170 authored by Caillat Michel's avatar Caillat Michel
Browse files

Material related to SAMP publishing. Publisher + Menu button

parent 4c670d06
<script>
var SAMPPublisher = function ( FITSHeader, connector) {
console.log("SAMPPublisher ctor: entering");
var _FITSHeader = FITSHeader;
var _connector = connector;
var _relSlicePNGPath = "";
_isPublishable = function () {
console.log("function ( _isPublishable = function () { entering");
console.log("function ( _isPublishable = function () { exiting");
return (_FITSHeader["CTYPE3"] === "FREQ" || _FITSHeader["CTYPE3"] === "VRAD") && _FITSHeader["NAXIS3"]>1;
}
this.sendPNGSlice = function() {
//_connector.runWithConnection(_sendPNGSlice);
console.log("SAMPPublisher.sendPNGSlice: entering");
var baseUrl = window.location.origin;
var pngUrl = "<%=urlRoot%>/"+_relSlicePNGPath;
console.log("About to send this message 'load "+pngUrl+"' to the HUB" );
var msg = new samp.Message("script.aladin.send", {"script": "load "+pngUrl});
_connector.connection.notifyAll([msg]);
console.log("SAMPPublisher.sendPNGSlice: exiting");
}
this.setSliceRelPNGPath = function(relSlicePNGPath) {
console.log("SAMPPublisher.setSliceRelPNGPath: entering");
_relSlicePNGPath = relSlicePNGPath;
console.log("Slice relative PNG path set to '"+_relSlicePNGPath+"'");
console.log("SAMPPublisher.setSliceRelPNGPath: exiting");
};
console.log("SAMPPublisher ctor: exiting");
}
class PublishSAMP {
constructor(sAMPPublisher) {
this.publisher = sAMPPublisher;
this.button = document.createElement("button");
this.button.setAttribute("type","button");
this.button.setAttribute("class", "btn btn-primary btn-sm");
this.button.setAttribute("data-tooltip", "tooltip");
this.button.setAttribute("title", "Publish image via a SAMP hub");
let x = document.createElement("span");
x.setAttribute("class", "fas fa-location-arrow");
this.button.appendChild(x);
$(this.button).on("click", function(event) {sAMPPublisher.sendPNGSlice()});
}
getButton() {
return this.button;
}
}
</script>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment