Search in sources :

Example 1 with MapMarkerSelectionFragment

use of net.osmand.plus.mapmarkers.MapMarkerSelectionFragment in project Osmand by osmandapp.

the class MapRouteInfoMenu method selectMapMarker.

public void selectMapMarker(final int index, final boolean target, final boolean intermediate) {
    if (index != -1) {
        MapMarker m = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers().get(index);
        LatLon point = new LatLon(m.getLatitude(), m.getLongitude());
        if (intermediate) {
            getTargets().navigateToPoint(point, true, getTargets().getIntermediatePoints().size(), m.getPointDescription(mapActivity));
        } else if (target) {
            getTargets().navigateToPoint(point, true, -1, m.getPointDescription(mapActivity));
        } else {
            getTargets().setStartPoint(point, true, m.getPointDescription(mapActivity));
        }
        updateFromIcon();
    } else {
        MapMarkerSelectionFragment selectionFragment = MapMarkerSelectionFragment.newInstance(target, intermediate);
        selectionFragment.show(mapActivity.getSupportFragmentManager(), MapMarkerSelectionFragment.TAG);
    }
}
Also used : LatLon(net.osmand.data.LatLon) MapMarkerSelectionFragment(net.osmand.plus.mapmarkers.MapMarkerSelectionFragment) MapMarker(net.osmand.plus.MapMarkersHelper.MapMarker)

Aggregations

LatLon (net.osmand.data.LatLon)1 MapMarker (net.osmand.plus.MapMarkersHelper.MapMarker)1 MapMarkerSelectionFragment (net.osmand.plus.mapmarkers.MapMarkerSelectionFragment)1