use of net.osmand.plus.plugins.osmedit.data.OsmNotesPoint in project Osmand by osmandapp.
the class ImportDuplicatesFragment method prepareDuplicates.
protected List<Object> prepareDuplicates(List<? super Object> duplicatesList) {
List<? super Object> duplicates = new ArrayList<>();
List<ApplicationMode.ApplicationModeBean> profiles = new ArrayList<>();
List<QuickAction> actions = new ArrayList<>();
List<PoiUIFilter> filters = new ArrayList<>();
List<ITileSource> tileSources = new ArrayList<>();
List<File> renderFilesList = new ArrayList<>();
List<File> routingFilesList = new ArrayList<>();
List<File> multimediaFilesList = new ArrayList<>();
List<File> trackFilesList = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
List<OsmNotesPoint> osmNotesPointList = new ArrayList<>();
List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>();
List<File> ttsVoiceFilesList = new ArrayList<>();
List<File> voiceFilesList = new ArrayList<>();
List<File> mapFilesList = new ArrayList<>();
List<MapMarker> mapMarkers = new ArrayList<>();
List<MapMarker> mapMarkersHistory = new ArrayList<>();
List<HistoryEntry> historyEntries = new ArrayList<>();
List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>();
List<MapMarkersGroup> itineraryGroups = new ArrayList<>();
for (Object object : duplicatesList) {
if (object instanceof ApplicationMode.ApplicationModeBean) {
profiles.add((ApplicationMode.ApplicationModeBean) object);
} else if (object instanceof QuickAction) {
actions.add((QuickAction) object);
} else if (object instanceof PoiUIFilter) {
filters.add((PoiUIFilter) object);
} else if (object instanceof ITileSource) {
tileSources.add((ITileSource) object);
} else if (object instanceof File) {
File file = (File) object;
FileSubtype fileSubtype = FileSubtype.getSubtypeByPath(app, file.getPath());
if (fileSubtype == FileSubtype.RENDERING_STYLE) {
renderFilesList.add(file);
} else if (fileSubtype == FileSubtype.ROUTING_CONFIG) {
routingFilesList.add(file);
} else if (fileSubtype == FileSubtype.MULTIMEDIA_NOTES) {
multimediaFilesList.add(file);
} else if (fileSubtype == FileSubtype.GPX) {
trackFilesList.add(file);
} else if (fileSubtype.isMap()) {
mapFilesList.add(file);
} else if (fileSubtype == FileSubtype.TTS_VOICE) {
ttsVoiceFilesList.add(file);
} else if (fileSubtype == FileSubtype.VOICE) {
voiceFilesList.add(file);
}
} else if (object instanceof AvoidRoadInfo) {
avoidRoads.add((AvoidRoadInfo) object);
} else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object);
} else if (object instanceof OsmNotesPoint) {
osmNotesPointList.add((OsmNotesPoint) object);
} else if (object instanceof OpenstreetmapPoint) {
osmEditsPointList.add((OpenstreetmapPoint) object);
} else if (object instanceof MapMarker) {
MapMarker mapMarker = (MapMarker) object;
if (mapMarker.history) {
mapMarkersHistory.add(mapMarker);
} else {
mapMarkers.add(mapMarker);
}
} else if (object instanceof HistoryEntry) {
historyEntries.add((HistoryEntry) object);
} else if (object instanceof OnlineRoutingEngine) {
onlineRoutingEngines.add((OnlineRoutingEngine) object);
} else if (object instanceof MapMarkersGroup) {
itineraryGroups.add((MapMarkersGroup) object);
}
}
if (!profiles.isEmpty()) {
duplicates.add(getString(R.string.shared_string_profiles));
duplicates.addAll(profiles);
}
if (!actions.isEmpty()) {
duplicates.add(getString(R.string.shared_string_quick_actions));
duplicates.addAll(actions);
}
if (!filters.isEmpty()) {
duplicates.add(getString(R.string.shared_string_poi_types));
duplicates.addAll(filters);
}
if (!tileSources.isEmpty()) {
duplicates.add(getString(R.string.quick_action_map_source_title));
duplicates.addAll(tileSources);
}
if (!routingFilesList.isEmpty()) {
duplicates.add(getString(R.string.shared_string_routing));
duplicates.addAll(routingFilesList);
}
if (!renderFilesList.isEmpty()) {
duplicates.add(getString(R.string.shared_string_rendering_style));
duplicates.addAll(renderFilesList);
}
if (!multimediaFilesList.isEmpty()) {
duplicates.add(getString(R.string.audionotes_plugin_name));
duplicates.addAll(multimediaFilesList);
}
if (!trackFilesList.isEmpty()) {
duplicates.add(getString(R.string.shared_string_tracks));
duplicates.addAll(trackFilesList);
}
if (!avoidRoads.isEmpty()) {
duplicates.add(getString(R.string.avoid_road));
duplicates.addAll(avoidRoads);
}
if (!favoriteGroups.isEmpty()) {
duplicates.add(getString(R.string.shared_string_favorites));
duplicates.addAll(favoriteGroups);
}
if (!osmNotesPointList.isEmpty()) {
duplicates.add(getString(R.string.osm_notes));
duplicates.addAll(osmNotesPointList);
}
if (!osmEditsPointList.isEmpty()) {
duplicates.add(getString(R.string.osm_edits));
duplicates.addAll(osmEditsPointList);
}
if (!mapFilesList.isEmpty()) {
duplicates.add(getString(R.string.shared_string_maps));
duplicates.addAll(mapFilesList);
}
if (!ttsVoiceFilesList.isEmpty()) {
duplicates.add(getString(R.string.local_indexes_cat_tts));
duplicates.addAll(ttsVoiceFilesList);
}
if (!voiceFilesList.isEmpty()) {
duplicates.add(getString(R.string.local_indexes_cat_voice));
duplicates.addAll(voiceFilesList);
}
if (!mapMarkers.isEmpty()) {
duplicates.add(getString(R.string.map_markers));
duplicates.addAll(mapMarkers);
}
if (!mapMarkersHistory.isEmpty()) {
duplicates.add(getString(R.string.markers_history));
duplicates.addAll(mapMarkersHistory);
}
if (!onlineRoutingEngines.isEmpty()) {
duplicates.add(getString(R.string.online_routing_engines));
duplicates.addAll(onlineRoutingEngines);
}
if (!historyEntries.isEmpty()) {
duplicates.add(getString(R.string.shared_string_search_history));
duplicates.addAll(historyEntries);
}
if (!itineraryGroups.isEmpty()) {
duplicates.add(getString(R.string.shared_string_itinerary));
duplicates.addAll(itineraryGroups);
}
return duplicates;
}
use of net.osmand.plus.plugins.osmedit.data.OsmNotesPoint in project Osmand by osmandapp.
the class EditPOIMenuBuilder method buildInternal.
@Override
public void buildInternal(View view) {
if (osmPoint instanceof OsmNotesPoint) {
OsmNotesPoint notes = (OsmNotesPoint) osmPoint;
buildRow(view, R.drawable.ic_action_note_dark, null, notes.getText(), 0, false, null, false, 0, false, null, false);
buildRow(view, R.drawable.ic_group, null, notes.getAuthor(), 0, false, null, false, 0, false, null, false);
} else if (osmPoint instanceof OpenstreetmapPoint) {
OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint;
for (Map.Entry<String, String> e : point.getEntity().getTags().entrySet()) {
if (POI_TYPE_TAG.equals(e.getKey())) {
String poiTranslation = e.getValue();
Map<String, PoiType> poiTypeMap = app.getPoiTypes().getAllTranslatedNames(false);
PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase());
int resId = 0;
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) {
resId = RenderingIcons.getBigIconResourceId(id);
}
}
if (resId == 0) {
resId = R.drawable.ic_action_folder_stroke;
}
buildRow(view, resId, null, poiTranslation, 0, false, null, false, 0, false, null, false);
break;
}
}
for (Map.Entry<String, String> e : point.getEntity().getTags().entrySet()) {
if (POI_TYPE_TAG.equals(e.getKey()) || e.getKey().startsWith(Entity.REMOVE_TAG_PREFIX)) {
continue;
}
String text = e.getKey() + "=" + e.getValue();
buildRow(view, R.drawable.ic_action_info_dark, null, text, 0, false, null, false, 0, false, null, false);
}
}
}
use of net.osmand.plus.plugins.osmedit.data.OsmNotesPoint in project Osmand by osmandapp.
the class SettingsHelper method prepareSettingsItems.
public List<SettingsItem> prepareSettingsItems(List<?> data, List<SettingsItem> settingsItems, boolean export) {
List<SettingsItem> result = new ArrayList<>();
List<QuickAction> quickActions = new ArrayList<>();
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
List<ITileSource> tileSourceTemplates = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<ApplicationModeBean> appModeBeans = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
List<OsmNotesPoint> osmNotesPointList = new ArrayList<>();
List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>();
List<MapMarkersGroup> markersGroups = new ArrayList<>();
List<MapMarkersGroup> markersHistoryGroups = new ArrayList<>();
List<HistoryEntry> historyEntries = new ArrayList<>();
List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>();
List<MapMarkersGroup> itineraryGroups = new ArrayList<>();
for (Object object : data) {
if (object instanceof QuickAction) {
quickActions.add((QuickAction) object);
} else if (object instanceof PoiUIFilter) {
poiUIFilters.add((PoiUIFilter) object);
} else if (object instanceof TileSourceTemplate || object instanceof SQLiteTileSource) {
tileSourceTemplates.add((ITileSource) object);
} else if (object instanceof File) {
try {
File file = (File) object;
if (file.getName().endsWith(IndexConstants.GPX_FILE_EXT)) {
result.add(new GpxSettingsItem(app, file));
} else {
result.add(new FileSettingsItem(app, file));
}
} catch (IllegalArgumentException e) {
LOG.warn("Trying to export unsuported file type", e);
}
} else if (object instanceof FileSettingsItem) {
result.add((FileSettingsItem) object);
} else if (object instanceof AvoidRoadInfo) {
avoidRoads.add((AvoidRoadInfo) object);
} else if (object instanceof ApplicationModeBean) {
appModeBeans.add((ApplicationModeBean) object);
} else if (object instanceof OsmNotesPoint) {
osmNotesPointList.add((OsmNotesPoint) object);
} else if (object instanceof OpenstreetmapPoint) {
osmEditsPointList.add((OpenstreetmapPoint) object);
} else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object);
} else if (object instanceof MapMarkersGroup) {
MapMarkersGroup markersGroup = (MapMarkersGroup) object;
if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
markersGroups.add((MapMarkersGroup) object);
} else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
markersHistoryGroups.add((MapMarkersGroup) object);
} else {
itineraryGroups.add((MapMarkersGroup) object);
}
} else if (object instanceof HistoryEntry) {
historyEntries.add((HistoryEntry) object);
} else if (object instanceof GlobalSettingsItem) {
result.add((GlobalSettingsItem) object);
} else if (object instanceof OnlineRoutingEngine) {
onlineRoutingEngines.add((OnlineRoutingEngine) object);
}
}
if (!quickActions.isEmpty()) {
QuickActionsSettingsItem baseItem = getBaseItem(SettingsItemType.QUICK_ACTIONS, QuickActionsSettingsItem.class, settingsItems);
result.add(new QuickActionsSettingsItem(app, baseItem, quickActions));
}
if (!poiUIFilters.isEmpty()) {
PoiUiFiltersSettingsItem baseItem = getBaseItem(SettingsItemType.POI_UI_FILTERS, PoiUiFiltersSettingsItem.class, settingsItems);
result.add(new PoiUiFiltersSettingsItem(app, baseItem, poiUIFilters));
}
if (!tileSourceTemplates.isEmpty()) {
MapSourcesSettingsItem baseItem = getBaseItem(SettingsItemType.MAP_SOURCES, MapSourcesSettingsItem.class, settingsItems);
result.add(new MapSourcesSettingsItem(app, baseItem, tileSourceTemplates));
}
if (!avoidRoads.isEmpty()) {
AvoidRoadsSettingsItem baseItem = getBaseItem(SettingsItemType.AVOID_ROADS, AvoidRoadsSettingsItem.class, settingsItems);
result.add(new AvoidRoadsSettingsItem(app, baseItem, avoidRoads));
}
if (!appModeBeans.isEmpty()) {
for (ApplicationModeBean modeBean : appModeBeans) {
if (export) {
ApplicationMode mode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
if (mode != null) {
result.add(new ProfileSettingsItem(app, mode));
}
} else {
result.add(new ProfileSettingsItem(app, getBaseProfileSettingsItem(modeBean, settingsItems), modeBean));
}
}
}
if (!osmNotesPointList.isEmpty()) {
OsmNotesSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_NOTES, OsmNotesSettingsItem.class, settingsItems);
result.add(new OsmNotesSettingsItem(app, baseItem, osmNotesPointList));
}
if (!osmEditsPointList.isEmpty()) {
OsmEditsSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_EDITS, OsmEditsSettingsItem.class, settingsItems);
result.add(new OsmEditsSettingsItem(app, baseItem, osmEditsPointList));
}
if (!favoriteGroups.isEmpty()) {
FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class, settingsItems);
result.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups));
}
if (!markersGroups.isEmpty()) {
List<MapMarker> mapMarkers = new ArrayList<>();
for (MapMarkersGroup group : markersGroups) {
mapMarkers.addAll(group.getMarkers());
}
MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class, settingsItems);
result.add(new MarkersSettingsItem(app, baseItem, mapMarkers));
}
if (!markersHistoryGroups.isEmpty()) {
List<MapMarker> mapMarkers = new ArrayList<>();
for (MapMarkersGroup group : markersHistoryGroups) {
mapMarkers.addAll(group.getMarkers());
}
HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class, settingsItems);
result.add(new HistoryMarkersSettingsItem(app, baseItem, mapMarkers));
}
if (!historyEntries.isEmpty()) {
SearchHistorySettingsItem baseItem = getBaseItem(SettingsItemType.SEARCH_HISTORY, SearchHistorySettingsItem.class, settingsItems);
result.add(new SearchHistorySettingsItem(app, baseItem, historyEntries));
}
if (!onlineRoutingEngines.isEmpty()) {
OnlineRoutingSettingsItem baseItem = getBaseItem(SettingsItemType.ONLINE_ROUTING_ENGINES, OnlineRoutingSettingsItem.class, settingsItems);
result.add(new OnlineRoutingSettingsItem(app, baseItem, onlineRoutingEngines));
}
if (!itineraryGroups.isEmpty()) {
ItinerarySettingsItem baseItem = getBaseItem(SettingsItemType.ITINERARY_GROUPS, ItinerarySettingsItem.class, settingsItems);
result.add(new ItinerarySettingsItem(app, baseItem, itineraryGroups));
}
return result;
}
use of net.osmand.plus.plugins.osmedit.data.OsmNotesPoint in project Osmand by osmandapp.
the class SettingsHelper method getSettingsToOperate.
public static Map<ExportSettingsType, List<?>> getSettingsToOperate(List<SettingsItem> settingsItems, boolean importComplete, boolean addEmptyItems) {
Map<ExportSettingsType, List<?>> settingsToOperate = new EnumMap<>(ExportSettingsType.class);
List<ApplicationModeBean> profiles = new ArrayList<>();
List<QuickAction> quickActions = new ArrayList<>();
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
List<ITileSource> tileSourceTemplates = new ArrayList<>();
List<File> routingFilesList = new ArrayList<>();
List<File> renderFilesList = new ArrayList<>();
List<File> ttsVoiceFilesList = new ArrayList<>();
List<File> voiceFilesList = new ArrayList<>();
List<FileSettingsItem> mapFilesList = new ArrayList<>();
List<FileSettingsItem> tracksFilesList = new ArrayList<>();
List<FileSettingsItem> multimediaFilesList = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<GlobalSettingsItem> globalSettingsItems = new ArrayList<>();
List<OsmNotesPoint> notesPointList = new ArrayList<>();
List<OpenstreetmapPoint> editsPointList = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
List<MapMarkersGroup> markersGroups = new ArrayList<>();
List<HistoryEntry> historyEntries = new ArrayList<>();
List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>();
List<MapMarkersGroup> itineraryGroups = new ArrayList<>();
for (SettingsItem item : settingsItems) {
switch(item.getType()) {
case PROFILE:
profiles.add(((ProfileSettingsItem) item).getModeBean());
break;
case FILE:
FileSettingsItem fileItem = (FileSettingsItem) item;
if (fileItem.getSubtype() == FileSubtype.RENDERING_STYLE) {
renderFilesList.add(fileItem.getFile());
} else if (fileItem.getSubtype() == FileSubtype.ROUTING_CONFIG) {
routingFilesList.add(fileItem.getFile());
} else if (fileItem.getSubtype() == FileSubtype.MULTIMEDIA_NOTES) {
multimediaFilesList.add(fileItem);
} else if (fileItem.getSubtype() == FileSubtype.GPX) {
tracksFilesList.add(fileItem);
} else if (fileItem.getSubtype().isMap()) {
mapFilesList.add(fileItem);
} else if (fileItem.getSubtype() == FileSubtype.TTS_VOICE) {
ttsVoiceFilesList.add(fileItem.getFile());
} else if (fileItem.getSubtype() == FileSubtype.VOICE) {
voiceFilesList.add(fileItem.getFile());
}
break;
case QUICK_ACTIONS:
QuickActionsSettingsItem quickActionsItem = (QuickActionsSettingsItem) item;
if (importComplete) {
quickActions.addAll(quickActionsItem.getAppliedItems());
} else {
quickActions.addAll(quickActionsItem.getItems());
}
break;
case POI_UI_FILTERS:
PoiUiFiltersSettingsItem poiUiFilterItem = (PoiUiFiltersSettingsItem) item;
if (importComplete) {
poiUIFilters.addAll(poiUiFilterItem.getAppliedItems());
} else {
poiUIFilters.addAll(poiUiFilterItem.getItems());
}
break;
case MAP_SOURCES:
MapSourcesSettingsItem mapSourcesItem = (MapSourcesSettingsItem) item;
if (importComplete) {
tileSourceTemplates.addAll(mapSourcesItem.getAppliedItems());
} else {
tileSourceTemplates.addAll(mapSourcesItem.getItems());
}
break;
case AVOID_ROADS:
AvoidRoadsSettingsItem avoidRoadsItem = (AvoidRoadsSettingsItem) item;
if (importComplete) {
avoidRoads.addAll(avoidRoadsItem.getAppliedItems());
} else {
avoidRoads.addAll(avoidRoadsItem.getItems());
}
break;
case GLOBAL:
globalSettingsItems.add((GlobalSettingsItem) item);
break;
case OSM_NOTES:
OsmNotesSettingsItem osmNotesSettingsItem = (OsmNotesSettingsItem) item;
if (importComplete) {
notesPointList.addAll(osmNotesSettingsItem.getAppliedItems());
} else {
notesPointList.addAll(osmNotesSettingsItem.getItems());
}
break;
case OSM_EDITS:
OsmEditsSettingsItem osmEditsSettingsItem = (OsmEditsSettingsItem) item;
if (importComplete) {
editsPointList.addAll(osmEditsSettingsItem.getAppliedItems());
} else {
editsPointList.addAll(osmEditsSettingsItem.getItems());
}
break;
case FAVOURITES:
FavoritesSettingsItem favoritesSettingsItem = (FavoritesSettingsItem) item;
favoriteGroups.addAll(favoritesSettingsItem.getItems());
break;
case ACTIVE_MARKERS:
MarkersSettingsItem markersSettingsItem = (MarkersSettingsItem) item;
markersGroups.add(markersSettingsItem.getMarkersGroup());
break;
case HISTORY_MARKERS:
HistoryMarkersSettingsItem historyMarkersSettingsItem = (HistoryMarkersSettingsItem) item;
markersGroups.add(historyMarkersSettingsItem.getMarkersGroup());
break;
case SEARCH_HISTORY:
SearchHistorySettingsItem searchHistorySettingsItem = (SearchHistorySettingsItem) item;
historyEntries.addAll(searchHistorySettingsItem.getItems());
break;
case GPX:
tracksFilesList.add((GpxSettingsItem) item);
break;
case ONLINE_ROUTING_ENGINES:
OnlineRoutingSettingsItem onlineRoutingSettingsItem = (OnlineRoutingSettingsItem) item;
onlineRoutingEngines.addAll(onlineRoutingSettingsItem.getItems());
break;
case ITINERARY_GROUPS:
ItinerarySettingsItem itinerarySettingsItem = (ItinerarySettingsItem) item;
itineraryGroups.addAll(itinerarySettingsItem.getItems());
break;
default:
break;
}
}
for (SettingsItem item : settingsItems) {
switch(item.getType()) {
case PROFILE:
if (!profiles.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.PROFILE, profiles);
}
break;
case FILE:
FileSettingsItem fileItem = (FileSettingsItem) item;
if (fileItem.getSubtype() == FileSubtype.RENDERING_STYLE) {
if (!renderFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.CUSTOM_RENDER_STYLE, renderFilesList);
}
} else if (fileItem.getSubtype() == FileSubtype.ROUTING_CONFIG) {
if (!routingFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.CUSTOM_ROUTING, routingFilesList);
}
} else if (fileItem.getSubtype() == FileSubtype.MULTIMEDIA_NOTES) {
if (!multimediaFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.MULTIMEDIA_NOTES, multimediaFilesList);
}
} else if (fileItem.getSubtype() == FileSubtype.GPX) {
if (!tracksFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.TRACKS, tracksFilesList);
}
} else if (fileItem.getSubtype().isMap()) {
if (!mapFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.OFFLINE_MAPS, mapFilesList);
}
} else if (fileItem.getSubtype() == FileSubtype.TTS_VOICE) {
if (!ttsVoiceFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.TTS_VOICE, ttsVoiceFilesList);
}
} else if (fileItem.getSubtype() == FileSubtype.VOICE) {
if (!voiceFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.VOICE, voiceFilesList);
}
}
break;
case QUICK_ACTIONS:
if (!quickActions.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.QUICK_ACTIONS, quickActions);
}
break;
case POI_UI_FILTERS:
if (!poiUIFilters.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.POI_TYPES, poiUIFilters);
}
break;
case MAP_SOURCES:
if (!tileSourceTemplates.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.MAP_SOURCES, tileSourceTemplates);
}
break;
case AVOID_ROADS:
if (!avoidRoads.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.AVOID_ROADS, avoidRoads);
}
break;
case GLOBAL:
if (!globalSettingsItems.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.GLOBAL, globalSettingsItems);
}
break;
case OSM_NOTES:
if (!notesPointList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.OSM_NOTES, notesPointList);
}
break;
case OSM_EDITS:
if (!editsPointList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.OSM_EDITS, editsPointList);
}
break;
case FAVOURITES:
if (!favoriteGroups.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.FAVORITES, favoriteGroups);
}
break;
case ACTIVE_MARKERS:
case HISTORY_MARKERS:
if (!markersGroups.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.ACTIVE_MARKERS, markersGroups);
}
break;
case SEARCH_HISTORY:
if (!historyEntries.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.SEARCH_HISTORY, historyEntries);
}
break;
case GPX:
if (!tracksFilesList.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.TRACKS, tracksFilesList);
}
break;
case ONLINE_ROUTING_ENGINES:
if (!onlineRoutingEngines.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.ONLINE_ROUTING_ENGINES, onlineRoutingEngines);
}
break;
case ITINERARY_GROUPS:
if (!itineraryGroups.isEmpty() || addEmptyItems) {
settingsToOperate.put(ExportSettingsType.ITINERARY_GROUPS, itineraryGroups);
}
break;
default:
break;
}
}
return settingsToOperate;
}
use of net.osmand.plus.plugins.osmedit.data.OsmNotesPoint in project Osmand by osmandapp.
the class OsmNotesSettingsItem method apply.
@Override
public void apply() {
List<OsmNotesPoint> newItems = getNewItems();
if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
appliedItems = new ArrayList<>(newItems);
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
if (osmEditingPlugin != null) {
OsmBugsDbHelper db = osmEditingPlugin.getDBBug();
for (OsmNotesPoint duplicate : duplicateItems) {
int ind = existingItems.indexOf(duplicate);
if (ind != -1 && ind < existingItems.size()) {
OsmNotesPoint original = existingItems.get(ind);
if (original != null) {
db.deleteAllBugModifications(original);
}
db.addOsmbugs(duplicate);
}
}
for (OsmNotesPoint point : appliedItems) {
db.addOsmbugs(point);
}
}
}
}
Aggregations