Opened 15 years ago
Closed 9 years ago
#4029 closed enhancement (fixed)
save editing session similar to other GIS app
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | session | Cc: | nakor, Pedja |
Description
When editing in JOSM, I usually load several gps traces, an OSM file and a some WMS. I often upload/download changes. But when I close JOSM I need to reload all the traces, etc. I want something like a qgis project file to save my editing session for future edits.
Attachments (1)
Change History (48)
comment:1 by , 14 years ago
Cc: | added |
---|
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 14 years ago
I attached a temporary patch. It works quite well with Osm and Gpx layer. It fails with Image Layers. Other are not yet implemented.
As explained on the mailing list I am having trouble with getting the layer sometimes a they are created in the background. Just look for FIXME in the code.
comment:4 by , 14 years ago
There are 2 threads: Event Dispatch Thread (EDT) and the main worker thread (Main.worker). User interaction happens in EDT and to change a GUI element, you must be in EDT. The worker thread is for long processes (e.g. opening a file or removing duplicate nodes in validator) so that the GUI does not freeze. When you are in EDT, you can schedule a task for the worker thread like this:
Main.worker.submit(heavyTask);
When you are in the worker thread you can submit a task for the EDT like this:
SwingUtilities.invokeLater(uiStuff);
In this basic setup you will not know from one thread when a certain task has finished in the other thread. So this does not work:
final Object result = null; Runnable loader = new Runnable() { public void run() { result = loadAlot(); } } Main.worker.submit(loader); System.err.println(result);
But luckily the second task will not start before the first has finished, so this works:
final Object result = null; Runnable loader = new Runnable() { public void run() { result = loadAlot(); } } Runnable postProcessing = new Runnable() { public void run() { System.err.println(result); } } Main.worker.submit(loader); Main.worker.submit(postProcessing);
(The reverse is also true, i.e. submitting 2 GUI tasks from the worker, the first finishes first.)
Most of the stuff that you are dealing with happens in the worker thread. This is from OsmImporter:
protected void importData(InputStream in, File associatedFile) throws IllegalDataException { DataSet dataSet = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); final OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile); // FIXME: remove UI stuff from IO subsystem // Runnable uiStuff = new Runnable() { public void run() { Main.main.addLayer(layer); layer.onPostLoadFromFile(); } }; if (SwingUtilities.isEventDispatchThread()) { uiStuff.run(); } else { SwingUtilities.invokeLater(uiStuff); } }
As the comment says, it might be a good idea to remove the gui stuff from the importer and move it into the OpenFileAction and SessionImporter (?) respectively.
comment:6 by , 14 years ago
Another thing: you should probably move the code for reading and writing the xml data to the individual layer files. After all, there might be all kinds of layers from plugins, like OpenStreetBugs and so on...
comment:7 by , 14 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:8 by , 14 years ago
Not sure when I'll have time to look into this again. Anyone is free to implement it using the preliminary work I did if they want.
comment:9 by , 14 years ago
Summary: | save editing session similar to other GIS app → [patch - unfinished] save editing session similar to other GIS app |
---|
comment:10 by , 14 years ago
Summary: | [patch - unfinished] save editing session similar to other GIS app → (patch - unfinished) save editing session similar to other GIS app |
---|
comment:12 by , 13 years ago
Here is the general idea:
A .jos file looks like this, and contains meta-data in a human readable format:
<?xml version="1.0" encoding="utf-8"?> <josm-session version="0.1"> <layers> <layer index="1" name="test.osm" type="osm-data" version="0.1"> <file>file:/home/user/test.osm</file> </layer> <layer index="2" name="test2.osm" type="osm-data" version="0.1"> <file>file:/home/user/test2.osm</file> </layer> </layers> </josm-session>
A .joz file is a zip archive that contains at least one .jos file. In this case, data files (.osm, .gpx, .png) can be included in the zip archive, so the file gets self contained.
I can see two primarily use cases:
- Save work in progress and easily restore the selection of layers, viewport etc. after restarting JOSM.
- Distribute packages from a website, e.g. for bug-fixing. You could even include map paint styles and presets or ensure that a certain projection is selected.
(Menu entry is currently hidden, unlock with session=true
.)
comment:15 by , 13 years ago
The basic setup for exporting and importing the list of layers is finished. Now we need to add more layer types.
comment:16 by , 13 years ago
I don't know how to export a marker layer to a file. Normally the markers come from a gpx file, but not always - the user can add additional audio playback bookmarks and so on.
comment:18 by , 13 years ago
Summary: | (patch - unfinished) save editing session similar to other GIS app → save editing session similar to other GIS app |
---|
comment:20 by , 13 years ago
Cc: | added |
---|
follow-up: 28 comment:27 by , 12 years ago
Will this also remember other settings, such as suppress errors from TMS layer etc. The reason I ask is that I sometimes uses a OpenSeaMap layer as layover to see existing seamarks rendered. This layer returns errors for each tile without any seamarks as it returns Error 404 instead of a blank tile. I generally deselect the "show errors" on this layer to avoid cluttering the screen with error messages
comment:28 by , 12 years ago
Replying to anonymous:
Will this also remember other settings, such as suppress errors from TMS layer etc. The reason I ask is that I sometimes uses a OpenSeaMap layer as layover to see existing seamarks rendered. This layer returns errors for each tile without any seamarks as it returns Error 404 instead of a blank tile. I generally deselect the "show errors" on this layer to avoid cluttering the screen with error messages
Not yet, but I'll put it on the TODO list.
follow-up: 32 comment:31 by , 12 years ago
Most of the changes in [5684] affect only the code for the (unpublished) session feature, so I hope it doesn't introduce any bugs for the release next week. :)
comment:32 by , 12 years ago
Replying to bastiK:
I hope it doesn't introduce any bugs for the release next week. :)
This particular change, no, but older ones did broke a bunch of plugins (compile errors):
- globalsat
- gpxfilter
- openvisible
- livegps
- public_transport
I have myself broken reverter plugin with r5680, fix on the way :)
comment:35 by , 12 years ago
Replying to bastiK:
see #4029 - session menu now visible in expert mode - Please report bugs and feature requests!
ok :)
- Start JOSM
- File -> Session -> Save as
Build-Date: 2013-08-13 11:43:28 Revision: 6142 Is-Local-Build: true Identification: JOSM/1.5 (6142 SVN fr) Windows 8 64-Bit Memory Usage: 198 MB / 1813 MB (89 MB allocated, but free) Java version: 1.7.0_25, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM java.lang.NullPointerException at org.openstreetmap.josm.actions.SessionSaveAsAction$SessionSaveAsDialog.initialize(SessionSaveAsAction.java:149) at org.openstreetmap.josm.actions.SessionSaveAsAction$SessionSaveAsDialog.<init>(SessionSaveAsAction.java:140) at org.openstreetmap.josm.actions.SessionSaveAsAction.actionPerformed(SessionSaveAsAction.java:63) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
follow-up: 39 comment:36 by , 12 years ago
Can you see also if you can do some code refactorization here ?
http://donvip.fr/sonar/resource/index/josm:org.openstreetmap.josm.io.session.GpxTracksSessionExporter?display_title=true&metric=88
It seems some strings have not been updated in GPX exporter because they refer "OSM data".
comment:39 by , 12 years ago
Replying to Don-vip:
Can you see also if you can do some code refactorization here ?
http://donvip.fr/sonar/resource/index/josm:org.openstreetmap.josm.io.session.GpxTracksSessionExporter?display_title=true&metric=88
I'm aware that there is some code duplication and eventually, some refactorization is needed. But for now, I'd like to keep it simple.
It seems some strings have not been updated in GPX exporter because they refer "OSM data".
Thanks, fixed.
comment:41 by , 12 years ago
Hi !
This new feature is really helpful, thank you for your work !
Do you think you could include the cadastre-fr plugin layers in the sessions ?
Cadastre plugin :
http://wiki.openstreetmap.org/wiki/FR:JOSM/Fr:Plugin/Cadastre-fr
https://github.com/openstreetmap/josm-plugins/tree/master/cadastre-fr
comment:45 by , 11 years ago
comment:46 by , 11 years ago
Keywords: | session added |
---|
comment:47 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This one is fixed and in use for 2 years.
I was thinking of a similar thing:
When closing JOSM it would save layer names with associated files (or set of files) + current view in a session file.
When loading JOSM layers would be reconstructed from that list and current view would be restored.