Fix drawing splits on tracks with multiple segments

Previously, if a track contained multiple segments, split distance/time
markers were drawn for *each* segment, including the overview segment
produced by OsmAnd.

This meant that many duplicate labels were shown, cluttering the display
and making the split markers useless. For example, given a track with two
segments of 6 km each, and a 1 km split interval, two 1 km markers are
shown: one for the first segment and one for the second segment.

Now splits are only shown for the overview segment, making the display
clear and usable.
This commit is contained in:
njohnston 2017-07-21 10:52:16 +00:00 committed by Victor Shcherb
parent 058b5ade68
commit da7871dfca

View file

@ -278,22 +278,22 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
// request to load // request to load
for (SelectedGpxFile g : selectedGPXFiles) { for (SelectedGpxFile g : selectedGPXFiles) {
List<GpxDisplayGroup> groups = g.getDisplayGroups(); List<GpxDisplayGroup> groups = g.getDisplayGroups();
if (groups != null) { if (groups != null && !groups.isEmpty()) {
for (GpxDisplayGroup group : groups) { GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path)); int color = gpxDataItem.getColor();
int color = gpxDataItem.getColor(); if (color == 0) {
if (color == 0) { color = g.getModifiableGpxFile().getColor(0);
color = g.getModifiableGpxFile().getColor(0);
}
if (color == 0) {
color = cachedColor;
}
paintInnerRect.setColor(color);
paintInnerRect.setAlpha(179);
List<GpxDisplayItem> items = group.getModifiableList();
drawSplitItems(canvas, tileBox, items, settings);
} }
if (color == 0) {
color = cachedColor;
}
paintInnerRect.setColor(color);
paintInnerRect.setAlpha(179);
List<GpxDisplayItem> items = groups.get(0).getModifiableList();
drawSplitItems(canvas, tileBox, items, settings);
} }
} }
} }