[OpenLayers-Trac] Re: [OpenLayers] #3400: Feature modification management

OpenLayers trac-20090302 at openlayers.org
Mon Jul 4 04:08:18 EDT 2011


#3400: Feature modification management
-------------------------+--------------------------------------------------
 Reporter:  ahocevar     |       Owner:  tschaub     
     Type:  feature      |      Status:  new         
 Priority:  minor        |   Milestone:  2.12 Release
Component:  Format.WFST  |     Version:  2.10        
 Keywords:               |       State:  Review      
-------------------------+--------------------------------------------------

Comment(by ahocevar):

 Thanks for the review Bart.

 Replying to [comment:3 bartvde]:
 >  * modified, shouldn't we call this originals or originalValues instead?
 To me the modified term sounds misleading, since I would expect it to have
 the modified values instead and not the originals?

 Most applications will look in the modified object and just see if it is
 truthy for a field ({{{if (modified.geometry) {/*do something*/}}}})
 Having to write ({{{if (originalValues.geometry) {/*do something*/}}}}
 looks a bit awkward to me. ExtJS also uses the name "modified" for an
 object on records, with the same content.

 >  * with tests/Format/WFST/v1.html I would expect only the geometry to be
 written out, since it is the only one in modified? Why are the 2
 attributes written out as well? I see it in the code (the check for
 feature.attributes), but it's not what I would expect to happen. Or is
 this to be backwards-compatible? I guess so, but maybe state it somewhere
 in a comment?

 Exactly, this is for backwards compatibility. I made this more clear in
 the APIdoc comments of the new patch. Think of somebody upgrading
 OpenLayers and using the ModifyFeature control, then updating a WFS
 through the WFS protocol. No attribute would ever be written if the user
 didn't care about updating modified.attributes.

 >  * tests/Control/ModifyFeature.html: layer.addFeatures[feature] is
 missing brackets

 Good catch, thanks. Fixed in new patch.

 >  * lib/OpenLayers/Format/WFST/v1.js: should we not also check if the
 original and modified values differ?

 If a geometry or attribute ends up in modified, it was usually modified.
 If the user changes it back to the original, and you only update them when
 they differ, you may end up with empty Update operations in WFS-T. I think
 it would overcomplicate things to take care of this.

 Please see [attachment:openlayers-3400.2.patch] for the new patch, and let
 me know if there are more concerns.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3400#comment:4>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list