On Saturday, March 13, 2010, Stephen Woodbridge <wood...@swoodbridge.com> wrote: > Hi all, > > I'm stuck on the best conceptual approach to editing feature attributes > and could really use some feedback or other ideas. In part because I > think I'm too tangled in all the code parts and have lost the big picture. > > So at a high level I need: > > 1) base map - check works fine > 2) vector layer pulling data from server - check works fine > 3) toolbar with [Nav][createPOI][dragPOI][selectPOI] - check have this > but might need to rethink it > 4) [createPOI] > a) needs to take click on map - check, works fine > b) open popup to allow setting attribute, check have this but ... > c) have [cancel] to abort creation - have button but how to abort
for a new feature "cancel" should just destroy that feature. for an updated feature "cancel" should go back to the initial feature, cloning the feature prior modification may help. > d) have [save] to write the data to the server - have button but how > to save If you use a protocol you can use protocol.create([feature]) or protocol.commit([featute]). I'm not sure I'm answering your question... > e) update layer with new feature - not sure the best way to do this. what do you mean? > 1) get return gid from server, add it to feature, and feature to layer I'd recommend you look at the Strategy.Save code. > 2) destroy the temporary feature, and have server return a complete > feature that gets added to layer > 3) not sure how to hook either of these into the code > 5) [dragPOI] - check works, needs a myXML writer I think > 6) [selectPOI] - check, have this but not everything works > a) open popup to allow editing attributes - check have this, but ... > b) have [delete] which will delete the feature > c) have [cancel] which will cancel the edits > d) have [save] which will save the edits to the server > e) update the layer with the modified feature - again see [createPOI] > > So where I'm getting caught up is that in form button onClick function > you really do not know what feature you are dealing with Hmm... when do you open the popup? I'd say when a new feature is drawn on the map and when a feature is selected for modification. So when you have an open popup you know the feature you are dealing with, no? > so I guess that > means that the selected feature needs to be listening for events > "abort", "cancel" and "save" that correspond to the buttons. and all the > function should try to do is trigger the appropriate event. And that the > listener should also have the responsibility for closing the popup. > > 1) So where should the listener be attached, I suppose to the vector > layer as Alexandre suggested in earlier email, but that did compute yet. > > 2) thoughts on best practice for updating the modified features? Sorry I don't understand this question? 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.lemo...@camptocamp.com http://www.camptocamp.com _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users