[Mapbender-commits] r3474 - in trunk/mapbender: http/javascripts resources/db/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 21 06:21:36 EST 2009


Author: christoph
Date: 2009-01-21 06:21:36 -0500 (Wed, 21 Jan 2009)
New Revision: 3474

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
   trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
   trunk/mapbender/resources/db/update/update_2.6.sql
Log:
http://trac.osgeo.org/mapbender/ticket/360

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2009-01-20 15:40:13 UTC (rev 3473)
+++ trunk/mapbender/http/javascripts/map_obj.js	2009-01-21 11:21:36 UTC (rev 3474)
@@ -96,6 +96,7 @@
 	this.width = width;
 	this.height = height;
 	this.frameName = frameName;
+	this.type = (frameName !== "") ? "IFRAME" : "DIV";
 	this.elementName = elementName;
 	this.layers = [];
 	this.styles = [];

Modified: trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2009-01-20 15:40:13 UTC (rev 3473)
+++ trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2009-01-21 11:21:36 UTC (rev 3474)
@@ -163,7 +163,8 @@
 }
 
 function wfsEnable(obj) {
-   	var el = window.frames[mod_wfs_spatialRequest_target].document;
+	var el = getMapDoc();
+
    	el.onmouseover = null;
    	el.onmousedown = null;
    	el.onmouseup = null;
@@ -188,7 +189,13 @@
 		for(var i=0; i<mod_wfs_spatialRequestSubFunctions.length; i++){
 			measureSub += eval(mod_wfs_spatialRequestSubFunctions[i]);
 		}
-		writeTag(mod_wfs_spatialRequest_target,"measure_sub",measureSub);
+		var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+		if (mb_mapObj[ind].type == "IFRAME") {
+			writeTag(mod_wfs_spatialRequest_target ,"measure_sub",measureSub);
+		}
+		else {
+			writeTag("" ,"measure_sub",measureSub);
+		}
 	}
 	else if (obj.id == button_rectangle){
 		if (activeButton == null) {
@@ -217,13 +224,30 @@
 	}
 }
 
+function getMapDoc () {
+	var mapIndex = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	var mapDomElement = mb_mapObj[mapIndex].getDomElement();
+	var mapType = mapDomElement.tagName.toUpperCase();
+	if (mapType == "IFRAME") {
+		return mapDomElement.window.document;
+	}
+	return window.document;
+}
+
 function wfsDisable(obj) {
-	var el = window.frames[mod_wfs_spatialRequest_target].document;
+	var el = getMapDoc();
 	el.onmousedown = null;
 	el.ondblclick = null;
 	el.onmousemove = null;
-	writeTag(mod_wfs_spatialRequest_target,"measure_display","");
-	writeTag(mod_wfs_spatialRequest_target,"measure_sub","");
+	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	if (mb_mapObj[ind].type == "IFRAME") {
+		writeTag(mod_wfs_spatialRequest_target,"measure_display","");
+		writeTag(mod_wfs_spatialRequest_target,"measure_sub","");
+	}
+	else {
+		writeTag("", "measure_display", "");
+		writeTag("", "measure_sub", "");
+	}
 	activeButton = null;
 }
 
@@ -233,7 +257,7 @@
 // -------------------- rectangle -----------------------------------------------------------------
 
 function mod_selAreaExt_click(){
-   var el = window.frames[mod_wfs_spatialRequest_target].document;
+	var el = getMapDoc();
    el.onmouseover = mod_selAreaExt_init;
    el.onmousedown = mod_box_start;
    el.onmouseup = mod_selAreaExt_get;
@@ -274,22 +298,48 @@
 	}
 	s = new Snapping(mod_wfs_spatialRequest_target);
 
-	var el = window.frames[mod_wfs_spatialRequest_target].document;
+	var el = getMapDoc();
 	el.onmousedown = mod_wfs_spatialRequest_start;
 	el.onmousemove = mod_wfs_spatialRequest_run;
 	var measureSub = "";
 	for(var i=0; i<mod_wfs_spatialRequestSubFunctions.length; i++){
 		measureSub += eval(mod_wfs_spatialRequestSubFunctions[i]);
 	}
-	writeTag(mod_wfs_spatialRequest_target,"measure_sub",measureSub);
+	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	if (mb_mapObj[ind].type == "IFRAME") {
+		writeTag(mod_wfs_spatialRequest_target,"measure_sub",measureSub);
+	}
+	else {
+		writeTag("", "measure_sub", measureSub);
+	}
 }
 
 // ---------------------------------------------------------------------------------------------
 
+function mod_wfs_getMousePosition(e) {
+	mb_getMousePos(e, mod_wfs_spatialRequest_target);
+	var currentPos = null;
+	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	if (mb_mapObj[ind].type == "DIV") {
+		var mapDomElement = mb_mapObj[ind].getDomElement();
+		currentPos = new parent.Point(
+			parent.clickX - parseInt(mapDomElement.style.left), 
+			parent.clickY - parseInt(mapDomElement.style.top)
+		);
+	}
+	else {
+		currentPos = new parent.Point(
+			parent.clickX, 
+			parent.clickY
+		);
+	}
+	return currentPos;
+}
+
+
 function mod_wfs_spatialRequest_run(e) {
 	if (mod_wfs_spatialRequest_geometry.count() >= 3) {
-		mb_getMousePos(e,mod_wfs_spatialRequest_target);
-		var pos = new Point(clickX,clickY);
+		var pos = mod_wfs_getMousePosition(e);
 		s.check(pos);
 	}
 }
@@ -301,8 +351,8 @@
 		s.clean();
 	}
 	else {
-		mb_getMousePos(e,mod_wfs_spatialRequest_target);
-		realWorldPos = mapToReal(mod_wfs_spatialRequest_target,new Point(clickX,clickY));
+		var pt = mod_wfs_getMousePosition(e);
+		realWorldPos = mapToReal(mod_wfs_spatialRequest_target, pt);
 	}
 
 	mod_wfs_spatialRequest_geometry.addPoint(realWorldPos);
@@ -338,7 +388,13 @@
 			}
 		}
 	}
-	writeTag(mod_wfs_spatialRequest_target,"measuring",str_mPoints);
+	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	if (mb_mapObj[ind].type == "IFRAME") {
+		writeTag(mod_wfs_spatialRequest_target,"measuring",str_mPoints);
+	}
+	else {
+		writeTag("", "measuring", str_mPoints);
+	}
 }
 function evaluateDashesExt(p1,p0,count){
 	var str_dashedLine = "";
@@ -374,19 +430,26 @@
 }
 
 function mod_wfs_spatialRequest_delete(){
-	writeTag(mod_wfs_spatialRequest_target,"measuring","");
-	writeTag(mod_wfs_spatialRequest_target,"measure_display","");
+	var ind = getMapObjIndexByName(mod_wfs_spatialRequest_target);
+	if (mb_mapObj[ind].type == "IFRAME") {
+		writeTag(mod_wfs_spatialRequest_target,"measuring","");
+		writeTag(mod_wfs_spatialRequest_target,"measure_display","");
+	}
+	else {
+		writeTag("","measuring","");
+		writeTag("","measure_display","");
+	}
 }
 
 function mod_wfs_spatialRequest_timeout(){
-	var el = window.frames[mod_wfs_spatialRequest_target].document;
+	var el = getMapDoc();
 	el.onmousedown = null;
 	el.ondblclick = null;
 	el.onmousemove = null;
 }
 
 function mod_wfs_spatialRequest_disableTimeout(){
-	var el = window.frames[mod_wfs_spatialRequest_target].document;
+	var el = getMapDoc();
 	el.onmousedown = mod_wfs_spatialRequest_start;
 }
 

Modified: trunk/mapbender/resources/db/update/update_2.6.sql
===================================================================
--- trunk/mapbender/resources/db/update/update_2.6.sql	2009-01-20 15:40:13 UTC (rev 3473)
+++ trunk/mapbender/resources/db/update/update_2.6.sql	2009-01-21 11:21:36 UTC (rev 3474)
@@ -86,7 +86,26 @@
 </div>' WHERE e_id = 'navFrame';
 
 
-UPDATE gui_element SET e_pos = 1, e_element = 'div', e_src = '', e_attributes = '', e_more_styles = 'overflow:hidden;', e_content = '<div id="mapframe1_maps" style="position:absolute;left:0px;right:0px;"></div>', e_closetag = 'div', e_js_file = 'mapnf.php' WHERE e_id = 'mapframe1';
+UPDATE gui_element SET e_pos = 1, e_element = 'div', e_src = '', e_attributes = '', e_more_styles = 'overflow:hidden;', e_content = '<div id='markResult' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:26'> </div>
+<div id='mapframe1_maps' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'> </div>
+<div id='highlight' style="position:absolute;top:-10px;left:-10px;width:14px;height:14px;z-index:3;visibility:visible"><img src="../img/redball.gif"/></div>
+<div id='l_right' name='l_right' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:10;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
+<div id='l_bottom'  name='l_bottom' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:11;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
+<div id='l_left' name='l_left' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:12;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
+<div id='l_top' name='l_top' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:13;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
+<div id="sandclock" style="position:absolute; top:0px; left:0px; z-index:14;"></div>
+<div id="scalebar" style="position:absolute; top:0px; left:0px; z-index:15;"></div>
+<div id="measuring" style="position:absolute; top:0px; left:0px; z-index:16; font-size:10px"></div>
+<div id="measure_display" style="position:absolute; top:0px; left:0px; z-index:17;"></div>
+<div id="copyright" style="position:absolute; top:0px; left:0px; z-index:18;"></div>
+<div id="measure_sub" style="position:absolute; top:0px; left:0px; z-index:19;"></div>
+<div id='permanent' style="position:absolute;top:-10px;left:-10px;width:14px;height:14px;z-index:13;visibility:hidden"><img src="../img/redball.gif"/></div>
+<div id="digitize_sub" style="position:absolute; top:0px; left:0px; z-index:24;"></div>
+<div id="digitize_display" style="position:absolute; top:0px; left:0px; z-index:25;"></div>
+<div id='um_title' name='um_title' style="font-family: Arial, Helvetica, sans-serif; DISPLAY:none; OVERFLOW:visible; POSITION:absolute; DISPLAY:none; BACKGROUND:#BEC1C4;border:1px solid black; z-index:98;"></div>
+<div id='um_draw' name='um_draw' style="LEFT:0px;OVERFLOW:visible;POSITION:absolute;TOP:0px;z-index:99;"></div>
+<img id='um_img' name='um_img' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; border:0;z-index:100' src='../img/transparent.gif' useMap='#um'>
+<map name='um' id='um'></map>', e_closetag = 'div', e_js_file = 'mapnf.php' WHERE e_id = 'mapframe1';
 UPDATE gui_element SET e_element = 'div', e_src = '', e_attributes = '', e_more_styles = 'overflow:hidden;', e_content = '<div id="overview_maps" style="position:absolute;left:0px;right:0px;"></div>', e_closetag = 'div', e_js_file = 'ovnf.php', e_target = 'mapframe1', e_requires = 'mapframe1' WHERE e_id = 'overview';
 INSERT INTO gui_element_vars select fkey_gui_id,'overview' as fkey_e_id, 'overview_wms' as var_name, '0' as var_value, 'wms that shows up as overview' as context, 'var' as var_type from gui_element where e_id = 'overview';
 UPDATE gui_element SET e_pos = 2, e_element = 'div', e_more_styles = 'visibility:visible;overflow:scroll', e_content = '', e_closetag = 'div', e_js_file = '../html/mod_treefolderPlain.php', e_mb_mod = 'jsTree.js', e_requires = 'mapframe1' WHERE e_id = 'treeGDE';
@@ -109,7 +128,9 @@
 INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'body', 'use_load_message', 'true', '' ,'php_var');
 INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui1', 'body', 'includeWhileLoading', '../include/gui1_splash.php', '' ,'php_var');
 
+UPDATE gui_element SET e_mb_mod = '../extensions/wz_jsgraphics.js,geometry.js' WHERE e_id = 'wfs';
 
+
 --to class the Mapbender gui list and hide the wms_container
 ALTER TABLE gui
    ADD COLUMN gui_type character varying;
@@ -130,5 +151,4 @@
 UPDATE gui SET gui_type='wms_container' WHERE gui_id='wms_germany';
 UPDATE gui SET gui_type='wms_container' WHERE gui_id='wms_north_america';
 UPDATE gui SET gui_type='wms_container' WHERE gui_id='wms_worldwide';
-   
-
+   
\ No newline at end of file



More information about the Mapbender_commits mailing list