[Mapbender-commits] r5338 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jan 19 06:39:08 EST 2010


Author: christoph
Date: 2010-01-19 06:39:03 -0500 (Tue, 19 Jan 2010)
New Revision: 5338

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
Log:
linted

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2010-01-19 10:03:30 UTC (rev 5337)
+++ trunk/mapbender/http/javascripts/map_obj.js	2010-01-19 11:39:03 UTC (rev 5338)
@@ -21,7 +21,6 @@
  */
 Mapbender.Map = function(frameName, elementName, width, height, wms_index){
 
-
     var mapMsgObj;
 	var extentHasChanged = false;
     
@@ -222,7 +221,7 @@
 		pageX -= x;
 
 		var y = 0;
-		var t = (typeof(target)=='string') ? 
+		t = (typeof(target)=='string') ? 
 			(document.getElementById ? 
 				document.getElementById(e) : 
 					(document.all ? document.all[e] : null)
@@ -597,13 +596,14 @@
             x = x.x;
         }
         
+		var centerx, centery;
         if (x && y) {
-            var centerx = parseFloat(x);
-            var centery = parseFloat(y);
+            centerx = parseFloat(x);
+            centery = parseFloat(y);
         }
         else {
-            var centerx = extent.minx + distx / 2;
-            var centery = extent.miny + disty / 2;
+            centerx = extent.minx + distx / 2;
+            centery = extent.miny + disty / 2;
         }
         
         var new_distx = distx / factor;
@@ -654,11 +654,12 @@
     };
     
     this.convertPixelToReal = function(aPoint, referenceExtent){
-    	if (arguments.length === 2) {
-    		var arrayBBox = referenceExtent.toString().split(",");
+    	var arrayBBox;
+		if (arguments.length === 2) {
+    		arrayBBox = referenceExtent.toString().split(",");
     	}
     	else {
-	        var arrayBBox = this.getExtent().split(",");
+	        arrayBBox = this.getExtent().split(",");
     	}
         var minX = parseFloat(arrayBBox[0]);
         var minY = parseFloat(arrayBBox[1]);
@@ -678,7 +679,7 @@
 		var posY = parseFloat(maxY - (aPoint.y / this.height) * xtenty);
 		posX = Math.round(posX * roundX) / roundX;
 		posY = Math.round(posY * roundY) / roundY;
-		var pt = new Point(posX.toFixed(-digitsX), posY.toFixed(-digitsY))
+		var pt = new Point(posX.toFixed(-digitsX), posY.toFixed(-digitsY));
 		return pt;
 
     };
@@ -687,11 +688,12 @@
      * Convert real world coordinates to pixel coordinates
      */
     this.convertRealToPixel = function(aPoint, referenceExtent){
-    	if (arguments.length === 2) {
-    		var arrayBBox = referenceExtent.toString().split(",");
+    	var arrayBBox;
+		if (arguments.length === 2) {
+    		arrayBBox = referenceExtent.toString().split(",");
     	}
     	else {
-	        var arrayBBox = this.getExtent().split(",");
+	        arrayBBox = this.getExtent().split(",");
     	}
         var minX = parseFloat(arrayBBox[0]);
         var minY = parseFloat(arrayBBox[1]);
@@ -959,6 +961,7 @@
     
     this.mb_setFutureObj = function(mod_back_cnt){
         var cnt = this.mb_MapFutureObj.length;
+		var i;
         this.mb_MapFutureObj[cnt] = {};
         this.mb_MapFutureObj[cnt].reqCnt = mod_back_cnt;
         this.mb_MapFutureObj[cnt].width = this.width;
@@ -967,19 +970,19 @@
         this.mb_MapFutureObj[cnt].extent = this.extent;
         this.mb_MapFutureObj[cnt].layers = [];
         
-        for (var i = 0; i < this.layers.length; i++) {
+        for (i = 0; i < this.layers.length; i++) {
             this.mb_MapFutureObj[cnt].layers[i] = this.layers[i];
         }
         
         this.mb_MapFutureObj[cnt].styles = [];
         
-        for (var i = 0; i < this.styles.length; i++) {
+        for (i = 0; i < this.styles.length; i++) {
             this.mb_MapFutureObj[cnt].styles[i] = this.styles[i];
         }
         
         this.mb_MapFutureObj[cnt].querylayers = [];
         
-        for (var i = 0; i < this.querylayers.length; i++) {
+        for (i = 0; i < this.querylayers.length; i++) {
             this.mb_MapFutureObj[cnt].querylayers[i] = this.querylayers[i];
         }
     };
@@ -987,14 +990,15 @@
     var drawMaps = function(idArray, index){
 		var numRequests = that.history.count();
 		var requestCnt = index;
-
+		var i;
+		
 		// existing history item
 		if (requestCnt + 1 < numRequests && numRequests > 1 || $("#" + that.elementName + "_request_" + requestCnt).size() > 0) {
 	        $("#" + that.elementName + "_request_" + requestCnt).hide();
-			for (var i = 0; i < requestCnt; i++) {
+			for (i = 0; i < requestCnt; i++) {
 		        $("#" + that.elementName + "_request_" + i).hide();
 			}
-			for (var i = requestCnt + 1; i <= numRequests; i++) {
+			for (i = requestCnt + 1; i <= numRequests; i++) {
 		        $("#" + that.elementName + "_request_" + i).hide();
 			}
 			$("#" + that.elementName + "_request_" + requestCnt + " div img").css({
@@ -1004,13 +1008,12 @@
 		// new history item
 		else {
 	        var newMapRequest = "";
-	        for (var i = 0; i < idArray.length; i++) {
+	        for (i = 0; i < idArray.length; i++) {
 	            var currentWms = that.wms[idArray[i]];
 /*
 				if (doAnimation && currentWms.gui_wms_visible === 2) {
 					// request larger background image
 					var bgExtent = this.calculateExtentAfterZoom(false, 2.0, that.extent.center.x, that.extent.center.y);
-//					console.log(bgExtent);
 					var bgSwPix = that.convertRealToPixel(bgExtent.min);
 					var bgNePix = that.convertRealToPixel(bgExtent.max);
 					
@@ -1019,7 +1022,6 @@
 					var width = bgNePix.x - bgSwPix.x;
 					var height = bgSwPix.y - bgNePix.y;
 					var html = getLayerHtmlCode(idArray[i], bgExtent, width, height, top, left, requestCnt);
-//					console.log(html);
 				}
 */				
 				newMapRequest += getLayerHtmlCode(
@@ -1041,7 +1043,7 @@
 				}).append($(newMapRequest));
 			
 	        $("#" + that.elementName + "_maps").append($currentRequest);
-			for (var i = 0; i < requestCnt; i++) {
+			for (i = 0; i < requestCnt; i++) {
 		        $("#" + that.elementName + "_request_" + i).hide().each(function () {
 					$(this).children().each(function () {
 						this.style.zIndex = this.style.zIndex - 1;
@@ -1054,7 +1056,7 @@
     };
     
     var displayMaps = function(index, wmsArray){
-        var ret = eventBeforeMapRequest.trigger({
+		var ret = eventBeforeMapRequest.trigger({
             map: that
         }, "AND");
         if (ret === false) {
@@ -1126,24 +1128,26 @@
 	var doAnimation = true;
 	
 	this.moveMap = function (x, y) {
+		var newX = x;
+		var newY = y;
 		var index = this.history.getCurrentIndex();
 
 		// do not reset the map
-		if (typeof x !== "undefined") {
+		if (typeof newX !== "undefined") {
 			$("#" + this.elementName + "_request_" + index).css({
-				top: String(y) + "px",
-				left: String(x) + "px"
+				top: String(newY) + "px",
+				left: String(newX) + "px"
 			});
 		}
 		
 		// reset pan sub elements only
 		// TO DO: this looks awkward when animation is turned on
-		if (typeof x === "undefined") {
-			var x = 0;
-			var y = 0;			
+		if (typeof newX === "undefined") {
+			newX = 0;
+			newY = 0;			
 		}
 		for(var i = 0; i < mb_PanSubElements.length; i++) {
-			mb_arrangeElement("", mb_PanSubElements[i], x, y);
+			mb_arrangeElement("", mb_PanSubElements[i], newX, newY);
 		} 
 	};
 	
@@ -1280,10 +1284,9 @@
     this.setMapRequest = function(wmsArray){
         // initialize history
         (function(){
-            var extent = new Extent(that.extent);
+			var extent = new Extent(that.extent);
 			if (typeof that.oldExtent === "undefined") {
 				that.setExtent(extent, false);
-//				displayMaps(0, wmsArray);
 				displayMaps(0);
 				if (typeof wmsArray === "undefined") {
 					animateMaps(0);
@@ -1294,11 +1297,9 @@
 	            that.history.addItem({
 	                forward: function(setExtent){
 						var index = that.history.getCurrentIndex();
-//	                    console.log("FORWARD: " + that.history.getCurrentIndex());
 	                    if (typeof setExtent === "undefined" || setExtent === true) {
 							that.setExtent(extent);
 						}
-//	        			displayMaps(index + 1, wmsArray);
 	        			displayMaps(index + 1);
 						if (typeof wmsArray === "undefined") {
 							animateMaps(index + 1);
@@ -1306,16 +1307,13 @@
 	                },
 	                back: function(){
 						var index = that.history.getCurrentIndex();
-//	                    console.log("BACK: " + that.history.getCurrentIndex());
 						that.setExtent(oldExtent);
-//			            displayMaps(index, wmsArray);
 			            displayMaps(index);
 						if (typeof wmsArray === "undefined") {
 							animateMaps(index);
 						}
 	                }
 	            });
-				
 			}
 		})();
 		
@@ -1578,10 +1576,10 @@
 Mapbender.Map.prototype.getWfsConfIds = function(wfs_config){
     var db_wfs_conf_id = [];
     var js_wfs_conf_id = [];
-    
+    var i, ii;
     //search configurations that are selected (and in scale)
-    for (var i = 0; i < this.wms.length; i++) {
-        for (var ii = 0; ii < this.wms[i].objLayer.length; ii++) {
+    for (i = 0; i < this.wms.length; i++) {
+        for (ii = 0; ii < this.wms[i].objLayer.length; ii++) {
             var o = this.wms[i].objLayer[ii];
             if (o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1') {
                 if (!checkscale || o.checkScale(this)) {
@@ -1590,8 +1588,8 @@
             }
         }
     }
-    for (var i = 0; i < db_wfs_conf_id.length; i++) {
-        for (var ii = 0; ii < wfs_config.length; ii++) {
+    for (i = 0; i < db_wfs_conf_id.length; i++) {
+        for (ii = 0; ii < wfs_config.length; ii++) {
             if (wfs_config[ii].wfs_conf_id == db_wfs_conf_id[i]) {
                 js_wfs_conf_id[js_wfs_conf_id.length] = ii;
                 break;



More information about the Mapbender_commits mailing list