Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7193 closed defect (fixed)

Opening more than two gpx-Tracks fails (regression)

Reported by: anonymous Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: Cc:

Description

Opening (Strg-O) more than two gpx-Tracks at once does not work properly.

Expected behaviour:
Open all gpx-files

Observed behaviour:
*Trying to open 3 gpx-files:

Two layers with third gpx-file and one layer with first gpx-file (second gpx-file missing)

*Trying to open 4 gpx-files:

Three layers with fourth gpx-file and one layer with first gpx-file (second and third missing) - or in other cases three layers with fourth gpx-file and one layer with second gpx-file (first and third missing)

Exact pattern hard to understand!
Console message lists "Open file: .....gpx (????? bytes)" correctly for all chosen files, however, the layers that appear within josm do not correspond to all gpx files!

This bug is a regression. It did not happen with older josm-versions!

Attachments (5)

layers.png (15.1 KB) - added by holger 11 years ago.
Layers Dialog in JOSM (after semi-failed gpx-import)
shell.png (375.1 KB) - added by holger 11 years ago.
corresponding messages on shell
layers_3-gpx-files.png (68.8 KB) - added by holger 11 years ago.
Layers: Error with just 3 gpx-files
shell_3-pgx-files.png (113.0 KB) - added by holger 11 years ago.
Shell: corresponding to the 3-gpx-files case
gpxlayer.patch (3.9 KB) - added by stoecker 11 years ago.
Example solution

Download all attachments as: .zip

Change History (19)

comment:1 Changed 11 years ago by bastiK

Cannot reproduce, what version exactly?

Changed 11 years ago by holger

Attachment: layers.png added

Layers Dialog in JOSM (after semi-failed gpx-import)

Changed 11 years ago by holger

Attachment: shell.png added

corresponding messages on shell

comment:2 in reply to:  1 Changed 11 years ago by holger

Replying to bastiK:

Cannot reproduce, what version exactly?

Josm version 4717 with the following plugins:

lade Plugin 'openstreetbugs' (Version 27119)
lade Plugin 'turnlanes' (Version 26731)
lade Plugin 'ElevationProfile' (Version 27285)
lade Plugin 'licensechange' (Version 27241)
lade Plugin 'photo_geotagging' (Version 27019)
lade Plugin 'turnrestrictions' (Version 27241)
lade Plugin 'FixAddresses' (Version 27178)
lade Plugin 'RoadSigns' (Version 27241)
lade Plugin 'mapdust' (Version 27119)
lade Plugin 'public_transport' (Version 27241)
Silent shortcut conflict: 'menu:Public Transport' moved by 'menu:Presets' to 'Alt+A'.
lade Plugin 'ImproveWayAccuracy' (Version 27178)
lade Plugin 'download_along' (Version 27119)
lade Plugin 'OpeningHoursEditor' (Version 27178)
lade Plugin 'utilsplugin2' (Version 27289)
Silent shortcut conflict: 'menu:More tools' moved by 'plugin:roadsigns:dialog' to 'Alt+B'.
RemoteControl::Accepting connections on port 8111

comment:3 Changed 11 years ago by stoecker

Owner: changed from team to anonymous
Status: newneedinfo

Does that also happen with a smaller number of files. Then please attach the smallest number of files required to reach that goal.

Layers Dialog in JOSM (after semi-failed gpx-import) corresponding messages on shell

Changed 11 years ago by holger

Attachment: layers_3-gpx-files.png added

Layers: Error with just 3 gpx-files

Changed 11 years ago by holger

Attachment: shell_3-pgx-files.png added

Shell: corresponding to the 3-gpx-files case

comment:4 Changed 11 years ago by bastiK

Ok, we shouldn't share one GpxImporter instance for all files. Otherwise it's kind of random which layer is added in EDT.

comment:5 Changed 11 years ago by holger

As mentioned in the title of the ticket:
Opening one or two gpx-tracks works ok.
Opening more than two (i.e. three or more) leads to the failed behaviour.
Two more screenshots corresponding to the three gpx files case attached.

All plugins were deactivated to x-check if error is due to plugins - which seems not to be the case.

Refering to "comment:4": That sounds chinese to me. I hope you do not expect any reply from me on that, right?

comment:6 Changed 11 years ago by stoecker

Owner: changed from anonymous to team
Status: needinfonew

Can reproduce it.

Instead of the real loaded layers one or more layers are displayed multiple times. In the above example 15 layers aren't displayed and 2 are displayed more than once.

comment:7 Changed 11 years ago by stoecker

@bastiK:

Why do you add variables to GpxImporter at all? Importers aren't means to be constructed individually for each file and I don't see sense in changing that.

comment:8 Changed 11 years ago by bastiK

This is for Session support. I need to get the Layer object from the importer directly, in order to set visibility and stuff like that. I could ignore the FileImporter classes and use OsmReader / GpxReader directly, but the importer shows dialog messages in certain cases and these might also be useful when importing a session (?).

comment:9 Changed 11 years ago by bastiK

This should fix the problem, but I don't like it too much:

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

     
    4141        String fileName = file.getName();
    4242        loadLayers(is, file, fileName, tr("Markers from {0}", fileName), progressMonitor);
    4343
     44        final GpxLayer gpxLayer = this.gpxLayer;
     45        final MarkerLayer markerLayer = this.markerLayer;
     46
    4447        // FIXME: remove UI stuff from the IO subsystem
    4548        GuiHelper.runInEDT(new Runnable() {
    4649            public void run() {

Changed 11 years ago by stoecker

Attachment: gpxlayer.patch added

Example solution

comment:10 Changed 11 years ago by stoecker

Can't you use a solution like the one in the patch I did and add a second importData(), which returns you the relevant structure containing all you need?

comment:11 Changed 11 years ago by bastiK

In [4755/josm]:

see #7193 - Opening more than two gpx-Tracks fails (regression)

comment:12 Changed 11 years ago by bastiK

I have no time for a proper fix at the moment, feel free to use your approach.

comment:13 Changed 11 years ago by bastiK

Resolution: fixed
Status: newclosed

In [4814/josm]:

fixed #7193 - Opening more than two gpx-Tracks fails (regression)

comment:14 Changed 11 years ago by bastiK

A drawback of your method is, that it has to be applied to each Importer but creation of a new instance would only be at one place.

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.