Search in sources :

Example 6 with OpenstreetmapPoint

use of net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint 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 7 with OpenstreetmapPoint

use of net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint in project Osmand by osmandapp.

the class OsmEditingPlugin method registerMapContextMenuActions.

@Override
public void registerMapContextMenuActions(@NonNull final MapActivity mapActivity, final double latitude, final double longitude, ContextMenuAdapter adapter, final Object selectedObj, boolean configureMenu) {
    ContextMenuAdapter.ItemClickListener listener = (adptr, resId, pos, isChecked, viewCoordinates) -> {
        if (resId == R.string.context_menu_item_create_poi) {
            // getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
            EditPoiDialogFragment editPoiDialogFragment = EditPoiDialogFragment.createAddPoiInstance(latitude, longitude, mapActivity.getMyApplication());
            editPoiDialogFragment.show(mapActivity.getSupportFragmentManager(), EditPoiDialogFragment.TAG);
        } else if (resId == R.string.context_menu_item_open_note) {
            openOsmNote(mapActivity, latitude, longitude, "", false);
        } else if (resId == R.string.context_menu_item_modify_note) {
            modifyOsmNote(mapActivity, (OsmNotesPoint) selectedObj);
        } else if (resId == R.string.poi_context_menu_modify) {
            if (selectedObj instanceof TransportStop && ((TransportStop) selectedObj).getAmenity() != null) {
                EditPoiDialogFragment.showEditInstance(((TransportStop) selectedObj).getAmenity(), mapActivity);
            } else if (selectedObj instanceof MapObject) {
                EditPoiDialogFragment.showEditInstance((MapObject) selectedObj, mapActivity);
            }
        } else if (resId == R.string.poi_context_menu_modify_osm_change) {
            final Entity entity = ((OpenstreetmapPoint) selectedObj).getEntity();
            EditPoiDialogFragment.createInstance(entity, false).show(mapActivity.getSupportFragmentManager(), EditPoiDialogFragment.TAG);
        }
        return true;
    };
    boolean isEditable = false;
    if (selectedObj instanceof Amenity || (selectedObj instanceof TransportStop && ((TransportStop) selectedObj).getAmenity() != null)) {
        Amenity amenity;
        if (selectedObj instanceof Amenity) {
            amenity = (Amenity) selectedObj;
        } else {
            amenity = ((TransportStop) selectedObj).getAmenity();
        }
        final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
        isEditable = !amenity.getType().isWiki() && poiType != null && !poiType.isNotEditableOsm();
    } else if (selectedObj instanceof MapObject) {
        Long objectId = ((MapObject) selectedObj).getId();
        isEditable = objectId != null && objectId > 0 && (objectId % 2 == MapObject.AMENITY_ID_RIGHT_SHIFT || (objectId >> MapObject.NON_AMENITY_ID_RIGHT_SHIFT) < Integer.MAX_VALUE);
    }
    if (isEditable) {
        adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity).setId(MAP_CONTEXT_MENU_CREATE_POI).setIcon(R.drawable.ic_action_edit_dark).setOrder(MODIFY_POI_ITEM_ORDER).setListener(listener).createItem());
    } else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
        adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify_osm_change, mapActivity).setId(MAP_CONTEXT_MENU_CREATE_POI).setIcon(R.drawable.ic_action_edit_dark).setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER).setListener(listener).createItem());
    } else {
        adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_create_poi, mapActivity).setId(MAP_CONTEXT_MENU_CREATE_POI).setIcon(R.drawable.ic_action_plus_dark).setOrder(CREATE_POI_ITEM_ORDER).setListener(listener).createItem());
    }
    if (selectedObj instanceof OsmNotesPoint) {
        adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_modify_note, mapActivity).setId(MAP_CONTEXT_MENU_OPEN_OSM_NOTE).setIcon(R.drawable.ic_action_edit_dark).setOrder(MODIFY_OSM_NOTE_ITEM_ORDER).setListener(listener).createItem());
    } else {
        adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_open_note, mapActivity).setId(MAP_CONTEXT_MENU_OPEN_OSM_NOTE).setIcon(R.drawable.ic_action_osm_note_add).setOrder(OPEN_OSM_NOTE_ITEM_ORDER).setListener(listener).createItem());
    }
}
Also used : OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) SendGpxBottomSheetFragment(net.osmand.plus.plugins.osmedit.dialogs.SendGpxBottomSheetFragment) NonNull(androidx.annotation.NonNull) R(net.osmand.plus.R) AddOSMBugAction(net.osmand.plus.plugins.osmedit.quickactions.AddOSMBugAction) INVALID_ID(net.osmand.plus.ContextMenuItem.INVALID_ID) OsmBugsDbHelper(net.osmand.plus.plugins.osmedit.helpers.OsmBugsDbHelper) Drawable(android.graphics.drawable.Drawable) ContextMenuAdapter.makeDeleteAction(net.osmand.plus.ContextMenuAdapter.makeDeleteAction) Fragment(androidx.fragment.app.Fragment) View(android.view.View) Amenity(net.osmand.data.Amenity) LoginBottomSheetFragment(net.osmand.plus.measurementtool.LoginBottomSheetFragment) DashFragmentData(net.osmand.plus.dashboard.tools.DashFragmentData) OsmBugsRemoteUtil(net.osmand.plus.plugins.osmedit.helpers.OsmBugsRemoteUtil) OsmandApplication(net.osmand.plus.OsmandApplication) OsmandPlugin(net.osmand.plus.plugins.OsmandPlugin) StringRes(androidx.annotation.StringRes) List(java.util.List) Nullable(androidx.annotation.Nullable) DashboardType(net.osmand.plus.dashboard.DashboardOnMap.DashboardType) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) OsmBugsLocalUtil(net.osmand.plus.plugins.osmedit.helpers.OsmBugsLocalUtil) MAP_CONTEXT_MENU_CREATE_POI(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CREATE_POI) TabActivity(net.osmand.plus.activities.TabActivity) Typeface(android.graphics.Typeface) Context(android.content.Context) OSM_NOTES(net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_NOTES) MapObject(net.osmand.data.MapObject) GpxInfo(net.osmand.plus.myplaces.ui.AvailableGPXFragment.GpxInfo) MAP_CONTEXT_MENU_OPEN_OSM_NOTE(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE) PLUGIN_OSMAND_EDITING(net.osmand.aidlapi.OsmAndCustomizationConstants.PLUGIN_OSMAND_EDITING) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) CommonPreference(net.osmand.plus.settings.backend.preferences.CommonPreference) AddPOIAction(net.osmand.plus.plugins.osmedit.quickactions.AddPOIAction) Intent(android.content.Intent) OsmandPreference(net.osmand.plus.settings.backend.preferences.OsmandPreference) FragmentActivity(androidx.fragment.app.FragmentActivity) ArrayList(java.util.ArrayList) RenderingRuleProperty(net.osmand.render.RenderingRuleProperty) PoiType(net.osmand.osm.PoiType) OsmEditsFragment(net.osmand.plus.plugins.osmedit.fragments.OsmEditsFragment) OpenstreetmapLocalUtil(net.osmand.plus.plugins.osmedit.helpers.OpenstreetmapLocalUtil) SettingsScreenType(net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType) OSM_EDITS(net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_EDITS) AvailableGPXFragment(net.osmand.plus.myplaces.ui.AvailableGPXFragment) DashOsmEditsFragment(net.osmand.plus.plugins.osmedit.fragments.DashOsmEditsFragment) PlatformUtil(net.osmand.PlatformUtil) Algorithms(net.osmand.util.Algorithms) AndroidUtils(net.osmand.plus.utils.AndroidUtils) Entity(net.osmand.osm.edit.Entity) Iterator(java.util.Iterator) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder) SpannableString(android.text.SpannableString) EditPoiDialogFragment(net.osmand.plus.plugins.osmedit.dialogs.EditPoiDialogFragment) StyleSpan(android.text.style.StyleSpan) TextUtils(android.text.TextUtils) POI_TYPE_TAG(net.osmand.osm.edit.Entity.POI_TYPE_TAG) TransportStop(net.osmand.data.TransportStop) ArrayAdapter(android.widget.ArrayAdapter) OpenstreetmapsDbHelper(net.osmand.plus.plugins.osmedit.helpers.OpenstreetmapsDbHelper) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) ShowHideOSMBugAction(net.osmand.plus.plugins.osmedit.quickactions.ShowHideOSMBugAction) Action(net.osmand.plus.plugins.osmedit.data.OsmPoint.Action) OPEN_STREET_MAP(net.osmand.aidlapi.OsmAndCustomizationConstants.OPEN_STREET_MAP) ContextMenuItem(net.osmand.plus.ContextMenuItem) FavoritesActivity(net.osmand.plus.myplaces.ui.FavoritesActivity) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) ConfigureMapMenu(net.osmand.plus.dialogs.ConfigureMapMenu) Log(org.apache.commons.logging.Log) OpenstreetmapRemoteUtil(net.osmand.plus.plugins.osmedit.helpers.OpenstreetmapRemoteUtil) QuickActionType(net.osmand.plus.quickaction.QuickActionType) MapActivity(net.osmand.plus.activities.MapActivity) Entity(net.osmand.osm.edit.Entity) Amenity(net.osmand.data.Amenity) ContextMenuItem(net.osmand.plus.ContextMenuItem) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) PoiType(net.osmand.osm.PoiType) EditPoiDialogFragment(net.osmand.plus.plugins.osmedit.dialogs.EditPoiDialogFragment) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder) TransportStop(net.osmand.data.TransportStop) MapObject(net.osmand.data.MapObject) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder)

Example 8 with OpenstreetmapPoint

use of net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint in project Osmand by osmandapp.

the class OsmEditsLayer method getIconId.

public int getIconId(OsmPoint osmPoint) {
    if (osmPoint.getGroup() == OsmPoint.Group.POI) {
        OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint;
        int iconResId = 0;
        String poiTranslation = osmP.getEntity().getTag(Entity.POI_TYPE_TAG);
        if (poiTranslation != null && ctx != null) {
            Map<String, PoiType> poiTypeMap = app.getPoiTypes().getAllTranslatedNames(false);
            PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase());
            if (poiType != null) {
                String id = null;
                if (RenderingIcons.containsBigIcon(poiType.getIconKeyName())) {
                    id = poiType.getIconKeyName();
                } else if (RenderingIcons.containsBigIcon(poiType.getOsmTag() + "_" + poiType.getOsmValue())) {
                    id = poiType.getOsmTag() + "_" + poiType.getOsmValue();
                }
                if (id != null) {
                    iconResId = RenderingIcons.getBigIconResourceId(id);
                }
            }
        }
        if (iconResId == 0) {
            iconResId = R.drawable.ic_action_info_dark;
        }
        return iconResId;
    } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
        return R.drawable.mm_special_symbol_plus;
    } else {
        return 0;
    }
}
Also used : OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) PoiType(net.osmand.osm.PoiType) OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint)

Example 9 with OpenstreetmapPoint

use of net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint in project Osmand by osmandapp.

the class OsmEditsLayer method applyNewObjectPosition.

@Override
public void applyNewObjectPosition(@NonNull Object o, @NonNull LatLon position, @Nullable ApplyMovedObjectCallback callback) {
    if (o instanceof OsmPoint) {
        if (o instanceof OpenstreetmapPoint) {
            OpenstreetmapPoint objectInMotion = (OpenstreetmapPoint) o;
            Entity entity = objectInMotion.getEntity();
            entity.setLatitude(position.getLatitude());
            entity.setLongitude(position.getLongitude());
            new SaveOsmChangeAsyncTask(mOsmChangeUtil, objectInMotion, callback).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        } else if (o instanceof OsmNotesPoint) {
            OsmNotesPoint objectInMotion = (OsmNotesPoint) o;
            objectInMotion.setLatitude(position.getLatitude());
            objectInMotion.setLongitude(position.getLongitude());
            new SaveOsmNoteAsyncTask(objectInMotion.getText(), ctx, callback, plugin, mOsmBugsUtil).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, objectInMotion);
        }
    }
}
Also used : SaveOsmNoteAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.SaveOsmNoteAsyncTask) Entity(net.osmand.osm.edit.Entity) OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) SaveOsmChangeAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.SaveOsmChangeAsyncTask)

Example 10 with OpenstreetmapPoint

use of net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint in project Osmand by osmandapp.

the class OsmEditsFragment method createOsmEditOptionsFragmentListener.

private OsmEditOptionsFragmentListener createOsmEditOptionsFragmentListener() {
    return new OsmEditOptionsFragmentListener() {

        @Override
        public void onUploadClick(OsmPoint osmPoint) {
            uploadItems(new OsmPoint[] { getPointAfterModify(osmPoint) });
        }

        @Override
        public void onShowOnMapClick(OsmPoint osmPoint) {
            OsmandSettings settings = getMyApplication().getSettings();
            settings.setMapLocationToShow(osmPoint.getLatitude(), osmPoint.getLongitude(), settings.getLastKnownMapZoom());
            MapActivity.launchMapActivityMoveToTop(getActivity());
        }

        @Override
        public void onModifyOsmChangeClick(OsmPoint osmPoint) {
            OpenstreetmapPoint i = (OpenstreetmapPoint) getPointAfterModify(osmPoint);
            final Entity entity = i.getEntity();
            refreshId = entity.getId();
            EditPoiDialogFragment.createInstance(entity, false).show(getActivity().getSupportFragmentManager(), "edit_poi");
        }

        @Override
        public void onModifyOsmNoteClick(OsmPoint osmPoint) {
            showBugDialog((OsmNotesPoint) osmPoint);
        }

        @Override
        public void onDeleteClick(OsmPoint osmPoint) {
            ArrayList<OsmPoint> points = new ArrayList<>();
            points.add(osmPoint);
            deleteItems(new ArrayList<>(points));
        }
    };
}
Also used : Entity(net.osmand.osm.edit.Entity) OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) OsmEditOptionsFragmentListener(net.osmand.plus.plugins.osmedit.dialogs.OsmEditOptionsBottomSheetDialogFragment.OsmEditOptionsFragmentListener) ArrayList(java.util.ArrayList) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings)

Aggregations

OpenstreetmapPoint (net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint)30 OsmPoint (net.osmand.plus.plugins.osmedit.data.OsmPoint)18 OsmNotesPoint (net.osmand.plus.plugins.osmedit.data.OsmNotesPoint)17 Entity (net.osmand.osm.edit.Entity)10 ArrayList (java.util.ArrayList)8 PoiType (net.osmand.osm.PoiType)8 File (java.io.File)5 Node (net.osmand.osm.edit.Node)5 HistoryEntry (net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry)5 MapMarkersGroup (net.osmand.plus.mapmarkers.MapMarkersGroup)5 FavoriteGroup (net.osmand.plus.myplaces.FavoriteGroup)5 OsmEditingPlugin (net.osmand.plus.plugins.osmedit.OsmEditingPlugin)5 QuickAction (net.osmand.plus.quickaction.QuickAction)5 List (java.util.List)4 ITileSource (net.osmand.map.ITileSource)4 MapActivity (net.osmand.plus.activities.MapActivity)4 AvoidRoadInfo (net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo)4 OnlineRoutingEngine (net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine)4 PoiUIFilter (net.osmand.plus.poi.PoiUIFilter)4 View (android.view.View)3