[OpenLayers-Dev] callback for setfeature event of TransformFeature Control receives wrong event type

Andreas Hocevar ahocevar at opengeo.org
Fri Apr 29 03:06:42 EDT 2011


Thanks for the detailed problem description. I created
http://trac.osgeo.org/openlayers/ticket/3280 and added a patch.

Andreas.

On Thu, Apr 28, 2011 at 6:09 PM,  <lissabon at online.de> wrote:
> Hi Andreas,
>
> I don't think my issue concerns #2714
> (http://trac.osgeo.org/openlayers/ticket/2714).
>
> It's the event object which is possibly malformed. I'll try to explain:
>
> Following console.log line..:
>
> OpenLayers.Console.warn("report method received event: " + event.type,
> event.feature ? event.feature.id : event.components);
>
> ..logs following information when I click on a Feature to be set for
> transformation (please see the 2nd line, which should be "setfeature"
> instead of "beforesetfeature"):
>
> report method received event: beforesetfeature
> OpenLayers.Feature.Vector_1081
> report method received event: beforesetfeature
> OpenLayers.Feature.Vector_1081
>
> (First, the click initializes a beforesetfeature event and then instantly a
> setfeature event.)
>
> It's the property "event.type" of the setfeature event of the
> TransformFeature callback function, which has the "wrong event information"
> I meant.
>
> You can investigate this issue if you modify
> http://openlayers.org/dev/examples/transform-feature.html as following:
>
> Place this into line 8 before OpenLayers library:
>
> <script src="http://www.openlayers.org/api/lib/Firebug/firebug.js"></script>
>
> Place these event registrations into line 52 after the TransformFeature
> control is initialized:
>
> control.events.register("beforesetfeature", null, function(event) {
>     OpenLayers.Console.log("report method received event: " + event.type,
> event.feature ? event.feature.id : event.components);
>     OpenLayers.Console.log(event);
> });
> control.events.register("setfeature", null, function(event) {
>     OpenLayers.Console.warn("report method received event: " + event.type,
> event.feature ? event.feature.id : event.components);
>     OpenLayers.Console.warn(event);
> });
>
> Thanks
>
> João
>
>
> On Apr 28, 2011, at 17:24  , Andreas Hocevar wrote:
>
> Looking more closely, I see that #2714 was about the transformcomplete
> event.
>
> What exactly do you mean by "wrong event type"? Both the "beforesetfeature"
> and "setfeature" event are called with an object that contains a feature.
>
> Andreas.
>
> On Apr 28, 2011, at 17:16 , Andreas Hocevar wrote:
>
>> This issue has been fixed in trunk, and will be included in the upcoming
>> 2.11 release. See http://trac.osgeo.org/openlayers/ticket/2714
>>
>> Andreas.
>>
>> On Apr 28, 2011, at 16:55 , João wrote:
>>
>>>
>>> It seems like the callback for the "setfeature" event of
>>> OpenLayers.Control.TransformFeature receives the wrong event type
>>> "beforesetfeature"!
>>>
>>> (Somehow the correct callback for setfeature event will be called, but
>>> the event object passed to this callback method has the wrong event type.)
>>>
>>> Thanks
>>> João
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Dev mailing list