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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Aug 28 07:53:54 EDT 2008


Author: verenadiewald
Date: 2008-08-28 07:53:54 -0400 (Thu, 28 Aug 2008)
New Revision: 2895

Modified:
   trunk/mapbender/http/print/mod_printPDF.php
Log:
changed function refreshParams because of bug with dynamicOverview: http://trac.osgeo.org/mapbender/ticket/285 

Modified: trunk/mapbender/http/print/mod_printPDF.php
===================================================================
--- trunk/mapbender/http/print/mod_printPDF.php	2008-08-28 11:45:53 UTC (rev 2894)
+++ trunk/mapbender/http/print/mod_printPDF.php	2008-08-28 11:53:54 UTC (rev 2895)
@@ -232,23 +232,55 @@
 	}
 }
 function refreshParams(){
-	var ind = pt.getMapObjIndexByName(target);
-	var f = document.form1;
-	f.map_url.value = "";
-	for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-		if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-			if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
-				if(f.map_url.value != ""){
-					f.map_url.value += "___";
-				}      
-				f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+	var f = document.forms[0];
+	size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+	format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+	
+	if(size != "" && format != ""){
+		var ind = pt.getMapObjIndexByName(target);
+		var coord = pt.mb_mapObj[ind].extent.split(",");
+		var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+		var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+		
+		var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+		pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+
+		pt.mb_mapObj[ind].width = Math.round(map_width);
+		pt.mb_mapObj[ind].height = Math.round(map_height);
+		pt.document.getElementById(target).style.width = Math.round(map_width);
+		pt.document.getElementById(target).style.height = Math.round(map_height);
+		pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
+		pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
+
+		//pt.setMapRequest(target);		
+		pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+		f.map_url.value = '';
+		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+			if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
+					if(f.map_url.value != ""){
+						f.map_url.value += "___";
+					}         
+					f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+				}
 			}
 		}
+		
+		//overview_url
+		var ind_overview = pt.getMapObjIndexByName('overview');
+
+		//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+		if(pt.mb_mapObj[ind_overview].mapURL != false ){
+			f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+		}
 	}
+
 	f.map_scale.value = pt.mb_getScale(target);
 	f.epsg.value = pt.mb_mapObj[ind].epsg;
+	
 	mod_legend_print();
 }
+	
 function printMap(){
 	if(size != "" && (format == "portrait" || format == "landscape")){
 		refreshParams();



More information about the Mapbender_commits mailing list