climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1489626 - in /incubator/climate/trunk/rcmet/src/main/ui/app/js: app.js controllers.js
Date Tue, 04 Jun 2013 21:29:08 GMT
Author: joyce
Date: Tue Jun  4 21:29:07 2013
New Revision: 1489626

URL: http://svn.apache.org/r1489626
Log:
Resolves CLIMATE-79 - Fix race condition when drawing map overlays.

- Adds isValid flag to regionSelectParams service. This flag is used as
  a lightweight lock so that users of the service know if the data is or
  isn't valid at the time they wish to use it.
- Updates overlay draw code to only attempt to rendering the user
  selected region if the regionSelectParams isValid flag is true.
- In ParameterSelectCtrl the $watch on datasets also calculates the new
  user select-able region and sets the values in regionSelectParams.
  This sets the isValid flag to false at the start of the function, sets
  it to true at the end of calculations, and then broadcasts a
  'redrawOverlay' event so the user region is redrawn.

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

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js?rev=1489626&r1=1489625&r2=1489626&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js Tue Jun  4 21:29:07 2013
@@ -43,12 +43,13 @@ angular.module('rcmes', ['ui.date']).
 	}).
 	service('regionSelectParams', function() {
 		var parameters = {
-			"latMin": "",
-			"latMax": "",
-			"lonMin": "",
-			"lonMax": "",
-			"start" : "",
-			"end"   : "",
+			"areValid" : true,
+			"latMin"   : "",
+			"latMax"   : "",
+			"lonMin"   : "",
+			"lonMax"   : "",
+			"start"    : "",
+			"end"      : "",
 		};
 
 		return {

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=1489626&r1=1489625&r2=1489626&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 Tue Jun  4 21:29:07 2013
@@ -44,8 +44,7 @@ function WorldMapCtrl($rootScope, $scope
  			});
 
 			// Draw user selected region
-			if ($scope.regionParams.latMin != "" && $scope.regionParams.latMax != "" &&

-				$scope.regionParams.lonMin != "" && $scope.regionParams.lonMax != "") {
+			if ($scope.regionParams.areValid) {
 
 				var bounds = [[$scope.regionParams.latMax, $scope.regionParams.lonMin],
 							  [$scope.regionParams.latMin, $scope.regionParams.lonMax]];
@@ -262,6 +261,7 @@ function ParameterSelectCtrl($rootScope,
 	$scope.$watch('datasets', 
 		function() { 
 			var numDatasets = $scope.datasets.length;
+			$scope.displayParams.areValid = false;
 			$scope.areInUserRegridState = false;
 
  			if (numDatasets) {
@@ -305,6 +305,9 @@ function ParameterSelectCtrl($rootScope,
 			$scope.lonMax = lonMax;
 			$scope.start = start.split(" ")[0];
 			$scope.end = end.split(" ")[0];
+
+			$scope.displayParams.areValid = true;
+			$rootScope.$broadcast('redrawOverlays', []);
 		}, true);
 }
 



Mime
View raw message