Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSWeb
Commits
9843f07b
Commit
9843f07b
authored
1 year ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Divide abstract optinally in preamble and body [GRIDV-74]
parent
46b380ff
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
spatial/static/spatial/js/gridmap.js
+26
-2
26 additions, 2 deletions
spatial/static/spatial/js/gridmap.js
spatial/templates/spatial/gridmap.html
+19
-16
19 additions, 16 deletions
spatial/templates/spatial/gridmap.html
with
45 additions
and
18 deletions
spatial/static/spatial/js/gridmap.js
+
26
−
2
View file @
9843f07b
...
@@ -38,6 +38,10 @@ let WMSLayersDateBucket = {};
...
@@ -38,6 +38,10 @@ let WMSLayersDateBucket = {};
let
map
=
undefined
;
let
map
=
undefined
;
let
popup
=
undefined
;
let
popup
=
undefined
;
/**
* Handles moving forwards/backwards in time for the current layer type (Warning status, day degrees etc)
* @param {Integer} dayIndex the index in the time array (0 = first day in time series)
*/
async
function
switchLayer
(
dayIndex
)
async
function
switchLayer
(
dayIndex
)
{
{
currentTimestamp
=
timestamps
[
dayIndex
];
currentTimestamp
=
timestamps
[
dayIndex
];
...
@@ -63,11 +67,19 @@ async function switchLayer(dayIndex)
...
@@ -63,11 +67,19 @@ async function switchLayer(dayIndex)
setCurrentDate
(
dayIndex
);
setCurrentDate
(
dayIndex
);
}
}
/**
* Given the timeseries index, figure out which date it is and display in the time slider
* @param {Integer} layerIndex
*/
function
setCurrentDate
(
layerIndex
)
function
setCurrentDate
(
layerIndex
)
{
{
document
.
getElementById
(
"
currentDate
"
).
innerHTML
=
moment
(
parseInt
(
timestamps
[
layerIndex
])).
format
(
"
YYYY-MM-DD
"
);
document
.
getElementById
(
"
currentDate
"
).
innerHTML
=
moment
(
parseInt
(
timestamps
[
layerIndex
])).
format
(
"
YYYY-MM-DD
"
);
}
}
/**
*
* @returns The OpenLayers object for the currently visible layer
*/
function
getCurrentVisibleOLLayer
()
function
getCurrentVisibleOLLayer
()
{
{
// The WMS layer returned from mapserver is found
// The WMS layer returned from mapserver is found
...
@@ -95,7 +107,11 @@ function getLayersForCurrentTimestamp()
...
@@ -95,7 +107,11 @@ function getLayersForCurrentTimestamp()
}
}
/**
* Loads map and data, and sets up the initial view of the map
* @param {*} inputModelId model Id, e.g. PSILARTEMP
* @param {*} mapAttribution background map source information (displayed in the map)
*/
async
function
initGridMap
(
inputModelId
,
mapAttribution
)
{
async
function
initGridMap
(
inputModelId
,
mapAttribution
)
{
modelId
=
inputModelId
;
modelId
=
inputModelId
;
var
backgroundLayer
=
new
ol
.
layer
.
Tile
({
var
backgroundLayer
=
new
ol
.
layer
.
Tile
({
...
@@ -121,7 +137,15 @@ async function initGridMap(inputModelId, mapAttribution) {
...
@@ -121,7 +137,15 @@ async function initGridMap(inputModelId, mapAttribution) {
document
.
getElementById
(
"
modelTitle
"
).
innerHTML
=
capabilities
.
Service
.
Title
;
document
.
getElementById
(
"
modelTitle
"
).
innerHTML
=
capabilities
.
Service
.
Title
;
if
(
capabilities
.
Service
.
Abstract
!=
undefined
)
if
(
capabilities
.
Service
.
Abstract
!=
undefined
)
{
{
document
.
getElementById
(
"
modelAbstract
"
).
innerHTML
=
capabilities
.
Service
.
Abstract
.
replaceAll
(
"
\n\n
"
,
""
);
// TODO: Check for sections ("preamble" and "body")
let
el
=
new
DOMParser
().
parseFromString
(
capabilities
.
Service
.
Abstract
.
replaceAll
(
"
\n\n
"
,
""
),
"
text/html
"
);
let
preamble
=
el
.
getElementById
(
"
preamble
"
)
!=
null
?
el
.
getElementById
(
"
preamble
"
)
:
el
;
document
.
getElementById
(
"
modelAbstractPreamble
"
).
innerHTML
=
new
XMLSerializer
().
serializeToString
(
preamble
);
let
body
=
el
.
getElementById
(
"
body
"
)
!=
null
?
el
.
getElementById
(
"
body
"
)
:
null
;
if
(
body
!=
null
)
{
document
.
getElementById
(
"
modelAbstractBody
"
).
innerHTML
=
new
XMLSerializer
().
serializeToString
(
body
);
}
}
}
//console.info(capabilities);
//console.info(capabilities);
...
...
This diff is collapsed.
Click to expand it.
spatial/templates/spatial/gridmap.html
+
19
−
16
View file @
9843f07b
...
@@ -24,22 +24,25 @@
...
@@ -24,22 +24,25 @@
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
<!-- Start map container -->
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
id=
"mapContainer"
style=
"position: relative; height: 800px;"
>
<h2
id=
"modelTitle"
></h2>
<div
class=
"slidecontainer"
style=
"position: absolute; left: 20px; bottom: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;"
>
<div
id=
"modelAbstractPreamble"
></div>
{% trans "Current date" %}:
<span
id=
"currentDate"
></span>
<br/>
</div>
<input
type=
"range"
min=
"0"
max=
"0"
value=
"0"
step=
"1"
id=
"layerDateRange"
onchange=
"switchLayer(parseInt(this.value));"
><br/>
<!-- Start map container -->
</div>
<div
class=
"col-md-12"
id=
"mapContainer"
style=
"position: relative; height: 800px; padding-top: 15px; padding-bottom: 15px;"
>
<div
class=
"form-group"
id=
"paramselector"
style=
"position: absolute; right: 20px; bottom: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;"
>
<div
class=
"slidecontainer"
style=
"position: absolute; left: 20px; bottom: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;"
>
</div>
{% trans "Current date" %}:
<span
id=
"currentDate"
></span>
<br/>
<div
id=
"layerLegend"
style=
"position: absolute; right: 20px; top: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;"
>
<input
type=
"range"
min=
"0"
max=
"0"
value=
"0"
step=
"1"
id=
"layerDateRange"
onchange=
"switchLayer(parseInt(this.value));"
><br/>
</div>
</div>
<div
id=
"popup"
title=
"{% trans "
Location
details
"
%}"
></div>
<div
class=
"col-md-12"
>
<h2
id=
"modelTitle"
></h2>
<div
id=
"modelAbstract"
></div>
</div>
</div>
<div
class=
"form-group"
id=
"paramselector"
style=
"position: absolute; right: 20px; bottom: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;"
>
</div>
<div
id=
"layerLegend"
style=
"position: absolute; right: 20px; top: 20px; background-color: white; z-index: 1000;padding: 15px; border-radius: 15px;"
>
</div>
</div>
<div
id=
"popup"
title=
"{% trans "
Location
details
"
%}"
></div>
<div
class=
"col-md-12"
>
<div
id=
"modelAbstractBody"
></div>
</div>
{% endblock %}
{% endblock %}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment