use of net.osmand.plus.plugins.osmedit.helpers.OsmBugsDbHelper 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