climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1499552 - in /incubator/climate/trunk/rcmet/src/main/ui/app/js: controllers/WorldMapCtrl.js directives/LeafletMap.js
Date Wed, 03 Jul 2013 20:50:20 GMT
Author: joyce
Date: Wed Jul  3 20:50:20 2013
New Revision: 1499552

URL: http://svn.apache.org/r1499552
Log:
Resolve CLIMATE-174 - Make map zoom to dataset overlap region

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js
    incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/LeafletMap.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js?rev=1499552&r1=1499551&r2=1499552&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js Wed Jul 
3 20:50:20 2013
@@ -79,6 +79,26 @@ function($rootScope, $scope, selectedDat
  			// Add rectangle Group to map
  			$rootScope.rectangleGroup.addTo($rootScope.map);
  		}
+
+		// Calculate the overlap region and set the map to show the new overlap
+		var latMin = -90,
+			latMax = 90,
+			lonMin = -180,
+			lonMax = 180;
+
+		// Get the valid lat/lon range in the selected datasets.
+		for (var i = 0; i < selectedDatasetInformation.getDatasetCount(); i++) {
+			var curDataset = $scope.datasets[i];
+
+			latMin = (curDataset['latlonVals']['latMin'] > latMin) ? curDataset['latlonVals']['latMin']
: latMin;
+			latMax = (curDataset['latlonVals']['latMax'] < latMax) ? curDataset['latlonVals']['latMax']
: latMax;
+			lonMin = (curDataset['latlonVals']['lonMin'] > lonMin) ? curDataset['latlonVals']['lonMin']
: lonMin;
+			lonMax = (curDataset['latlonVals']['lonMax'] < lonMax) ? curDataset['latlonVals']['lonMax']
: lonMax;
+		}
+
+		var overlapBounds = [[latMax, lonMin], [latMin, lonMax]];
+		$rootScope.map.fitBounds(overlapBounds, {padding: [5, 5]});
+
 	};
 
 	$scope.$on('redrawOverlays', function(event, parameters) {

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/LeafletMap.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/LeafletMap.js?rev=1499552&r1=1499551&r2=1499552&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/LeafletMap.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/LeafletMap.js Wed Jul  3 20:50:20
2013
@@ -29,10 +29,9 @@ App.Directives.directive('leafletMap', f
 				zoom: 2,
 				scrollWheelZoom: false,
 			});
+
 			//create a CloudMade tile layer and add it to the map
-			L.tileLayer('http://{s}.tile.cloudmade.com/57cbb6ca8cac418dbb1a402586df4528/997/256/{z}/{x}/{y}.png',
{
-				maxZoom: 4, minZoom: 2,
-			}).addTo($rootScope.map);
+			L.tileLayer('http://{s}.tile.cloudmade.com/57cbb6ca8cac418dbb1a402586df4528/997/256/{z}/{x}/{y}.png',
{}).addTo($rootScope.map);
 		}
 	};
 });



Mime
View raw message