use of net.osmand.plus.track.helpers.DisplayPointsGroupsHelper.DisplayGroupsHolder in project Osmand by osmandapp.
the class TrackPointsAdapter method synchronizeGroups.
public void synchronizeGroups(@NonNull List<GpxDisplayGroup> displayGroups) {
groups.clear();
pointsGroups.clear();
DisplayGroupsHolder groupsHolder = DisplayPointsGroupsHelper.getGroups(app, displayGroups, null);
groups.addAll(groupsHolder.groups);
for (Map.Entry<GpxDisplayGroup, List<GpxDisplayItem>> entry : groupsHolder.itemGroups.entrySet()) {
List<WptPt> points = new ArrayList<>();
for (GpxDisplayItem item : entry.getValue()) {
points.add(item.locationStart);
}
pointsGroups.put(entry.getKey(), points);
}
notifyDataSetChanged();
}
use of net.osmand.plus.track.helpers.DisplayPointsGroupsHelper.DisplayGroupsHolder in project Osmand by osmandapp.
the class DisplayGroupsBottomSheet method initSelectableItems.
private void initSelectableItems() {
List<GpxDisplayGroup> displayGroups = displayHelper.getPointsOriginalGroups();
DisplayGroupsHolder groupsHolder = DisplayPointsGroupsHelper.getGroups(app, displayGroups, null);
uiItems.clear();
for (GpxDisplayGroup group : groupsHolder.groups) {
if (group.getType() != GpxDisplayItemType.TRACK_POINTS) {
continue;
}
SelectableItem<GpxDisplayGroup> uiItem = new SelectableItem<>();
List<GpxDisplayItem> groupItems = groupsHolder.itemGroups.get(group);
String categoryName = group.getName();
if (TextUtils.isEmpty(categoryName)) {
categoryName = app.getString(R.string.shared_string_gpx_points);
}
uiItem.setTitle(categoryName);
uiItem.setColor(group.getColor());
int size = groupItems != null ? groupItems.size() : 0;
uiItem.setDescription(String.valueOf(size));
uiItem.setObject(group);
uiItems.add(uiItem);
}
}
use of net.osmand.plus.track.helpers.DisplayPointsGroupsHelper.DisplayGroupsHolder in project Osmand by osmandapp.
the class TrackMenuFragment method fitSelectedPointsGroupOnMap.
private void fitSelectedPointsGroupOnMap(GpxDisplayGroup group) {
DisplayGroupsHolder groupsHolder = getDisplayGroupsHolder();
List<GpxDisplayItem> points = groupsHolder.getItemsByGroupName(group.getName());
if (points != null) {
QuadRect pointsRect = new QuadRect();
for (GpxDisplayItem point : points) {
GPXUtilities.updateQR(pointsRect, point.locationStart, 0, 0);
}
adjustMapPosition(pointsRect);
}
}
use of net.osmand.plus.track.helpers.DisplayPointsGroupsHelper.DisplayGroupsHolder in project Osmand by osmandapp.
the class TrackMenuFragment method updateDisplayGroupsWidget.
public void updateDisplayGroupsWidget() {
boolean widgetVisible = hasPointsGroups() && !shouldShowWidgets();
if (widgetVisible) {
DisplayGroupsHolder displayGroupsHolder = getDisplayGroupsHolder();
int visible = displayGroupsHolder.getVisibleTrackGroupsNumber(selectedGpxFile);
int total = displayGroupsHolder.getTotalTrackGroupsNumber();
TextView indication = displayGroupsWidget.findViewById(R.id.visible_display_groups_size);
boolean hasRouteGroupsOnly = total == 0;
if (hasRouteGroupsOnly) {
indication.setText("0");
} else {
indication.setText(getString(R.string.ltr_or_rtl_combine_via_slash, String.valueOf(visible), String.valueOf(total)));
}
}
AndroidUiHelper.updateVisibility(displayGroupsWidget, widgetVisible);
}
Aggregations