use of io.jawg.osmcontributor.ui.events.edition.PleaseApplyNodeRefPositionChange in project osm-contributor by jawg.
the class MapFragment method confirmPosition.
private void confirmPosition() {
LatLng newPoiPosition;
LatLng pos;
switch(mapMode) {
case POI_CREATION:
if (getZoomLevel() < zoomVectorial) {
changeMapZoomSmooth(15d);
}
createPoi();
break;
case NOTE_CREATION:
pos = mapboxMap.getCameraPosition().target;
NoteCommentDialogFragment dialog = NoteCommentDialogFragment.newInstance(pos.getLatitude(), pos.getLongitude());
dialog.show(getActivity().getFragmentManager(), "dialog");
break;
case POI_POSITION_EDITION:
Poi poi = (Poi) markerSelected.getRelatedObject();
newPoiPosition = mapboxMap.getCameraPosition().target;
eventBus.post(new PleaseApplyPoiPositionChange(newPoiPosition, poi.getId()));
markerSelected.setPosition(newPoiPosition);
markerSelected.setIcon(IconFactory.getInstance(getActivity()).fromBitmap(bitmapHandler.getMarkerBitmap(poi.getType(), Poi.computeState(false, false, true))));
poi.setUpdated(true);
mapboxMap.updateMarker(markerSelected);
switchMode(MapMode.DETAIL_POI);
break;
case NODE_REF_POSITION_EDITION:
PoiNodeRef poiNodeRef = wayMarkerSelected.getPoiNodeRef();
newPoiPosition = mapboxMap.getCameraPosition().target;
eventBus.post(new PleaseApplyNodeRefPositionChange(newPoiPosition, poiNodeRef.getId()));
wayMarkerSelected.setPosition(newPoiPosition);
wayMarkerSelected.setIcon(IconFactory.getInstance(getActivity()).fromBitmap(bitmapHandler.getNodeRefBitmap(PoiNodeRef.State.SELECTED)));
removePolyline(editionPolyline);
switchMode(MapMode.WAY_EDITION);
break;
case DETAIL_POI:
getActivity().finish();
break;
default:
break;
}
}
Aggregations