Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Caillat Michel
yafits
Commits
14fd0e35
Commit
14fd0e35
authored
Jan 24, 2020
by
Caillat Michel
Browse files
Fix animation problem on bottom graph
parent
51ab4b9e
Changes
2
Show whitespace changes
Inline
Side-by-side
yafitsv/public/stylesheets/olqv.css
View file @
14fd0e35
...
...
@@ -16,8 +16,10 @@ h4 {font-size: 1em; margin: 30px 0 15px 0;}
top
:
0
;
left
:
0
;
z-index
:
100
;
/*width: 100vw;
height: 100vh;*/
width
:
100vw
;
height
:
100
vh
;
height
:
1
2
00
px
;
background-color
:
rgba
(
192
,
192
,
192
,
0.5
);
background-image
:
url("../MnyxU.gif")
;
background-repeat
:
no-repeat
;
...
...
@@ -142,6 +144,7 @@ h4 {font-size: 1em; margin: 30px 0 15px 0;}
.chart-container
>
.row
>
.chart-plot
{
max-width
:
100%
;
padding-left
:
0
;
padding-top
:
5em
;
}
.hidden
{
...
...
yafitsv/views/olqv.ejs
View file @
14fd0e35
<!DOCTYPE html>
<html>
<head>
<title><
%=
title
%
></title>
...
...
@@ -7,10 +8,15 @@
<!--script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> -->
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
type=
"text/javascript"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity=
"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"
integrity=
"sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity=
"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"
integrity=
"sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.js"
></script>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
integrity=
"sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
integrity=
"sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
crossorigin=
"anonymous"
>
<script
src=
"https://code.highcharts.com/highcharts.src.js"
></script>
<script
src=
"https://code.highcharts.com/modules/boost.js"
></script>
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
...
...
@@ -22,12 +28,12 @@
<script
src=
"../javascript/FITSHeaderTable.js"
></script>
<script
src=
"../javascript/olqv_utils.js"
></script>
<!-- <script src="https://openlayers.org/en/v4.6.4/build/ol.js" type="text/javascript"></script> -->
<!-- <script src="https://openlayers.org/en/v4.6.4/build/ol.js" type="text/javascript"></script> -->
<!-- Conditional code generation -->
<
%
if
(
useSAMP
){%
>
<
%
if
(
useSAMP
){%
>
<script
src=
"../javascript/samp.js"
></script>
<script
src=
"../javascript/samp_utils.js"
></script>
<
%}%
>
<
%}%
>
<!-- End of conditional code generation -->
</head>
...
...
@@ -73,7 +79,7 @@
</nav>
</div>
<
%}%
>
<
%}%
>
</div>
</div>
<nav
class=
"navbar navbar-dark bg-dark"
>
...
...
@@ -228,17 +234,25 @@
var
ENTER
=
function
()
{
console
.
log
(
arguments
.
callee
.
name
+
"
: entering.
"
);
};
var
EXIT
=
function
()
{
console
.
log
(
arguments
.
callee
.
name
+
"
: exiting.
"
);
};
<%
if
(
useSAMP
){
%>
<%
if
(
useSAMP
)
{
%>
var
sAMPPublisher
=
null
;
<%
}
%>
var
ROI
;
var
summedPixelsSpectrumChart
;
var
spectrumChart
;
var
viewIn3D
=
function
()
{
window
.
open
(
"
getYtObj?relFITSFilePath=
"
+
relFITSFilePath
+
"
&iRA0=
"
+
ROI
.
iRA0
+
"
&iRA1=
"
+
ROI
.
iRA1
+
"
&iDEC0=
"
+
ROI
.
iDEC0
+
"
&iDEC1=
"
+
ROI
.
iDEC1
+
"
&iFREQ0=
"
+
ROI
.
iFREQ0
+
"
&iFREQ1=
"
+
ROI
.
iFREQ1
);
var
viewIn3D
=
function
()
{
window
.
open
(
"
getYtObj?relFITSFilePath=
"
+
relFITSFilePath
+
"
&iRA0=
"
+
ROI
.
iRA0
+
"
&iRA1=
"
+
ROI
.
iRA1
+
"
&iDEC0=
"
+
ROI
.
iDEC0
+
"
&iDEC1=
"
+
ROI
.
iDEC1
+
"
&iFREQ0=
"
+
ROI
.
iFREQ0
+
"
&iFREQ1=
"
+
ROI
.
iFREQ1
);
};
var
showLoaderAction
=
function
(
enable
){
if
(
enable
){
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
block
'
;
}
else
{
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
none
'
;
}
}
var
handleEvent
=
function
(
evt
)
{
console
.
log
(
JSON
.
stringify
(
evt
,
null
,
4
));
return
true
;
...
...
@@ -247,16 +261,16 @@
/**
Add a series where Y=0 in the given chart
*/
function
addYAxisSeries
(
chart
){
function
addYAxisSeries
(
chart
)
{
chart
.
addSeries
({
lineWidth
:
1
,
enableMouseTracking
:
false
,
showInLegend
:
false
,
color
:
"
#000000
"
,
marker
:
{
enabled
:
false
lineWidth
:
1
,
enableMouseTracking
:
false
,
showInLegend
:
false
,
color
:
"
#000000
"
,
marker
:
{
enabled
:
false
},
data
:
[[
chart
.
xAxis
[
0
].
dataMin
,
0
],
[
chart
.
xAxis
[
0
].
dataMax
,
0
]]
data
:
[[
chart
.
xAxis
[
0
].
dataMin
,
0
],
[
chart
.
xAxis
[
0
].
dataMax
,
0
]]
});
}
...
...
@@ -266,28 +280,28 @@
avgSpectrum array is reversed if data are radial velocities and
cdelt3 < 0
*/
function
getSummedSpectrumTitle
(
avgSpectrum
,
imin
,
imax
,
cdelt3prim
){
function
getSummedSpectrumTitle
(
avgSpectrum
,
imin
,
imax
,
cdelt3prim
)
{
let
result
=
0
;
if
(
_ctype3
===
'
VRAD
'
&&
_cdelt3
<
0
){
if
(
_ctype3
===
'
VRAD
'
&&
_cdelt3
<
0
)
{
let
copy
=
(
x
)
=>
x
;
let
arraycopy
=
avgSpectrum
.
map
(
copy
);
result
=
sumArr
(
arraycopy
.
reverse
(),
imin
,
imax
,
cdelt3prim
);
}
else
{
}
else
{
result
=
sumArr
(
avgSpectrum
,
imin
,
imax
,
cdelt3prim
);
}
return
result
/
unitRescale
(
summedPixelsSpectrumUnit
(
_bunit
));
return
result
/
unitRescale
(
summedPixelsSpectrumUnit
(
_bunit
));
}
function
getCalculatedIndex
(
value
)
{
function
getCalculatedIndex
(
value
)
{
let
result
=
0
;
if
(
_ctype3
===
'
VRAD
'
){
let
step1
=
(
unitFactor
[
defaultOutputUnit
[
_ctype3
]]
/
unitFactor
[
getCunit3
()])
/
_cdelt3
;
result
=
Math
.
abs
(
value
*
step1
)
-
_crval3
+
_crpix3
-
1
;
}
else
if
(
_ctype3
===
'
FREQ
'
)
{
if
(
_ctype3
===
'
VRAD
'
)
{
let
step1
=
(
unitFactor
[
defaultOutputUnit
[
_ctype3
]]
/
unitFactor
[
getCunit3
()])
/
_cdelt3
;
result
=
Math
.
abs
(
value
*
step1
)
-
_crval3
+
_crpix3
-
1
;
}
else
if
(
_ctype3
===
'
FREQ
'
)
{
// if ctype is FREQ we have to read defaultOutputUnit['VRAD']
let
step1
=
v2f
(
value
*
unitFactor
[
defaultOutputUnit
[
'
VRAD
'
]]
,
_restfreq
);
let
step1
=
v2f
(
value
*
unitFactor
[
defaultOutputUnit
[
'
VRAD
'
]],
_restfreq
);
let
step2
=
(
step1
-
_crval3
)
/
_cdelt3
;
result
=
step2
+
_crpix3
-
1
;
result
=
step2
+
_crpix3
-
1
;
}
return
Math
.
round
(
result
);
}
...
...
@@ -297,7 +311,7 @@
// in a popup bow located close to the position passed
// as a parameter.
//
function
LastClickMarker
(
map
)
{
function
LastClickMarker
(
map
)
{
var
_map
=
map
;
var
_overlay
=
null
;
var
_container
=
document
.
getElementById
(
'
popup
'
);
...
...
@@ -329,7 +343,7 @@
* Add a click handler to hide the popup.
* @return {boolean} Don't follow the href.
*/
_closer
.
onclick
=
function
()
{
_closer
.
onclick
=
function
()
{
_overlay
.
setPosition
(
undefined
);
_closer
.
blur
();
return
false
;
...
...
@@ -344,8 +358,8 @@
// stored in _lastCoordinate, _lastRADEC and _lastFluxDensity
//
var
_updateLastClickInfos
=
function
()
{
if
(
_lastCoordinate
==
null
)
return
;
_content
.
innerHTML
=
'
Chan#
'
+
_lastChanIndex
+
'
<br>
'
+
'
x =
'
+
_lastCoordinate
[
0
].
toFixed
(
0
)
+
'
, y =
'
+
_lastCoordinate
[
1
].
toFixed
(
0
)
+
'
<br>
'
+
if
(
_lastCoordinate
==
null
)
return
;
_content
.
innerHTML
=
'
Chan#
'
+
_lastChanIndex
+
'
<br>
'
+
'
x =
'
+
_lastCoordinate
[
0
].
toFixed
(
0
)
+
'
, y =
'
+
_lastCoordinate
[
1
].
toFixed
(
0
)
+
'
<br>
'
+
'
RA=
'
+
_lastRADEC
[
'
RA
'
]
+
'
<br>
'
+
'
DEC=
'
+
_lastRADEC
[
'
DEC
'
]
+
'
<br>
'
+
'
Value=
'
+
Number
(
_lastFluxDensity
).
toExponential
(
4
);
...
...
@@ -357,7 +371,7 @@
// public method to register the values to be displayed
// in the popup and update its content.
//
this
.
setPositionAndFluxDensity
=
function
(
data
)
{
this
.
setPositionAndFluxDensity
=
function
(
data
)
{
console
.
log
(
"
this.setPosition = function(coordinate) { : entering
"
);
_lastChanIndex
=
data
[
"
chanIndex
"
]
...
...
@@ -374,7 +388,7 @@
// public method to register the fluxDensity value passed as a parameter
// and update the popup content accordingly.
//
this
.
setFluxDensity
=
function
(
fluxDensity
,
sliceIndex
)
{
this
.
setFluxDensity
=
function
(
fluxDensity
,
sliceIndex
)
{
console
.
log
(
"
this.setFluxDensity = function(fluxDensity) { : entering
"
);
_lastFluxDensity
=
fluxDensity
;
_lastChanIndex
=
sliceIndex
;
...
...
@@ -396,7 +410,7 @@
var
_image
=
null
;
function
_onProgress
(
event
)
{
if
(
event
.
lengthComputable
)
{
var
percentComplete
=
(
event
.
loaded
/
event
.
total
)
*
100
;
var
percentComplete
=
(
event
.
loaded
/
event
.
total
)
*
100
;
console
.
log
(
"
Transfert: %d%%
"
,
percentComplete
);
}
else
{
// Impossible de calculer la progression puisque la taille totale est inconnue
...
...
@@ -418,7 +432,7 @@
}
else
{
console
.
log
(
"
Response status: %d (%s)
"
,
this
.
status
,
this
.
statusText
);
}
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
none
'
;
showLoaderAction
(
false
)
;
}
let
hidden_canvas_1
=
document
.
getElementById
(
"
hiddenSlice
"
);
...
...
@@ -428,11 +442,11 @@
// What happends when the image to be displayed in 'image'
// is loaded. To be used for _map_1
//
var
_imageLoadFunction_1
=
function
(
image
,
src
)
{
var
_imageLoadFunction_1
=
function
(
image
,
src
)
{
console
.
log
(
"
_imageLoadFunction_1 : entering
"
);
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
block
'
;
image
.
getImage
().
addEventListener
(
'
load
'
,
function
()
{
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
none
'
;
showLoaderAction
(
true
)
;
image
.
getImage
().
addEventListener
(
'
load
'
,
function
()
{
showLoaderAction
(
false
)
;
hidden_canvas_1
.
getContext
(
'
2d
'
).
drawImage
(
image
.
getImage
(),
0
,
0
);
});
...
...
@@ -446,11 +460,11 @@
// What happends when the image to be displayed in 'image'
// is loaded. To be used for _map_2
//
var
_imageLoadFunction_2
=
function
(
image
,
src
)
{
var
_imageLoadFunction_2
=
function
(
image
,
src
)
{
console
.
log
(
"
_imageLoadFunction_2 : entering
"
);
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
block
'
;
image
.
getImage
().
addEventListener
(
'
load
'
,
function
()
{
document
.
getElementById
(
'
loading
'
).
style
.
display
=
'
none
'
;
showLoaderAction
(
true
)
;
image
.
getImage
().
addEventListener
(
'
load
'
,
function
()
{
showLoaderAction
(
false
)
;
hidden_canvas_2
.
getContext
(
'
2d
'
).
drawImage
(
image
.
getImage
(),
0
,
0
);
});
...
...
@@ -461,7 +475,7 @@ var _imageLoadFunction_2 = function(image, src) {
};
var
SAMPPNGPublishControl
=
(
function
(
Control
)
{
var
SAMPPNGPublishControl
=
(
function
(
Control
)
{
function
SAMPPNGPublishControl
(
opt_options
)
{
var
options
=
opt_options
||
{};
var
button
=
document
.
createElement
(
'
button
'
);
...
...
@@ -476,17 +490,17 @@ var SAMPPNGPublishControl = (function (Control) {
target
:
options
.
target
});
this
.
handlePublish
=
function
()
{
;
}
this
.
handlePublish
=
function
()
{
;
}
button
.
addEventListener
(
'
click
'
,
this
.
handlePublish
.
bind
(
this
),
false
);
this
.
setHandler
=
function
(
handler
)
{
console
.
log
(
"
Changing handler
"
);
button
.
addEventListener
(
'
click
'
,
handler
.
bind
(
this
),
false
)};
this
.
setHandler
=
function
(
handler
)
{
console
.
log
(
"
Changing handler
"
);
button
.
addEventListener
(
'
click
'
,
handler
.
bind
(
this
),
false
)
};
}
if
(
Control
)
SAMPPNGPublishControl
.
__proto__
=
Control
;
SAMPPNGPublishControl
.
prototype
=
Object
.
create
(
Control
&&
Control
.
prototype
);
if
(
Control
)
SAMPPNGPublishControl
.
__proto__
=
Control
;
SAMPPNGPublishControl
.
prototype
=
Object
.
create
(
Control
&&
Control
.
prototype
);
SAMPPNGPublishControl
.
prototype
.
constructor
=
SAMPPNGPublishControl
;
return
SAMPPNGPublishControl
;
}(
ol
.
control
.
Control
));
}(
ol
.
control
.
Control
));
/*
...
...
@@ -496,7 +510,7 @@ var SAMPPNGPublishControl = (function (Control) {
*/
var
_canvasContext_1
=
null
;
function
SliceViewer
(
relFITSFilePath
,
width
,
height
,
RADECRangeInDegrees
,
FITSHeader
,
divSlice
,
divSummedSlices
)
{
function
SliceViewer
(
relFITSFilePath
,
width
,
height
,
RADECRangeInDegrees
,
FITSHeader
,
divSlice
,
divSummedSlices
)
{
console
.
log
(
"
SliceViewer : entering
"
);
let
_relFITSFilePath
=
null
;
...
...
@@ -531,11 +545,11 @@ var SAMPPNGPublishControl = (function (Control) {
var
_sliceIndex
;
_relFITSFilePath
=
relFITSFilePath
;
_width
=
width
;
_height
=
height
;
_divSlice
=
divSlice
;
_divSummedSlices
=
divSummedSlices
;
_relFITSFilePath
=
relFITSFilePath
;
_width
=
width
;
_height
=
height
;
_divSlice
=
divSlice
;
_divSummedSlices
=
divSummedSlices
;
hidden_canvas_1
.
width
=
_width
;
hidden_canvas_1
.
height
=
_height
;
...
...
@@ -543,7 +557,7 @@ var SAMPPNGPublishControl = (function (Control) {
hidden_canvas_2
.
width
=
_width
;
hidden_canvas_2
.
height
=
_height
;
_extent
=
[
0
,
0
,
_width
-
1
,
_height
-
1
];
_extent
=
[
0
,
0
,
_width
-
1
,
_height
-
1
];
let
_ra0
=
RADECRangeInDegrees
[
0
][
0
];
let
_ra1
=
RADECRangeInDegrees
[
1
][
0
];
...
...
@@ -555,16 +569,16 @@ var SAMPPNGPublishControl = (function (Control) {
console
.
log
(
"
_dec0 =
"
+
DecDeg2HMS
(
_dec0
)
+
"
_dec1 =
"
+
DecDeg2HMS
(
_dec1
));
let
_raLabelFormatter
=
new
raLabelFormatter
(
_extent
[
0
],
_extent
[
2
],
_ra0
,
_ra1
);
let
_decLabelFormatter
=
new
decLabelFormatter
(
_extent
[
1
],
_extent
[
3
],
_dec0
,
_dec1
);
let
_raLabelFormatter
=
new
raLabelFormatter
(
_extent
[
0
],
_extent
[
2
],
_ra0
,
_ra1
);
let
_decLabelFormatter
=
new
decLabelFormatter
(
_extent
[
1
],
_extent
[
3
],
_dec0
,
_dec1
);
let
_coordinateFormatType_1
=
function
(
olc
)
{
let
result
;
var
ctx
=
hidden_canvas_1
.
getContext
(
'
2d
'
);
var
pixelAtPosition
=
ctx
.
getImageData
(
olc
[
0
],
height
-
olc
[
1
],
1
,
1
).
data
;
if
(
pixelAtPosition
)
{
var
data_steps_index
=
pixelAtPosition
.
slice
(
0
,
3
).
join
(
'
_
'
);
result
=
'
Chan#
'
+
_sliceIndex
+
"
,
"
+
_raLabelFormatter
.
format
(
olc
[
0
])
+
'
,
'
+
_decLabelFormatter
.
format
(
olc
[
1
])
+
'
,
'
+
(
_data_steps_1
[
data_steps_index
]).
toExponential
(
2
)
+
"
"
+
_bunit
;
if
(
pixelAtPosition
)
{
var
data_steps_index
=
pixelAtPosition
.
slice
(
0
,
3
).
join
(
'
_
'
);
result
=
'
Chan#
'
+
_sliceIndex
+
"
,
"
+
_raLabelFormatter
.
format
(
olc
[
0
])
+
'
,
'
+
_decLabelFormatter
.
format
(
olc
[
1
])
+
'
,
'
+
(
_data_steps_1
[
data_steps_index
]).
toExponential
(
2
)
+
"
"
+
_bunit
;
}
else
{
result
=
"
???
"
;
...
...
@@ -577,8 +591,8 @@ var SAMPPNGPublishControl = (function (Control) {
var
ctx
=
hidden_canvas_2
.
getContext
(
'
2d
'
);
var
pixelAtPosition
=
ctx
.
getImageData
(
olc
[
0
],
height
-
olc
[
1
],
1
,
1
).
data
;
if
(
pixelAtPosition
)
{
var
data_steps_index
=
pixelAtPosition
.
slice
(
0
,
3
).
join
(
'
_
'
);
result
=
_raLabelFormatter
.
format
(
olc
[
0
])
+
'
,
'
+
_decLabelFormatter
.
format
(
olc
[
1
])
+
'
,
'
+
_data_steps_2
[
data_steps_index
].
toExponential
(
1
)
+
"
"
+
summedPixelsUnit
(
_bunit
);
var
data_steps_index
=
pixelAtPosition
.
slice
(
0
,
3
).
join
(
'
_
'
);
result
=
_raLabelFormatter
.
format
(
olc
[
0
])
+
'
,
'
+
_decLabelFormatter
.
format
(
olc
[
1
])
+
'
,
'
+
_data_steps_2
[
data_steps_index
].
toExponential
(
1
)
+
"
"
+
summedPixelsUnit
(
_bunit
);
}
else
{
result
=
"
???
"
;
...
...
@@ -592,8 +606,8 @@ var SAMPPNGPublishControl = (function (Control) {
let
result
=
null
;
var
ctx
=
hidden_canvas_1
.
getContext
(
'
2d
'
);
var
pixelAtPosition
=
ctx
.
getImageData
(
pixelCoordinate
[
0
],
height
-
pixelCoordinate
[
1
],
1
,
1
).
data
;
if
(
pixelAtPosition
)
{
var
data_steps_index
=
pixelAtPosition
.
slice
(
0
,
3
).
join
(
'
_
'
);
if
(
pixelAtPosition
)
{
var
data_steps_index
=
pixelAtPosition
.
slice
(
0
,
3
).
join
(
'
_
'
);
result
=
_data_steps_1
[
data_steps_index
];
}
else
{
...
...
@@ -603,7 +617,7 @@ var SAMPPNGPublishControl = (function (Control) {
};
this
.
getRADEC
=
function
(
pixelCoordinate
)
{
return
{
'
RA
'
:
_raLabelFormatter
.
format
(
pixelCoordinate
[
0
]),
'
DEC
'
:
_decLabelFormatter
.
format
(
pixelCoordinate
[
1
])
}
return
{
'
RA
'
:
_raLabelFormatter
.
format
(
pixelCoordinate
[
0
]),
'
DEC
'
:
_decLabelFormatter
.
format
(
pixelCoordinate
[
1
])
}
};
/*
...
...
@@ -621,15 +635,17 @@ var SAMPPNGPublishControl = (function (Control) {
className
:
'
custom-mouse-position
'
,
target
:
document
.
getElementById
(
'
external_mouse_position_1
'
),
undefinedHTML
:
''
,
coordinateFormat
:
_coordinateFormatType_1
}),
coordinateFormat
:
_coordinateFormatType_1
}),
new
ol
.
control
.
MousePosition
({
className
:
'
custom-mouse-position
'
,
target
:
document
.
getElementById
(
'
external_mouse_position_2
'
),
undefinedHTML
:
''
,
coordinateFormat
:
_coordinateFormatType_2
}),
coordinateFormat
:
_coordinateFormatType_2
}),
new
ol
.
control
.
FullScreen
()
];
<%
if
(
useSAMP
){
%>
<%
if
(
useSAMP
)
{
%>
let
_sAMPPNGPublishControl_1
=
new
SAMPPNGPublishControl
();
_sAMPPNGPublishControl_1
.
setHandler
(
sAMPPublisher
.
sendPNGSlice
);
<%
}
%>
...
...
@@ -640,7 +656,7 @@ var SAMPPNGPublishControl = (function (Control) {
center
:
ol
.
extent
.
getCenter
(
_extent
),
resolution
:
hidden_canvas_1
.
width
/
512
})
<%
if
(
useSAMP
){
%>
<%
if
(
useSAMP
)
{
%>
,
controls
:
ol
.
control
.
defaults
().
extend
([
_sAMPPNGPublishControl_1
...
...
@@ -657,23 +673,23 @@ var SAMPPNGPublishControl = (function (Control) {
}),
//targetSize: 75,
lonLabelFormatter
:
_raLabelFormatter
.
format
,
lonLabelStyle
:
new
ol
.
style
.
Text
({
lonLabelStyle
:
new
ol
.
style
.
Text
({
font
:
'
12px Calibri,sans-serif
'
,
textBaseline
:
'
bottom
'
,
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(0,0,0,1)
'
}),
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'
rgba(255,255,255,1)
'
,
width
:
3
})
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(0,0,0,1)
'
}),
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'
rgba(255,255,255,1)
'
,
width
:
3
})
}),
latLabelFormatter
:
_decLabelFormatter
.
format
});
document
.
getElementById
(
"
slice
"
).
addEventListener
(
"
mouseenter
"
,
function
()
{
_map_controls_1
.
forEach
(
function
(
ctrl
)
{
document
.
getElementById
(
"
slice
"
).
addEventListener
(
"
mouseenter
"
,
function
()
{
_map_controls_1
.
forEach
(
function
(
ctrl
)
{
_map_1
.
addControl
(
ctrl
);
});
});
document
.
getElementById
(
"
slice
"
).
addEventListener
(
"
mouseleave
"
,
function
()
{
_map_controls_1
.
forEach
(
function
(
ctrl
)
{
document
.
getElementById
(
"
slice
"
).
addEventListener
(
"
mouseleave
"
,
function
()
{
_map_controls_1
.
forEach
(
function
(
ctrl
)
{
_map_1
.
removeControl
(
ctrl
);
});
});
...
...
@@ -684,14 +700,16 @@ var SAMPPNGPublishControl = (function (Control) {
this
.
markLastClickInSlice
=
function
(
coordinate
)
{
_lastClickMarker_1
.
setPositionAndFluxDensity
(
{
"
coordinate
"
:
coordinate
,
{
"
coordinate
"
:
coordinate
,
"
chanIndex
"
:
_sliceIndex
,
"
RADEC
"
:
this
.
getRADEC
(
coordinate
),
"
fluxDensity
"
:
"
t.b.d.
"
}
"
RADEC
"
:
this
.
getRADEC
(
coordinate
),
"
fluxDensity
"
:
"
t.b.d.
"
}
);
};
this
.
setFluxDensityInPopup
=
function
(
density
)
{
this
.
setFluxDensityInPopup
=
function
(
density
)
{
_lastClickMarker_1
.
setFluxDensity
(
density
*
unitRescale
(
_bunit
),
_sliceIndex
);
}
...
...
@@ -710,16 +728,18 @@ var SAMPPNGPublishControl = (function (Control) {
className
:
'
custom-mouse-position
'
,
target
:
document
.
getElementById
(
'
external_mouse_position_1
'
),
undefinedHTML
:
''
,
coordinateFormat
:
_coordinateFormatType_1
}),
coordinateFormat
:
_coordinateFormatType_1
}),
new
ol
.
control
.
MousePosition
({
className
:
'
custom-mouse-position
'
,
target
:
document
.
getElementById
(
'
external_mouse_position_2
'
),
undefinedHTML
:
''
,
coordinateFormat
:
_coordinateFormatType_2
}),
coordinateFormat
:
_coordinateFormatType_2
}),
new
ol
.
control
.
FullScreen
()
];
<%
if
(
useSAMP
){
%>
<%
if
(
useSAMP
)
{
%>
let
_sAMPPNGPublishControl_2
=
new
SAMPPNGPublishControl
();
_sAMPPNGPublishControl_2
.
setHandler
(
sAMPPublisher
.
sendPNGSummedSlices
);
<%
}
%>
...
...
@@ -731,7 +751,7 @@ var SAMPPNGPublishControl = (function (Control) {
center
:
ol
.
extent
.
getCenter
(
_extent
),
resolution
:
hidden_canvas_2
.
width
/
512
})
<%
if
(
useSAMP
){
%>
<%
if
(
useSAMP
)
{
%>
,
controls
:
ol
.
control
.
defaults
().
extend
([
_sAMPPNGPublishControl_2
...
...
@@ -739,14 +759,14 @@ var SAMPPNGPublishControl = (function (Control) {
<%
}
%>
});
document
.
getElementById
(
"
summedslices
"
).
addEventListener
(
"
mouseenter
"
,
function
()
{
_map_controls_2
.
forEach
(
function
(
ctrl
)
{
document
.
getElementById
(
"
summedslices
"
).
addEventListener
(
"
mouseenter
"
,
function
()
{
_map_controls_2
.
forEach
(
function
(
ctrl
)
{
_map_2
.
addControl
(
ctrl
);
});
});
document
.
getElementById
(
"
summedslices
"
).
addEventListener
(
"
mouseleave
"
,
function
()
{
_map_controls_2
.
forEach
(
function
(
ctrl
)
{
document
.
getElementById
(
"
summedslices
"
).
addEventListener
(
"
mouseleave
"
,
function
()
{
_map_controls_2
.
forEach
(
function
(
ctrl
)
{
_map_2
.
removeControl
(
ctrl
);
});
});
...
...
@@ -770,11 +790,11 @@ var SAMPPNGPublishControl = (function (Control) {
// Here we have all the stuff to create boxes on summedslices
// and trigger the update of the spectrum of sums of pixels per slice
_box_source_2
=
new
ol
.
source
.
Vector
({
wrapX
:
false
});
_box_layer_2
=
new
ol
.
layer
.
Vector
({
source
:
_box_source_2
});
_box_source_2
=
new
ol
.
source
.
Vector
({
wrapX
:
false
});
_box_layer_2
=
new
ol
.
layer
.
Vector
({
source
:
_box_source_2
});
_select_2
=
new
ol
.
interaction
.
Select
({
condition
:
ol
.
events
.
pointerMove
});
_select_2
.
on
(
'
select
'
,
function
(
e
)
{
_select_2
=
new
ol
.
interaction
.
Select
({
condition
:
ol
.
events
.
pointerMove
});
_select_2
.
on
(
'
select
'
,
function
(
e
)
{
console
.
log
(
e
.
target
.
getFeatures
().
getLength
()
+
'
selected features (last operation selected
'
+
e
.
selected
.
length
+
...
...
@@ -793,7 +813,7 @@ var SAMPPNGPublishControl = (function (Control) {
_map_2
.
addInteraction
(
_select_2
);
_dragBox_2
=
new
ol
.
interaction
.
DragBox
();
_dragBox_2
.
on
(
'
boxend
'
,
function
()
{
_dragBox_2
.
on
(
'
boxend
'
,
function
()
{
var
extent
=
_dragBox_2
.
getGeometry
().
getExtent
();
var
tl
=
ol
.
extent
.
getTopLeft
(
extent
);
var
tr
=
ol
.
extent
.
getTopRight
(
extent
);
...
...
@@ -801,7 +821,7 @@ var SAMPPNGPublishControl = (function (Control) {
var
bl
=
ol
.
extent
.
getBottomLeft
(
extent
);
var
corners
=
[]
corners
.
push
(
tl
,
tr
,
br
,
bl
,
tl
);
corners
.
push
(
tl
,
tr
,
br
,
bl
,
tl
);
var
ln
=
new
ol
.
geom
.
LinearRing
(
corners
);
var
style
=
{
...
...
@@ -811,7 +831,7 @@ var SAMPPNGPublishControl = (function (Control) {
fillColor
:
"
#00FF00
"
,
fillOpacity
:
0.8
,
};
var
pf
=
new
ol
.
Feature
({
geometry
:
new
ol
.
geom
.
Polygon
([
corners
])});
var
pf
=
new
ol
.
Feature
({
geometry
:
new
ol
.
geom
.
Polygon
([
corners
])
});
_box_source_2
.
addFeature
(
pf
);
})
...
...
@@ -819,19 +839,19 @@ var SAMPPNGPublishControl = (function (Control) {
let
_updateSliceWithPOST
=
function
()
{
console
.
log
(
'
_updateSliceWithPOST: entering
'
);
document
.
getElementById
(
'
loading
'
).
style
.
display
=
"
block
"
;
showLoaderAction
(
true
)
;
ittName
=
$
(
'
#ITTSelector
'
).
find
(
'
:selected
'
).
text
().
trim
()
lutName
=
$
(
'
#LUTSelector
'
).
find
(
'
:selected
'
).
text
().
trim
()
vmName
=
$
(
'
#VideoModeSelector
'
).
find
(
'
:selected
'
).
text
().
trim
()
$
.
post
(
'
png
'
,
{
'
si
'
:
_sliceIndex
,
'
relFITSFilePath
'
:
_relFITSFilePath
,
'
ittName
'
:
ittName
,
'
lutName
'
:
lutName
,
'
vmName
'
:
vmName
}).
done
(
function
(
resp
)
{
$
.
post
(
'
png
'
,
{
'
si
'
:
_sliceIndex
,
'
relFITSFilePath
'
:
_relFITSFilePath
,
'
ittName
'
:
ittName
,
'
lutName
'
:
lutName
,
'
vmName
'
:
vmName
}).
done
(
function
(
resp
)
{
console
.
log
(
"
$.post('/png', {'si': _sliceIndex, 'relFITSFilePath': _relFITSFilePath}).done(: entering
"
);
if
(
resp
[
"
status
"
]
==
false
)
{
alert
(
"
Something went wrong during the generation of the image. The message was '
"
+
resp
[
"
message
"
]
+
"
'
"
);
alert
(
"
Something went wrong during the generation of the image. The message was '
"
+
resp
[
"
message
"
]
+
"
'
"
);
}
else
{
_data_steps_1
=
resp
[
"
result
"
][
"
data_steps
"
];
if
(
_instrume
==
"
SITELLE
"
)
{
if
(
_instrume
==
"
SITELLE
"
)
{
for
(
var
k
in
_data_steps_1
)
{
if
(
_data_steps_1
.
hasOwnProperty
(
k
))
{
_data_steps_1
[
k
]
/=
Math
.
abs
(
3600
.
*
3600
.
*
_cdelt1
*
_cdelt2
);
...
...
@@ -845,24 +865,25 @@ var SAMPPNGPublishControl = (function (Control) {
_im_layer_1
=
new
ol
.
layer
.
Image
({
source
:
new
ol
.
source
.
ImageStatic
({
url
:
"
<%=urlRoot%>
"
+
"
/
"
+
path_to_png
,
url
:
"
<%=urlRoot%>
"
+
"
/
"
+
path_to_png
,
projection
:
_projection_1
,
imageExtent
:
_extent
,
imageLoadFunction
:
_imageLoadFunction_1
})
imageLoadFunction
:
_imageLoadFunction_1
})
});
_map_1
.
addLayer
(
_im_layer_1
);
}
<%
if
(
useSAMP
){
%>
<%
if
(
useSAMP
)
{
%>
sAMPPublisher
.
setSliceRelPNGPath
(
path_to_png
);
<%
}
%>
document
.
getElementById
(
'
loading
'
).
style
.
display
=
"
none
"
;
showLoaderAction
(
false
)
;
console
.
log
(
"
$.post('/png', {'si': _sliceIndex, 'path': _path}).done(: exiting
"
);
}
)
console
.
log
(
'
_updateSliceWithPOST: exiting
'
);
};
let
_displaySlice
=
function
(
relFITSFilePath
,
sliceIndex
)
{
let
_displaySlice
=
function
(
relFITSFilePath
,
sliceIndex
)
{