[Mapbender-commits] r1378 - branches/mapbender_sld/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 30 03:36:14 EDT 2007


Author: uli
Date: 2007-05-30 03:36:14 -0400 (Wed, 30 May 2007)
New Revision: 1378

Modified:
   branches/mapbender_sld/http/javascripts/map.php
Log:
new mapObj methods getMapRequests and getScale

Modified: branches/mapbender_sld/http/javascripts/map.php
===================================================================
--- branches/mapbender_sld/http/javascripts/map.php	2007-05-30 07:35:09 UTC (rev 1377)
+++ branches/mapbender_sld/http/javascripts/map.php	2007-05-30 07:36:14 UTC (rev 1378)
@@ -206,6 +206,29 @@
 	};
 	
 	/**
+	 * get all mapRequests 
+	 *
+	 * @member mb_mapObj_const
+	 * @return array of mapRequests of this map object  
+	 * @type string[]  
+	 */
+	this.getMapRequests = function(){
+		var allRequests = [];
+		//loop through all wms to get the mapRequests
+		for(var i=0; i<this.wms.length; i++){
+			var currentRequest = this.wms[i].getMapRequest(this);
+			if(currentRequest){ 
+				allRequests.push(currentRequest);
+			}
+		}
+		if(allRequests.length > 0){
+			return allRequests;
+		}
+		return false;
+	};
+	
+	
+	/**
 	 * get all featureInfoRequests 
 	 *
 	 * @member mb_mapObj_const
@@ -229,8 +252,20 @@
 		return false;
 	};
 	
+	/**
+	 * calculation of the mapscale 
+	 *
+	 * @member mb_mapObj_const
+	 * @return scale  
+	 * @type integer  
+	 */
+	this.getScale = function(){
+		var bbox = this.extent.split(",");
+		var xtenty =  parseFloat(bbox[3]) - parseFloat(bbox[1]);
+		var scale = (xtenty / this.height) * (mb_resolution * 100);
+		return Math.round(scale);
+	};
 	
-	
    for(var i=0; i<mb_MapObjectSubFunctions.length; i++){
       eval(mb_MapObjectSubFunctions[i]);
    }  
@@ -431,6 +466,7 @@
 	for(var i=0; i<mb_mapObj.length; i++){
 		var newMapRequest = "";
 		if(mb_mapObj[i].frameName == frameName){
+			mb_mapObj[i].getMapRequests();
 			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
 				if(mb_mapObj[i].wms[ii].gui_wms_visible > 0){
 					var myDivId = "div_" + ii;          



More information about the Mapbender_commits mailing list