use of org.greenrobot.eventbus.Subscribe in project osm-contributor by jawg.
the class EditPoiManager method onPleaseApplyPoiPositionChange.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseApplyPoiPositionChange(PleaseApplyPoiPositionChange event) {
Timber.d("Please apply poi position change");
Poi editPoi = poiManager.queryForId(event.getPoiId());
editPoi.setOldPoiId(saveOldVersionOfPoi(editPoi));
editPoi.setLatitude(event.getPoiPosition().getLatitude());
editPoi.setLongitude(event.getPoiPosition().getLongitude());
editPoi.setUpdated(true);
poiManager.savePoi(editPoi);
poiManager.updatePoiTypeLastUse(editPoi.getType().getId());
}
use of org.greenrobot.eventbus.Subscribe in project osm-contributor by jawg.
the class EditPoiManager method onPleaseCreateNoTagPoiEvent.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseCreateNoTagPoiEvent(PleaseCreateNoTagPoiEvent event) {
Poi poi = new Poi();
LatLng latLng = event.getLatLng();
poi.setLatitude(latLng.getLatitude());
poi.setLongitude(latLng.getLongitude());
poi.setType(event.getPoiType());
List<PoiTag> defaultTags = new ArrayList<>();
for (PoiTypeTag poiTypeTag : poi.getType().getTags()) {
if (poiTypeTag.getValue() != null) {
// default tags should be set in the corresponding POI
PoiTag poiTag = new PoiTag();
poiTag.setKey(poiTypeTag.getKey());
poiTag.setValue(poiTypeTag.getValue());
defaultTags.add(poiTag);
}
}
poi.setTags(defaultTags);
poi.setUpdated(true);
poiManager.savePoi(poi);
poiManager.updatePoiTypeLastUse(event.getPoiType().getId());
eventBus.post(new PoiNoTypeCreated());
}
use of org.greenrobot.eventbus.Subscribe in project osm-contributor by jawg.
the class EditPoiManager method onPleaseApplyNodeRefPositionChange.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseApplyNodeRefPositionChange(PleaseApplyNodeRefPositionChange event) {
Timber.d("Please apply noderef position change");
LatLng newLatLng = event.getPoiPosition();
// apply changes on the noderef
PoiNodeRef poiNodeRef = poiNodeRefDao.queryForId(event.getPoiId());
poiNodeRef.setOldPoiId(saveOldVersionOfPoiNodeRef(poiNodeRef));
poiNodeRef.setLongitude(newLatLng.getLongitude());
poiNodeRef.setLatitude(newLatLng.getLatitude());
poiNodeRef.setUpdated(true);
poiNodeRefDao.createOrUpdate(poiNodeRef);
}
use of org.greenrobot.eventbus.Subscribe in project osm-contributor by jawg.
the class TypeManager method onInternalUpdatePoiTagsEvent.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onInternalUpdatePoiTagsEvent(InternalUpdatePoiTagsEvent event) {
PoiType poiType = event.getPoiType();
poiManager.savePoiType(poiType);
bus.post(new PoiTagsUpdatedEvent(poiType));
}
use of org.greenrobot.eventbus.Subscribe in project osm-contributor by jawg.
the class TypeManager method onInternalSavePoiTagEvent.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onInternalSavePoiTagEvent(InternalSavePoiTagEvent event) {
PoiTypeTag poiTypeTag = event.getPoiTypeTag();
PoiType poiType = poiTypeTag.getPoiType();
poiManager.savePoiType(poiType);
bus.post(new PoiTagCreatedEvent(poiTypeTag));
}
Aggregations