[Mapbender-commits] r2879 - branches/nimix_dev/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Aug 19 04:14:26 EDT 2008
Author: nimix
Date: 2008-08-19 04:14:26 -0400 (Tue, 19 Aug 2008)
New Revision: 2879
Modified:
branches/nimix_dev/http/javascripts/tooltip_wms.php
branches/nimix_dev/http/javascripts/wms.js
Log:
wms tooltip
Modified: branches/nimix_dev/http/javascripts/tooltip_wms.php
===================================================================
--- branches/nimix_dev/http/javascripts/tooltip_wms.php 2008-08-18 18:20:44 UTC (rev 2878)
+++ branches/nimix_dev/http/javascripts/tooltip_wms.php 2008-08-19 08:14:26 UTC (rev 2879)
@@ -24,90 +24,72 @@
include '../include/dyn_js.php';
?>
-var tooltipTime = 500;
-
+//destination frame for the request (creates Popup if empty)
+var destFrameName = "tooltip";
+var tooltipTime = 1000;
+var no_result_text = ["Kein Ergebnis."];
var mouseMoves=0;
var tooltipWin=null;
var point;
-var numberOfFinishedAjaxCalls = 0;
-buttonWfs_toDigitize_on ="0";
+//buttonWfs_toDigitize_on ="0";
function mod_tooltipInit(){
- $(window.frames["mapframe1"].document).mousemove(function(event){
+ $(window.frames[tooltipTarget].document).mousemove(function(event){
mod_tooltip_run();
- mb_getMousePos(event,"mapframe1");
+ mb_getMousePos(event,tooltipTarget);
}).mouseout(function(){mouseMoves=0;});
}
-mb_registerInitFunctions("mod_tooltipInit();");
+eventInit.register(mod_tooltipInit);
function mod_tooltip_run(){
mouseMoves++;
- setTimeout("if(mouseMoves=="+mouseMoves+")showWMSBalloon();",tooltipTime);
-});
-
-function showWMSBalloon(){
- x=clickX+parseInt(document.getElementById("mapframe1").style.left);
- y=clickY+parseInt(document.getElementById("mapframe1").style.top);
- if(tooltipWin&&tooltipWin.isVisible())
- tooltipWin.destroy();
- url = getfirstFeatureInfoRequest(tooltipTarget,clickX,clickY,"../extensions/ext_featureInfoTunnel.php");
-// var ind = getMapObjIndexByName("mapframe1");
-// req = mb_mapObj[ind].getFeatureInfoRequests({x:clickX,y:clickY});
- mb_ajax_post(url, null, function(js_code,status){
- if(js_code.indexOf("Kein Ergebnis.")!==-1)
- return;
- tooltipWin = new mb_popup({html:"<iframe>"+js_code+"</iframe>",title:"Feature Info",width:270,height:200,balloon:true,left:x,top:y});
- tooltipWin.show();
- });
- //if(req)
+ setTimeout("if(mouseMoves=="+mouseMoves+")fireFeatureInfo();",tooltipTime);
}
-function getfirstFeatureInfoRequest(fName,x,y,path) {
- for(i=0; i<mb_mapObj.length; i++){
- if(mb_mapObj[i].frameName == fName){
- for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
- var newfeatureInfoRequest = "";
- var requestParams = "";
- var validation = false;
- newfeatureInfoRequest += mb_mapObj[i].wms[ii].wms_getfeatureinfo;
- newfeatureInfoRequest += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getfeatureinfo);
+function fireFeatureInfo(){
+ var ind = getMapObjIndexByName(tooltipTarget);
+ point = new Point(clickX,clickY);
+ urls = mb_mapObj[ind].getFeatureInfoRequests(point);
+
+ for(var j=0;j < urls.length;j++){
+ mb_ajax_post("../x_tour_rlp/ext_featureInfoTunnel.php?url="+escape(urls[j]), null, function(js_code,status){
+ for(var k=0;k < no_result_text.length;k++){
+ if(js_code.indexOf(no_result_text[k])!==-1)
+ return;
+ }
+
+ //test if we have a fixed destination and create popup otherwise
+ if(destFrameName=="")
+ showWmsBalloon(js_code);
- if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){requestParams += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=feature_info&";}
- if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){requestParams += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetFeatureInfo&SERVICE=WMS&";}
- requestParams += "SRS="+mb_mapObj[i].epsg+"&";
- requestParams += "BBOX="+mb_mapObj[i].extent+"&";
- requestParams += "WIDTH="+mb_mapObj[i].width+"&";
- requestParams += "HEIGHT="+mb_mapObj[i].height+"&";
- requestParams += "LAYERS="+mb_mapObj[i].layers[ii]+"&";
- requestParams += "STYLES="+mb_mapObj[i].styles[ii]+"&";
- requestParams += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
- requestParams += "INFO_FORMAT="+mb_mapObj[i].wms[ii].gui_wms_featureinfoformat+"&";
- requestParams += "EXCEPTIONS=application/vnd.ogc.se_xml&";
- if(mb_feature_count > 0){
- requestParams += "FEATURE_COUNT="+mb_feature_count+"&";
+ //if so put the frame there
+ $("#"+destFrameName).each(function(){
+ var oDoc = this.contentWindow || this.contentDocument;
+ if (oDoc.document) {
+ oDoc = oDoc.document;
}
- requestParams += "QUERY_LAYERS="+mb_mapObj[i].querylayers[ii]+"&";
- requestParams += "X=" + x + "&";
- requestParams += "Y=" + y;
-
- if(mb_mapObj[i].querylayers[ii] !== "" && mb_mapObj[i].layers[ii] !== ""){
- validation = true;
- }
- //add vendor-specific
- for(var v=0; v < mb_vendorSpecific.length; v++){
- var vendorSpecificString = eval(mb_vendorSpecific[v]);
- requestParams += "&" + vendorSpecificString;
- }
- if(mb_log && validation){
- var tmp = eval(mb_log + "('" + newfeatureInfoRequest + requestParams + "','" + ts + "')");
- }
- if(validation){
- newfeatureInfoRequest += requestParams;
- return newfeatureInfoRequest;
- }
- }
- }
+ oDoc.open();
+ oDoc.write(js_code);
+ oDoc.close();
+ });
+ });
}
- return false;
}
+
+function showWMSBalloon(html){
+ x=clickX+parseInt(document.getElementById(tooltipTarget).style.left);
+ y=clickY+parseInt(document.getElementById(tooltipTarget).style.top);
+ if(tooltipWin&&tooltipWin.isVisible())
+ tooltipWin.destroy();
+
+ tooltipWin = new mb_popup({html:'<iframe id="tooltipWin" name="tooltipWin" src="about:blank"/>',title:"Feature Info",width:270,height:200,balloon:true,left:x,top:y});
+ $("#"+tooltipWin.id+" iframe").each(function(){
+ var oDoc = this.contentWindow || this.contentDocument;
+ if (oDoc.document) {
+ oDoc = oDoc.document;
+ }
+ oDoc.write(html);
+ });
+ tooltipWin.show();
+}
Modified: branches/nimix_dev/http/javascripts/wms.js
===================================================================
--- branches/nimix_dev/http/javascripts/wms.js 2008-08-18 18:20:44 UTC (rev 2878)
+++ branches/nimix_dev/http/javascripts/wms.js 2008-08-19 08:14:26 UTC (rev 2879)
@@ -207,6 +207,9 @@
}
rq += "&LAYERS=" + layers.join(",");
+ if(mb_feature_count > 0){
+ rq += "&FEATURE_COUNT="+mb_feature_count;
+ }
rq += "&QUERY_LAYERS=" + querylayers.join(",");
rq += "&WIDTH=" + mapObj.getWidth();
rq += "&HEIGHT=" + mapObj.getHeight();
@@ -405,11 +408,13 @@
* @return array of layernames
* @type string[]
*/
-wms_const.prototype.getQuerylayers = function(){
+wms_const.prototype.getQuerylayers = function(mapObj){
queryLayers = [];
for(var i=0; i< this.objLayer.length; i++){
if(this.objLayer[i].gui_layer_querylayer === 1 && ! this.objLayer[i].has_childs ){
- queryLayers.push(this.objLayer[i].layer_name);
+ if(this.objLayer[i].checkScale(mapObj)){
+ queryLayers.push(this.objLayer[i].layer_name);
+ }
}
}
if(queryLayers.length === 0){
More information about the Mapbender_commits
mailing list