From: Gilles B. <gil...@ma...> - 2008-06-17 18:01:20
|
Hi list, I have adapted the WfsGetFeature widget so that it's possible to select different handlers. Using simple html radiobutton, the user can choose a point handler, a box handler or an irregularpolygon handler. The backend is a custom web-service that accept a wkt geometry in the request parameters (it still returns a GML feature collection). In my custom WfsGetFeature.js, the draw function looks like this: draw: function() { switch (objRef.handlerType) { case 'POINT': this.handler = new OpenLayers.Handler.Point( this, {done: this.selectGeom}, {keyMask: this.keyMask} ); break; case 'BOX': this.handler = new OpenLayers.Handler.RegularPolygon( this, {done: this.selectGeom}, {keyMask: this.keyMask, sides: 4, irregular: true} ); break; } }, The WfsGetFeature class also provide a method designed to handle click event on the html radiobuttons: this.setHandlerType = function(objRef, handlerType) { objRef.handlerType = handlerType; if (objRef.control) { objRef.control.draw(); if (objRef.control.active) { objRef.control.deactivate(); objRef.control.handler = objRef.control.handler; objRef.control.activate(); } } } All this works pretty fine in Firefox but does not in IE... The behavior in IE is the following: - when the control is selected, an handler is activated and works fine - if the user change the handler type (using html radiobuttons), the mouse handler does not change until the next selection. For example, the handler is of type 'point' and the user clicks on 'box', when the user try to click on the map the handler is still of type 'point' but change to 'box' after this first selection. I've spent hours trying to understand what's wrong. Any help greatly appreciated. Regards Gilles -- Gilles Bassiere MAKINA CORPUS 30 rue des Jeuneurs FR-75002 PARIS +33 (0) 1 44 82 00 80 http://www.makina-corpus.com |