[OpenLayers-Users] Help with Strategy.save and protocol.http

Eric Lemoine eric.lemoine at camptocamp.com
Thu May 20 08:04:17 EDT 2010


On Thu, May 20, 2010 at 9:02 AM, Frank Broniewski <brfr at metrico.lu> wrote:
> Hello Eric, all,
>
>> The save strategy just calls protocol.commit(). See
>>
>> <http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Strategy/Save.js#L178>.
>>
>> The protocol's commit method looks at the states of the features and
>> calls the appropriate method (update/create/delete). See
>>
>> <http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Protocol/HTTP.js#L519>.
>
> If it "just" calls protocol.commit(), what's the reason for having a
> save-strategy? Is it to have some kind of user - frontend to the protocols
> methods? If I don't use the save-strategies autosave feature, there's for me
> no difference wether I call protocol.commit() or strategy.save().

Look at the onCommit method in the strategy, it does some work.

> Or is
> there something more to using strategy.save() or strategies in general?
> Something like: "Don't use protocols directly, it is preferred to use them
> through strategies.", thus a design decision?

To me there's no such principle.

> From looking at the code ;-) I see that there is a projection check and an
> optional transformation to the remote projection, so that would be the
> "only" difference before protocol.commit(), right?

onCommit does other things.

> I presume, the
> transformation is mostly there for the google projection (900913) to wgs84
> transformation, or does OpenLayers have already some kind of proj support
> built in?

OpenLayers can be used with proj4js.


Cheers,

-- 
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



More information about the Users mailing list