Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#21967 closed defect (fixed)

[Patch] Keep OSM layer activated when loading GPX layer

Reported by: josm@… Owned by: team
Priority: normal Milestone: 22.03
Component: Core Version: tested
Keywords: template_report gpx importer Cc: Bjoeni

Description

What steps will reproduce the problem?

  1. Load a region into JOSM
  1. Open a GPX with a track file. (It's not necessary that this tracks overlaps the downloaded area.)

What is the expected result?

The OSM data can be edited in JOSM as usual.

What happens instead?

The OSM ways are grey and not editable. Deactiviating the GPX layer via the eye symbol does NOT help, the GPX track vanishes but the OSM ways are still grey and not editable. After deleting the GPX layer via the trash symbol the OSM ways immediately get their colours back and the ways are editable again.

Please provide any additional information below. Attach a screenshot if possible.

JOSM1.png: The normal and expected state. No GPX file loaded
JOSM2.png: GPX file loaded. The elements are grey and not editable.

I did this many times in the past: Loading GPX files from several sources (Garmin satnav device, several smartphones, GPX files from various other sources, GPX files created by GPSBabel and other tools) and it has always worked until some JOSM version. I noticed this behavior with at least JOSM version.

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2022-03-06 10:38:55 +0100 (Sun, 06 Mar 2022)
Build-Date:2022-03-07 02:31:09
Revision:18387
Relative:URL: ^/trunk

Identification: JOSM/1.5 (18387 de) Windows 8.1 64-Bit
OS Build number: Windows 8.1 Pro (9600)
Memory Usage: 205 MB / 455 MB (68 MB allocated, but free)
Java version: 1.8.0_311-b11, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1200 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1200
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: de_DE
Numbers with default locale: 1234567890 -> 1234567890

Plugins:
+ FixAddresses (35893)
+ buildings_tools (35916)
+ continuosDownload (99)
+ fieldpapers (v0.5.0)
+ openqa (0.2.2)
+ utilsplugin2 (35893)

Last errors/warnings:
- 00005.243 W: Unable to request certificate of https://grca.nat.gov.tw
- 00005.482 W: Unable to request certificate of https://grca.nat.gov.tw

Attachments (2)

JOSM1.png (439.3 KB ) - added by josm@… 4 years ago.
Screenshot of working JOSM, without a loaded GPX file
JOSM2.png (373.1 KB ) - added by josm@… 4 years ago.
Screenshot of "grey" JOSM, with a loaded GPX file

Download all attachments as: .zip

Change History (9)

by josm@…, 4 years ago

Attachment: JOSM1.png added

Screenshot of working JOSM, without a loaded GPX file

by josm@…, 4 years ago

Attachment: JOSM2.png added

Screenshot of "grey" JOSM, with a loaded GPX file

comment:1 by skyper, 4 years ago

Keywords: gpx added
Priority: majornormal
Resolution: worksforme
Status: newclosed

JOSM always activates new data and gpx layers. In order to edit a layer you need to activate it (source:trunk/resources/images/dialogs/layerlist/active.svg), see Help/Dialog/LayerList.

comment:2 by josm@…, 4 years ago

Okay, this way it works for me, too, so it's not a bug. However, up to a few months ago I didn't have to click the green "check" symbol after loading a GPX file in order to edit the map - has this behaviour changed recently?

comment:3 by skyper, 4 years ago

Cc: Bjoeni added
Resolution: worksforme
Status: closedreopened

Indeed, the behavior changed. With r18193 the gpx layer is not activated but with r18303 it is.
Are there any reasons for the change in behavior?

comment:4 by GerdP, 4 years ago

Don't know why it was changed, I think the old behaviour was better.

comment:5 by Bjoeni, 4 years ago

Keywords: importer added
Milestone: 22.03
Summary: OSM elements are not editable if a GPX file is loaded[Patch] Keep OSM layer activated when loading GPX layer

Looks like I introduced that with r18287.

  • src/org/openstreetmap/josm/gui/io/importexport/GpxImporter.java

    ### Eclipse Workspace Patch 1.0
    #P josm
     
    1616import org.openstreetmap.josm.gui.layer.GpxLayer;
    1717import org.openstreetmap.josm.gui.layer.GpxRouteLayer;
    1818import org.openstreetmap.josm.gui.layer.ImageryLayer;
     19import org.openstreetmap.josm.gui.layer.Layer;
     20import org.openstreetmap.josm.gui.layer.MainLayerManager;
    1921import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2022import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    2123import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    139141    public static void addLayers(final GpxImporterData data) {
    140142        // FIXME: remove UI stuff from the IO subsystem
    141143        GuiHelper.runInEDT(() -> {
     144            MainLayerManager manager = MainApplication.getLayerManager();
    142145            if (data.markerLayer != null) {
    143                 MainApplication.getLayerManager().addLayer(data.markerLayer);
     146                manager.addLayer(data.markerLayer);
    144147            }
    145148            if (data.gpxRouteLayer != null) {
    146                 MainApplication.getLayerManager().addLayer(data.gpxRouteLayer);
     149                manager.addLayer(data.gpxRouteLayer);
    147150            }
    148151            if (data.gpxLayer != null) {
    149                 MainApplication.getLayerManager().addLayer(data.gpxLayer);
    150                 MainApplication.getLayerManager().setActiveLayer(data.gpxLayer);
     152                manager.addLayer(data.gpxLayer);
     153                Layer activeLayer = manager.getActiveLayer();
     154                if (activeLayer == null || activeLayer instanceof GpxLayer || activeLayer instanceof MarkerLayer) {
     155                    manager.setActiveLayer(data.gpxLayer);
     156                }
    151157            }
    152158            data.postLayerTask.run();
    153159        });

comment:6 by GerdP, 4 years ago

Resolution: fixed
Status: reopenedclosed

In 18422/josm:

fix #21967: Keep OSM layer activated when loading GPX layer
Patch by Bjoeni

comment:7 by GerdP, 4 years ago

Thanks for the patch!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.