[josm-dev] Layer specific history

Holger Mappt holgerosm at gmx.net
Tue Dec 29 16:16:03 UTC 2015


Hi,

See https://josm.openstreetmap.de/ticket/11904.
What is the recommended way to add a command history with undo/redo 
functionality to a layer that is not an OSM data layer?  In this case 
the GeoImageLayer.

The other software I know has one history stack.  Every modification 
generates a history entry.  JOSM default is to have history only for OSM 
data layers.  The Mapillary plugin implements a history as toggle dialog 
with separate undo/redo buttons.

I can imagine three options:
1) One linear history stack for all actions with one interface.  This is 
what is usually done in other software.  The interface is the undo/redo 
in the edit menu and the main toolbar and the command stack toggle dialog.

2) One history stack per layer with one interface.  Similar to 1), but 
undo/redo applies only to the active layer.  This decouples the actions 
done in different layers.  It requires that actions done in one layer do 
not depend on actions in another layer.  "Layer" can either be a single 
layer or one layer type.

3) Each layer implements a custom history.  Similar to 2), but different 
interface for each layer.  Has the advantage that fancy things can be 
done.  E.g. for the GeoImageLayer the history could be per image.  But 
the user is confronted with many history dialogs and undo mechanisms.

To be useful the history needs a concept of "connected actions" and the 
possibility to undo unconnected actions independently.  Example: The key 
"opening_hours" is added to a POI node, then the key "name" of an other 
PI node is changed.  To undo the opening_hours the name change has to 
undone too with the current implementation.  But the two POI nodes are 
not connected, it should be possible to undo either change.

Regards,
Holger



More information about the josm-dev mailing list