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
5647e140
Commit
5647e140
authored
Dec 09, 2019
by
Caillat Michel
Browse files
Refactoring mostly. Work in progress
parent
91413587
Changes
1
Hide whitespace changes
Inline
Side-by-side
yafitsv/views/olqv_2d.ejs
View file @
5647e140
...
...
@@ -182,6 +182,7 @@ th, td {
<
%
include
olqv_customcontrols
%
>
<
%
include
olqv_reset
%
>
<
%
include
olqv_samp_publisher
%
>
<
%
include
olqv_boxes
%
>
<div
id=
"fullscreen"
class=
"fullscreen"
>
<div
class=
"sidepanel"
>
<nav
class=
"navbar navbar-dark bg-dark"
>
...
...
@@ -255,8 +256,27 @@ var yaFITSContoursGUI;
var
reset
;
var
settings
;
var
boxTool
;
function
SliceViewer
(
relFITSFilePath
,
width
,
height
,
RADECRangeInDegrees
,
FITSHeader
,
divSlice
)
{
var
format
=
function
(
floatValue
)
{
let
result
=
floatValue
;
if
(
typeof
result
===
"
number
"
&&
!
Number
.
isInteger
(
result
)){
result
=
result
.
toExponential
(
4
);
}
return
result
;
};
var
infos_line
=
document
.
getElementById
(
'
infos-line
'
);
var
infos_block
=
document
.
getElementById
(
'
ModalInfosBlockBody
'
);
var
populateInfosBlock
=
function
(
title
,
collection
)
{
infos_block
.
innerHTML
=
"
<b>
"
+
title
+
"
<br><br>
"
;
for
(
var
k
in
collection
)
{
infos_block
.
innerHTML
+=
k
+
"
:
"
+
format
(
collection
[
k
][
"
value
"
])
+
"
"
+
collection
[
k
][
"
unit
"
]
+
"
<br>
"
;
}
}
function
SliceViewer
(
relFITSFilePath
,
width
,
height
,
RADECRangeInDegrees
,
FITSHeader
,
divSlice
)
{
console
.
log
(
"
SliceViewer : entering
"
);
let
_relFITSFilePath
=
null
;
...
...
@@ -345,6 +365,14 @@ function SliceViewer ( relFITSFilePath, width, height, RADECRangeInDegrees, FITS
return
result
;
};
this
.
getSliceIndex
=
function
()
{
return
_sliceIndex
;
}
this
.
getRelFITSFilePath
=
function
()
{
return
_relFITSFilePath
;
}
this
.
reset
=
function
()
{
_map_1
.
getView
().
setCenter
(
ol
.
extent
.
getCenter
(
_extent
));
_map_1
.
getView
().
setResolution
(
1
);
...
...
@@ -566,33 +594,16 @@ var _marker_styles_f = function(feature) {
_selected_features_1
=
event
.
target
.
getFeatures
();
_deselected_features_1
=
event
.
deselected
;
let
infos_line
=
document
.
getElementById
(
'
infos-line
'
);
let
infos_block
=
document
.
getElementById
(
'
ModalInfosBlockBody
'
);
// Update the displayed integrated flux accordingly with the selected box.
if
(
_selected_features_1
.
getLength
()
==
1
)
{
let
selectedFeature
=
_selected_features_1
.
item
(
0
);
let
featureType
=
selectedFeature
.
getGeometry
().
getType
();
let
format
=
function
(
floatValue
)
{
let
result
=
floatValue
;
if
(
typeof
result
===
"
number
"
&&
!
Number
.
isInteger
(
result
)){
result
=
result
.
toExponential
(
4
);
}
return
result
;
};
let
populateInfosBlock
=
function
(
title
,
collection
)
{
infos_block
.
innerHTML
=
"
<b>
"
+
title
+
"
<br><br>
"
;
for
(
var
k
in
collection
)
{
infos_block
.
innerHTML
+=
k
+
"
:
"
+
format
(
collection
[
k
][
"
value
"
])
+
"
"
+
collection
[
k
][
"
unit
"
]
+
"
<br>
"
;
}
}
switch
(
featureType
)
{
case
'
Polygon
'
:
infos_line
.
innerHTML
=
'
Integrated flux :
'
+
_box_infos_1
[
_
selected
_f
eature
s_1
.
item
(
0
).
getId
()][
"
flux
"
].
toExponential
(
3
)
+
'
Jy
'
;
boxFactory
.
selected
(
selected
F
eature
)
;
break
;
case
'
LineString
'
:
var
coordinates
=
selectedFeature
.
getGeometry
().
getCoordinates
();
let
properties
=
selectedFeature
.
get
(
"
properties
"
);
...
...
@@ -681,21 +692,21 @@ var _marker_styles_f = function(feature) {
/*
** This is our dragbox interaction
*/
_dragBox_1
=
new
ol
.
interaction
.
DragBox
();
//
_dragBox_1 = new ol.interaction.DragBox();
/*
** And its behaviour.
*/
_dragBox_1
.
on
(
'
boxend
'
,
function
()
{
console
.
log
(
"
_dragBox_1.on('boxend', function() { : entering
"
);
var
extent
=
_dragBox_1
.
getGeometry
().
getExtent
();
// The real work when a drag box interaction reach its end is done below
_getSumOverSliceRectAreaWithPOST
(
_relFITSFilePath
,
0
,
0
,
extent
);
console
.
log
(
JSON
.
stringify
(
extent
));
console
.
log
(
"
_dragBox_1.on('boxend', function() { : exiting
"
);
});
//
_dragBox_1.on('boxend', function() {
//
console.log(" _dragBox_1.on('boxend', function() { : entering");
//
var extent = _dragBox_1.getGeometry().getExtent();
//
//
// The real work when a drag box interaction reach its end is done below
//
_getSumOverSliceRectAreaWithPOST(_relFITSFilePath, 0, 0, extent);
//
//
console.log(JSON.stringify(extent));
//
console.log(" _dragBox_1.on('boxend', function() { : exiting");
//
});
let
_updateSliceWithPOST
=
function
()
{
...
...
@@ -863,22 +874,22 @@ var _marker_styles_f = function(feature) {
break
;
// B
case
66
:
if
(
_interaction_mode
==
""
)
{
// Has to see with boxes
_interaction_mode
=
"
box
"
;
_map_1
.
removeInteraction
(
_select_1
);
// Enter box mode
_map_1
.
addInteraction
(
_dragBox_1
);
jTarget
.
css
(
'
cursor
'
,
'
nwse-resize
'
);
}
else
if
(
_interaction_mode
==
"
box
"
)
{
// Leave box mode
_interaction_mode
=
""
;
_map_1
.
removeInteraction
(
_dragBox_1
);
_map_1
.
addInteraction
(
_select_1
);
jTarget
.
css
(
'
cursor
'
,
'
pointer
'
);
}
break
;
//
case 66 :
//
if (_interaction_mode == "") { // Has to see with boxes
//
_interaction_mode = "box";
//
_map_1.removeInteraction(_select_1); // Enter box mode
//
_map_1.addInteraction(_dragBox_1);
//
//
jTarget.css('cursor','nwse-resize');
//
}
//
else if (_interaction_mode == "box") { // Leave box mode
//
_interaction_mode = "";
//
_map_1.removeInteraction(_dragBox_1);
//
_map_1.addInteraction(_select_1);
//
//
jTarget.css('cursor','pointer');
//
}
//
break;
// X
case
88
:
...
...
@@ -1123,20 +1134,22 @@ $( document ).ready(function() {
settings
=
new
Settings
(
sliceViewer
);
customControls
.
addButton
(
settings
.
getButton
());
<%
if
(
useSAMP
){
%>
publishSAMP
=
new
PublishSAMP
(
sAMPPublisher
);
customControls
.
addButton
(
publishSAMP
.
getButton
());
<%
}
%>
markerFactory
=
new
MarkerFactory
(
sliceViewer
);
customControls
.
addButton
(
markerFactory
.
getButton
());
yAFITSContoursViewer
=
new
ContoursViewer
(
relFITSFilePath
,
sliceViewer
);
customControls
.
addButton
(
yAFITSContoursViewer
.
getButton
());
<%
if
(
useSAMP
){
%>
publishSAMP
=
new
PublishSAMP
(
sAMPPublisher
);
customControls
.
addButton
(
publishSAMP
.
getButton
());
<%
}
%>
yAFITSContoursGUI
=
new
ContoursGUI
();
yAFITSContoursGUI
.
connect
(
yAFITSContoursViewer
,
sliceViewer
);
boxFactory
=
new
BoxFactory
(
sliceViewer
);
customControls
.
addButton
(
boxFactory
.
getButton
());
$
(
'
a#rccap
'
).
click
(
function
()
{
sliceViewer
.
refresh
()});
console
.
log
(
'
$.post("", {"method": "RADECRangeInDegrees", "fileName": relFITSFilePath}).done(function (resp) { : exiting
'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment