Search in sources :

Example 6 with FavoriteGroup

use of net.osmand.plus.myplaces.FavoriteGroup in project Osmand by osmandapp.

the class FavoritesTreeFragment method selectMapMarkersImpl.

private void selectMapMarkersImpl() {
    if (getSelectedFavoritesCount() > 0) {
        MapMarkersHelper markersHelper = getMyApplication().getMapMarkersHelper();
        List<LatLon> points = new ArrayList<>();
        List<PointDescription> names = new ArrayList<>();
        for (Map.Entry<String, Set<FavouritePoint>> entry : favoritesSelected.entrySet()) {
            FavoriteGroup group = helper.getGroup(entry.getKey());
            if (group != null && entry.getValue().size() == group.getPoints().size()) {
                markersHelper.addOrEnableGroup(group);
            } else {
                for (FavouritePoint fp : entry.getValue()) {
                    points.add(new LatLon(fp.getLatitude(), fp.getLongitude()));
                    names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName()));
                }
                markersHelper.addMapMarkers(points, names, null);
                points.clear();
                names.clear();
            }
        }
        MapActivity.launchMapActivityMoveToTop(getActivity());
    }
}
Also used : LatLon(net.osmand.data.LatLon) Set(java.util.Set) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) MapMarkersHelper(net.osmand.plus.mapmarkers.MapMarkersHelper) FavouritePoint(net.osmand.data.FavouritePoint) FavoriteGroup(net.osmand.plus.myplaces.FavoriteGroup) PointDescription(net.osmand.data.PointDescription) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Example 7 with FavoriteGroup

use of net.osmand.plus.myplaces.FavoriteGroup in project Osmand by osmandapp.

the class FavoriteAction method drawUI.

@Override
public void drawUI(@NonNull final ViewGroup parent, @NonNull final MapActivity mapActivity) {
    FavouritesHelper helper = mapActivity.getMyApplication().getFavoritesHelper();
    final View root = LayoutInflater.from(parent.getContext()).inflate(R.layout.quick_action_add_favorite, parent, false);
    parent.addView(root);
    AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) root.findViewById(R.id.category_edit);
    SwitchCompat showDialog = (SwitchCompat) root.findViewById(R.id.saveButton);
    ImageView categoryImage = (ImageView) root.findViewById(R.id.category_image);
    EditText name = (EditText) root.findViewById(R.id.name_edit);
    if (!getParams().isEmpty()) {
        showDialog.setChecked(Boolean.valueOf(getParams().get(KEY_DIALOG)));
        categoryImage.setColorFilter(Integer.valueOf(getParams().get(KEY_CATEGORY_COLOR)));
        name.setText(getParams().get(KEY_NAME));
        categoryEdit.setText(getParams().get(KEY_CATEGORY_NAME));
        if (getParams().get(KEY_NAME).isEmpty() && Integer.valueOf(getParams().get(KEY_CATEGORY_COLOR)) == 0) {
            categoryEdit.setText(mapActivity.getString(R.string.shared_string_favorites));
            categoryImage.setColorFilter(mapActivity.getResources().getColor(R.color.color_favorite));
        }
    } else if (helper.getFavoriteGroups().size() > 0) {
        FavoriteGroup group = helper.getFavoriteGroups().get(0);
        int color = group.getColor() == 0 ? mapActivity.getResources().getColor(R.color.color_favorite) : group.getColor();
        categoryEdit.setText(group.getDisplayName(mapActivity));
        categoryImage.setColorFilter(color);
        getParams().put(KEY_CATEGORY_NAME, group.getName());
        getParams().put(KEY_CATEGORY_COLOR, String.valueOf(group.getColor()));
    } else {
        categoryEdit.setText(mapActivity.getString(R.string.shared_string_favorites));
        categoryImage.setColorFilter(mapActivity.getResources().getColor(R.color.color_favorite));
        getParams().put(KEY_CATEGORY_NAME, "");
        getParams().put(KEY_CATEGORY_COLOR, "0");
    }
    categoryEdit.setOnClickListener(view -> {
        FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
        CategorySelectionListener listener = (category, color) -> fillGroupParams(root, category, color);
        SelectPointsCategoryBottomSheet.showSelectFavoriteCategoryFragment(fragmentManager, listener, "");
    });
    SelectPointsCategoryBottomSheet dialogFragment = (SelectPointsCategoryBottomSheet) mapActivity.getSupportFragmentManager().findFragmentByTag(SelectPointsCategoryBottomSheet.TAG);
    if (dialogFragment != null) {
        dialogFragment.setSelectionListener((category, color) -> fillGroupParams(root, category, color));
    }
}
Also used : EditText(android.widget.EditText) FragmentManager(androidx.fragment.app.FragmentManager) Context(android.content.Context) CategorySelectionListener(net.osmand.plus.mapcontextmenu.editors.SelectPointsCategoryBottomSheet.CategorySelectionListener) AddressLookupRequest(net.osmand.plus.GeocodingLookupService.AddressLookupRequest) QuickAction(net.osmand.plus.quickaction.QuickAction) NonNull(androidx.annotation.NonNull) ImageView(android.widget.ImageView) FavouritesHelper(net.osmand.plus.myplaces.FavouritesHelper) R(net.osmand.plus.R) Dialog(android.app.Dialog) SelectPointsCategoryBottomSheet(net.osmand.plus.mapcontextmenu.editors.SelectPointsCategoryBottomSheet) LatLon(net.osmand.data.LatLon) View(android.view.View) OnAddressLookupResult(net.osmand.plus.GeocodingLookupService.OnAddressLookupResult) FavoriteGroup(net.osmand.plus.myplaces.FavoriteGroup) DialogInterface(android.content.DialogInterface) FragmentManager(androidx.fragment.app.FragmentManager) SwitchCompat(androidx.appcompat.widget.SwitchCompat) LayoutInflater(android.view.LayoutInflater) AutoCompleteTextViewEx(net.osmand.plus.widgets.AutoCompleteTextViewEx) ProgressDialog(android.app.ProgressDialog) ViewGroup(android.view.ViewGroup) FavoritePointEditor(net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor) QuickActionType(net.osmand.plus.quickaction.QuickActionType) EditText(android.widget.EditText) MapActivity(net.osmand.plus.activities.MapActivity) AutoCompleteTextViewEx(net.osmand.plus.widgets.AutoCompleteTextViewEx) CategorySelectionListener(net.osmand.plus.mapcontextmenu.editors.SelectPointsCategoryBottomSheet.CategorySelectionListener) FavouritesHelper(net.osmand.plus.myplaces.FavouritesHelper) SelectPointsCategoryBottomSheet(net.osmand.plus.mapcontextmenu.editors.SelectPointsCategoryBottomSheet) FavoriteGroup(net.osmand.plus.myplaces.FavoriteGroup) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) SwitchCompat(androidx.appcompat.widget.SwitchCompat)

Example 8 with FavoriteGroup

use of net.osmand.plus.myplaces.FavoriteGroup in project Osmand by osmandapp.

the class SettingsHelper method getMyPlacesItems.

private Map<ExportSettingsType, List<?>> getMyPlacesItems(@Nullable List<ExportSettingsType> settingsTypes, boolean addEmptyItems) {
    Map<ExportSettingsType, List<?>> myPlacesItems = new LinkedHashMap<>();
    List<FavoriteGroup> favoriteGroups = settingsTypes == null || settingsTypes.contains(ExportSettingsType.FAVORITES) ? app.getFavoritesHelper().getFavoriteGroups() : Collections.emptyList();
    if (!favoriteGroups.isEmpty() || addEmptyItems) {
        myPlacesItems.put(ExportSettingsType.FAVORITES, favoriteGroups);
    }
    List<GpxDataItem> gpxItems = settingsTypes == null || settingsTypes.contains(ExportSettingsType.TRACKS) ? app.getGpxDbHelper().getItems() : Collections.emptyList();
    if (!gpxItems.isEmpty() || addEmptyItems) {
        List<File> files = new ArrayList<>();
        for (GpxDataItem gpxItem : gpxItems) {
            File file = gpxItem.getFile();
            if (file.exists() && !file.isDirectory()) {
                files.add(file);
            }
        }
        if (!files.isEmpty() || addEmptyItems) {
            myPlacesItems.put(ExportSettingsType.TRACKS, files);
        }
    }
    OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getActivePlugin(OsmEditingPlugin.class);
    if (osmEditingPlugin != null) {
        List<OsmNotesPoint> notesPointList = settingsTypes == null || settingsTypes.contains(ExportSettingsType.OSM_NOTES) ? osmEditingPlugin.getDBBug().getOsmbugsPoints() : Collections.emptyList();
        if (!notesPointList.isEmpty() || addEmptyItems) {
            myPlacesItems.put(ExportSettingsType.OSM_NOTES, notesPointList);
        }
        List<OpenstreetmapPoint> editsPointList = settingsTypes == null || settingsTypes.contains(ExportSettingsType.OSM_EDITS) ? osmEditingPlugin.getDBPOI().getOpenstreetmapPoints() : Collections.emptyList();
        if (!editsPointList.isEmpty() || addEmptyItems) {
            myPlacesItems.put(ExportSettingsType.OSM_EDITS, editsPointList);
        }
    }
    AudioVideoNotesPlugin avNotesPlugin = OsmandPlugin.getActivePlugin(AudioVideoNotesPlugin.class);
    if (avNotesPlugin != null) {
        List<File> files = new ArrayList<>();
        if (settingsTypes == null || settingsTypes.contains(ExportSettingsType.MULTIMEDIA_NOTES)) {
            for (Recording rec : avNotesPlugin.getAllRecordings()) {
                File file = rec.getFile();
                if (file != null && file.exists()) {
                    files.add(file);
                }
            }
        }
        if (!files.isEmpty() || addEmptyItems) {
            myPlacesItems.put(ExportSettingsType.MULTIMEDIA_NOTES, files);
        }
    }
    List<MapMarker> mapMarkers = settingsTypes == null || settingsTypes.contains(ExportSettingsType.ACTIVE_MARKERS) ? app.getMapMarkersHelper().getMapMarkers() : Collections.emptyList();
    if (!mapMarkers.isEmpty() || addEmptyItems) {
        String name = app.getString(R.string.map_markers);
        String groupId = ExportSettingsType.ACTIVE_MARKERS.name();
        MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, ItineraryType.MARKERS);
        markersGroup.setMarkers(mapMarkers);
        myPlacesItems.put(ExportSettingsType.ACTIVE_MARKERS, Collections.singletonList(markersGroup));
    }
    List<MapMarker> markersHistory = settingsTypes == null || settingsTypes.contains(ExportSettingsType.HISTORY_MARKERS) ? app.getMapMarkersHelper().getMapMarkersHistory() : Collections.emptyList();
    if (!markersHistory.isEmpty() || addEmptyItems) {
        String name = app.getString(R.string.shared_string_history);
        String groupId = ExportSettingsType.HISTORY_MARKERS.name();
        MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, ItineraryType.MARKERS);
        markersGroup.setMarkers(markersHistory);
        myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup));
    }
    List<HistoryEntry> historyEntries = settingsTypes == null || settingsTypes.contains(ExportSettingsType.SEARCH_HISTORY) ? SearchHistoryHelper.getInstance(app).getHistoryEntries(false) : Collections.emptyList();
    if (!historyEntries.isEmpty() || addEmptyItems) {
        myPlacesItems.put(ExportSettingsType.SEARCH_HISTORY, historyEntries);
    }
    List<MapMarkersGroup> markersGroups = settingsTypes == null || settingsTypes.contains(ExportSettingsType.ITINERARY_GROUPS) ? app.getMapMarkersHelper().getVisibleMapMarkersGroups() : Collections.emptyList();
    if (!markersGroups.isEmpty() || addEmptyItems) {
        myPlacesItems.put(ExportSettingsType.ITINERARY_GROUPS, markersGroups);
    }
    return myPlacesItems;
}
Also used : AudioVideoNotesPlugin(net.osmand.plus.plugins.audionotes.AudioVideoNotesPlugin) MapMarker(net.osmand.plus.mapmarkers.MapMarker) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) GpxDataItem(net.osmand.plus.track.helpers.GPXDatabase.GpxDataItem) List(java.util.List) ArrayList(java.util.ArrayList) MapMarkersGroup(net.osmand.plus.mapmarkers.MapMarkersGroup) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType) FavoriteGroup(net.osmand.plus.myplaces.FavoriteGroup) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin) HistoryEntry(net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry) Recording(net.osmand.plus.plugins.audionotes.AudioVideoNotesPlugin.Recording) File(java.io.File)

Example 9 with FavoriteGroup

use of net.osmand.plus.myplaces.FavoriteGroup in project Osmand by osmandapp.

the class ExportItemsBottomSheet method setupBottomSheetItem.

private void setupBottomSheetItem(BottomSheetItemWithCompoundButton item, Object object) {
    if (object instanceof ApplicationModeBean) {
        ApplicationModeBean modeBean = (ApplicationModeBean) object;
        String profileName = modeBean.userProfileName;
        if (Algorithms.isEmpty(profileName)) {
            ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
            if (appMode != null) {
                profileName = appMode.toHumanString();
            } else {
                profileName = Algorithms.capitalizeFirstLetter(modeBean.stringKey);
            }
        }
        item.setTitle(profileName);
        String routingProfile = "";
        String routingProfileValue = modeBean.routingProfile;
        if (!routingProfileValue.isEmpty()) {
            try {
                routingProfile = getString(RoutingProfilesResources.valueOf(routingProfileValue.toUpperCase()).getStringRes());
                routingProfile = Algorithms.capitalizeFirstLetterAndLowercase(routingProfile);
            } catch (IllegalArgumentException e) {
                routingProfile = Algorithms.capitalizeFirstLetterAndLowercase(routingProfileValue);
                LOG.error("Error trying to get routing resource for " + routingProfileValue + "\n" + e);
            }
        }
        if (!Algorithms.isEmpty(routingProfile)) {
            item.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.nav_type_hint), routingProfile));
        } else {
            item.setDescription(getString(R.string.profile_type_osmand_string));
        }
        int profileIconRes = AndroidUtils.getDrawableId(app, modeBean.iconName);
        ProfileIconColors iconColor = modeBean.iconColor;
        Integer customIconColor = modeBean.customIconColor;
        int actualIconColor;
        if (selectedItems.contains(object)) {
            actualIconColor = customIconColor != null ? customIconColor : ContextCompat.getColor(app, iconColor.getColor(nightMode));
        } else {
            actualIconColor = ContextCompat.getColor(app, secondaryColorRes);
        }
        int iconRes = profileIconRes != 0 ? profileIconRes : R.drawable.ic_world_globe_dark;
        item.setIcon(uiUtilities.getPaintedIcon(iconRes, actualIconColor));
    } else if (object instanceof QuickAction) {
        QuickAction quickAction = (QuickAction) object;
        item.setTitle(quickAction.getName(app));
        item.setIcon(uiUtilities.getIcon(quickAction.getIconRes(), getItemIconColor(object)));
    } else if (object instanceof PoiUIFilter) {
        PoiUIFilter poiUIFilter = (PoiUIFilter) object;
        item.setTitle(poiUIFilter.getName());
        int iconRes = RenderingIcons.getBigIconResourceId(poiUIFilter.getIconId());
        item.setIcon(uiUtilities.getIcon(iconRes != 0 ? iconRes : R.drawable.ic_action_user, activeColorRes));
    } else if (object instanceof TileSourceTemplate || object instanceof SQLiteTileSource) {
        ITileSource tileSource = (ITileSource) object;
        item.setTitle(tileSource.getName());
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_map, getItemIconColor(object)));
    } else if (object instanceof File) {
        setupBottomSheetItemForFile(item, (File) object);
    } else if (object instanceof GpxSettingsItem) {
        GpxSettingsItem settingsItem = (GpxSettingsItem) object;
        setupBottomSheetItemForGpx(item, settingsItem.getFile(), settingsItem.getAppearanceInfo());
    } else if (object instanceof FileSettingsItem) {
        FileSettingsItem settingsItem = (FileSettingsItem) object;
        setupBottomSheetItemForFile(item, settingsItem.getFile());
    } else if (object instanceof AvoidRoadInfo) {
        AvoidRoadInfo avoidRoadInfo = (AvoidRoadInfo) object;
        item.setTitle(avoidRoadInfo.name);
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_alert, getItemIconColor(object)));
    } else if (object instanceof OsmNotesPoint) {
        OsmNotesPoint osmNotesPoint = (OsmNotesPoint) object;
        item.setTitle(osmNotesPoint.getText());
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_osm_note_add, getItemIconColor(object)));
    } else if (object instanceof OpenstreetmapPoint) {
        OpenstreetmapPoint openstreetmapPoint = (OpenstreetmapPoint) object;
        item.setTitle(OsmEditingPlugin.getTitle(openstreetmapPoint, app));
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_info_dark, getItemIconColor(object)));
    } else if (object instanceof FavoriteGroup) {
        FavoriteGroup group = (FavoriteGroup) object;
        item.setTitle(group.getDisplayName(app));
        int color;
        if (selectedItems.contains(object)) {
            color = group.getColor() == 0 ? ContextCompat.getColor(app, R.color.color_favorite) : group.getColor();
        } else {
            color = ContextCompat.getColor(app, secondaryColorRes);
        }
        item.setIcon(uiUtilities.getPaintedIcon(R.drawable.ic_action_folder, color));
        int points = group.getPoints().size();
        String itemsDescr = getString(R.string.shared_string_gpx_points);
        item.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, points));
    } else if (object instanceof GlobalSettingsItem) {
        GlobalSettingsItem globalSettingsItem = (GlobalSettingsItem) object;
        item.setTitle(globalSettingsItem.getPublicName(app));
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_settings, getItemIconColor(object)));
    } else if (object instanceof MapMarkersGroup) {
        MapMarkersGroup markersGroup = (MapMarkersGroup) object;
        if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
            item.setTitle(getString(R.string.map_markers));
            item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, getItemIconColor(object)));
        } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
            item.setTitle(getString(R.string.markers_history));
            item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_history, getItemIconColor(object)));
        } else {
            String groupName = markersGroup.getName();
            if (Algorithms.isEmpty(groupName)) {
                if (markersGroup.getType() == ItineraryType.FAVOURITES) {
                    groupName = app.getString(R.string.shared_string_favorites);
                } else if (markersGroup.getType() == ItineraryType.MARKERS) {
                    groupName = app.getString(R.string.map_markers);
                }
            }
            item.setTitle(groupName);
            item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, getItemIconColor(object)));
        }
        int selectedMarkers = markersGroup.getMarkers().size();
        String itemsDescr = getString(R.string.shared_string_items);
        item.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers));
    } else if (object instanceof HistoryEntry) {
        HistoryEntry historyEntry = (HistoryEntry) object;
        item.setTitle(historyEntry.getName().getName());
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_history, getItemIconColor(object)));
    } else if (object instanceof OnlineRoutingEngine) {
        OnlineRoutingEngine onlineRoutingEngine = (OnlineRoutingEngine) object;
        item.setTitle(onlineRoutingEngine.getName(app));
        item.setIcon(uiUtilities.getIcon(R.drawable.ic_world_globe_dark, getItemIconColor(object)));
    }
}
Also used : QuickAction(net.osmand.plus.quickaction.QuickAction) ProfileIconColors(net.osmand.plus.profiles.ProfileIconColors) TileSourceTemplate(net.osmand.map.TileSourceManager.TileSourceTemplate) ApplicationModeBean(net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean) FavoriteGroup(net.osmand.plus.myplaces.FavoriteGroup) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) GpxSettingsItem(net.osmand.plus.settings.backend.backup.items.GpxSettingsItem) AvoidRoadInfo(net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) PoiUIFilter(net.osmand.plus.poi.PoiUIFilter) SQLiteTileSource(net.osmand.plus.resources.SQLiteTileSource) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) OnlineRoutingEngine(net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine) GlobalSettingsItem(net.osmand.plus.settings.backend.backup.items.GlobalSettingsItem) FileSettingsItem(net.osmand.plus.settings.backend.backup.items.FileSettingsItem) ITileSource(net.osmand.map.ITileSource) HistoryEntry(net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry) MapMarkersGroup(net.osmand.plus.mapmarkers.MapMarkersGroup) File(java.io.File)

Example 10 with FavoriteGroup

use of net.osmand.plus.myplaces.FavoriteGroup in project Osmand by osmandapp.

the class FavouritesLayer method onPrepareBufferImage.

@Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
    cache.clear();
    if (this.settings.SHOW_FAVORITES.get() && favouritesHelper.isFavoritesLoaded()) {
        if (tileBox.getZoom() >= START_ZOOM) {
            float textScale = getTextScale();
            float iconSize = getIconSize(view.getApplication());
            QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);
            // request to load
            final QuadRect latLonBounds = tileBox.getLatLonBounds();
            List<LatLon> fullObjectsLatLon = new ArrayList<>();
            List<LatLon> smallObjectsLatLon = new ArrayList<>();
            for (FavoriteGroup group : favouritesHelper.getFavoriteGroups()) {
                List<Pair<FavouritePoint, MapMarker>> fullObjects = new ArrayList<>();
                boolean synced = isSynced(group);
                for (FavouritePoint favoritePoint : group.getPoints()) {
                    double lat = favoritePoint.getLatitude();
                    double lon = favoritePoint.getLongitude();
                    if (favoritePoint.isVisible() && favoritePoint != contextMenuLayer.getMoveableObject() && lat >= latLonBounds.bottom && lat <= latLonBounds.top && lon >= latLonBounds.left && lon <= latLonBounds.right) {
                        MapMarker marker = null;
                        if (synced) {
                            marker = mapMarkersHelper.getMapMarker(favoritePoint);
                            if (marker == null || marker.history && !view.getSettings().KEEP_PASSED_MARKERS_ON_MAP.get()) {
                                continue;
                            }
                        }
                        cache.add(favoritePoint);
                        float x = tileBox.getPixXFromLatLon(lat, lon);
                        float y = tileBox.getPixYFromLatLon(lat, lon);
                        if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
                            @ColorInt int color;
                            if (marker != null && marker.history) {
                                color = grayColor;
                            } else {
                                color = favouritesHelper.getColorWithCategory(favoritePoint, defaultColor);
                            }
                            PointImageDrawable pointImageDrawable = PointImageDrawable.getFromFavorite(view.getContext(), color, true, favoritePoint);
                            pointImageDrawable.drawSmallPoint(canvas, x, y, textScale);
                            smallObjectsLatLon.add(new LatLon(lat, lon));
                        } else {
                            fullObjects.add(new Pair<>(favoritePoint, marker));
                            fullObjectsLatLon.add(new LatLon(lat, lon));
                        }
                    }
                }
                for (Pair<FavouritePoint, MapMarker> pair : fullObjects) {
                    FavouritePoint favoritePoint = pair.first;
                    float x = tileBox.getPixXFromLatLon(favoritePoint.getLatitude(), favoritePoint.getLongitude());
                    float y = tileBox.getPixYFromLatLon(favoritePoint.getLatitude(), favoritePoint.getLongitude());
                    drawBigPoint(canvas, favoritePoint, x, y, pair.second, textScale);
                }
            }
            this.fullObjectsLatLon = fullObjectsLatLon;
            this.smallObjectsLatLon = smallObjectsLatLon;
        }
    }
    if (isTextVisible()) {
        textLayer.putData(this, cache);
    }
}
Also used : FavouritePoint(net.osmand.data.FavouritePoint) MapMarker(net.osmand.plus.mapmarkers.MapMarker) FavoriteGroup(net.osmand.plus.myplaces.FavoriteGroup) ArrayList(java.util.ArrayList) QuadRect(net.osmand.data.QuadRect) PointImageDrawable(net.osmand.plus.views.PointImageDrawable) FavouritePoint(net.osmand.data.FavouritePoint) LatLon(net.osmand.data.LatLon) ColorInt(androidx.annotation.ColorInt) Pair(android.util.Pair)

Aggregations

FavoriteGroup (net.osmand.plus.myplaces.FavoriteGroup)29 FavouritePoint (net.osmand.data.FavouritePoint)15 ArrayList (java.util.ArrayList)10 FavouritesHelper (net.osmand.plus.myplaces.FavouritesHelper)9 HistoryEntry (net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry)8 MapMarkersGroup (net.osmand.plus.mapmarkers.MapMarkersGroup)7 PoiUIFilter (net.osmand.plus.poi.PoiUIFilter)7 File (java.io.File)6 MapMarker (net.osmand.plus.mapmarkers.MapMarker)6 QuickAction (net.osmand.plus.quickaction.QuickAction)6 NonNull (androidx.annotation.NonNull)5 ITileSource (net.osmand.map.ITileSource)5 MapActivity (net.osmand.plus.activities.MapActivity)5 AvoidRoadInfo (net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo)5 OnlineRoutingEngine (net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine)5 OpenstreetmapPoint (net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint)5 OsmNotesPoint (net.osmand.plus.plugins.osmedit.data.OsmNotesPoint)5 Context (android.content.Context)4 View (android.view.View)4 List (java.util.List)4