use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class DisplayPointsGroupsHelper method setCollectedItems.
private void setCollectedItems(GpxDisplayGroup group, Map<String, List<GpxDisplayItem>> itemsMap) {
List<String> categories = new ArrayList<>(itemsMap.keySet());
Collections.sort(categories, comparator);
for (String category : categories) {
List<GpxDisplayItem> values = itemsMap.get(category);
GpxDisplayGroup headerGroup = group.cloneInstance();
headerGroup.setName(category);
for (GpxDisplayItem i : values) {
if (i.locationStart != null && i.locationStart.getColor() != 0) {
headerGroup.setColor(i.locationStart.getColor(group.getColor()));
break;
}
}
List<GpxDisplayItem> headerGroupItems = headerGroup.getModifiableList();
headerGroupItems.clear();
headerGroupItems.addAll(values);
itemGroups.put(headerGroup, values);
this.groups.add(headerGroup);
}
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class GpxUiHelper method makeGpxDisplayItem.
public static GpxDisplayItem makeGpxDisplayItem(@NonNull OsmandApplication app, @NonNull GPXFile gpxFile, @NonNull ChartPointLayer chartPointLayer) {
GpxDisplayGroup group = null;
if (!Algorithms.isEmpty(gpxFile.tracks)) {
GpxSelectionHelper helper = app.getSelectedGpxHelper();
String groupName = helper.getGroupName(gpxFile);
group = helper.buildGpxDisplayGroup(gpxFile, 0, groupName);
}
if (group != null && group.getModifiableList().size() > 0) {
GpxDisplayItem gpxItem = group.getModifiableList().get(0);
if (gpxItem != null) {
gpxItem.chartPointLayer = chartPointLayer;
}
return gpxItem;
}
return null;
}
Aggregations