Blame view

app/partials/flightTracking/flightTracking.controller.js 2.61 KB
e196b9b74   Anchit Jindal   new changes added
1
2
3
  'use strict';
  
  angular.module('acufuel')
2b4e85bad   Anchit Jindal   minor chages
4
  .controller('flightTrackingController', ['$scope','$compile', 'uiCalendarConfig', 'flightTrackingService', function($scope, $compile, uiCalendarConfig, flightTrackingService) {
429786996   Kuldeep Arora   live flight track...
5
  	
429786996   Kuldeep Arora   live flight track...
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   Anchit Jindal   minor chages
11

429786996   Kuldeep Arora   live flight track...
12
13
14
  	init();
  	function initialize() {
  	var mapProp = {
2b4e85bad   Anchit Jindal   minor chages
15
  	        center: new google.maps.LatLng(36.778259, -98.417931), //LLANDRINDOD WELLS
429786996   Kuldeep Arora   live flight track...
16
17
18
19
20
  	        zoom: 4,
  	        mapTypeId: google.maps.MapTypeId.ROADMAP
  	    };
  
  	    map = new google.maps.Map(document.getElementById("map"), mapProp);
2b4e85bad   Anchit Jindal   minor chages
21
  	    console.log('sssssssss', json);
429786996   Kuldeep Arora   live flight track...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  	    
  		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   Anchit Jindal   minor chages
43
  				        
429786996   Kuldeep Arora   live flight track...
44
45
46
47
48
49
50
51
52
53
54
55
56
  				        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   Anchit Jindal   minor chages
57
  				        bindInfoWindow(marker, map, infowindow, details);
429786996   Kuldeep Arora   live flight track...
58
59
60
61
62
  				  	  }
  			      });
  			});
  		},5000);
  	}
2b4e85bad   Anchit Jindal   minor chages
63
  	 function bindInfoWindow(marker, map, infowindow, strDescription) {
429786996   Kuldeep Arora   live flight track...
64
           google.maps.event.addListener(marker, 'click', function() {
2b4e85bad   Anchit Jindal   minor chages
65
66
               infowindow.setContent(strDescription);
               infowindow.open(map, marker);
429786996   Kuldeep Arora   live flight track...
67
68
69
           });
       }
  	 
429786996   Kuldeep Arora   live flight track...
70
  	 function init(){
2b4e85bad   Anchit Jindal   minor chages
71
  		 console.log('aaaaaa')
429786996   Kuldeep Arora   live flight track...
72
73
74
  		 google.maps.event.addDomListener(window, 'load', initialize);
  	 }
  	 
2b4e85bad   Anchit Jindal   minor chages
75
76
77
78
79
80
  	 
           
  	
  	
  	
  	
e196b9b74   Anchit Jindal   new changes added
81
  }]);