Modify

Opened 4 weeks ago

Last modified 17 hours ago

#16755 new enhancement

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

Download all attachments as: .zip

Change History (10)

Changed 4 weeks ago by Bjoeni

Attachment: example-original.png added

Changed 4 weeks ago by Bjoeni

Attachment: example-merged-con.png added

Changed 4 weeks ago by Bjoeni

Attachment: example-merged.png added

Changed 4 weeks ago by Bjoeni

Attachment: dialog-target.png added

Changed 4 weeks ago by Bjoeni

Attachment: dialog-prioritize.png added

comment:1 Changed 4 weeks ago by Bjoeni

Description: modified (diff)

Changed 4 weeks ago by Bjoeni

Attachment: MergeGPXV1.diff added

comment:2 Changed 18 hours ago by Don-vip

Milestone: 18.10

Sorry for delay I missed that one.

comment:3 Changed 18 hours 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 17 hours 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!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to Bjoeni
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


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

 
Note: See TracTickets for help on using tickets.