use of io.jawg.osmcontributor.model.entities.Poi 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;
}
}
use of io.jawg.osmcontributor.model.entities.Poi in project osm-contributor by jawg.
the class MapFragment method displayPoiDetailBanner.
/*-----------------------------------------------------------
* POI DETAIL
*---------------------------------------------------------*/
private void displayPoiDetailBanner(boolean display) {
if (display) {
if (markerSelected != null) {
Poi poi = (Poi) markerSelected.getRelatedObject();
eventBus.post(new PleaseChangeValuesDetailPoiFragmentEvent(poi));
}
if (poiDetailWrapper.getVisibility() != View.VISIBLE) {
Animation bottomUp = AnimationUtils.loadAnimation(getActivity(), R.anim.anim_up_detail);
poiDetailWrapper.startAnimation(bottomUp);
poiDetailWrapper.setVisibility(View.VISIBLE);
}
} else {
if (poiDetailWrapper.getVisibility() == View.VISIBLE) {
Animation upDown = AnimationUtils.loadAnimation(getActivity(), R.anim.anim_down_detail);
poiDetailWrapper.startAnimation(upDown);
poiDetailWrapper.setVisibility(View.GONE);
}
}
}
use of io.jawg.osmcontributor.model.entities.Poi in project osm-contributor by jawg.
the class MapFragment method onPleaseDeletePoiFromMapEvent.
/*-----------------------------------------------------------
* POI DELETION
*---------------------------------------------------------*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPleaseDeletePoiFromMapEvent(PleaseDeletePoiFromMapEvent event) {
Poi poi = (Poi) markerSelected.getRelatedObject();
poi.setToDelete(true);
removeMarkerView(markersPoi.get(poi.getId()));
markersPoi.remove(poi.getId());
eventBus.post(new PleaseDeletePoiEvent(poi));
OsmAnswers.localPoiAction(poi.getType().getTechnicalName(), "delete");
switchMode(MapMode.DEFAULT);
}
use of io.jawg.osmcontributor.model.entities.Poi in project osm-contributor by jawg.
the class MapFragment method unselectMarker.
public void unselectMarker() {
if (markerSelected != null) {
Bitmap bitmap = null;
switch(markerSelected.getType()) {
case POI:
Poi poi = (Poi) markerSelected.getRelatedObject();
bitmap = bitmapHandler.getMarkerBitmap(poi.getType(), Poi.computeState(false, false, poi.getUpdated()));
break;
case NOTE:
bitmap = bitmapHandler.getNoteBitmap(Note.computeState((Note) markerSelected.getRelatedObject(), false, false));
break;
default:
break;
}
if (bitmap != null) {
markerSelected.setIcon(IconFactory.getInstance(getActivity()).fromBitmap(bitmap));
}
markerSelectedId = -1L;
markerSelected = null;
}
}
use of io.jawg.osmcontributor.model.entities.Poi in project osm-contributor by jawg.
the class EditPoiManager method saveOldVersionOfPoi.
private Long saveOldVersionOfPoi(Poi poi) {
if (poi.getBackendId() == null) {
return null;
}
if (poiManager.countForBackendId(poi.getBackendId()) == 1) {
Poi old = poi.getCopy();
old.setOld(true);
poiManager.savePoi(old);
return old.getId();
}
return poi.getOldPoiId();
}
Aggregations