[Mapbender-commits] r1714 - trunk/mapbender/http/print

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Oct 5 10:27:42 EDT 2007


Author: verenadiewald
Date: 2007-10-05 10:27:41 -0400 (Fri, 05 Oct 2007)
New Revision: 1714

Modified:
   trunk/mapbender/http/print/mod_printPDF.php
Log:
new handling for legendurl

Modified: trunk/mapbender/http/print/mod_printPDF.php
===================================================================
--- trunk/mapbender/http/print/mod_printPDF.php	2007-10-05 13:42:47 UTC (rev 1713)
+++ trunk/mapbender/http/print/mod_printPDF.php	2007-10-05 14:27:41 UTC (rev 1714)
@@ -89,103 +89,63 @@
 	document.forms[0].wms_title.value = "";
 	document.forms[0].legendurl.value = "";
 	
-
-	
 	for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-		if(pt.mb_mapObj[ind].wms[i].gui_wms_visible != 0){
-			layers = pt.mb_checkScale(mod_legend_target,ind,i);
-			var layer = layers[0].split(",");
-			var title = layers[2].split(",");
-			var temp_legendurl = layers[3].split(",");
-			var layerparent= layers[4].split(",");
-	
-			if( pt.mb_mapObj[ind].layers[i] != "" && pt.mb_mapObj[ind].layers[i]){
-	
-			   if(i>0 && document.forms[0].wms_id.value!=''){
+		layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
+		if(layers != "" && layers){
+		
+			if(i>0 && document.forms[0].wms_id.value!=''){
 			    document.forms[0].layers.value += "___";
 			    document.forms[0].wms_id.value += "___";
 			    document.forms[0].wms_title.value += "___";
 			    document.forms[0].legendurl.value += "___";
+			}
+					
+			document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;   
+			document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
+				
+			for(var j=0; j<layers.length; j++){			
+				var layer = layers[j];
+				var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
+				var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
+				if(layerStyle==false){
+					var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");	
 				}
+				else{
+					var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
+				}
 				
-				//document.forms[0].layers.value += pt.mb_mapObj[ind].wms[i].objLayer[ii].layer_title; //pt.mb_mapObj[ind].layers[i]	;
-				
-				document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;   
-				document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
-				
 				//---------- legendurl ----------
-				tmp_name = "";
-				for(var j=0; j<layer.length; j++){
-				 if(layerparent[j] == 0){
-					if(j>0){
-						document.forms[0].layers.value += ",";
-					}
-	
-					var l = pt.mb_getchildsbyname(ind,i,layer[j]);
-	
-				 	if (l) {
-				 		document.forms[0].layers.value += title[j];
-	
-				 		if(j>0){
-							document.forms[0].legendurl.value += ",";
-						}
-						for (var k=0; k<l["name"].length; k++){
-					 		if (tmp_name != l["title"][k]) {
-					 		    document.forms[0].layers.value += "*"
-					 			if(k>0){
-					 				 document.forms[0].legendurl.value += "*";
-					 			}else{
-					 				 document.forms[0].legendurl.value += '1*';
-					 			}
-	
-								if (l["legendurl"][k] != '' || !l["legendurl"][k]==true){
-									document.forms[0].layers.value += l["name"][k];
-					  				document.forms[0].legendurl.value += l["legendurl"][k];
-								}else{
-									document.forms[0].layers.value += '0';
-									document.forms[0].legendurl.value += '0';
-								}
-								tmp_name = l["title"][k];
-					 		}	// if
-						 } // for var k=0
-	
-					} // if (l) 
-					else{
-						//prompt (!temp_legendurl[j] ,temp_legendurl[j] + !temp_legendurl[j]);
-	
-							document.forms[0].layers.value += title[j];
-							if(j>0){
-								document.forms[0].legendurl.value += ",";
-							}
-							if (temp_legendurl[j]!= '' || !temp_legendurl[j] == 'true'){
-								document.forms[0].legendurl.value += temp_legendurl[j];
-							}else{
-								document.forms[0].legendurl.value +='0';
-							}
-						
-					}// else (l) 
-				   }//check parent==0
-				}//for var j=0
-				
-				//-------------------
-	
-				//document.forms[0].legendurl.value += layers[3];
-		
-			} else{
-				 if(i>0 && document.forms[0].wms_id.value!=''){
+				tmp_name = "";	
+				if(j>0){
+					document.forms[0].layers.value += ",";
+				}
+					document.forms[0].layers.value += title;
+				if(j>0){
+					document.forms[0].legendurl.value += ",";
+				}
+				if (temp_legendurl!= '' || !temp_legendurl == 'true'){
+					document.forms[0].legendurl.value += temp_legendurl;
+				}else{
+					document.forms[0].legendurl.value +='0';
+				}	
+			}	
+		}
+		else{
+			if(i>0 && document.forms[0].wms_id.value!=''){
 			    document.forms[0].layers.value += "___";
 			    document.forms[0].wms_id.value += "___";
 			    document.forms[0].wms_title.value += "___";
 			    document.forms[0].legendurl.value += "___";
-				}
-				
-				document.forms[0].layers.value += "0";
-			    document.forms[0].wms_id.value += "0";
-			    document.forms[0].wms_title.value += "0";
-			    document.forms[0].legendurl.value += "0";
-			}
-		}//if
+		    }
+			
+			document.forms[0].layers.value += "0";
+		    document.forms[0].wms_id.value += "0";
+		    document.forms[0].wms_title.value += "0";
+		    document.forms[0].legendurl.value += "0";
+		}
 	}//for
+	//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);	
+		
 }
 
 function validate(){



More information about the Mapbender_commits mailing list