|
|
@ -29,8 +29,6 @@ $('body').on('hidden.bs.modal', '.modal', function () {
|
|
|
|
/*Map layer configurations*/
|
|
|
|
/*Map layer configurations*/
|
|
|
|
var map;
|
|
|
|
var map;
|
|
|
|
|
|
|
|
|
|
|
|
initialLoad();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function initialLoad() {
|
|
|
|
function initialLoad() {
|
|
|
|
if (document.getElementById('map') == null) {
|
|
|
|
if (document.getElementById('map') == null) {
|
|
|
|
setTimeout(initialLoad, 500); // give everything some time to render
|
|
|
|
setTimeout(initialLoad, 500); // give everything some time to render
|
|
|
@ -47,17 +45,18 @@ function initialLoad() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setPageTitle() {
|
|
|
|
function setPageTitle() {
|
|
|
|
var hash = window.parent.location.hash;
|
|
|
|
var hash = window.parent.location.hash;
|
|
|
|
if(hash) {
|
|
|
|
if(hash) {
|
|
|
|
var startIdx = hash.indexOf("/") + 1;
|
|
|
|
var startIdx = hash.indexOf("/") + 1;
|
|
|
|
var lastIdx = hash.length;
|
|
|
|
var lastIdx = hash.length;
|
|
|
|
var deviceInfoString = hash.substring(startIdx,lastIdx);
|
|
|
|
var deviceInfoString = hash.substring(startIdx,lastIdx);
|
|
|
|
var deviceInfo = JSON.parse(deviceInfoString);
|
|
|
|
var deviceInfo = JSON.parse(deviceInfoString);
|
|
|
|
if(deviceInfo) {
|
|
|
|
if(deviceInfo) {
|
|
|
|
var newTitle = "[ " + deviceInfo.device.id + "]" + " - Geo Dashboard [" + deviceInfo.device.type + "]";
|
|
|
|
var newTitle = "[ " + deviceInfo.device.id + "]" + " - Geo Dashboard [" + deviceInfo.device.type + "]";
|
|
|
|
window.parent.document.title = newTitle;
|
|
|
|
window.parent.document.title = newTitle;
|
|
|
|
}
|
|
|
|
$("#title").val(newTitle)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//function success(position) {
|
|
|
|
//function success(position) {
|
|
|
@ -98,12 +97,12 @@ function initializeMap() {
|
|
|
|
zoom: 14,
|
|
|
|
zoom: 14,
|
|
|
|
center: [6.927078, 79.861243],
|
|
|
|
center: [6.927078, 79.861243],
|
|
|
|
layers: [defaultOSM, defaultTFL],
|
|
|
|
layers: [defaultOSM, defaultTFL],
|
|
|
|
zoomControl: false,
|
|
|
|
zoomControl: true,
|
|
|
|
attributionControl: false,
|
|
|
|
attributionControl: false,
|
|
|
|
maxZoom: 20,
|
|
|
|
maxZoom: 20,
|
|
|
|
maxNativeZoom: 18
|
|
|
|
maxNativeZoom: 18
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
map.zoomControl.setPosition('bottomleft');
|
|
|
|
map.on('click', function (e) {
|
|
|
|
map.on('click', function (e) {
|
|
|
|
$.UIkit.offcanvas.hide();//[force = false] no animation
|
|
|
|
$.UIkit.offcanvas.hide();//[force = false] no animation
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -354,6 +353,66 @@ function enableRealTime() {
|
|
|
|
isBatchModeOn = false;
|
|
|
|
isBatchModeOn = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function InitSpatialObject() {
|
|
|
|
|
|
|
|
var fromDate = new Date();
|
|
|
|
|
|
|
|
fromDate.setHours(fromDate.getHours() - 2);
|
|
|
|
|
|
|
|
var toDate = new Date();
|
|
|
|
|
|
|
|
console.log(fromDate + " " + toDate);
|
|
|
|
|
|
|
|
var tableData = getProviderData(fromDate.valueOf(), toDate.valueOf());
|
|
|
|
|
|
|
|
for (var i = 0; i < tableData.length; i++) {
|
|
|
|
|
|
|
|
var data = tableData[i];
|
|
|
|
|
|
|
|
var geoMessage = {
|
|
|
|
|
|
|
|
"messageType": "Point",
|
|
|
|
|
|
|
|
"type": "Feature",
|
|
|
|
|
|
|
|
"id": data.id,
|
|
|
|
|
|
|
|
"deviceId": data.id,
|
|
|
|
|
|
|
|
"deviceType": data.type,
|
|
|
|
|
|
|
|
"properties": {
|
|
|
|
|
|
|
|
"speed": data.speed,
|
|
|
|
|
|
|
|
"heading": data.heading,
|
|
|
|
|
|
|
|
"state": data.state,
|
|
|
|
|
|
|
|
"information": data.information,
|
|
|
|
|
|
|
|
"notify": data.notify,
|
|
|
|
|
|
|
|
"type": data.type
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"geometry": {
|
|
|
|
|
|
|
|
"type": "Point",
|
|
|
|
|
|
|
|
"coordinates": [data.longitude, data.latitude]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
processPointMessage(geoMessage);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var spatialObject = currentSpatialObjects[deviceId];// (local)
|
|
|
|
|
|
|
|
if (!spatialObject) {
|
|
|
|
|
|
|
|
$.UIkit.notify({
|
|
|
|
|
|
|
|
message: "Spatial Object <span style='color:red'>" + deviceId + "</span> not in the Map!!",
|
|
|
|
|
|
|
|
status: 'warning',
|
|
|
|
|
|
|
|
timeout: ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,
|
|
|
|
|
|
|
|
pos: 'top-center'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
selectedSpatialObject = deviceId;
|
|
|
|
|
|
|
|
if (spatialObject.type == "area") {
|
|
|
|
|
|
|
|
spatialObject.focusOn(map);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.setView(spatialObject.marker.getLatLng(), 15, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#objectInfo').find('#objectInfoId').html(selectedSpatialObject);
|
|
|
|
|
|
|
|
spatialObject.marker.openPopup();
|
|
|
|
|
|
|
|
if (!toggled) {
|
|
|
|
|
|
|
|
$('#objectInfo').animate({width: 'toggle'}, 100);
|
|
|
|
|
|
|
|
toggled = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
spatialObject.drawPath();
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
createChart();
|
|
|
|
|
|
|
|
chart.load({columns: [spatialObject.speedHistory.getArray()]});
|
|
|
|
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
|
|
|
|
function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
|
|
|
|
if (!timeFrom) {
|
|
|
|
if (!timeFrom) {
|
|
|
|
notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom);
|
|
|
|
notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom);
|
|
|
|