[hamradio-commits] [dump1090] 245/373: Merge branch 'mapRefactor' into masterMerge

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Thu Oct 23 14:58:24 UTC 2014


This is an automated email from the git hooks/post-receive script.

mernisse-guest pushed a commit to branch backport
in repository dump1090.

commit f53632b00d2e0435c18041a1ec91ede270f409e3
Merge: 3eb21ea 5f0e295
Author: terribl <terri at rannalla.net>
Date:   Mon Jun 3 10:53:17 2013 +0300

    Merge branch 'mapRefactor' into masterMerge
    
    Conflicts:
    	.gitignore
    	public_html/gmap.html
    	public_html/script.js
    
      All conflicts fixed but you are still merging.
    
    	modified:   .gitignore
    	modified:   dump1090.c
    	new file:   public_html/config.js
    	new file:   public_html/coolclock/coolclock.js
    	new file:   public_html/coolclock/excanvas.js
    	new file:   public_html/coolclock/moreskins.js
    	new file:   public_html/extension.js
    	modified:   public_html/gmap.html
    	new file:   public_html/options.js
    	new file:   public_html/planeObject.js
    	modified:   public_html/script.js
    	modified:   public_html/style.css

 .gitignore                         |   2 +-
 dump1090.c                         |   9 +-
 public_html/config.js              |  33 ++
 public_html/coolclock/coolclock.js | 318 +++++++++++++
 public_html/coolclock/excanvas.js  | 785 ++++++++++++++++++++++++++++++++
 public_html/coolclock/moreskins.js | 212 +++++++++
 public_html/extension.js           |  19 +
 public_html/gmap.html              |  93 ++--
 public_html/options.js             |  17 +
 public_html/planeObject.js         | 257 +++++++++++
 public_html/script.js              | 895 ++++++++++++++++++++++---------------
 public_html/style.css              |  83 +---
 12 files changed, 2255 insertions(+), 468 deletions(-)

diff --cc .gitignore
index fd84bc3,8007927..67495f9
--- a/.gitignore
+++ b/.gitignore
@@@ -7,4 -7,5 +7,4 @@@ frames.j
  *~
  *.rej
  *.orig
- public_html/untrackedDeveloperSettings.js
 -untrackedDeveloperSettings.js
 -
++untrackedDeveloperSettings.js
diff --cc public_html/script.js
index 2c612a5,bda2ec3..05a1b1c
--- a/public_html/script.js
+++ b/public_html/script.js
@@@ -245,242 -548,79 +548,94 @@@ function sortTable(szTableID,iCol) 
  	aStore=null;
  }
  
- function fetchData() {
- 	$.getJSON('data.json', function(data) {
- 		// Planes that are still with us, and set map count to 0
- 		var stillhere = {}
- 		PlanesOnMap = 0;
- 
- 		// Loop through all the planes in the data packet
- 		for (var j=0; j < data.length; j++) {
- 
- 			// Set plane to be this particular plane in the data set
- 			var plane = data[j];
- 			// Add to the still here list
- 			stillhere[plane.hex] = true;
- 			plane.flight = $.trim(plane.flight);
- 
- 			// Set the marker to null, for now
- 			var marker = null;
- 
- 			// Either update the data or add it
- 			if (Planes[plane.hex]) {
- 				// Declare our plane that we are working with from our old data set
- 				var myplane = Planes[plane.hex];
- 
- 				// If the has valid position, we should make a marker for it
- 				if (plane.validposition) {
- 					if (myplane.marker != null) {
- 						marker = myplane.marker;
- 						var icon = marker.getIcon();
- 						var newpos = new google.maps.LatLng(plane.lat, plane.lon);
- 						marker.setPosition(newpos);
- 						marker.setIcon(getIconForPlane(plane));
- 						PlanesOnMap++;
- 					} else {
- 						// Add new plane to map, dont ask me why this is needed here now...
- 						marker = new google.maps.Marker({
- 							position: new google.maps.LatLng(plane.lat, plane.lon),
- 							map: Map,
- 							icon: getIconForPlane(plane)
- 						});
- 						myplane.marker = marker;
- 						marker.planehex = plane.hex;
- 						PlanesOnMap++;
- 
- 						// Trap clicks for this marker.
- 						google.maps.event.addListener(marker, 'click', selectPlane);
- 					}
- 				}
- 
- 				// Update all the other information
- 				myplane.altitude = plane.altitude;
- 				myplane.speed = plane.speed;
- 				myplane.lat = plane.lat;
- 				myplane.lon = plane.lon;
- 				myplane.track = plane.track;
- 				myplane.flight = plane.flight;
- 				myplane.seen = plane.seen;
- 				myplane.messages = plane.messages;
- 				myplane.squawk = plane.squawk;
- 				myplane.validposition = plane.validposition;
- 				myplane.validtrack = plane.validtrack;
- 
- 				// If this is a selected plane, refresh its data outside of the table
- 				if (myplane.hex == Selected)
- 					refreshSelectedInfo();
- 			} else {
- 				// This is a new plane
- 				// Do we have a lat/long that is not 0?
- 				if (plane.validposition) {
- 					// Add new plane to map
- 					marker = new google.maps.Marker({
- 						position: new google.maps.LatLng(plane.lat, plane.lon),
- 						map: Map,
- 						icon: getIconForPlane(plane)
- 					});
- 					plane.marker = marker;
- 					marker.planehex = plane.hex;
- 					PlanesOnMap++;
- 
- 					// Trap clicks for this marker.
- 					google.maps.event.addListener(marker, 'click', selectPlane);
- 				}
- 
- 				// Copy the plane into Planes
- 				Planes[plane.hex] = plane;
- 			}
- 
- 			// If we have lat/long, we must have a marker, so lets set the marker title
- 			if (plane.validposition) {
- 				if (plane.flight.length == 0) {
- 					marker.setTitle(plane.hex)
- 				} else {
- 					marker.setTitle(plane.flight+' ('+plane.hex+')')
- 				}
- 			}
- 
+ function selectPlaneByHex(hex) {
+ 	// If SelectedPlane has something in it, clear out the selected
+ 	if (SelectedPlane != null) {
+ 		Planes[SelectedPlane].is_selected = false;
+ 		Planes[SelectedPlane].funcClearLine();
+ 		Planes[SelectedPlane].markerColor = MarkerColor;
+ 		// If the selected has a marker, make it not stand out
+ 		if (Planes[SelectedPlane].marker) {
+ 			Planes[SelectedPlane].marker.setIcon(Planes[SelectedPlane].funcGetIcon());
  		}
+ 	}
  
- 		// How many planes have we heard from?
- 		PlanesOnGrid = data.length;
- 
- 		/* Remove idle planes. */
- 		for (var p in Planes) {
- 			if (!stillhere[p]) {
- 				if (Planes[p].marker != null)
- 					Planes[p].marker.setMap(null);
- 				delete Planes[p];
- 			}
+ 	// If we are clicking the same plane, we are deselected it.
+ 	if (String(SelectedPlane) != String(hex)) {
+ 		// Assign the new selected
+ 		SelectedPlane = hex;
+ 		Planes[SelectedPlane].is_selected = true;
+ 		// If the selected has a marker, make it stand out
+ 		if (Planes[SelectedPlane].marker) {
+ 			Planes[SelectedPlane].funcUpdateLines();
+ 			Planes[SelectedPlane].marker.setIcon(Planes[SelectedPlane].funcGetIcon());
  		}
- 
- 		refreshTableInfo();
- 		refreshSelectedInfo();
- 	});
- }
- 
- function checkTime(i) {
-     if (i < 10) {
-         return "0" + i;
-     }
-     return i;
+ 	} else { 
+ 		SelectedPlane = null;
+ 	}
+     refreshSelected();
+     refreshTableInfo();
  }
  
- function printTime() {
-     var currentTime = new Date();
-     var hours = checkTime(currentTime.getUTCHours());
-     var minutes = checkTime(currentTime.getUTCMinutes());
-     var seconds = checkTime(currentTime.getUTCSeconds());
+ function resetMap() {
+     // Reset localStorage values
+     localStorage['CenterLat'] = CONST_CENTERLAT;
+     localStorage['CenterLon'] = CONST_CENTERLON;
+     localStorage['ZoomLvl']   = CONST_ZOOMLVL;
      
-     if (document.getElementById) {
-         document.getElementById('utcTime').innerHTML =
-             hours + ":" + minutes + ":" + seconds;
-     }
- }
- 
- function placeSettings() {
-     // Settings link
-     var marginLeft = $('#header').width() - $('#info_settings').width();
-     $('#info_settings').css('left', marginLeft);
-     $('#info_settings').css('top', parseInt($('#utcTime').offset().top));
+     // Try to read values from localStorage else use CONST_s
+     CenterLat = Number(localStorage['CenterLat']) || CONST_CENTERLAT;
+     CenterLon = Number(localStorage['CenterLon']) || CONST_CENTERLON;
+     ZoomLvl   = Number(localStorage['ZoomLvl']) || CONST_ZOOMLVL;
      
-     // Settings area
-     $('#info_settings_area').css('top', parseInt($('#geninfo').offset().top));
-     $('#info_settings_area').css('left', 5);
-     $('#info_settings_area').css('width', parseInt($('#info').width() - 40));
- }
- 
- function toggleSettings() {
-     if ($('#info_settings_area').css('display') != 'none') {
-         $('#info_settings_area').hide(350);
-     } else {
-         // Open settings
-         $('#info_settings_area').show(350);
-     }
- }
+     // Set and refresh
+ 	GoogleMap.setZoom(parseInt(ZoomLvl));
+ 	GoogleMap.setCenter(new google.maps.LatLng(parseFloat(CenterLat), parseFloat(CenterLon)));
+ 	
+ 	if (SelectedPlane) {
+ 	    selectPlaneByHex(SelectedPlane);
+ 	}
  
++<<<<<<< HEAD
 +function resetMap() {
 +    localStorage['CenterLat'] = CONST_CENTERLAT;
 +    localStorage['CenterLon'] = CONST_CENTERLON;
 +    localStorage['ZoomLvl']   = CONST_ZOOMLVL;
 +    CenterLat = CONST_CENTERLAT;
 +    CenterLon = CONST_CENTERLON;
 +    ZoomLvl   = CONST_ZOOMLVL;
 +    Map.setZoom(parseInt(localStorage['ZoomLvl']));
 +    Map.setCenter(new google.maps.LatLng(parseFloat(localStorage['CenterLat']),
 +            parseFloat(localStorage['CenterLon'])));
 +    Selected = null;
 +    refreshSelectedInfo();
++=======
+ 	refreshSelected();
+ 	refreshTableInfo();
++>>>>>>> mapRefactor
  }
  
- function initialize() {
-     var mapTypeIds = [];
-     for(var type in google.maps.MapTypeId) {
-         mapTypeIds.push(google.maps.MapTypeId[type]);
-     }
-     mapTypeIds.push("OSM");
- 
-     var mapOptions = {
-         center: new google.maps.LatLng(CenterLat, CenterLon),
-         zoom: ZoomLvl,
-         mapTypeId: google.maps.MapTypeId.ROADMAP,
-         mapTypeControlOptions: {
-             mapTypeIds: mapTypeIds,
+ function drawCircle(marker, distance) {
+     if (typeof distance === 'undefined') {
+         return false;
+         
+         if (!(!isNaN(parseFloat(distance)) && isFinite(distance)) || distance < 0) {
+             return false;
          }
-     };
-     Map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
- 
-     //Define OSM map type pointing at the OpenStreetMap tile server
-     Map.mapTypes.set("OSM", new google.maps.ImageMapType({
-         getTileUrl: function(coord, zoom) {
-            return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
-         },
-         tileSize: new google.maps.Size(256, 256),
-         name: "OpenStreetMap",
-         maxZoom: 18
-     }));
-     
-     // show settings at info-area
-     $(function(){
-         $(window).resize(function(e){
-             placeSettings();
-         });
-         placeSettings();
-         // hide it before it's positioned
-         $('#info_settings').css('display','inline');
-     });
-     
-     // Listener for newly created Map
-     google.maps.event.addListener(Map, 'center_changed', function() {
-         localStorage['CenterLat'] = Map.getCenter().lat();
-         localStorage['CenterLon'] = Map.getCenter().lng();
-     });
+     }
      
-     google.maps.event.addListener(Map, 'zoom_changed', function() {
-         localStorage['ZoomLvl']  = Map.getZoom();
-     });
+     distance *= 1000.0;
+     if (!Metric) {
+         distance *= 1.852;
+     }
      
-     google.maps.event.addListener(Map, 'click', function() {
-         if (Selected) {
-             selectPlane("xyzxyz"); // Select not valid ICAO24 (hex) address to clear selection.
-         }
-         Selected = null;
-         refreshSelectedInfo();
-         refreshTableInfo();
+     // Add circle overlay and bind to marker
+     var circle = new google.maps.Circle({
+       map: GoogleMap,
+       radius: distance, // In meters
+       fillOpacity: 0.0,
+       strokeWeight: 1,
+       strokeOpacity: 0.3
      });
- 
-     // Setup our timer to poll from the server.
-     window.setInterval(function() {
-         fetchData();
-         refreshGeneralInfo();
-     }, 1000);
-     
-     // Faster timer, smoother things
-     window.setInterval(function() {
-         printTime();
-     }, 250);
-     
-     refreshGeneralInfo();
-     refreshSelectedInfo();
-     refreshTableInfo();
+     circle.bindTo('center', marker, 'position');
  }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git



More information about the pkg-hamradio-commits mailing list