java feature get_WMS GetFeatureInfo;多层,不同来源

我希望对其他人有这个帮助,我意识到:你很难控制在异步模式下执行请求,但这没关系,没问题,真正的问题是当控件处理请求并触发事件时“ getfeatureinfo“所以,我为这个控件修改了2个方法并且它可以工作!所以要做到这一点我首先声明控件,然后在野蛮模式我修改了这里的方法是de code:

getInfo = new OpenLayers.Control.WMSGetFeatureInfo({ drillDown:true , queryVisible: true , maxFeatures:100 });

//then i declare a variable that help me to handle more than 1 request.....

getInfo.responses = [];

getInfo.handleResponse=function(xy, request) { var doc = request.responseXML;

if(!doc || !doc.documentElement) { doc = request.responseText; }

var features = this.format.read(doc);

if (this.drillDown === false) {

this.triggerGetFeatureInfo(request, xy, features);

} else {

this._requestCount++;

this._features = (this._features || []).concat(features);

if( this._numRequests > 1){

//if the num of RQ, (I mean more than 1 resource ), i put the Request in array, this is for maybe in a future i could be need other properties or methods from RQ, i dont know.

this.responses.push(request);}

else{

this.responses = request;}

if (this._requestCount === this._numRequests) {

//here i change the code....

//this.triggerGetFeatureInfo(request, xy, this._features.concat());

this.triggerGetFeatureInfo(this.responses, xy, this._features.concat());

delete this._features;

delete this._requestCount;

delete this._numRequests;

// I Adding this when the all info is done 4 reboot

this.responses=[];

}

}

}

getInfo.triggerGetFeatureInfo= function( request , xy , features) {

//finally i added this code for get all request.responseText's

if( isArray( request ) ){

text_rq = '';

for(i in request ){

text_rq += request[i].responseText;

}

}

else{

text_rq = request.responseText;

}

this.events.triggerEvent("getfeatureinfo", {

//text: request.responseText,

text : text_rq,

features: features,

request: request,

xy: xy

});

// Reset the cursor.

OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");}

谢谢,你带我一个发现我的问题的方法,这是我解决的方式,我希望这可以帮助别人 .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值