Commit 11384de7 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

test

parent 1ee43781
......@@ -39,12 +39,12 @@ module.exports = function(grunt) {
demo: {
includeSelf: true,
src: ['demo/index.html'],
overrides : {
"leaflet-itracer-control" : {
"main" : [
"src/leaflet-itracer-cards.js", "src/leaflet-oilitracerobs-control.js" , "src/leaflet-itracer-control.css"
]
},
overrides : {
"leaflet-itracer-control" : {
"main" : [
"src/leaflet-itracer-cards.js", "src/leaflet-itracer-control.js" , "src/leaflet-itracer-control.css"
]
},
"uikit-stw": {
"main" : [
"js/uikit.js", "js/components/notify.min.js",'js/components/datepicker.min.js','js/components/timepicker.min.js','js/components/autocomplete.min.js','js/components/accordion.min.js',
......@@ -68,8 +68,11 @@ module.exports = function(grunt) {
},
"leaflet-forcing-boundary" : {
"main" : ["dist/leaflet-forcing-boundary.js"]
}
}
},
"stwkit" : {
"main" : ["src/stwkit.js", "src/components/cards.js", "src/components/cards.css"]
}
}
}
}
......
......@@ -2,7 +2,7 @@
<html lang="en" style="font-size: 100%">
<head>
<title>leaflet-oilobs-control - Demo</title>
<title>leaflet-itracer-control - Demo</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv='x-dns-prefetch-control' content='on'>
......@@ -20,6 +20,7 @@
<link rel="stylesheet" href="../bower_components/uikit-stw/css/components/accordion.almost-flat.min.css" />
<link rel="stylesheet" href="../bower_components/ion.rangeSlider/css/ion.rangeSlider.css" />
<link rel="stylesheet" href="../bower_components/ion.rangeSlider/css/ion.rangeSlider.skinNice.css" />
<link rel="stylesheet" href="../bower_components/stwkit/src/components/cards.css" />
<link rel="stylesheet" href="../bower_components/leaflet-container-control/dist/leaflet-container-control.css" />
<link rel="stylesheet" href="../bower_components/DataTables/media/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="../bower_components/DataTables/media/css/dataTables.uikit.min.css" />
......@@ -27,7 +28,7 @@
<link rel="stylesheet" href="../bower_components/leaflet.draw/dist/leaflet.draw.css" />
<link rel="stylesheet" href="../bower_components/leaflet-coordinates-control/dist/leaflet-coordinates-control.css" />
<link rel="stylesheet" href="../bower_components/intro.js/introjs.css" />
<link rel="stylesheet" href="../src/leaflet-oilobs-control.css" />
<link rel="stylesheet" href="../src/leaflet-itracer-control.css" />
<!-- endbower -->
</head>
......@@ -47,6 +48,7 @@
<script src="../bower_components/moment/moment.js"></script>
<script src="../bower_components/ion.rangeSlider/js/ion.rangeSlider.min.js"></script>
<script src="../bower_components/stwkit/src/stwkit.js"></script>
<script src="../bower_components/stwkit/src/components/cards.js"></script>
<script src="../bower_components/leaflet-container-control/dist/leaflet-container-control.js"></script>
<script src="../bower_components/jquery.inputmask/dist/jquery.inputmask.bundle.js"></script>
<script src="../bower_components/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
......@@ -60,10 +62,8 @@
<script src="../bower_components/leaflet-coordinates-control/dist/leaflet-coordinates-control.js"></script>
<script src="../bower_components/leaflet-forcing-boundary/dist/leaflet-forcing-boundary.js"></script>
<script src="../bower_components/intro.js/intro.js"></script>
<script src="../src/leaflet-oilobs-cards.js"></script>
<script src="../src/leaflet-oilobs-control.js"></script>
<script src="../src/leaflet-observation.js"></script>
<script src="../src/leaflet-observation-sat.js"></script>
<script src="../src/leaflet-itracer-cards.js"></script>
<script src="../src/leaflet-itracer-control.js"></script>
<!-- endbower -->
<script>
......@@ -80,7 +80,7 @@
map.addControl(containerControl);
var language = 'en';
var oilobsLangData = {
var itracerLangData = {
};
var coordinatesLangData = {
......@@ -125,7 +125,7 @@
};
var langData = {
"oilobs": oilobsLangData,
"itracer": itracerLangData,
"coordinates": coordinatesLangData
};
......@@ -135,10 +135,6 @@
"domain": "NS02"
};
var obs = {
"sat": true
};
var domainname = "HELCOM";
reqwest({
......@@ -146,15 +142,14 @@
method: 'get',
type: 'json',
success: function (forcing) {
var ooproperties = {
var itracerproperties = {
"domain" : domainname,
"lang": language,
"langdata": langData
};
if (forcing.features.length > 0) ooproperties["forcing"] = forcing;
ooproperties["obs"] = obs;
var oilobs = new L.Control.OilObs(ooproperties);
containerControl.addComponent("Oil observation", oilobs);
if (forcing.features.length > 0) itracerproperties["forcing"] = forcing;
var itracer = new L.Control.InstantTracer(itracerproperties);
containerControl.addComponent("Instant Tracer", itracer);
}
});
......
......@@ -21,8 +21,8 @@ app.get('/demo/input/785b50c5-4804-462d-8a24-1dc2c9fd14f8', function (req, res)
"type": "Feature",
"properties": {
"uuid": "785b50c5-4804-462d-8a24-1dc2c9fd14f8",
"type": "oil",
"subtype": "observation",
"type": "object",
"subtype": "itracer",
"meanLng": 20.214843749999996,
"meanLat": 58.95000823335702,
"simulation": {
......@@ -74,8 +74,8 @@ app.get('/demo/input/24ef2cac-ef78-406c-b59a-db625f38919e', function (req, res)
"uuid": "24ef2cac-ef78-406c-b59a-db625f38919e",
"domain": "HELCOM",
"model": "NEMO",
"type": "oil",
"subtype": "observation",
"type": "object",
"subtype": "itracer",
"meanLng": 20.522460937500004,
"meanLat": 58.51665179936381,
"simulation": {
......@@ -127,20 +127,20 @@ app.get('/demo/availableTimes/ms/HELCOM_NEMO', function (req, res) {
);
});
app.post('/demo/startoo', function (req, res) {
app.post('/demo/startit', function (req, res) {
var result = {};
console.log(req.body.features[0].properties);
result["id"] = "uuid";
res.send(result);
});
app.get('/demo/guide/oo',
app.get('/demo/guide/it',
function (req, res) {
res.send(
{
steps: [
{
intro: "This guide will take you through the steps needed to start an Oil observation simulation."
intro: "This guide will take you through the steps needed to start an Instant Tracer simulation."
},
{
element: '#guideoo1',
......
declare var STWkit : any;
\ No newline at end of file
declare namespace STWkit{
export var DomUtil: any;
export var getParamIndex: any;
export var getURLParams: any;
export var hasParam: any;
export var replaceParam: any;
export var updateUrl: any;
export var deleteParam: any;
export var getSearchUrl: any;
export var getParamValue: any;
}
\ No newline at end of file
......@@ -13,1098 +13,26 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var OilObsCard = (function () {
function OilObsCard(id, label, parent, content) {
this.status = false;
this.title = L.DomUtil.create('h5', 'uk-accordion-title uk-width-1-1 chevron-title', parent);
this.title.id = id;
this.badgeSpan = L.DomUtil.create('span', 'uk-badge', this.title);
var titleSpan = L.DomUtil.create('span', 'title', this.title);
titleSpan.textContent = ' ' + label;
this.titleIcon = L.DomUtil.create('span', 'uk-icon-chevron-down chevron-icon', this.title);
var accContent = L.DomUtil.create('div', 'uk-accordion-content uk-padding-remove', parent);
accContent.appendChild(content);
this.content = content;
this.hide();
this.changeListeners = [];
var ITLocation = (function (_super) {
__extends(ITLocation, _super);
function ITLocation(id, parentDiv, lang, langData, map, forcing) {
return _super.call(this, id, 'Specify location', parentDiv, lang, langData, map, forcing) || this;
}
OilObsCard.prototype.addChangeFnListener = function (listener) {
this.changeListeners.push(listener);
};
OilObsCard.prototype.fireChangeFn = function (changeCard) {
for (var i = 0; i < this.changeListeners.length; i++) {
var listener = this.changeListeners[i];
listener.changeFn(changeCard);
}
};
OilObsCard.prototype.addLabelDiv = function (parentDiv, labelTxt, labelInfo) {
var self = this;
var label = L.DomUtil.create('label', 'uk-form-label form-label', parentDiv);
label.textContent = labelTxt;
var addPositionInfo = L.DomUtil.create('span', 'uk-icon-hover uk-icon-info-circle', parentDiv);
addPositionInfo.onclick = function () {
OilObsCard.infoMsg(labelTxt, labelInfo);
};
};
;
OilObsCard.infoMsg = function (title, msg) {
return UIkit.notify("<span class='uk-icon-small uk-icon-info-circle'></span> <b>" + title + "</b><p>" + msg, { status: 'info', timeout: 10000 });
};
OilObsCard.warningMsg = function (title, msg) {
return UIkit.notify("<span class='uk-icon-small uk-icon-info-circle'></span> <b>" + title + "</b><p>" + msg, { status: 'warning', timeout: 10000 });
};
OilObsCard.enableNext = function (button, enable) {
var isEnabled = button.classList.contains('next-enabled');
if (enable && !isEnabled) {
button.classList.add('next-enabled');
}
if (!enable && isEnabled) {
button.classList.remove('next-enabled');
}
};
OilObsCard.isEnabled = function (button) {
return button.classList.contains('next-enabled');
};
OilObsCard.prototype.clear = function () {
this.status = false;
};
OilObsCard.prototype.hide = function () {
this.title.style.display = 'none';
this.content.style.display = 'none';
};
OilObsCard.prototype.show = function () {
this.title.style.display = 'block';
this.content.style.display = 'block';
};
OilObsCard.prototype.visible = function () {
return (this.title.style.display == 'block');
};
return OilObsCard;
}());
var OOLocation = (function (_super) {
__extends(OOLocation, _super);
function OOLocation(id, parentDiv, lang, langData, map, forcing, obs) {
var _this = this;
var locationDiv = L.DomUtil.create('div', 'uk-width-1-1 uk-margin-top', parentDiv);
_this = _super.call(this, id, 'Specify time and location', parentDiv, locationDiv) || this;
var self = _this;
if (forcing)
self.forcingBoundary = new Forcing.Boundary(locationDiv, map, forcing);
var satCallbackFn = function (latlngs, geojsonfeature, timestamp, id) {
self.clear();
var geojson = {};
geojson["type"] = "FeatureCollection";
geojson["features"] = [];
geojson["features"].push(geojsonfeature);
var observation = {
"id": id,
"provider": "EMSA",
"providerDataRef": null,
"providerImgRef": null,
"providerType": null,
"type": "SAT",
"date": moment.utc(timestamp).valueOf()
};
geojson.features[0].properties["observation"] = [];
geojson.features[0].properties["observation"].push(observation);
geojson.features[0].properties["simulation"] = {};
self.populateCard(geojson);
};
function legendBox(fieldset, color, text, size) {
var rowDiv = L.DomUtil.create('div', 'uk-form-row uk-margin-remove', fieldset);
var legendBox = L.DomUtil.create('div', 'legend-box', rowDiv);
legendBox.style.backgroundColor = color;
legendBox.style.width = size;
legendBox.style.height = size;
legendBox.title = text;
var legendText = L.DomUtil.create('div', 'legend-text', rowDiv);
legendText.textContent = text;
}
if (obs && obs.sat) {
self.satObs = new Observation.Sat(map, satCallbackFn, 'observation/oo');
var satDetectionDiv = L.DomUtil.create('div', '', locationDiv);
var satDetectionList = L.DomUtil.create('dl', 'uk-description-list-line', satDetectionDiv);
var satDetectionItem = L.DomUtil.create('dt', '', satDetectionList);
var satDetectionHeading = L.DomUtil.create('h5', 'uk-width-1-1 chevron-title', satDetectionItem);
satDetectionHeading.textContent = "Satellite oil detections";
self.satDetectionChevronIcon = L.DomUtil.create('span', 'uk-icon-chevron-down chevron-icon', satDetectionHeading);
self.satDetectionContent = L.DomUtil.create('div', 'uk-animation-fade', satDetectionItem);
self.satDetectionContent.style.display = 'none';
satDetectionHeading.onclick = function (evt) {
if (self.satDetectionChevronIcon.classList.contains('uk-icon-chevron-down')) {
self.satDetectionChevronIcon.classList.remove('uk-icon-chevron-down');
self.satDetectionChevronIcon.classList.add('uk-icon-chevron-up');
self.satDetectionContent.style.display = "";
self.satObs.show();
}
else {
self.satDetectionChevronIcon.classList.remove('uk-icon-chevron-up');
self.satDetectionChevronIcon.classList.add('uk-icon-chevron-down');
self.satDetectionContent.style.display = 'none';
self.satObs.hide();
}
};
var satDetectionform = L.DomUtil.create('form', 'uk-form uk-form-stacked', self.satDetectionContent);
satDetectionform.onsubmit = function (e) {
e.preventDefault();
e.stopPropagation();
return false;
};
var satDetectionfieldset = L.DomUtil.create('fieldset', '', satDetectionform);
var satDetectionRowDiv = L.DomUtil.create('div', 'uk-form-row uk-margin-top', satDetectionfieldset);
_super.prototype.addLabelDiv.call(_this, satDetectionRowDiv, "Detection frequency", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-satdetection' target='_blank'>here</a>");
legendBox(satDetectionfieldset, 'rgb(255, 0, 0)', 'Past day', '10px');
legendBox(satDetectionfieldset, 'rgb(255, 153, 0)', 'Past week', '10px');
legendBox(satDetectionfieldset, 'rgb(255, 255, 0)', 'Two weeks', '10px');
legendBox(satDetectionfieldset, 'rgb(255, 255, 204)', 'Older', '10px');
}
var obsform = L.DomUtil.create('form', 'uk-form uk-form-stacked', locationDiv);
obsform.onsubmit = function (e) {
e.preventDefault();
e.stopPropagation();
return false;
};
self.datetimeFormat = 'YYYY-MM-DD HH:mm';
self.datetimeTFormat = 'YYYY-MM-DDTHH:mm:ss.000';
self.dateFormat = 'YYYY-MM-DD';
self.timeFormat = 'HH:mm';
var obsdateLabelGrid = L.DomUtil.create('div', 'uk-grid', obsform);
var obsfieldset = L.DomUtil.create('fieldset', '', obsform);
var obsdateRowDiv = L.DomUtil.create('div', 'uk-form-row', obsfieldset);
_super.prototype.addLabelDiv.call(_this, obsdateRowDiv, "Observation time (UTC)", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-time' target='_blank'>here</a>");
var obsdateDiv = L.DomUtil.create('div', 'uk-form-controls uk-form-icon uk-width-1-1', obsdateRowDiv);
obsdateDiv.id = 'guideoo1';
var obsdateIcon = L.DomUtil.create('span', 'uk-icon-calendar', obsdateDiv);
self.obsDateInput = L.DomUtil.create('input', 'uk-width-1-2', obsdateDiv);
self.obsDateInput.type = 'text';
self.obsDateInput.placeholder = self.dateFormat;
self.obsTimeInput = L.DomUtil.create('input', 'uk-width-1-2', obsdateDiv);
self.obsTimeInput.type = 'text';
var typeLabelGrid = L.DomUtil.create('div', 'uk-grid uk-margin-top', obsform);
var objectlabelDiv = L.DomUtil.create('div', 'uk-width-1-2', typeLabelGrid);
_super.prototype.addLabelDiv.call(_this, objectlabelDiv, "Outlet type", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-type' target='_blank'>here</a>");
var typeDiv = L.DomUtil.create('div', '', obsform);
typeDiv.id = 'guidefo1';
typeDiv.setAttribute('data-uk-button-radio', '');
var typeButtonGrid = L.DomUtil.create('div', 'uk-grid uk-grid-small', typeDiv);
var objectbuttonsDiv = L.DomUtil.create('div', 'uk-width-1-2', typeButtonGrid);
var objectButtonGroup = L.DomUtil.create('div', 'uk-button-group', objectbuttonsDiv);
self.pointButton = L.DomUtil.create('button', 'uk-button uk-button-small', objectButtonGroup);
self.pointButton.textContent = 'Single';
self.lineButton = L.DomUtil.create('button', 'uk-button uk-button-small', objectButtonGroup);
self.lineButton.textContent = 'Line';
self.lineButton.disabled = false;
self.polygonButton = L.DomUtil.create('button', 'uk-button uk-button-small', objectButtonGroup);
self.polygonButton.textContent = 'Area';
self.pointButton.onclick = function () { self.geometryType = "point"; self.control.setType(self.geometryType); };
self.lineButton.onclick = function () { self.geometryType = "linestring"; self.control.setType(self.geometryType); };
self.polygonButton.onclick = function () { self.geometryType = "polygon"; self.control.setType(self.geometryType); };
self.polygonButton.disabled = false;
self.hasPosition = false;
function validate() {
var date = moment.utc(self.obsDateInput.value + ' ' + self.obsTimeInput.value, self.datetimeFormat);
if (!date.isValid())
return;
if (!self.hasPosition)
return;
self.status = true;
OilObsCard.enableNext(self.nextButton, true);
(self.oncallback && self.oncallback());
}
;
var positionLabelGrid = L.DomUtil.create('div', 'uk-grid uk-margin-top', obsform);
var positionlabelDiv = L.DomUtil.create('div', 'uk-width-1-1', positionLabelGrid);
_super.prototype.addLabelDiv.call(_this, positionlabelDiv, "Position", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-position' target='_blank'>here</a>");
var positionDiv = L.DomUtil.create('div', '', obsform);
positionDiv.id = 'guideoo2';
var positionButtonGrid = L.DomUtil.create('div', 'uk-grid uk-grid-small', positionDiv);
var latlonDiv = L.DomUtil.create('div', 'uk-width-1-2', positionButtonGrid);
var drawDiv = L.DomUtil.create('div', 'uk-width-1-2', positionButtonGrid);
// var importDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-width-1-3', positionButtonGrid);
var latlngButton = L.DomUtil.create('button', 'uk-button uk-button-small', latlonDiv);
latlngButton.textContent = 'Enter manually';
var drawButton = L.DomUtil.create('button', 'uk-button uk-button-small uk-align-right uk-margin-remove', drawDiv);
drawButton.textContent = 'Free hand draw';
// var importButton = <HTMLButtonElement>L.DomUtil.create('button', 'uk-button uk-button-small', importDiv);
// importButton.textContent = 'Import';
positionDiv.guideFn = function () {
var geojson = {};
geojson["type"] = "FeatureCollection";
geojson["features"] = [];
var feature = {};
feature['type'] = "Feature";
feature['geometry'] = {};
feature['geometry']['type'] = "Point";
feature['geometry']['coordinates'] = [];
feature['geometry']['coordinates'].push(19.0);
feature['geometry']['coordinates'].push(56.0);
geojson["features"].push(feature);
self.control.addGeoJSON(geojson);
};
var bbox = {};
bbox['s'] = -90;
bbox['n'] = 90;
bbox['w'] = -180;
bbox['e'] = 180;
if (forcing)
bbox = forcing.features[0].properties.bbox;
self.control = new L.Control.Coordinates({
"lang": lang,
"langdata": langData.coordinates,
"id": id,
"inline": true,
"bbox": bbox,
"table": true,
"type": false,
"buttons": false,
"tabs": false,
"callback": function (latlngs, geojson) {
self.hasPosition = false;
if (latlngs.length > 0) {
var toggleevt = document.createEvent("CustomEvent");
toggleevt.initCustomEvent('container:toggleVisibility', false, false, {
'show': true
});
window.dispatchEvent(toggleevt);
self.fireChangeFn(self);
if (self.exitControl)
map.removeControl(self.exitControl);
self.exitControl = null;
var coordinates = [];
switch (self.geometryType) {
case 'point':
coordinates.push([latlngs[0][0].lng, latlngs[0][0].lat]);
break;
case 'multipoint':
coordinates = geojson.features[0].geometry.coordinates;
break;
case 'linestring':
var center = L.polyline(latlngs).getBounds().getCenter();
coordinates.push([center.lng, center.lat]);
break;
case 'polygon':
var center = L.polygon(latlngs).getBounds().getCenter();
coordinates.push([center.lng, center.lat]);
break;
default:
break;
}
if (self.forcingBoundary)
self.forcingBoundary.validate(coordinates);
self.control.showTable();
self.hasPosition = true;
validate();
}
}
});
var content = self.control.onAdd(map);
var coordinateDiv = L.DomUtil.create('div', 'uk-margin-top uk-margin-bottom', locationDiv);
coordinateDiv.appendChild(content);
self.control.hideTable();
latlngButton.onclick = function () { self.control.latlng(); };
drawButton.onclick = function () {
var toggleevt = document.createEvent("CustomEvent");
toggleevt.initCustomEvent('container:toggleVisibility', false, false, {
'show': false
});
window.dispatchEvent(toggleevt);
if (self.forcingBoundary)
self.forcingBoundary.show();
self.control.draw();
self.exitControl = new L.Control({ position: 'bottomright' });
self.exitControl.onAdd = function (map) {
var container = L.DomUtil.create('div', 'exit-control');
var exitPanel = L.DomUtil.create('div', 'uk-panel uk-panel-box', container);
var finnishButton = L.DomUtil.create('button', 'uk-button uk-button-small uk-button-primary uk-margin-right', exitPanel);
finnishButton.textContent = 'Finnish';
finnishButton.onclick = function (e) {
map.fire('draw:canceled');
};
finnishButton.style.display = 'none';
// 3 is multipoint type in coordinates control
if (self.control.getType() == 3)
finnishButton.style.display = '';
var cancelButton = L.DomUtil.create('button', 'uk-button uk-button-small', exitPanel);
cancelButton.textContent = 'Cancel';
cancelButton.onclick = function (e) {
if (self.exitControl)
map.removeControl(self.exitControl);
self.exitControl = null;
var toggleevt = document.createEvent("CustomEvent");
toggleevt.initCustomEvent('container:toggleVisibility', false, false, {
'show': true
});
window.dispatchEvent(toggleevt);
self.clear();
};
L.DomEvent.disableClickPropagation(container);
return container;
};
self.exitControl.addTo(map);
};
// importButton.onclick = function(){self.control.import();};
var clearDiv = L.DomUtil.create('div', 'uk-clearfix', locationDiv);
var clearButton = L.DomUtil.create('button', 'uk-button uk-margin-top uk-align-left', clearDiv);
clearButton.textContent = 'Clear';
clearButton.onclick = function () {
self.clear();
};
self.nextButton = L.DomUtil.create('button', 'uk-button uk-margin-top uk-align-right', clearDiv);
self.nextButton.textContent = 'Next';
self.nextButton.id = 'guideoo3';
self.nextButton.guideFn = function () {
self.nextButton.click();
};
OilObsCard.enableNext(self.nextButton, false);
self.nextButton.onclick = function () {
if (!OilObsCard.isEnabled(self.nextButton)) {
OilObsCard.warningMsg('Mandatory fields missing', 'Specify a location by <b>manually entering</b> position or <b>draw</b> on the map.');
return;
}
if (self.forcingBoundary)
self.forcingBoundary.hide();
(self.oncallback && self.oncallback(true));
};
UIkit.ready(function () {
var startDatePicker = UIkit.datepicker(self.obsDateInput, { format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.obsTimeInput, {});
self.defaults();
});
return _this;
}
OOLocation.prototype.show = function () {
ITLocation.prototype.show = function () {
_super.prototype.show.call(this);
};
OOLocation.prototype.hide = function () {
ITLocation.prototype.hide = function () {
_super.prototype.hide.call(this);
};
OOLocation.prototype.defaults = function () {
var self = this;
if (document.body.contains(self.pointButton))
self.pointButton.click();
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
};
OOLocation.prototype.populateCard = function (geojson) {
var self = this;
var simulation = geojson.features[0].properties.simulation;
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;
var type = geojson.features[0].geometry.type.toLowerCase();
switch (type) {
case "point":
self.pointButton.click();
break;
case "linestring":
self.lineButton.click();
break;
case "polygon":
self.polygonButton.click();
break;
default:
break;
}
self.control.setType(type);
self.control.addGeoJSON(geojson);
};
OOLocation.prototype.populateData = function (geojson) {
var self = this;
var json = self.control.getGeoJSON();
for (var i = 0; i < json.features.length; i++) {
json.features[i]["properties"] = {};
geojson.features.push(json.features[i]);
}