[Mapbender-commits] r3887 - branches/2.6/http/javascripts trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Apr 16 04:29:50 EDT 2009


Author: verenadiewald
Date: 2009-04-16 04:29:50 -0400 (Thu, 16 Apr 2009)
New Revision: 3887

Modified:
   branches/2.6/http/javascripts/mod_tooltip.php
   trunk/mapbender/http/javascripts/mod_tooltip.php
Log:
no zoom on click

Modified: branches/2.6/http/javascripts/mod_tooltip.php
===================================================================
--- branches/2.6/http/javascripts/mod_tooltip.php	2009-04-16 08:16:56 UTC (rev 3886)
+++ branches/2.6/http/javascripts/mod_tooltip.php	2009-04-16 08:29:50 UTC (rev 3887)
@@ -419,8 +419,8 @@
 	else if (event == "click"){
 		resultHighlight.del(currentGeom, cw_fillcolor);
 		var bbox = currentGeom.getBBox();
-		parent.mb_calculateExtent(tooltipTarget, bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
-		parent.zoom(tooltipTarget, 'true', 1.0);
+		//parent.mb_calculateExtent(tooltipTarget, bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
+		//parent.zoom(tooltipTarget, 'true', 1.0);
 		resultHighlight.add(currentGeom, cw_fillcolor);
 		resultHighlight.paint();
 	}

Modified: trunk/mapbender/http/javascripts/mod_tooltip.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_tooltip.php	2009-04-16 08:16:56 UTC (rev 3886)
+++ trunk/mapbender/http/javascripts/mod_tooltip.php	2009-04-16 08:29:50 UTC (rev 3887)
@@ -33,9 +33,13 @@
 
 include '../include/dyn_js.php';
 ?>
-//tolerance when we ask wfs
-var mb_wfs_tolerance = 8;
+//tolerance when we ask wfs (comes from conf file)
+if(typeof(mb_wfs_tolerance)==='undefined') {
+	var mb_wfs_tolerance = 8;
+}	
 
+var targetArray = tooltipTarget.split(",");
+
 //initialize Element Vars
 
 //destination frame for the request (creates Popup if empty)
@@ -51,6 +55,10 @@
 	var tooltip_height = 200;
 if(typeof(tooltip_styles_detail)==='undefined')
 	var tooltip_styles_detail = "";
+if(typeof(tooltip_disableWms)==='undefined')
+	var tooltip_disableWms = "0";
+if(typeof(tooltip_disableWfs)==='undefined')
+	var tooltip_disableWfs = "0";	
 try{
 	var no_result_text = eval(tooltip_noResultArray);
 }catch(e){
@@ -64,10 +72,8 @@
 var numberOfFinishedWfsRequests = 0;
 var numberOfFinishedWmsRequests = 0;
 var visibleRequest = 0;
-var TooltipMsg = {'title':"<?php echo _mb("Information");?>"};
+var tooltipMsg = {'title':"<?php echo _mb("Information");?>"};
 
-//buttonWfs_toDigitize_on ="0";
-
 function mod_tooltipInit(){
 	var tooltip_map = getMapObjByName(tooltipTarget);
 	var ind = getMapObjIndexByName(tooltipTarget);
@@ -99,38 +105,44 @@
 }
 
 function fireRequests(point){
-
-	
-
 	var ind = getMapObjIndexByName(tooltipTarget);
 	var point_geom = new Geometry(geomType.point);
 	point_geom.addPoint(mapToReal(tooltipTarget,point));
 	visibleRequest = 0;
-	
-	//FeatureInfo requests
-	urls = mb_mapObj[ind].getFeatureInfoRequests(point);
-	tooltipWmsRequestCount = urls.length;
-	numberOfFinishedWmsRequests	= 0;	
-	for(var j=0;j < urls.length;j++){
-		mb_ajax_post("../extensions/ext_featureInfoTunnel.php", {url:urls[j]}, 
-			checkFeatureInfoResults);
+
+	if(tooltip_disableWms != '1') {	
+		//FeatureInfo requests
+		urls = mb_mapObj[ind].getFeatureInfoRequests(point);
+		tooltipWmsRequestCount = urls.length;
+		numberOfFinishedWmsRequests	= 0;	
+		for(var j=0;j < urls.length;j++){
+			mb_ajax_post("../extensions/ext_featureInfoTunnel.php", {url:urls[j]}, 
+				checkFeatureInfoResults);
+		}
 	}
 	
-	//WFS requests
-	requests = getWfsRequests(tooltipTarget, point_geom, true);
-	tooltipWfsRequestCount = requests.length;
-	numberOfFinishedWfsRequests = 0;
-	resultGeomArray = new GeometryArray();
-	for(var j=0;j< requests.length;j++){
-		mb_ajax_post("../" + wfsResultModulePath + wfsResultModuleFilename,requests[j],function(js_code,status){
-			if (js_code) {
-				eval(js_code);
-			}
-			if (typeof(geom) == "undefined") {
-				var geom = new GeometryArray();
-			}
-			checkWfsResultsFinished(geom);
-		});
+	if(tooltip_disableWfs != '1') {	
+		//WFS requests
+		requests = getWfsRequests(tooltipTarget, point_geom, true);
+		tooltipWfsRequestCount = requests.length;
+		numberOfFinishedWfsRequests = 0;
+		resultGeomArray = new GeometryArray();
+		for(var j=0;j< requests.length;j++){
+			(function () {
+				var currentRequest = requests[j];
+				mb_ajax_post("../" + wfsResultModulePath + wfsResultModuleFilename,currentRequest,function(js_code,status){
+					var geom = new GeometryArray();
+					if (js_code && geom.importGeoJSON(js_code)) {
+						if (typeof(currentRequest) === "object" && typeof(currentRequest.js_wfs_conf_id) !== "undefined") {
+							for (var i = 0; i < geom.count(); i++) {
+								geom.get(i).wfs_conf = parseInt(currentRequest.js_wfs_conf_id);
+							}					
+						}
+					}
+					checkWfsResultsFinished(geom);
+				});
+			}());
+		}
 	}
 }
 
@@ -166,10 +178,12 @@
 	if (numberOfFinishedWfsRequests == tooltipWfsRequestCount) {
 		if(resultGeomArray.count()>0){
 			//generate and output result
-			if(resultGeomArray.count()>1)
+			//if(resultGeomArray.count()>1) {
 				var html = createSimpleWfsResultHtml(resultGeomArray);
-			else
-				var html = createDetailedWfsResultHtml(resultGeomArray);
+			//}	
+			//else {
+			//	var html = createDetailedWfsResultHtml(resultGeomArray);
+			//}	
 			displayResultDoc(html);
 		}
 		else if(!isFirstResult())
@@ -218,7 +232,7 @@
 			tooltipWin.destroy();
 	
 		//create Popup and append document
-		tooltipWin = new mb_popup({html:'<iframe id="tooltipWin" name="tooltipWin" src="about:blank"/>',title:TooltipMsg.title,width:tooltip_width,height:tooltip_height,balloon:true,left:x,top:y});
+		tooltipWin = new mb_popup({html:'<iframe id="tooltipWin" name="tooltipWin" src="about:blank"/>',title:tooltipMsg.title,width:tooltip_width,height:tooltip_height,balloon:true,left:x,top:y});
 		//open document
 		tooltipWin.open();
 	}
@@ -303,9 +317,9 @@
 	for (var i = 0 ; i < _geomArray.count(); i ++) {
 		if (_geomArray.get(i).get(-1).isComplete()) {
 			html += "\t<tr class='list_"+(i%2?"uneven":"even")+"'>\n\t\t<td \n";
-//			html += "\t\t\t onmouseover='mb_wfs_perform(\"over\",_geomArray.get("+i+"),resultHighlightColour);' ";
-//			html += " onmouseout='mb_wfs_perform(\"out\",_geomArray.get("+i+"),resultHighlightColour)' ";
-//			html += " onclick='mb_wfs_perform(\"click\",_geomArray.get("+i+"),resultHighlightColour);' ";
+			html += "\t\t\t onmouseover='parent.setResult(\"over\","+i+");' ";
+			html += " onmouseout='parent.setResult(\"out\","+i+")' ";
+			html += " onclick='parent.setResult(\"click\","+i+");' ";
 			var geomName = getWfsListEntry(_geomArray.get(i)); 
 			html += ">" + geomName +"</td>";
 			html += "\t\t</tr>\n"; 
@@ -385,3 +399,30 @@
 	}
 }
 
+/*
+* event -> {over || out || click}
+* geom -> commaseparated coordinates x1,y1,x2,y2 ...
+*/
+function setResult(event, index){
+	var currentGeom = resultGeomArray.get(index);
+	var resultHighlight = new parent.Highlight(targetArray, "tooltipHighlight", {"position":"absolute", "top":"0px", "left":"0px", "z-index":100}, 2);
+	var cw_fillcolor = "#cc33cc";
+	
+	if (event == "over") {
+		resultHighlight.add(currentGeom, cw_fillcolor);
+		resultHighlight.paint();
+	}
+	else if (event == "out"){
+		resultHighlight.del(currentGeom, cw_fillcolor);
+		resultHighlight.paint();
+	}
+	else if (event == "click"){
+		resultHighlight.del(currentGeom, cw_fillcolor);
+		var bbox = currentGeom.getBBox();
+		//parent.mb_calculateExtent(tooltipTarget, bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
+		//parent.zoom(tooltipTarget, 'true', 1.0);
+		resultHighlight.add(currentGeom, cw_fillcolor);
+		resultHighlight.paint();
+	}
+	return true;
+}
\ No newline at end of file



More information about the Mapbender_commits mailing list