{"version":3,"sources":["webpack:///historyController_f61149ed4534c2438558.js","webpack:///webpack/bootstrap f61149ed4534c2438558","webpack:///./src/history/history.controller.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","45","historyController","$scope","$location","$localStorage","$sessionStorage","$interval","$filter","$document","$timeout","configBaseLayers","configHistoryLayers","leafletData","markerService","emissionControlAreaService","vesselService","vm","this","storage","$default","center","lat","lng","zoom","toDate","Date","angular","extend","error","clearLastError","refreshInSeconds","historySidebarActive","selectedVessel","historyItems","$storage","defaults","minZoom","worldCopyJump","controls","availableVessels","layers","paths","markers","events","marker","enable","logic","path","closeHistorySidebar","buildHistorySource","_","sortBy","vessel","description","historyList","groupBy","addHistoryItem","fromDate","push","copy","minFrom","minFromDate","from","to","color","setAvailableVessels","removeHistoryItem","currentItem","filter","item","copyHistoryItem","removeHistoryItems","length","vessels","v","every","code","refreshView","getMap","then","map","getHistoricalMarkersAndPaths","result","catch","e","message","data","cod","Message","getVoyages","vesselCode","searchValue","getCurrentVoyages","dateOptions","dateDisabled","formatYear","maxDate","minDate","startingDay","fromDateOpen","toDateOpen","colorOptions","required","swatchOnly","pos","formatDate","date","setFocus","voyage","controlId","indexOf","getElementById","focus","getEmissionControlAreas","$on","event","leafletObject","options","tooltip","bindTooltip","openTooltip","getVesselsHavingWaypoints","scale","logonInfo","security","hasAdminRole","custom","createHistoryWaypointsControl","position","config","$routeProvider","when","templateUrl","controller","controllerAs","authorize","$inject"],"mappings":"CAAS,SAAUA,GCIjB,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUE,OAGnC,IAAIC,GAASF,EAAiBD,IAC7BI,EAAGJ,EACHK,GAAG,EACHH,WAUD,OANAJ,GAAQE,GAAUM,KAAKH,EAAOD,QAASC,EAAQA,EAAOD,QAASH,GAG/DI,EAAOE,GAAI,EA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AAI,4CAA6C,SAAUC,EAAOpE,GACjEA,EAAKqE,cAAcC,QAAQC,UAC3BvE,EAAKqE,cAAcG,YACfxE,EAAKqE,cAAcC,QAAQC,SAASE,cACxCzE,EAAKqE,cAAcC,QAAQC,QAAU,MAK7CpH,EAAOgH,IAAI,8CAA+C,SAAUC,EAAOvE,GACnEA,EAAOwE,cAAcC,QAAQC,UAC7B1E,EAAOwE,cAAcG,YACjB3E,EAAOwE,cAAcC,QAAQC,SAASE,cAC1C5E,EAAOwE,cAAcC,QAAQC,QAAU,KAM/CtG,GAAGc,iBAD4B,GAE/BxB,EAAU,WAFqB,KAGvBU,EAAGc,kBACHd,EAAGY,MAAQ,GACXhB,EAAYkE,SAASC,KAAK,SAAUC,GAEhChE,EAAGyD,QAAU1D,EAAc0G,4BAA4B1C,KAAK,SAAUG,GAClElE,EAAGyD,QAAUS,EAAOnG,EAAE0F,QACtBzD,EAAGiD,sBAEEjD,EAAGsB,SAASoF,QAETrH,EAAgBsH,UAAUC,SAASC,aACnC7G,EAAGsB,UACCoF,OAAO,EACPI,OAAQjH,EAAckH,iCAClBC,SAAU,cAIjBhH,EAAGsB,UAAaoF,OAAO,MAEjCvC,MAAM,SAAUC,GACf,GAAIC,GAAUD,CAEVA,GAAEE,MAAQF,EAAEE,KAAKE,UACjBH,EAAUD,EAAEE,KAAKE,SAGrBxE,EAAGY,MAAQ,0BAA4ByD,MAG/CrE,EAAGc,iBAAmB,GAEtBd,EAAGc,kBAAoB,GAE5B,KArRPJ,QACKjD,OAAO,OACPwJ,QACG,iBAAkB,SAASC,GACvBA,EACKC,KAAK,YAEEC,YAAa,8BACbC,WAAY,oBACZC,aAAc,KACdC,WAAW,OAI9BF,WAAW,oBAAqBpI,GAErCA,EAAkBuI,SACd,SACA,YACA,gBACA,kBACA,YACA,UACA,YACA,WACA,mBACA,sBACA,cACA,gBACA,6BACA","file":"historyController_f61149ed4534c2438558.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"assets/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 45);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 45:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// var angular = require('angular');\n// var _ = require('lodash');\n\n(function () {\n 'use strict';\n\n angular.module('app').config(['$routeProvider', function ($routeProvider) {\n $routeProvider.when('/history', {\n templateUrl: 'assets/history/history.html',\n controller: 'HistoryController',\n controllerAs: 'vm',\n authorize: true\n });\n }]).controller('HistoryController', historyController);\n\n historyController.$inject = ['$scope', '$location', '$localStorage', '$sessionStorage', '$interval', '$filter', '$document', '$timeout', 'configBaseLayers', 'configHistoryLayers', 'leafletData', 'markerService', 'emissionControlAreaService', 'vesselService'];\n\n function historyController($scope, $location, $localStorage, $sessionStorage, $interval, $filter, $document, $timeout, configBaseLayers, configHistoryLayers, leafletData, markerService, emissionControlAreaService, vesselService) {\n\n var vm = this;\n\n // build initial view and leaflet model\n var storage = $localStorage.$default({\n center: {\n lat: 50,\n lng: 10,\n zoom: 4\n }\n });\n\n var toDate = new Date();\n angular.extend(vm, {\n error: '',\n clearLastError: function clearLastError() {\n vm.error = '';\n },\n refreshInSeconds: 0,\n historySidebarActive: true,\n selectedVessel: null,\n historyItems: [],\n $storage: storage,\n defaults: {\n minZoom: 2,\n worldCopyJump: true\n },\n controls: {},\n availableVessels: [],\n layers: configBaseLayers(),\n paths: {},\n markers: {},\n events: { // http://leafletjs.com/reference-1.2.0.html#map-event\n marker: {\n enable: ['mouseover'],\n logic: \"emit\"\n },\n path: {\n enable: ['mouseover'],\n logic: \"emit\"\n }\n },\n closeHistorySidebar: function closeHistorySidebar() {\n vm.historySidebarActive = false;\n },\n buildHistorySource: function buildHistorySource() {\n vm.historyItems = _.sortBy(vm.historyItems, [function (i) {\n return i.vessel.description;\n }]);\n vm.historyList = _.groupBy(vm.historyItems, function (i) {\n return i.vessel.description;\n });\n },\n addHistoryItem: function addHistoryItem() {\n if (!vm.selectedVessel) return;\n var toDate = new Date();\n var fromDate = new Date(toDate - 864000000); // default 10 days in past\n vm.historyItems.push({\n vessel: angular.copy(vm.selectedVessel),\n minFrom: new Date(vm.selectedVessel.minFromDate),\n from: fromDate,\n to: toDate,\n color: '#16813d'\n });\n\n // sort by vessel description\n vm.buildHistorySource();\n vm.selectedVessel = null;\n vm.setAvailableVessels();\n },\n removeHistoryItem: function removeHistoryItem(currentItem) {\n vm.historyItems = _.filter(vm.historyItems, function (item) {\n return item !== currentItem;\n });\n vm.buildHistorySource();\n vm.selectedVessel = null;\n vm.setAvailableVessels();\n },\n copyHistoryItem: function copyHistoryItem(item) {\n if (!item) return;\n var toDate = new Date();\n var fromDate = new Date(toDate - 864000000); // default 10 days in past\n vm.historyItems.push({\n vessel: item.vessel,\n minFrom: item.minFrom,\n from: fromDate,\n to: toDate,\n color: item.color\n });\n vm.buildHistorySource();\n },\n removeHistoryItems: function removeHistoryItems() {\n vm.historyItems = [];\n vm.buildHistorySource();\n vm.selectedVessel = null;\n vm.setAvailableVessels();\n },\n setAvailableVessels: function setAvailableVessels() {\n if (vm.historyItems.length === 0) vm.availableVessels = vm.vessels;else vm.availableVessels = _.filter(vm.vessels, function (v) {\n return _.every(vm.historyItems, function (i) {\n return i.vessel.code !== v.code;\n });\n });\n vm.availableVessels = _.sortBy(vm.availableVessels, [function (i) {\n return i.description;\n }]);\n },\n refreshView: function refreshView() {\n vm.error = '';\n\n // relevant part of view model is: vm.historyItems\n leafletData.getMap().then(function (map) {\n vm.markers = {};\n vm.paths = [];\n markerService.getHistoricalMarkersAndPaths(vm.historyItems).then(function (result) {\n vm.markers = result.markers;\n vm.paths = result.paths;\n }).catch(function (e) {\n var message = e;\n // openweathermap.org\n if (e.data && e.data.cod && e.data.message) {\n message = e.data.message;\n }\n // softship web services\n if (e.data && e.data.Message) {\n message = e.data.Message;\n }\n\n vm.error = 'unable to get markers: ' + message;\n });\n });\n },\n getVoyages: function getVoyages(vesselCode, searchValue) {\n return vesselService.getCurrentVoyages(vesselCode, searchValue | '');\n },\n dateOptions: {\n dateDisabled: false,\n formatYear: 'yy',\n maxDate: toDate,\n minDate: new Date(toDate - 8640000000), // 100 days in past\n startingDay: 1\n },\n fromDateOpen: function fromDateOpen(item) {\n vm.dateOptions.minDate = item.minFrom;\n item.fromDateOpen = true;\n },\n toDateOpen: function toDateOpen(item) {\n vm.dateOptions.minDate = item.minFrom;\n item.toDateOpen = true;\n },\n colorOptions: {\n required: true,\n swatchOnly: true,\n pos: 'bottom right'\n },\n formatDate: function formatDate(date) {\n return $filter('date')(date, \"MM/dd/yyyy HH:mm\");\n },\n setFocus: function setFocus(voyage, controlId) {\n var isFrom = controlId.indexOf('fromDate') !== -1;\n if (isFrom) voyage.from = '';else voyage.to = '';\n $timeout(function () {\n $document[0].getElementById(controlId).focus();\n }, 500);\n }\n });\n\n emissionControlAreaService.getEmissionControlAreas().then(function (data) {\n var layers = configHistoryLayers(data);\n vm.layers = layers;\n }).catch(function (e) {\n vm.error = 'unable to config layers: ' + e;\n });\n\n // create event handlers\n // path point tooltip\n $scope.$on('leafletDirectivePath.historyMap.mouseover', function (event, path) {\n if (path.leafletObject.options.tooltip) {\n path.leafletObject.bindTooltip(path.leafletObject.options.tooltip).openTooltip();\n path.leafletObject.options.tooltip = '';\n }\n });\n\n // harbour, vessel tooltip\n $scope.$on('leafletDirectiveMarker.historyMap.mouseover', function (event, marker) {\n if (marker.leafletObject.options.tooltip) {\n marker.leafletObject.bindTooltip(marker.leafletObject.options.tooltip).openTooltip();\n marker.leafletObject.options.tooltip = '';\n }\n });\n\n // initial load / reload harbour and vessel markers every 60 seconds\n var refreshIntervalInSeconds = 60;\n vm.refreshInSeconds = refreshIntervalInSeconds;\n $interval(function () {\n if (vm.refreshInSeconds === refreshIntervalInSeconds) {\n vm.error = '';\n leafletData.getMap().then(function (map) {\n // check for new vessels each minute\n vm.vessels = vesselService.getVesselsHavingWaypoints().then(function (result) {\n vm.vessels = result.d.vessels;\n vm.setAvailableVessels();\n // only once, otherwise they are created several times and shown more than once in map!\n if (!vm.controls.scale) {\n // waypoints control only for SeaMap Admin (1001)\n if ($sessionStorage.logonInfo.security.hasAdminRole) {\n vm.controls = {\n scale: true,\n custom: markerService.createHistoryWaypointsControl()({\n position: 'topright'\n })\n };\n } else vm.controls = { scale: true };\n }\n }).catch(function (e) {\n var message = e;\n // softship web services\n if (e.data && e.data.Message) {\n message = e.data.Message;\n }\n\n vm.error = 'unable to get vessels: ' + message;\n });\n });\n vm.refreshInSeconds = 0;\n } else {\n vm.refreshInSeconds += 1;\n }\n }, 1000);\n }\n})();\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// historyController_f61149ed4534c2438558.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"assets/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 45);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f61149ed4534c2438558","// var angular = require('angular');\r\n// var _ = require('lodash');\r\n\r\n(function () {\r\n 'use strict';\r\n\r\n angular\r\n .module('app')\r\n .config([\r\n '$routeProvider', function($routeProvider) {\r\n $routeProvider\r\n .when('/history',\r\n {\r\n templateUrl: 'assets/history/history.html',\r\n controller: 'HistoryController',\r\n controllerAs: 'vm',\r\n authorize: true\r\n });\r\n }\r\n ])\r\n .controller('HistoryController', historyController);\r\n\r\n historyController.$inject = [\r\n '$scope',\r\n '$location',\r\n '$localStorage',\r\n '$sessionStorage',\r\n '$interval',\r\n '$filter',\r\n '$document',\r\n '$timeout',\r\n 'configBaseLayers',\r\n 'configHistoryLayers',\r\n 'leafletData',\r\n 'markerService',\r\n 'emissionControlAreaService',\r\n 'vesselService'\r\n ];\r\n\r\n function historyController($scope,\r\n $location,\r\n $localStorage,\r\n $sessionStorage,\r\n $interval,\r\n $filter,\r\n $document,\r\n $timeout,\r\n configBaseLayers,\r\n configHistoryLayers,\r\n leafletData,\r\n markerService,\r\n emissionControlAreaService,\r\n vesselService) {\r\n\r\n var vm = this;\r\n\r\n // build initial view and leaflet model\r\n var storage = $localStorage.$default({\r\n center: {\r\n lat: 50,\r\n lng: 10,\r\n zoom: 4\r\n }\r\n });\r\n\r\n var toDate = new Date();\r\n angular.extend(vm, {\r\n error: '',\r\n clearLastError: function () {\r\n vm.error = '';\r\n },\r\n refreshInSeconds: 0,\r\n historySidebarActive: true,\r\n selectedVessel: null,\r\n historyItems: [],\r\n $storage: storage,\r\n defaults: {\r\n minZoom: 2,\r\n worldCopyJump: true\r\n },\r\n controls: {},\r\n availableVessels: [],\r\n layers: configBaseLayers(),\r\n paths: {},\r\n markers: {},\r\n events: { // http://leafletjs.com/reference-1.2.0.html#map-event\r\n marker: {\r\n enable: ['mouseover'],\r\n logic: \"emit\"\r\n },\r\n path: {\r\n enable: ['mouseover'],\r\n logic: \"emit\"\r\n }\r\n },\r\n closeHistorySidebar: function () {\r\n vm.historySidebarActive = false;\r\n },\r\n buildHistorySource: function () {\r\n vm.historyItems = _.sortBy(vm.historyItems, [function (i) { return i.vessel.description; }]);\r\n vm.historyList = _.groupBy(vm.historyItems, function (i) { return i.vessel.description; });\r\n },\r\n addHistoryItem: function () {\r\n if (!vm.selectedVessel) return;\r\n var toDate = new Date();\r\n var fromDate = new Date(toDate - 864000000); // default 10 days in past\r\n vm.historyItems.push({\r\n vessel: angular.copy(vm.selectedVessel),\r\n minFrom: new Date(vm.selectedVessel.minFromDate),\r\n from: fromDate,\r\n to: toDate,\r\n color: '#16813d'\r\n });\r\n\r\n // sort by vessel description\r\n vm.buildHistorySource();\r\n vm.selectedVessel = null;\r\n vm.setAvailableVessels();\r\n },\r\n removeHistoryItem: function (currentItem) {\r\n vm.historyItems = _.filter(vm.historyItems, function (item) {\r\n return item !== currentItem;\r\n });\r\n vm.buildHistorySource();\r\n vm.selectedVessel = null;\r\n vm.setAvailableVessels();\r\n },\r\n copyHistoryItem: function (item) {\r\n if (!item) return;\r\n var toDate = new Date();\r\n var fromDate = new Date(toDate - 864000000); // default 10 days in past\r\n vm.historyItems.push({\r\n vessel: item.vessel,\r\n minFrom: item.minFrom,\r\n from: fromDate,\r\n to: toDate,\r\n color: item.color\r\n });\r\n vm.buildHistorySource();\r\n },\r\n removeHistoryItems: function () {\r\n vm.historyItems = [];\r\n vm.buildHistorySource();\r\n vm.selectedVessel = null;\r\n vm.setAvailableVessels();\r\n },\r\n setAvailableVessels: function () {\r\n if (vm.historyItems.length === 0) vm.availableVessels = vm.vessels;\r\n else vm.availableVessels = _.filter(vm.vessels, function (v) {\r\n return _.every(vm.historyItems, function (i) { return i.vessel.code !== v.code; });\r\n });\r\n vm.availableVessels = _.sortBy(vm.availableVessels, [function (i) { return i.description; }]);\r\n },\r\n refreshView: function () {\r\n vm.error = '';\r\n\r\n // relevant part of view model is: vm.historyItems\r\n leafletData.getMap().then(function (map) {\r\n vm.markers = {};\r\n vm.paths = [];\r\n markerService.getHistoricalMarkersAndPaths(vm.historyItems)\r\n .then(function (result) {\r\n vm.markers = result.markers;\r\n vm.paths = result.paths;\r\n }).catch(function (e) {\r\n var message = e;\r\n // openweathermap.org\r\n if (e.data && e.data.cod && e.data.message) {\r\n message = e.data.message;\r\n }\r\n // softship web services\r\n if (e.data && e.data.Message) {\r\n message = e.data.Message;\r\n }\r\n\r\n vm.error = 'unable to get markers: ' + message;\r\n });\r\n });\r\n },\r\n getVoyages: function (vesselCode, searchValue) {\r\n return vesselService.getCurrentVoyages(vesselCode, searchValue | '');\r\n },\r\n dateOptions: {\r\n dateDisabled: false,\r\n formatYear: 'yy',\r\n maxDate: toDate,\r\n minDate: new Date(toDate - 8640000000), // 100 days in past\r\n startingDay: 1\r\n },\r\n fromDateOpen: function (item) {\r\n vm.dateOptions.minDate = item.minFrom;\r\n item.fromDateOpen = true;\r\n },\r\n toDateOpen: function (item) {\r\n vm.dateOptions.minDate = item.minFrom;\r\n item.toDateOpen = true;\r\n },\r\n colorOptions: {\r\n required: true,\r\n swatchOnly: true,\r\n pos: 'bottom right'\r\n },\r\n formatDate: function (date) {\r\n return $filter('date')(date, \"MM/dd/yyyy HH:mm\");\r\n },\r\n setFocus(voyage, controlId) {\r\n var isFrom = controlId.indexOf('fromDate') !== -1;\r\n if (isFrom)\r\n voyage.from = '';\r\n else\r\n voyage.to = '';\r\n $timeout(function () {\r\n $document[0].getElementById(controlId).focus();\r\n }, 500);\r\n }\r\n });\r\n\r\n emissionControlAreaService.getEmissionControlAreas()\r\n .then(function (data) {\r\n var layers = configHistoryLayers( data);\r\n vm.layers = layers;\r\n \r\n }).catch(function (e) {\r\n vm.error = 'unable to config layers: ' + e;\r\n });\r\n\r\n // create event handlers\r\n // path point tooltip\r\n $scope.$on('leafletDirectivePath.historyMap.mouseover', function (event, path) {\r\n if (path.leafletObject.options.tooltip) {\r\n path.leafletObject.bindTooltip(\r\n path.leafletObject.options.tooltip).openTooltip();\r\n path.leafletObject.options.tooltip = '';\r\n }\r\n });\r\n\r\n // harbour, vessel tooltip\r\n $scope.$on('leafletDirectiveMarker.historyMap.mouseover', function (event, marker) {\r\n if (marker.leafletObject.options.tooltip) {\r\n marker.leafletObject.bindTooltip(\r\n marker.leafletObject.options.tooltip).openTooltip();\r\n marker.leafletObject.options.tooltip = '';\r\n }\r\n });\r\n\r\n // initial load / reload harbour and vessel markers every 60 seconds\r\n var refreshIntervalInSeconds = 60;\r\n vm.refreshInSeconds = refreshIntervalInSeconds;\r\n $interval(function () {\r\n if (vm.refreshInSeconds === refreshIntervalInSeconds) {\r\n vm.error = '';\r\n leafletData.getMap().then(function (map) {\r\n // check for new vessels each minute\r\n vm.vessels = vesselService.getVesselsHavingWaypoints().then(function (result) {\r\n vm.vessels = result.d.vessels;\r\n vm.setAvailableVessels();\r\n // only once, otherwise they are created several times and shown more than once in map!\r\n if (!vm.controls.scale) {\r\n // waypoints control only for SeaMap Admin (1001)\r\n if ($sessionStorage.logonInfo.security.hasAdminRole) {\r\n vm.controls = {\r\n scale: true,\r\n custom: markerService.createHistoryWaypointsControl()({\r\n position: 'topright'\r\n })\r\n };\r\n }\r\n else vm.controls = { scale: true };\r\n }\r\n }).catch(function (e) {\r\n var message = e;\r\n // softship web services\r\n if (e.data && e.data.Message) {\r\n message = e.data.Message;\r\n }\r\n\r\n vm.error = 'unable to get vessels: ' + message;\r\n });\r\n });\r\n vm.refreshInSeconds = 0;\r\n } else {\r\n vm.refreshInSeconds += 1;\r\n }\r\n }, 1000);\t\t\r\n }\r\n})();\n\n\n// WEBPACK FOOTER //\n// ./src/history/history.controller.js"],"sourceRoot":""}