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
parent a7c27eeb23
commit 1b7ca1c86c

View file

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