Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#16755 closed enhancement (fixed)

[Patch] Cut overlapping GPX layers when merging

Reported by: Bjoeni Owned by: team
Priority: normal Milestone: 18.10
Component: Core Version:
Keywords: gpx merging Cc:

Description (last modified by Bjoeni)

followup of #16681

Ideas that could implemented in the future
[...]
allow multiple tracks to be processed and prioritized (from different sources, e.g. GPS + phone + Google Timeline) [cut overlapping parts of less important tracks and replace by more important ones -> merge before handling]

This patch allows the user to cut timewise overlapping tracks and to connect them on the cuts when merging layers.

I had to modify the AbstractMergeAction: I kept it abstract and all public signatures the same, but please have a closer look at that before patching.

Dialogs:



Example:

Original:

Merged (connected):

Merged (not connected):

These are also the files used for unit tests, see patch.

Attachments (6)

example-original.png (14.3 KB) - added by Bjoeni 5 years ago.
example-merged-con.png (15.0 KB) - added by Bjoeni 5 years ago.
example-merged.png (14.5 KB) - added by Bjoeni 5 years ago.
dialog-target.png (9.1 KB) - added by Bjoeni 5 years ago.
dialog-prioritize.png (16.1 KB) - added by Bjoeni 5 years ago.
MergeGPXV1.diff (54.5 KB) - added by Bjoeni 5 years ago.

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by Bjoeni

Attachment: example-original.png added

Changed 5 years ago by Bjoeni

Attachment: example-merged-con.png added

Changed 5 years ago by Bjoeni

Attachment: example-merged.png added

Changed 5 years ago by Bjoeni

Attachment: dialog-target.png added

Changed 5 years ago by Bjoeni

Attachment: dialog-prioritize.png added

comment:1 Changed 5 years ago by Bjoeni

Description: modified (diff)

Changed 5 years ago by Bjoeni

Attachment: MergeGPXV1.diff added

comment:2 Changed 5 years ago by Don-vip

Milestone: 18.10

Sorry for delay I missed that one.

comment:3 Changed 5 years ago by Don-vip

This could be rewritten as a single line with Java 8 stream API:

        boolean ogpx = true;
        for (Layer l : targetLayers) {
            if (!(l instanceof GpxLayer)) {
                ogpx = false;
                break;
            }
        }
        final boolean onlygpx = ogpx;

comment:4 Changed 5 years ago by Don-vip

The new method GpxData.mergeFrom(GpxData other, boolean cutOverlapping, boolean connect) is too big. The algorithm should be split in several methods, it's hard to maintain methods with 116 lines.

Otherwise looks good!

comment:5 Changed 5 years ago by Don-vip

Resolution: fixed
Status: newclosed

In 14338/josm:

fix #16755 - Cut overlapping GPX layers when merging (patch by Bjoeni, modified)

comment:6 Changed 5 years ago by Don-vip

In 14341/josm:

see #16755 - fix sonarqube warnings

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.