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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 30 05:56:15 EDT 2007


Author: verenadiewald
Date: 2007-10-30 05:56:15 -0400 (Tue, 30 Oct 2007)
New Revision: 1778

Modified:
   trunk/mapbender/http/javascripts/map.js
Log:
new functions for getting layer styles, edited function mb_checkScale

Modified: trunk/mapbender/http/javascripts/map.js
===================================================================
--- trunk/mapbender/http/javascripts/map.js	2007-10-30 09:49:56 UTC (rev 1777)
+++ trunk/mapbender/http/javascripts/map.js	2007-10-30 09:56:15 UTC (rev 1778)
@@ -701,8 +701,9 @@
 					var myDivId = "div_" + ii;          
 					var myMapId = "map_" + ii;
 					//disable Layer which are out of scale
-					var str_LayerStyles = mb_checkScale(frameName,i,ii);
-					if(mb_mapObj[i].layers[ii] != "" && str_LayerStyles[0] != ''){
+					var validLayers = mb_checkScale(frameName,i,ii);
+					var layerNames = validLayers.toString();
+					if(mb_mapObj[i].layers[ii] != "" && validLayers != ''){
 						var newMapURL = "";
 
 						if (mb_mapObj[i].wms[ii].gui_wms_mapopacity != 1) {
@@ -729,9 +730,21 @@
 						if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){newMapURL += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=map&";}
 						if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){newMapURL += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetMap&SERVICE=WMS&";} 
 						
-						newMapURL += "LAYERS="+str_LayerStyles[0]+"&";
-						newMapURL += "STYLES="+str_LayerStyles[1]+"&";
-		
+						newMapURL += "LAYERS="+layerNames+"&";
+						newMapURL += "STYLES=";
+						var layer = layerNames.split(",");
+						for(var j=0; j<layer.length; j++){
+							if(j>0){
+								newMapURL  += ",";
+							}
+							if(mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j])==false){
+								newMapURL  += "";
+							}
+							else{
+								newMapURL  += mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]);
+							}
+						}
+						newMapURL += "&";
 						newMapURL += "SRS="+mb_mapObj[i].epsg+"&";
 						newMapURL += "BBOX="+mb_mapObj[i].extent+"&";
 						newMapURL += "WIDTH="+mb_mapObj[i].width+"&";
@@ -779,6 +792,7 @@
 					}
 				}
 			}
+			//console.log(newMapRequest);
 			//prompt("",newMapRequest);
 			writeTag(mb_mapObj[i].frameName,mb_mapObj[i].elementName,newMapRequest);
 		}
@@ -811,10 +825,24 @@
 					if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){newMapURL += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetMap&SERVICE=WMS&";}             
 					
 					//disable Layer which are out of scale
-					var str_LayerStyles = mb_checkScale(frameName,i,ii); 
+					var validLayers = mb_checkScale(frameName,i,ii);
+					var layerNames = validLayers.toString();
+					//var str_LayerStyles = mb_checkScale(frameName,i,ii); 
 
-					newMapURL += "LAYERS="+str_LayerStyles[0]+"&";
-					newMapURL += "STYLES="+str_LayerStyles[1]+"&";
+					newMapURL += "LAYERS="+layerNames+"&";
+					var layer = layerNames.split(",");
+					for(var j=0; j<layer.length; j++){
+						if(j>0){
+							newMapURL  += ",";
+						}
+						if(mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j])==false){
+							newMapURL  += "";
+						}
+						else{
+							newMapURL  += mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]);
+						}
+					}
+					//newMapURL += "STYLES="+str_LayerStyles[1]+"&";
          
 					newMapURL += "SRS="+mb_mapObj[i].epsg+"&";
 					newMapURL += "BBOX="+mb_mapObj[i].extent+"&";
@@ -905,10 +933,10 @@
 	var thisLayer = mb_mapObj[mObj].layers[wmsObj].split(",");
 	var thisScale = mb_getScale(frameName);  
 	var str_layer = "";
-	var str_styles = "";
-	var str_titles = "";
-	var str_legendurls = "";
-	var str_parent = "";
+	//var str_styles = "";
+	//var str_titles = "";
+	//var str_legendurls = "";
+	//var str_parent = "";
 	var cnt_layer = 0;
 	for(var i=0; i<mb_mapObj[mObj].wms[wmsObj].objLayer.length; i++){  
 		var myLayername = mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_name;
@@ -921,14 +949,14 @@
 				if(myMinscale == 0 || thisScale >= myMinscale){minscaleOK = true;}
 				if(myMaxscale == 0 || thisScale <= myMaxscale){maxscaleOK = true;}
 				if(maxscaleOK == true && minscaleOK == true ){
-					if(cnt_layer > 0){str_layer += ","; str_styles += ","; str_titles += ",";str_parent += ","; str_legendurls += ",";}
+					if(cnt_layer > 0){str_layer += ","; }//str_styles += ","; str_titles += ",";str_parent += ","; str_legendurls += ",";}
 					str_layer += thisLayer[ii];
-					str_styles += "";
-					str_titles += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_title;
-					str_parent += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_parent;
-					if(mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_style.length>0){
-					 	str_legendurls += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_style[0]["legendurl"] ;
-					}
+					//str_styles += "";
+					//str_titles += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_title;
+					//str_parent += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_parent;
+					//if(mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_style.length>0){
+					// 	str_legendurls += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_style[0]["legendurl"] ;
+					//}
 					cnt_layer++;
 				}
 			}
@@ -936,10 +964,10 @@
 	}
 	var str_layerstyles = [];
 	str_layerstyles[0] = str_layer;
-	str_layerstyles[1] = str_styles;
-	str_layerstyles[2] = str_titles;
-	str_layerstyles[3] = str_legendurls;
-	str_layerstyles[4] = str_parent;
+	//str_layerstyles[1] = str_styles;
+	//str_layerstyles[2] = str_titles;
+	//str_layerstyles[3] = str_legendurls;
+	//str_layerstyles[4] = str_parent;
 	return str_layerstyles;
 }
 function setFeatureInfoRequest(fName,x,y, path) {



More information about the Mapbender_commits mailing list