Blame view
app/partials/flightTracking/flightTracking.controller.js
2.6 KB
e196b9b74
|
1 2 3 |
'use strict'; angular.module('acufuel') |
2b4e85bad
|
4 |
.controller('flightTrackingController', ['$scope','$compile', 'uiCalendarConfig', 'flightTrackingService', function($scope, $compile, uiCalendarConfig, flightTrackingService) { |
429786996
|
5 |
|
429786996
|
6 7 8 9 10 |
var map; var icon = "https://en.spitogatos.gr/visualCaptcha/images/airplane.png"; var json = "http://34.214.139.94:8080/ws/liveTracking"; var arr = []; var infowindow = new google.maps.InfoWindow(); |
2b4e85bad
|
11 |
|
19eace1cf
|
12 13 |
$scope.initialise = function() { var mapProp = { |
2b4e85bad
|
14 |
center: new google.maps.LatLng(36.778259, -98.417931), //LLANDRINDOD WELLS |
429786996
|
15 16 17 18 19 |
zoom: 4, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"), mapProp); |
2b4e85bad
|
20 |
console.log('sssssssss', json); |
429786996
|
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
setInterval(function(){ $.get(json, function(json1) { $.each(json1, function(key, data) { var exists = false; $.each(arr, function (index, value) { if(value.title === data.id) { var latLng = new google.maps.LatLng(data.latitude, data.longitude, data.altitude); value.link.setPosition(latLng); exists = true; } }); if(!exists) { var latLng = new google.maps.LatLng(data.latitude, data.longitude, data.altitude); var marker = new google.maps.Marker({ position: latLng, map: map, icon: icon, title: data.id }); |
2b4e85bad
|
42 |
|
429786996
|
43 44 45 46 47 48 49 50 51 52 53 54 55 |
var details = "Aircraft :" + " " + data.id + "<br> " + "Path :" + " " + data.departurePoint + " " + "--->" + " " + data.arrivalPoint + "<br>" + "Altitude :" + " " + data.altitude + " " + "ft" + "<br>" + "Speed :" + " " + data.speed + " " + "Knots" + "<br>" + "Departure Time :" + " " + data.departureActualTime + " " + "(Actual)" + "<br>" + "Arrival Time :" + " " + data.arrivalEstimatedTime + " " + "(Estimated)" + "<br>"; arr.push({ title: data.id, link: marker, details : details }); |
2b4e85bad
|
56 |
bindInfoWindow(marker, map, infowindow, details); |
429786996
|
57 58 59 60 61 |
} }); }); },5000); } |
2b4e85bad
|
62 |
function bindInfoWindow(marker, map, infowindow, strDescription) { |
429786996
|
63 |
google.maps.event.addListener(marker, 'click', function() { |
2b4e85bad
|
64 65 |
infowindow.setContent(strDescription); infowindow.open(map, marker); |
429786996
|
66 67 68 |
}); } |
19eace1cf
|
69 |
google.maps.event.addDomListener(document.getElementById("map"), 'load', $scope.initialise()); |
429786996
|
70 |
|
2b4e85bad
|
71 72 73 74 75 76 |
|
e196b9b74
|
77 |
}]); |