Ok so now I am using the code located here - 
http://trac.osgeo.org/openlayers/browser/sandbox/bartvde/wmsgetfeatureinfo/openlayers/examples/getfeatureinfo-gml.html?rev=8453

And I redefined my getfeature control.. except I still have similar
questions unfortunately.
My code is the same as the example however modified slightly.. Now maybe I
am just not understanding this control correctly.. what I need to do is have
multiple layers but sometimes these layers are not visible...except I am not
adding these layers to the map at all I am declaring a seperate WMS layer
for an existing one and not adding it to the map, but still using it for the
getfeatureinfo (for speed purposes). So therefore I have to add/remove
layers from this getfeature control when the user switches themes and turns
legend entries on/off etc. I keep trying to do this in function however I am
ran into problems with my control firing a previously declared events.on
method instead of one i modified... so I'm guessing the events.on was still
registered and screwing up my new one. Is there a better way I should be
doing this if I want to have multiple layers for the below code but still be
able to remove/add them to the control?

 var infoCtrl = new OpenLayers.Control({
                activate: function() {
                    var handlerOptions = {
                       'single': true,
                       'double': false,
                       'pixelTolerance': 0,
                       'stopSingle': false,
                       'stopDouble': false
                    };
                    this.handler = new OpenLayers.Handler.Click(this, {
                        'click': this.onClick
                    }, handlerOptions);
                    this.protocol = new OpenLayers.Protocol.HTTP({
                        url: url,
                        format: new OpenLayers.Format.WMSGetFeatureInfo()
                    });
                    OpenLayers.Control.prototype.activate.call(this);
                 },
        
                 onClick: function(e) {
                    this.protocol.read({
                        params: {
                            REQUEST: "GetFeatureInfo",
                            EXCEPTIONS: "application/vnd.ogc.se_xml",
                            VERSION: "1.1.1",
                            BBOX: map.getExtent().toBBOX(),
                            X: e.xy.x,
                            Y: e.xy.y,
                            INFO_FORMAT: 'text/xml',
                            LAYERS: layer_Parcel_Hotspots.params.LAYERS,
                            QUERY_LAYERS: layer_Parcel_Hotspots.params.LAYERS,
                            WIDTH: map.size.w,
                            HEIGHT: map.size.h
                        },
                        callback: this.onResponse,
                        scope: this
                    });
                 },
        
                 onResponse: function(response) {
                        //testing output - it works
                        alert(response.priv.responseText);
                 }
            });
        
            map.addControl(infoCtrl);
            infoCtrl.activate();


-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Unregistering-an-event-for-wmsgetfeatureinfo-tp5950119p5957269.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to