[Mapbender-commits] r3151 - in branches/noframes/http: javascripts print

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Oct 13 08:19:48 EDT 2008


Author: nimix
Date: 2008-10-13 08:19:48 -0400 (Mon, 13 Oct 2008)
New Revision: 3151

Modified:
   branches/noframes/http/javascripts/geometry.js
   branches/noframes/http/javascripts/map_obj.js
   branches/noframes/http/javascripts/mod_coords.php
   branches/noframes/http/javascripts/mod_digitize_tab.php
   branches/noframes/http/javascripts/mod_dragMapSize.php
   branches/noframes/http/javascripts/mod_export_image.php
   branches/noframes/http/javascripts/mod_featureInfoTunnel.php
   branches/noframes/http/javascripts/mod_highlightPOI.php
   branches/noframes/http/javascripts/mod_resize_mapsize.php
   branches/noframes/http/print/mod_printPDF.php
Log:
some more changes for noframe

Modified: branches/noframes/http/javascripts/geometry.js
===================================================================
--- branches/noframes/http/javascripts/geometry.js	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/geometry.js	2008-10-13 12:19:48 UTC (rev 3151)
@@ -1405,7 +1405,7 @@
 		mapframeHeight = mb_mapObj[mapObjInd].height;
 	});
 	var style = aStyle;
-	var canvas = new jsGraphics(aTagName, window.frames[mapframe]);
+	var canvas = new jsGraphics(aTagName, mb_mapObj[mapObjInd].getDomElement().frameName?window.frames[mapframe]:window);
 	canvas.setStroke(lineWidth);
 	mb_registerPanSubElement(aTagName);
 }

Modified: branches/noframes/http/javascripts/map_obj.js
===================================================================
--- branches/noframes/http/javascripts/map_obj.js	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/map_obj.js	2008-10-13 12:19:48 UTC (rev 3151)
@@ -32,6 +32,12 @@
 	 */
 	this.setWidth = function(width){
 		this.width = parseInt(width, 10);
+
+		//apply new width
+		if(this.frameName){
+			document.getElementById(this.frameName).style.width = this.width;
+		}
+		this.domElement.style.width = this.width;
 	};
 	
 	/**
@@ -52,6 +58,12 @@
 	 */
 	this.setHeight = function(height){
 		this.height = parseInt(height, 10);
+
+		//apply new height
+		if(this.frameName){
+			document.getElementById(this.frameName).style.height = this.height;
+		}
+		this.domElement.style.height = this.height;
 	};
 	
 	/**

Modified: branches/noframes/http/javascripts/mod_coords.php
===================================================================
--- branches/noframes/http/javascripts/mod_coords.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_coords.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -21,6 +21,7 @@
 echo "var mod_showCoords_target = '".$e_target[0]."';";
 ?>
 
+var mod_showCoords_map = null;
 var mod_showCoords_win = null;
 var mod_showCoords_elName = "showCoords";
 var mod_showCoords_frameName = "";
@@ -37,43 +38,33 @@
 	mb_button[ind].elName = mod_showCoords_elName;
 	mb_button[ind].fName = mod_showCoords_frameName;
 	mb_button[ind].go = new Function ("mod_showCoords_run()");
-	mb_button[ind].stop = new Function ("mod_showCoords_disable()");   
+	mb_button[ind].stop = new Function ("mod_showCoords_disable()");
+	
+	mod_showCoords_map = getMapObjByName(mod_showCoords_target);
 }
 function mod_showCoords_run(){
-	window.frames[mod_showCoords_target].document.onmousemove = mod_showCoords_display;
-	window.frames[mod_showCoords_target].document.onclick = mod_showCoords_click;
+	var el = mod_showCoords_map.getDomElement();
+	el.onmousemove = mod_showCoords_display;
+	el.onclick = mod_showCoords_click;
 }
 function mod_showCoords_disable(){
-	window.frames[mod_showCoords_target].document.onclick = null;
-	window.frames[mod_showCoords_target].document.onmousemove = null;
+	var el = mod_showCoords_map.getDomElement();
+	el.onmousemove = null;
+	el.onclick = null;
 	window.status = "";
 }
 function mod_showCoords_click(e){
 	mod_showCoords_win = window.open("","","width=150, height=100");
 	mod_showCoords_win.document.open("text/html");
-	if(ie){
-		clickX = window.frames[mod_showCoords_target].event.clientX;
-		clickY = window.frames[mod_showCoords_target].event.clientY;
 
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
+	mod_showCoords_map.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_showCoords_target, clickX, clickY);
 	mod_showCoords_win.document.write((Math.round(pos[0]*100)/100) + " / " +  (Math.round(pos[1]*100)/100));
 	mod_showCoords_win.document.close();
 	mod_showCoords_win.focus();
 }
 function mod_showCoords_display(e){
-	if(ie){
-		clickX = window.frames[mod_showCoords_target].event.clientX;
-		clickY = window.frames[mod_showCoords_target].event.clientY;
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
+	mod_showCoords_map.getMousePos(e);
 	var pos = makeClickPos2RealWorldPos(mod_showCoords_target, clickX, clickY);
 	window.status = pos[0] + " / " +  pos[1];
 }
\ No newline at end of file

Modified: branches/noframes/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/noframes/http/javascripts/mod_digitize_tab.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_digitize_tab.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -437,11 +437,12 @@
 
 
 function setStyleForTargetFrame(){
-	var cssLink = parent.window.frames[mod_digitize_target].document.createElement("link");
+	var target_map = getMapObjByName(mod_digitize_target);
+	var cssLink = target_map.getDomElement().ownerDocument.createElement("link");
 	cssLink.setAttribute("href", cssUrl); 
 	cssLink.setAttribute("type", "text/css"); 
 	cssLink.setAttribute("rel", "stylesheet"); 
-	var cssTmp = parent.window.frames[mod_digitize_target].document.getElementsByTagName("head")[0];
+	var cssTmp = target_map.getDomElement().ownerDocument.getElementsByTagName("head")[0];
 	cssTmp.appendChild(cssLink);
 }
 

Modified: branches/noframes/http/javascripts/mod_dragMapSize.php
===================================================================
--- branches/noframes/http/javascripts/mod_dragMapSize.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_dragMapSize.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -78,12 +78,12 @@
 	mb_getMousePos(e);
 	mb_end_x = clickX;
 	mb_end_y = clickY;
-	var ind = getMapObjIndexByName(mod_dragMapSize_target);
+	targetObject = getMapObjByName(mod_dragMapSize_target);
 	var dif_x = (parseFloat(mb_end_x) - parseFloat(mb_start_x));
 	var dif_y = (parseFloat(mb_end_y) - parseFloat(mb_start_y));
 	
-	if(parseFloat(mb_mapObj[ind].width) + parseFloat(dif_x)<0 ||
-		parseFloat(mb_mapObj[ind].height) + parseFloat(dif_y)<0)
+	if(parseFloat(targetObject.width) + parseFloat(dif_x)<0 ||
+		parseFloat(targetObject.height) + parseFloat(dif_y)<0)
 	{
 		var dif_x = mb_start_x - (parseInt(document.getElementById('dragMapSize').style.width) / 2);
 		var dif_y = mb_start_y - (parseInt(document.getElementById('dragMapSize').style.height) / 2);
@@ -93,21 +93,12 @@
 	var newX = (parseFloat(mb_mapObj[ind].width) + parseFloat(dif_x));
 	var newY = (parseFloat(mb_mapObj[ind].height) + parseFloat(dif_y));
 	var pos =  makeClickPos2RealWorldPos(mod_dragMapSize_target, newX, newY);
-	mb_mapObj[ind].width = parseFloat(mb_mapObj[ind].width) + parseFloat(dif_x);
-	mb_mapObj[ind].height = parseFloat(mb_mapObj[ind].height) + parseFloat(dif_y);
+	targetObject.setWidth(targetObject.getWidth() + parseFloat(dif_x));
+	targetObject.setHeight(targetObject.getHeight() + parseFloat(dif_y));
 
-	targetObject = getMapObjByName(mod_dragMapSize_target);
-	if(targetObject.frameName){
-		document.getElementById(targetObject.frameName).style.width = mb_mapObj[ind].width;
-		document.getElementById(targetObject.frameName).style.height = mb_mapObj[ind].height;
-	}
-	var el = targetObject.getDomElement();
-	el.style.width = mb_mapObj[ind].width;
-	el.style.height = mb_mapObj[ind].height;
-	
-	var mybbox = mb_mapObj[ind].extent.split(",");
-	mb_mapObj[ind].extent = mybbox[0] + "," + pos[1] + "," + pos[0] + "," +  mybbox[3];
-	setMapRequest(mod_dragMapSize_target);
+	var mybbox = targetObject.extent.split(",");
+	targetObject.setExtent(mybbox[0], pos[1], pos[0], mybbox[3]);
+	targetObject.setMapRequest();
 	eventResizeMap.trigger();
 }
 

Modified: branches/noframes/http/javascripts/mod_export_image.php
===================================================================
--- branches/noframes/http/javascripts/mod_export_image.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_export_image.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -151,15 +151,10 @@
 			document.form1.header_height.value = header_Landscape_a3_height;
 		}            
 		var pos = window.opener.makeClickPos2RealWorldPos(mod_print1_target, document.form1.map_width.value , document.form1.map_height.value );
-		window.opener.mb_mapObj[ind].width = document.form1.map_width.value;
-		window.opener.mb_mapObj[ind].height = document.form1.map_height.value;
-		window.opener.document.getElementById(mod_print1_target).style.width = document.form1.map_width.value;
-		window.opener.document.getElementById(mod_print1_target).style.height = document.form1.map_height.value;
-		window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.width = document.form1.map_width.value;
-		window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.height = document.form1.map_height.value;
-      
-		window.opener.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-		window.opener.setMapRequest(mod_print1_target);
+		window.opener.mb_mapObj[ind].setWidth(document.form1.map_width.value);
+		window.opener.mb_mapObj[ind].setHeight(document.form1.map_height.value);
+		window.opener.mb_mapObj[ind].setExtent(coord[0], pos[1], pos[0], coord[3]);
+		window.opener.mb_mapObj[ind].setMapRequest();
 	}
 }
 function refreshParams(){

Modified: branches/noframes/http/javascripts/mod_featureInfoTunnel.php
===================================================================
--- branches/noframes/http/javascripts/mod_featureInfoTunnel.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_featureInfoTunnel.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -32,6 +32,7 @@
 var mod_featureInfoTunnel_elName = "featureInfoTunnel";
 var mod_featureInfoTunnel_frameName = "";
 var mod_featureInfoTunnel_target = "<?php echo $e_target[0]; ?>";
+var mod_featureInfoTunnel_map = null;
 
 var mod_featureInfoTunnel_img_on = new Image(); mod_featureInfoTunnel_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
 var mod_featureInfoTunnel_img_off = new Image(); mod_featureInfoTunnel_img_off.src ="<?php  echo $e_src;  ?>";
@@ -47,41 +48,34 @@
 	mb_button[ind].fName = mod_featureInfoTunnel_frameName;
 	mb_button[ind].go = new Function ("mod_featureInfoTunnel_click()");
 	mb_button[ind].stop = new Function ("mod_featureInfoTunnel_disable()");
+	
+	mod_featureInfoTunnel_map = getMapObjByName(mod_featureInfoTunnel_target);
 }
 function mod_featureInfoTunnel_click(){   
-	window.frames[mod_featureInfoTunnel_target].document.onclick = mod_featureInfoTunnel_event;
+	mod_featureInfoTunnel_map.getDomElement().onclick = mod_featureInfoTunnel_event;
 }
 function mod_featureInfoTunnel_disable(){
-	window.frames[mod_featureInfoTunnel_target].document.onclick = null;
+	mod_featureInfoTunnel_map.getDomElement().onclick = null;
 }
 function mod_featureInfoTunnel_event(e){
-	if(ie){
-		clickX = window.frames[mod_featureInfoTunnel_target].event.clientX;
-		clickY = window.frames[mod_featureInfoTunnel_target].event.clientY;
+	mod_featureInfoTunnel_map.getMousePos(e);
 
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
-
 	eventBeforeFeatureInfo.trigger({"fName":mod_featureInfoTunnel_target});
 
-	var ind = getMapObjIndexByName(mod_featureInfoTunnel_target);
-	var point = new Point(clickX,clickY);
+	var point = mod_featureInfoTunnel_map.getMousePos(e);
 	var path = '../extensions/ext_featureInfoTunnel.php';
 	
 //TODO that code should go to featureInfo Redirect module
 	if(document.getElementById("FeatureInfoRedirect")){
 		//fill the frames
-		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-			var req = mb_mapObj[ind].wms[i].getFeatureInfoRequest(mb_mapObj[ind], point);
+		for(var i=0; i<mod_featureInfoTunnel_map.wms.length; i++){
+			var req = mod_featureInfoTunnel_map.wms[i].getFeatureInfoRequest(mb_mapObj[ind], point);
 			if(req)
-				window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[ind].wms[i].wms_id).src = path+"?url="+escape(req);
+				window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfoTunnel_map.wms[i].wms_id).src = path+"?url="+escape(req);
 		}
 	}
 	else{
-		urls = mb_mapObj[ind].getFeatureInfoRequests(point);
+		urls = mod_featureInfoTunnel_map.getFeatureInfoRequests(point);
 		if(urls){
 			for(var i=0;i<urls.length;i++){
 				if(featureInfoLayerPopup == 'true'){

Modified: branches/noframes/http/javascripts/mod_highlightPOI.php
===================================================================
--- branches/noframes/http/javascripts/mod_highlightPOI.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_highlightPOI.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -121,11 +121,8 @@
 
 function mod_highlightPOI_draw(){
   var ind = getMapObjIndexByName(mod_highlightPOI_target);
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.width = mb_mapObj[ind].width;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.height = mb_mapObj[ind].height;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.top = 0;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.left = 0;
-  window.frames[mod_highlightPOI_target].document.getElementById('permanent').style.visibility = 'visible';
+  var div = new DivTag(mod_highlightPOI_target+'permanent', mb_mapObj[ind].frameName, 
+  	"position:absolute;width:"+mb_mapObj[ind].width+";height:"+mb_mapObj[ind].height+";top:0;left:0;visibility:visible");
   var tagSource = "";
   for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
     var pos = makeRealWorld2mapPos(mod_highlightPOI_target,mod_highlightPOI_params[i+1], mod_highlightPOI_params[i+2]);
@@ -134,5 +131,5 @@
     tagSource += "<span style='"+poi_style+"'>"+mod_highlightPOI_params[i]+"<span>";
     tagSource += "</div>";
   }
-  writeTag(mod_highlightPOI_target, "permanent", tagSource);
+  div.write(tagSource);
 }
\ No newline at end of file

Modified: branches/noframes/http/javascripts/mod_resize_mapsize.php
===================================================================
--- branches/noframes/http/javascripts/mod_resize_mapsize.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/javascripts/mod_resize_mapsize.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -93,13 +93,9 @@
 	var coords = mb_mapObj[ind].extent.split(",");
 	midcoordx=parseFloat((parseFloat(coords[2])-parseFloat(coords[0]))/2)+parseFloat(coords[0]);
 	midcoordy=parseFloat((parseFloat(coords[3])-parseFloat(coords[1]))/2)+parseFloat(coords[1]);
-	mb_mapObj[ind].width = mapwidth;
-	mb_mapObj[ind].height = mapheight;
-	document.getElementById(map_frame).style.width = mb_mapObj[ind].width;
-	document.getElementById(map_frame).style.height = mb_mapObj[ind].height;
-	window.frames[map_frame].document.getElementById("maps").style.width = mb_mapObj[ind].width;
-	window.frames[map_frame].document.getElementById("maps").style.height = mb_mapObj[ind].height;
-	mb_repaintScale("<?php  echo $e_target;  ?>",midcoordx,midcoordy,mb_getScale("<?php  echo $e_target;  ?>"));
+	mb_mapObj[ind].setWidth(mapwidth);
+	mb_mapObj[ind].setHeight(mapheight);
+	mb_mapObj[ind].repaintScale(midcoordx,midcoordy,mb_mapObj[ind].getScale());
 }
 
 function rebuild() {

Modified: branches/noframes/http/print/mod_printPDF.php
===================================================================
--- branches/noframes/http/print/mod_printPDF.php	2008-10-09 11:05:06 UTC (rev 3150)
+++ branches/noframes/http/print/mod_printPDF.php	2008-10-13 12:19:48 UTC (rev 3151)
@@ -184,17 +184,12 @@
 			}
 			var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
 			var prevscale= pt.mb_getScale(target);
-			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+			pt.mb_mapObj[ind].setExtent(coord[0], pos[1], pos[0], coord[3]);
+			pt.mb_mapObj[ind].setWidth(map_width);
+			pt.mb_mapObj[ind].setHeight(map_width);
 
-			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, prevscale);
+			pt.mb_mapObj[ind].repaintScale(null, null, prevscale)
 		document.form1.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){
@@ -228,17 +223,13 @@
 			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].setExtent(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.mb_mapObj[ind].setWidth(Math.round(map_width));
+			pt.mb_mapObj[ind].setHeight(Math.round(map_height));
+			
 			//pt.setMapRequest(target);		
-			pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+			pt.mb_mapObj[ind].repaintScale(null, null, pt.mb_mapObj[ind].getScale());
 			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){



More information about the Mapbender_commits mailing list