Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
leaflet-oilspill-control
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stw
leaflet-oilspill-control
Commits
9e6f924c
Commit
9e6f924c
authored
May 23, 2017
by
Tomas Pettersson
🏸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
populateCards
parent
47fd2774
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
10 deletions
+78
-10
demo/server.js
demo/server.js
+14
-1
src/leaflet-oilspill-cards.js
src/leaflet-oilspill-cards.js
+30
-4
src/leaflet-oilspill-cards.js.map
src/leaflet-oilspill-cards.js.map
+1
-1
src/leaflet-oilspill-cards.ts
src/leaflet-oilspill-cards.ts
+33
-4
No files found.
demo/server.js
View file @
9e6f924c
...
...
@@ -42,7 +42,13 @@ app.get('/demo/input', function (req, res) {
"
duration
"
:
"
6
"
,
"
durationUnit
"
:
"
hours
"
},
"
observation
"
:
[],
"
observation
"
:
[{
"
id
"
:
null
,
"
provider
"
:
'
USER
'
,
"
providerDataRef
"
:
null
,
"
providerImgRef
"
:
null
,
"
providerType
"
:
null
,
"
type
"
:
'
MANUAL
'
,
"
date
"
:
1495540800000
}],
"
status
"
:
"
COMPLETE
"
,
"
timestamp
"
:
1491225478000
,
"
period
"
:
"
2 days 0 hrs
"
,
...
...
@@ -57,8 +63,15 @@ app.get('/demo/input', function (req, res) {
);
});
app
.
get
(
'
/demo/availableTimes/ms/HELCOM_NEMO
'
,
function
(
req
,
res
)
{
res
.
send
(
{
"
availableTime
"
:{
"
start
"
:
1491094800000
,
"
stop
"
:
1492124400000
},
"
missingTime
"
:[]}
);
});
app
.
post
(
'
/demo/startos
'
,
function
(
req
,
res
)
{
var
result
=
{};
console
.
log
(
req
.
body
.
features
[
0
].
properties
);
result
[
"
id
"
]
=
"
uuid
"
;
res
.
send
(
result
);
});
...
...
src/leaflet-oilspill-cards.js
View file @
9e6f924c
...
...
@@ -277,6 +277,13 @@ var OSLocation = (function (_super) {
default
:
break
;
}
var
simulation
=
geojson
.
features
[
0
].
properties
.
simulation
;
self
.
depthInput
.
value
=
simulation
.
depth
;
var
observation
=
geojson
.
features
[
0
].
properties
.
observation
[
0
];
var
date
=
moment
.
utc
(
observation
.
date
).
format
(
self
.
dateFormat
);
self
.
obsDateInput
.
value
=
date
;
var
time
=
moment
.
utc
(
observation
.
date
).
format
(
self
.
timeFormat
);
self
.
obsTimeInput
.
value
=
time
;
};
OSLocation
.
prototype
.
populateData
=
function
(
geojson
)
{
var
self
=
this
;
...
...
@@ -292,11 +299,11 @@ var OSLocation = (function (_super) {
"
providerImgRef
"
:
null
,
"
providerType
"
:
null
,
"
type
"
:
"
MANUAL
"
,
"
date
"
:
1495538160000
"
date
"
:
moment
.
utc
(
self
.
obsDateInput
.
value
+
'
'
+
self
.
obsTimeInput
.
value
,
self
.
datetimeFormat
).
valueOf
()
};
geojson
.
features
[
0
].
properties
[
"
simulation
"
]
=
{};
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
depth
"
]
=
self
.
depthInput
.
value
;
geojson
.
features
[
0
].
properties
[
"
observation
"
]
=
{}
;
geojson
.
features
[
0
].
properties
[
"
observation
"
]
=
[]
;
geojson
.
features
[
0
].
properties
[
"
observation
"
].
push
(
observation
);
};
OSLocation
.
prototype
.
clear
=
function
()
{
...
...
@@ -706,16 +713,25 @@ var OSType = (function (_super) {
OSType
.
prototype
.
populateCard
=
function
(
geojson
)
{
var
self
=
this
;
var
simulation
=
geojson
.
features
[
0
].
properties
.
simulation
;
if
(
simulation
.
oilclass
==
'
Oil classes
'
)
{
document
.
getElementById
(
'
osOilClassTab
'
).
click
();
;
self
.
selectOilClass
.
value
=
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
];
}
if
(
simulation
.
oilclass
==
'
Oil, specific
'
)
{
document
.
getElementById
(
'
osOilSpecificTab
'
).
click
();
self
.
selectOilClass
.
value
=
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
];
}
};
OSType
.
prototype
.
populateData
=
function
(
geojson
)
{
var
self
=
this
;
if
(
self
.
selectOilClass
.
selectedIndex
!==
-
1
)
{
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
'
Oil classes
'
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
self
.
selectOilClass
.
options
[
self
.
selectOilClass
.
selectedIndex
].
value
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
]
=
self
.
selectOilClass
.
options
[
self
.
selectOilClass
.
selectedIndex
].
value
;
}
if
(
self
.
selectOilSpecific
.
selectedIndex
!==
-
1
)
{
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
'
Oil, specific
'
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
self
.
selectOilSpecific
.
options
[
self
.
selectOilSpecific
.
selectedIndex
].
value
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
]
=
self
.
selectOilSpecific
.
options
[
self
.
selectOilSpecific
.
selectedIndex
].
value
;
}
};
OSType
.
prototype
.
clear
=
function
()
{
...
...
@@ -837,6 +853,16 @@ var OSAmount = (function (_super) {
OSAmount
.
prototype
.
populateCard
=
function
(
geojson
)
{
var
self
=
this
;
var
simulation
=
geojson
.
features
[
0
].
properties
.
simulation
;
self
.
amountInput
.
value
=
simulation
.
amount
;
var
amountevt
=
document
.
createEvent
(
'
Event
'
);
amountevt
.
initEvent
(
"
change
"
,
true
,
true
);
self
.
amountInput
.
dispatchEvent
(
amountevt
);
self
.
amountSelect
.
value
=
simulation
.
amountUnit
;
self
.
durationInput
.
value
=
simulation
.
duration
;
var
durationevt
=
document
.
createEvent
(
'
Event
'
);
durationevt
.
initEvent
(
"
change
"
,
true
,
true
);
self
.
durationInput
.
dispatchEvent
(
durationevt
);
self
.
durationSelect
.
value
=
simulation
.
durationUnit
;
};
OSAmount
.
prototype
.
populateData
=
function
(
geojson
)
{
var
self
=
this
;
...
...
src/leaflet-oilspill-cards.js.map
View file @
9e6f924c
This diff is collapsed.
Click to expand it.
src/leaflet-oilspill-cards.ts
View file @
9e6f924c
...
...
@@ -309,6 +309,13 @@ class OSLocation extends OilSpillCard {
default
:
break
;
}
var
simulation
=
geojson
.
features
[
0
].
properties
.
simulation
;
self
.
depthInput
.
value
=
simulation
.
depth
;
var
observation
=
geojson
.
features
[
0
].
properties
.
observation
[
0
];
var
date
=
moment
.
utc
(
observation
.
date
).
format
(
self
.
dateFormat
);
self
.
obsDateInput
.
value
=
date
;
var
time
=
moment
.
utc
(
observation
.
date
).
format
(
self
.
timeFormat
);
self
.
obsTimeInput
.
value
=
time
;
}
public
populateData
(
geojson
)
{
...
...
@@ -326,11 +333,12 @@ class OSLocation extends OilSpillCard {
"
providerImgRef
"
:
null
,
"
providerType
"
:
null
,
"
type
"
:
"
MANUAL
"
,
"
date
"
:
1495538160000
"
date
"
:
moment
.
utc
(
self
.
obsDateInput
.
value
+
'
'
+
self
.
obsTimeInput
.
value
,
self
.
datetimeFormat
).
valueOf
()
};
geojson
.
features
[
0
].
properties
[
"
simulation
"
]
=
{};
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
depth
"
]
=
self
.
depthInput
.
value
;
geojson
.
features
[
0
].
properties
[
"
observation
"
]
=
{}
;
geojson
.
features
[
0
].
properties
[
"
observation
"
]
=
[]
;
geojson
.
features
[
0
].
properties
[
"
observation
"
].
push
(
observation
);
}
...
...
@@ -776,17 +784,26 @@ class OSType extends OilSpillCard {
public
populateCard
(
geojson
)
{
var
self
=
this
;
var
simulation
=
geojson
.
features
[
0
].
properties
.
simulation
;
if
(
simulation
.
oilclass
==
'
Oil classes
'
)
{
document
.
getElementById
(
'
osOilClassTab
'
).
click
();;
self
.
selectOilClass
.
value
=
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
];
}
if
(
simulation
.
oilclass
==
'
Oil, specific
'
)
{
document
.
getElementById
(
'
osOilSpecificTab
'
).
click
();
self
.
selectOilClass
.
value
=
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
];
}
}
public
populateData
(
geojson
)
{
var
self
=
this
;
if
(
self
.
selectOilClass
.
selectedIndex
!==
-
1
)
{
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
'
Oil classes
'
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
self
.
selectOilClass
.
options
[
self
.
selectOilClass
.
selectedIndex
].
value
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
]
=
self
.
selectOilClass
.
options
[
self
.
selectOilClass
.
selectedIndex
].
value
;
}
if
(
self
.
selectOilSpecific
.
selectedIndex
!==
-
1
)
{
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
'
Oil, specific
'
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
oilclass
"
]
=
self
.
selectOilSpecific
.
options
[
self
.
selectOilSpecific
.
selectedIndex
].
value
;
geojson
.
features
[
0
].
properties
[
"
simulation
"
][
"
substance
"
]
=
self
.
selectOilSpecific
.
options
[
self
.
selectOilSpecific
.
selectedIndex
].
value
;
}
}
...
...
@@ -923,6 +940,18 @@ class OSAmount extends OilSpillCard {
public
populateCard
(
geojson
)
{
var
self
=
this
;
var
simulation
=
geojson
.
features
[
0
].
properties
.
simulation
;
self
.
amountInput
.
value
=
simulation
.
amount
;
var
amountevt
=
document
.
createEvent
(
'
Event
'
);
amountevt
.
initEvent
(
"
change
"
,
true
,
true
);
self
.
amountInput
.
dispatchEvent
(
amountevt
);
self
.
amountSelect
.
value
=
simulation
.
amountUnit
;
self
.
durationInput
.
value
=
simulation
.
duration
;
var
durationevt
=
document
.
createEvent
(
'
Event
'
);
durationevt
.
initEvent
(
"
change
"
,
true
,
true
);
self
.
durationInput
.
dispatchEvent
(
durationevt
);
self
.
durationSelect
.
value
=
simulation
.
durationUnit
;
}
public
populateData
(
geojson
)
{
...
...
Write
Preview
Markdown
is supported
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