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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Nov 9 10:00:31 EST 2007


Author: christoph
Date: 2007-11-09 10:00:31 -0500 (Fri, 09 Nov 2007)
New Revision: 1793

Modified:
   trunk/mapbender/http/javascripts/map.js
Log:
added set mb_extensiondata, get mb_extensiondata

Modified: trunk/mapbender/http/javascripts/map.js
===================================================================
--- trunk/mapbender/http/javascripts/map.js	2007-11-09 14:34:28 UTC (rev 1792)
+++ trunk/mapbender/http/javascripts/map.js	2007-11-09 15:00:31 UTC (rev 1793)
@@ -106,6 +106,24 @@
 	} 	 
 }
 
+function mb_setWmcExtensionData(anArray) {
+	for (var i in anArray) {
+		if (typeof(anArray[i]) != "undefined") {
+			currentWmcExtensionData[i] = anArray[i];
+		}
+	}
+}
+
+function mb_getWmcExtensionData(arrayKey) {
+	for (var i in restoredWmcExtensionData) {
+		if (arrayKey == i) {
+			return restoredWmcExtensionData[i];
+		}
+	}
+	var e = new Mb_warning("mb_getWmcExtensionData: "+arrayKey+" not found. Maybe this GUI does not allow loading or saving WMC documents from/to the session");
+	return null;
+}
+
 var mb_PanSubElements = [];
 function mb_registerPanSubElement(elName){
 	var ind = mb_PanSubElements.length;
@@ -147,72 +165,80 @@
 }
 
 function mb_mapObj_const(frameName, elementName, width, height, wms_index){
+	this.width = width;
+	this.height = height;
+	this.frameName = frameName;
+	this.elementName = elementName;
+	this.layers = [];
+	this.styles = [];
+	this.querylayers = [];
+	this.geom = "";
+	this.gml = ""; 
 
-   this.width = width;
-   this.height = height;
-   this.frameName = frameName;
-   this.elementName = elementName;
-   this.layers = [];
-   this.styles = [];
-   this.querylayers = [];
-   this.geom = "";
-   this.gml = ""; 
-   if(wms_index != null){
-      this.wms = [];
-      this.wms[0] = wms[wms_index];
-      this.wms[0].mapURL = false;
-      var cnt_layers = 0;
-      var cnt_querylayers = 0;
-      var styles = "";
-      var layers = "";
-      var querylayers = "";
-      for(var ii=0; ii<this.wms[0].objLayer.length; ii++){
-         if(this.wms[0].objLayer[ii].gui_layer_visible == 1 && ii>0){
-            if(cnt_layers > 0){layers += ","; styles += ","; }
-            layers += this.wms[0].objLayer[ii].layer_name; 
-            styles += ""; 
-            cnt_layers++;
-         }   
-         if(this.wms[0].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
-            if(cnt_querylayers > 0){querylayers += ",";}
-            querylayers += this.wms[0].objLayer[ii].layer_name; 
-            cnt_querylayers++;
-         }                      
-      }
-      this.layers[0] = layers;
-      this.styles[0] = styles;
-      this.querylayers[0] = querylayers;   
-   }
-   else{
-	this.wms = [];
-	for(i=0; i<wms.length; i++){
-		this.wms[i] = wms[i];
-		this.wms[i].mapURL = false;
+	if (wms_index !== null){
+		this.wms = [];
+		this.wms[0] = wms[wms_index];
+		this.wms[0].mapURL = false;
+		var cnt_layers = 0;
+		var cnt_querylayers = 0;
+		var styles = "";
+		var layers = "";
+		var querylayers = "";
+		for (var ii=0; ii<this.wms[0].objLayer.length; ii++){
+			if (this.wms[0].objLayer[ii].gui_layer_visible == 1 && ii>0){
+				if (cnt_layers > 0) {
+					layers += ","; styles += ","; 
+				}
+				layers += this.wms[0].objLayer[ii].layer_name; 
+				styles += ""; 
+				cnt_layers++;
+			}   
+			if (this.wms[0].objLayer[ii].gui_layer_querylayer == 1 && ii>0) {
+				if (cnt_querylayers > 0) {
+					querylayers += ",";
+				}
+				querylayers += this.wms[0].objLayer[ii].layer_name; 
+				cnt_querylayers++;
+			}                      
+		}
+		this.layers[0] = layers;
+		this.styles[0] = styles;
+		this.querylayers[0] = querylayers;   
 	}
-      for(var i=0; i< this.wms.length; i++){
-         var cnt_layers = 0;
-         var cnt_querylayers = 0;
-         var styles = "";
-         var layers = "";
-         var querylayers = "";
-         for(var ii=0; ii<this.wms[i].objLayer.length; ii++){
-            if(this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
-               if(cnt_layers > 0){layers += ","; styles += ","; }
-               layers += wms[i].objLayer[ii].layer_name; 
-               styles += ""; 
-               cnt_layers++;
-            }            
-            if(this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
-               if(cnt_querylayers > 0){querylayers += ",";}
-               querylayers += wms[i].objLayer[ii].layer_name; 
-               cnt_querylayers++;
-            }                          
-         }
-         this.layers[i] = layers;
-         this.styles[i] = styles;
-         this.querylayers[i] = querylayers;
-      }
-   }
+	else {
+		this.wms = [];
+		for(var i=0; i<wms.length; i++){
+			this.wms[i] = wms[i];
+			this.wms[i].mapURL = false;
+		}
+		for(i=0; i< this.wms.length; i++){
+			var cnt_layers = 0;
+			var cnt_querylayers = 0;
+			var styles = "";
+			var layers = "";
+			var querylayers = "";
+			for(var ii=0; ii<this.wms[i].objLayer.length; ii++){
+				if(this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
+					if(cnt_layers > 0){
+						layers += ","; styles += ","; 
+					}
+					layers += wms[i].objLayer[ii].layer_name; 
+					styles += ""; 
+					cnt_layers++;
+				}            
+				if(this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
+					if(cnt_querylayers > 0){
+						querylayers += ",";
+					}
+					querylayers += wms[i].objLayer[ii].layer_name; 
+					cnt_querylayers++;
+				}                          
+			}
+			this.layers[i] = layers;
+			this.styles[i] = styles;
+			this.querylayers[i] = querylayers;
+		}
+	}
    this.epsg = wms[0].gui_wms_epsg;
    this.extent = setExtent(this.width,this.height,this.epsg);
    this.mapURL = [];
@@ -803,12 +829,13 @@
 }
 function setSingleMapRequest(frameName,wms_id){
 	var functionName = 'setSingleMapRequest';
+	
 	var ts = mb_timestamp();	
 	
 	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
 		eval(mb_MapRequestPreFunctions[i]);
 	}	
-	for(var i=0; i<mb_mapObj.length; i++){
+	for(i=0; i<mb_mapObj.length; i++){
 		var newMapRequest = "";
 		if(mb_mapObj[i].frameName == frameName){
 			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){ 
@@ -872,8 +899,10 @@
 						var temp = "&SLD=" + tmp+ "&";
 						newMapURL += temp;
 					}
+
 					//prompt("",newMapURL);
-					if(mb_mapObj[i].layers[ii] != "" && str_LayerStyles[0] != ""){
+					if(mb_mapObj[i].layers[ii] != ""){
+//					if(mb_mapObj[i].layers[ii] != "" && str_LayerStyles[0] != ""){
 						newMapRequest += newMapURL;
 						mb_mapObj[i].mapURL[ii] = newMapURL;
 						mb_mapObj[i].wms[ii].mapURL = newMapURL;
@@ -885,6 +914,7 @@
 						newMapRequest = "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
 						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
 					}        
+
 					//prompt("",newMapRequest);
 					if(mb_log){
 						var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
@@ -894,6 +924,7 @@
 			}           
 		}      
 	}   
+	
 	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
 		eval(mb_MapRequestSubFunctions[i]);
 	}  
@@ -977,7 +1008,7 @@
 		eval(mb_FeatureInfoPreFunctions[i]);
 	}   
 	var cnt_fi = 0;
-	for(var i=0; i<mb_mapObj.length; i++){
+	for(i=0; i<mb_mapObj.length; i++){
 		if(mb_mapObj[i].frameName == fName){
 			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
 				var newfeatureInfoRequest = "";



More information about the Mapbender_commits mailing list