Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 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 6 years ago.
example-merged-con.png (15.0 KB ) - added by Bjoeni 6 years ago.
example-merged.png (14.5 KB ) - added by Bjoeni 6 years ago.
dialog-target.png (9.1 KB ) - added by Bjoeni 6 years ago.
dialog-prioritize.png (16.1 KB ) - added by Bjoeni 6 years ago.
MergeGPXV1.diff (54.5 KB ) - added by Bjoeni 6 years ago.

Download all attachments as: .zip

Change History (12)

by Bjoeni, 6 years ago

Attachment: example-original.png added

by Bjoeni, 6 years ago

Attachment: example-merged-con.png added

by Bjoeni, 6 years ago

Attachment: example-merged.png added

by Bjoeni, 6 years ago

Attachment: dialog-target.png added

by Bjoeni, 6 years ago

Attachment: dialog-prioritize.png added

comment:1 by Bjoeni, 6 years ago

Description: modified (diff)

by Bjoeni, 6 years ago

Attachment: MergeGPXV1.diff added

comment:2 by Don-vip, 6 years ago

Milestone: 18.10

Sorry for delay I missed that one.

comment:3 by Don-vip, 6 years ago

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 by Don-vip, 6 years ago

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 by Don-vip, 6 years ago

Resolution: fixed
Status: newclosed

In 14338/josm:

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

comment:6 by Don-vip, 6 years ago

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. 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.