Hi, no the patch attached to the ticket is not related to this issue. There the waypoints are just put in a list and sorted by time, it is intentional that no new instance is created.
Here however I thought that the (maybe expensive) copying of the instances was not necessary if I removed the cached values (dir), because the old layer was going to be removed in the process anyway. But now with new instances it works, so thanks for mentioning this :) For some reason now some lines between waypoints in the old layer (that are not even touched when adding a new one) disappear... but I haven't had a closer look at that yet. Cheers Niklas Michael Zangl <[email protected]> schrieb am So., 16. Sep. 2018, 8:22 AM: > Hi, > > I just had a short look at the patch that is attached to the ticket, > assuming it contains the code you used to split things. > > I did not have a deep look at it, but from what I can tell, you copy > over the waypoints to a new layer. > > Mind that this should not be done. New WayPoints always need to be > created for the new layer. So you need to call the WayPoint copy > constructor for every waypoint you add to the new layer. > > The connectivity is cached using those waypoint objects. > > Michael > > On 15.09.2018 03:48, Niklas B wrote: > > (maybe this time..?) > > > > Hi, > > > > I'm currently implementing an option to cut overlapping GPX tracks when > > merging them into one layer (followup of #16681 > > <https://josm.openstreetmap.de/ticket/16681> "*allow multiple tracks to > be > > processed and prioritized (from different sources, e.g. GPS + phone + > > Google Timeline)*", but when merging layers because this is not > > specifically related to geotagging / geoimage layers). > > > > Everything works fine, but the resulting GPX layer is not displayed > > correctly: Some lines are displayed between tracks that are not connected > > anymore (because another track was on top of it, so the underlying track > > needed to be split) and also some weird lines connecting points that were > > never connected appear - haven't figured them out yet. > > > > Before I debug that any further: What caching mechanisms are there in > > place, what do I have to reset? I'm already calling invalidate() (in > > GpxData, which calls the appropriate listeners) and tried removing the > > cached "dir" values from all of the waypoints, but it didn't help. > > The layer will however be displayed perfectly fine if it's converted to a > > data layer (and back) or saved as GPX and reloaded. > > > > Any ideas on what might be the reason for that? > > > > Thanks, > > Niklas (Bjoeni) > > > >
