climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1501559 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js
Date Tue, 09 Jul 2013 21:21:00 GMT
Author: joyce
Date: Tue Jul  9 21:20:59 2013
New Revision: 1501559

URL: http://svn.apache.org/r1501559
Log:
CLIMATE-184 progress - Center preview maps on dataset bounds

- Use map.fitBounds to center the map on the dataset bounds. This
  doesn't necessarily mean that the entire dataset will be visible in
  the preview map. The map has to be fairly small to fit in the UI so
  large datasets will have their overlap be the entire preview area
  since the map cannot zoom out far enough. This may need to be changed
  later.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js?rev=1501559&r1=1501558&r2=1501559&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js Tue Jul  9 21:20:59
2013
@@ -6,7 +6,7 @@ App.Directives.directive('previewMap', f
 		template: '<div id="{{dataset.name}}" class="preview-map"></div>',
 		link: function(scope, element, attrs) {
 			var map = L.map(attrs.id, {
-				center: [40, 0],
+				//center: [40, 0],
 				zoom: 0,
 				scrollWheelZoom: false,
 				zoomControl: false,
@@ -15,6 +15,10 @@ App.Directives.directive('previewMap', f
 
 			//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',
{}).addTo(map);
+
+			var overlapBounds = [[scope.dataset.latlonVals.latMax, scope.dataset.latlonVals.lonMin],

+								 [scope.dataset.latlonVals.latMin, scope.dataset.latlonVals.lonMax]];
+			map.fitBounds(overlapBounds, {});
 		}
 	};
 });



Mime
View raw message