Blame view

app/partials/flightTracking/flightTracking.controller.js 2.6 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

19eace1cf   Anchit Jindal   minor
12
13
  	$scope.initialise = function() {
  		var mapProp = {
2b4e85bad   Anchit Jindal   minor chages
14
  	        center: new google.maps.LatLng(36.778259, -98.417931), //LLANDRINDOD WELLS
429786996   Kuldeep Arora   live flight track...
15
16
17
18
19
  	        zoom: 4,
  	        mapTypeId: google.maps.MapTypeId.ROADMAP
  	    };
  
  	    map = new google.maps.Map(document.getElementById("map"), mapProp);
2b4e85bad   Anchit Jindal   minor chages
20
  	    console.log('sssssssss', json);
429786996   Kuldeep Arora   live flight track...
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   Anchit Jindal   minor chages
42
  				        
429786996   Kuldeep Arora   live flight track...
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   Anchit Jindal   minor chages
56
  				        bindInfoWindow(marker, map, infowindow, details);
429786996   Kuldeep Arora   live flight track...
57
58
59
60
61
  				  	  }
  			      });
  			});
  		},5000);
  	}
2b4e85bad   Anchit Jindal   minor chages
62
  	 function bindInfoWindow(marker, map, infowindow, strDescription) {
429786996   Kuldeep Arora   live flight track...
63
           google.maps.event.addListener(marker, 'click', function() {
2b4e85bad   Anchit Jindal   minor chages
64
65
               infowindow.setContent(strDescription);
               infowindow.open(map, marker);
429786996   Kuldeep Arora   live flight track...
66
67
68
           });
       }
  	 
19eace1cf   Anchit Jindal   minor
69
  	 google.maps.event.addDomListener(document.getElementById("map"), 'load', $scope.initialise());
429786996   Kuldeep Arora   live flight track...
70
  	 
2b4e85bad   Anchit Jindal   minor chages
71
72
73
74
75
76
  	 
           
  	
  	
  	
  	
e196b9b74   Anchit Jindal   new changes added
77
  }]);