climate-commits mailing list archives

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

URL: http://svn.apache.org/r1501558
Log:
CLIMATE-184 progress - Initial PreviewMap directive

- Add initial preview map. The directive binds a scope variable to
  passed dataset information and generates a new thumbnail based on the
  long name of the dataset. Using the name as the ID for the map should
  avoid name conflicts but this may change in the future. As it stands
  now there isn't a use case for comparing a model/observation against
  itself. This should be made more robust in the future.

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

Added: 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=1501558&view=auto
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js (added)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/directives/PreviewMap.js Tue Jul  9 21:20:57
2013
@@ -0,0 +1,20 @@
+App.Directives.directive('previewMap', function($rootScope) {
+	return {
+		restrict: 'A',
+		replace: true,
+		scope: {dataset: '=previewMap'},
+		template: '<div id="{{dataset.name}}" class="preview-map"></div>',
+		link: function(scope, element, attrs) {
+			var map = L.map(attrs.id, {
+				center: [40, 0],
+				zoom: 0,
+				scrollWheelZoom: false,
+				zoomControl: false,
+				attributionControl: 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',
{}).addTo(map);
+		}
+	};
+});



Mime
View raw message