use of io.jawg.osmcontributor.ui.events.edition.PoiChangesApplyEvent in project osm-contributor by jawg.
the class EditPoiManager method onPleaseCreatePoiEvent.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseCreatePoiEvent(PleaseCreatePoiEvent event) {
Timber.d("Please create poi");
Poi poi = event.getPoi();
poi.setUpdated(true);
poi.applyChanges(event.getPoiChanges().getTagsMap());
poi.applyChanges(applyConstraints(poi));
poiManager.savePoi(poi);
poiManager.updatePoiTypeLastUse(poi.getType().getId());
eventBus.post(new PoiChangesApplyEvent());
}
use of io.jawg.osmcontributor.ui.events.edition.PoiChangesApplyEvent in project osm-contributor by jawg.
the class EditPoiManager method onPleaseApplyPoiChanges.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseApplyPoiChanges(PleaseApplyPoiChanges event) {
Timber.d("please apply poi changes");
Poi editPoi = poiManager.queryForId(event.getPoiChanges().getId());
if (editPoi.hasChanges(event.getPoiChanges().getTagsMap())) {
editPoi.setOldPoiId(saveOldVersionOfPoi(editPoi));
// this is the edition of a new poi or we already edited this poi
editPoi.applyChanges(event.getPoiChanges().getTagsMap());
editPoi.applyChanges(applyConstraints(editPoi));
editPoi.setUpdated(true);
poiManager.savePoi(editPoi);
poiManager.updatePoiTypeLastUse(editPoi.getType().getId());
}
eventBus.post(new PoiChangesApplyEvent());
}
Aggregations