climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1492468 - in /incubator/climate/trunk/rcmet/src/main/ui/app: index.html js/controllers.js js/controllers/ js/controllers/WorldMapCtrl.js
Date Wed, 12 Jun 2013 23:16:00 GMT
Author: joyce
Date: Wed Jun 12 23:16:00 2013
New Revision: 1492468

URL: http://svn.apache.org/r1492468
Log:
CLIMATE-65 progress - Moves WorldMapCtrl

- Moves WorldMapCtrl to js/controllers/WorldMapCtrl.
- Adds new include in index.html for the new file.

Added:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js
Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/index.html
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/index.html
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/index.html?rev=1492468&r1=1492467&r2=1492468&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/index.html (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/index.html Wed Jun 12 23:16:00 2013
@@ -230,6 +230,7 @@
   <script src="js/app.js"></script>
   <script src="js/services.js"></script>
   <script src="js/controllers.js"></script>
+  <script src="js/controllers/WorldMapCtrl.js"></script>
   <script src="js/filters.js"></script>
   <script src="js/directives.js"></script>
 </body>

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js?rev=1492468&r1=1492467&r2=1492468&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js Wed Jun 12 23:16:00 2013
@@ -1,77 +1,5 @@
 'use strict';
 
-// Controller for the world map
-function WorldMapCtrl($rootScope, $scope, selectedDatasetInformation, regionSelectParams)
{
-	$scope.datasets = selectedDatasetInformation.getDatasets();
-	$scope.regionParams = regionSelectParams.getParameters();
-
-	$scope.updateMap = function() {
- 		// Clear Group of layers from map if it exists
- 		if ("rectangleGroup" in $rootScope) {
- 			$rootScope.rectangleGroup.clearLayers();
- 		}
-
-		// Don't process if we don't have any datasets added!!
-		if ($scope.datasets.length == 0)
-			return;
- 		
- 		if ("map" in $rootScope) {
- 			// Create Group to add all rectangles to map
- 			$rootScope.rectangleGroup = L.layerGroup();
- 			
- 			// Loop through datasets and add rectangles to Group 
-			var i = -1;
- 			angular.forEach($scope.datasets, function(dataset) {
-				// Keep track of dataset count for displaying colors
-				i++;
-
-				// If the user disabled the overlay then get out of here!
-				if (!dataset.shouldDisplay)
-					return;
-
- 				// Get bounds from dataset 
- 				var maplatlon = dataset.latlonVals;
- 				var bounds = [[maplatlon.latMax, maplatlon.lonMin], [maplatlon.latMin, maplatlon.lonMax]];
-
- 				var polygon = L.rectangle(bounds,{
-					stroke: false,
-					fillColor: $rootScope.fillColors[i],
- 				    fillOpacity: 0.3
- 				});
-
- 				// Add layer to Group
- 				$rootScope.rectangleGroup.addLayer(polygon);
- 			});
-
-			// Draw user selected region
-			if ($scope.regionParams.areValid) {
-
-				var bounds = [[$scope.regionParams.latMax, $scope.regionParams.lonMin],
-							  [$scope.regionParams.latMin, $scope.regionParams.lonMax]];
-
-				var polygon = L.rectangle(bounds, {
-					color: '#000000',
-					opacity: 1.0,
-					fill: false,
-				});
-
-				$rootScope.rectangleGroup.addLayer(polygon);
-			}
-
- 			// Add rectangle Group to map
- 			$rootScope.rectangleGroup.addTo($rootScope.map);
- 		}
-	};
-
-	$scope.$on('redrawOverlays', function(event, parameters) {
-		$scope.updateMap();
-	});
-
-	$scope.$watch('datasets', function() {
-		$scope.updateMap();
-	}, true);
-};
-
 // Controller for dataset parameter selection/modification
 function ParameterSelectCtrl($rootScope, $scope, $http, $timeout, selectedDatasetInformation,

 							 regionSelectParams, evaluationSettings) {

Added: 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=1492468&view=auto
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js (added)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/WorldMapCtrl.js Wed Jun 12
23:16:00 2013
@@ -0,0 +1,88 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.You may obtain a copy of the License at
+// 
+// http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Controller for the world map
+function WorldMapCtrl($rootScope, $scope, selectedDatasetInformation, regionSelectParams)
{
+	$scope.datasets = selectedDatasetInformation.getDatasets();
+	$scope.regionParams = regionSelectParams.getParameters();
+
+	$scope.updateMap = function() {
+ 		// Clear Group of layers from map if it exists
+ 		if ("rectangleGroup" in $rootScope) {
+ 			$rootScope.rectangleGroup.clearLayers();
+ 		}
+
+		// Don't process if we don't have any datasets added!!
+		if ($scope.datasets.length == 0)
+			return;
+ 		
+ 		if ("map" in $rootScope) {
+ 			// Create Group to add all rectangles to map
+ 			$rootScope.rectangleGroup = L.layerGroup();
+ 			
+ 			// Loop through datasets and add rectangles to Group 
+			var i = -1;
+ 			angular.forEach($scope.datasets, function(dataset) {
+				// Keep track of dataset count for displaying colors
+				i++;
+
+				// If the user disabled the overlay then get out of here!
+				if (!dataset.shouldDisplay)
+					return;
+
+ 				// Get bounds from dataset 
+ 				var maplatlon = dataset.latlonVals;
+ 				var bounds = [[maplatlon.latMax, maplatlon.lonMin], [maplatlon.latMin, maplatlon.lonMax]];
+
+ 				var polygon = L.rectangle(bounds,{
+					stroke: false,
+					fillColor: $rootScope.fillColors[i],
+ 				    fillOpacity: 0.3
+ 				});
+
+ 				// Add layer to Group
+ 				$rootScope.rectangleGroup.addLayer(polygon);
+ 			});
+
+			// Draw user selected region
+			if ($scope.regionParams.areValid) {
+
+				var bounds = [[$scope.regionParams.latMax, $scope.regionParams.lonMin],
+							  [$scope.regionParams.latMin, $scope.regionParams.lonMax]];
+
+				var polygon = L.rectangle(bounds, {
+					color: '#000000',
+					opacity: 1.0,
+					fill: false,
+				});
+
+				$rootScope.rectangleGroup.addLayer(polygon);
+			}
+
+ 			// Add rectangle Group to map
+ 			$rootScope.rectangleGroup.addTo($rootScope.map);
+ 		}
+	};
+
+	$scope.$on('redrawOverlays', function(event, parameters) {
+		$scope.updateMap();
+	});
+
+	$scope.$watch('datasets', function() {
+		$scope.updateMap();
+	}, true);
+};



Mime
View raw message