Search in sources :

Example 1 with OpenstreetmapsDbHelper

use of net.osmand.plus.plugins.osmedit.helpers.OpenstreetmapsDbHelper in project Osmand by osmandapp.

the class OsmEditsSettingsItem method apply.

@Override
public void apply() {
    List<OpenstreetmapPoint> newItems = getNewItems();
    if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
        appliedItems = new ArrayList<>(newItems);
        OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
        if (osmEditingPlugin != null) {
            OpenstreetmapsDbHelper db = osmEditingPlugin.getDBPOI();
            for (OpenstreetmapPoint duplicate : duplicateItems) {
                db.deletePOI(duplicate);
                db.addOpenstreetmap(duplicate);
            }
            for (OpenstreetmapPoint point : appliedItems) {
                db.addOpenstreetmap(point);
            }
        }
    }
}
Also used : OpenstreetmapPoint(net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint) OpenstreetmapsDbHelper(net.osmand.plus.plugins.osmedit.helpers.OpenstreetmapsDbHelper) OsmEditingPlugin(net.osmand.plus.plugins.osmedit.OsmEditingPlugin)

Aggregations

OsmEditingPlugin (net.osmand.plus.plugins.osmedit.OsmEditingPlugin)1 OpenstreetmapPoint (net.osmand.plus.plugins.osmedit.data.OpenstreetmapPoint)1 OpenstreetmapsDbHelper (net.osmand.plus.plugins.osmedit.helpers.OpenstreetmapsDbHelper)1