[Users] GeoExt2: Problem adding multiple Features to FeatureStore and VectorLayer

Eric Lemoine eric.lemoine at camptocamp.com
Tue May 29 21:02:54 CEST 2012


On Tuesday, May 29, 2012, Alexandre Dube wrote:

> Lukas,
>
> This looks like a bug indeed. What seems to happen is the FeatureStore
> [addFeatures] calls loadRawData, which fires the 'load' event, which
> triggers [onLoad] that calls this.layer.removeAllFeatures() before
> adding the new ones. Writing a test to replicate what your trying to do
> should reproduce the issue.
>
> Without testing it and from what I understand, here's what I think could
> solve the problem. The [LayerStore] used to have that same issue and it
> was changed. The LayerModel has a static method to build new [layer
> model instances] that can then be added/inserted/removed with standard
> store methods.
>
> In brief, it should use the loadRawData method, but add instead. Would
> you send a pull request with a fix and tests or simply create an issue
> on github, please ?
>
> [addFeatures]
>
> https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/FeatureStore.js#L206
> [onLoad]
>
> https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/FeatureStore.js#L319
> [LayerStore]
>
> https://github.com/geoext/geoext2/commit/c2d5993714a4201d4c190f29eeae63b3e51d4d6e
> [layer model instances]
> https://github.com/geoext/geoext2/blob/master/src/<https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/LayerModel.js#L18>
> GeoExt/data/LayerModel.js#L18<https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/LayerModel.js#L18>



The issue is that the onLoad listener cannot know if the load is in an
“append” mode or not. So it assumes it isn't in “append” mode and
unconditionally calls “removeAllFeatures” on the layer. François and I
fixed the same issue in the LayerStore: <
https://github.com/geoext/geoext2/commit/a4192128934e463d54e6d0bca2d6ba7187471a17>.
I think the same fix should apply to the LayerStore.

I won't have time to fix this myself, but I'm happy to review and merge a
patch (with tests) for that :-) Thank you.


-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120529/bb038dcf/attachment.htm 


More information about the Users mailing list