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,8 +278,7 @@ 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) {
if (groups != null && !groups.isEmpty()) {
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
int color = gpxDataItem.getColor();
if (color == 0) {
@ -291,13 +290,14 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
paintInnerRect.setColor(color);
paintInnerRect.setAlpha(179);
List<GpxDisplayItem> items = group.getModifiableList();
List<GpxDisplayItem> items = groups.get(0).getModifiableList();
drawSplitItems(canvas, tileBox, items, settings);
}
}
}
}
}
private void drawSplitItems(Canvas canvas, RotatedTileBox tileBox, List<GpxDisplayItem> items, DrawSettings settings) {
final QuadRect latLonBounds = tileBox.getLatLonBounds();