Search in sources :

Example 1 with MapMarkersLayer

use of net.osmand.plus.views.MapMarkersLayer in project Osmand by osmandapp.

the class PlanRouteFragment method createSnapToRoadFragmentListener.

private SnapToRoadFragmentListener createSnapToRoadFragmentListener() {
    return new SnapToRoadFragmentListener() {

        @Override
        public void onDestroyView(boolean snapToRoadEnabled) {
        }

        @Override
        public void onApplicationModeItemClick(ApplicationMode mode) {
            if (planRouteContext.getSnappedMode() != mode) {
                boolean defaultMode = mode == ApplicationMode.DEFAULT;
                MapMarkersLayer layer = getMapMarkersLayer();
                if (layer != null) {
                    layer.setDefaultAppMode(defaultMode);
                }
                if (defaultMode) {
                    planRouteContext.cancelSnapToRoad();
                }
                planRouteContext.getSnappedToRoadPoints().clear();
                planRouteContext.setSnappedMode(mode);
                planRouteContext.recreateSnapTrkSegment(false);
                setupAppModesBtn();
            }
        }
    };
}
Also used : MapMarkersLayer(net.osmand.plus.views.MapMarkersLayer) SnapToRoadFragmentListener(net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener) ApplicationMode(net.osmand.plus.ApplicationMode)

Example 2 with MapMarkersLayer

use of net.osmand.plus.views.MapMarkersLayer in project Osmand by osmandapp.

the class PlanRouteFragment method enterPlanRouteMode.

private void enterPlanRouteMode() {
    final MapActivity mapActivity = getMapActivity();
    MapMarkersLayer markersLayer = getMapMarkersLayer();
    if (mapActivity != null && markersLayer != null) {
        markersLayer.setInPlanRouteMode(true);
        mapActivity.disableDrawer();
        mark(portrait ? View.INVISIBLE : View.GONE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
        mark(View.GONE, R.id.map_route_info_button, R.id.map_menu_button, R.id.map_compass_button, R.id.map_layers_button, R.id.map_search_button, R.id.map_quick_actions_button);
        View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
        if (collapseButton != null && collapseButton.getVisibility() == View.VISIBLE) {
            wasCollapseButtonVisible = true;
            collapseButton.setVisibility(View.INVISIBLE);
        } else {
            wasCollapseButtonVisible = false;
        }
        if (planRouteContext.getSnappedMode() == null) {
            planRouteContext.setSnappedMode(ApplicationMode.DEFAULT);
        }
        setupAppModesBtn();
        OsmandMapTileView tileView = mapActivity.getMapView();
        previousMapPosition = tileView.getMapPosition();
        tileView.setMapPosition(portrait ? MIDDLE_TOP_CONSTANT : LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
        selectedCount = mapActivity.getMyApplication().getMapMarkersHelper().getSelectedMarkersCount();
        planRouteContext.recreateSnapTrkSegment(planRouteContext.isAdjustMapOnStart());
        planRouteContext.setAdjustMapOnStart(true);
        mapActivity.refreshMap();
        updateSelectButton();
    }
}
Also used : MapMarkersLayer(net.osmand.plus.views.MapMarkersLayer) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) RecyclerView(android.support.v7.widget.RecyclerView) MapActivity(net.osmand.plus.activities.MapActivity)

Example 3 with MapMarkersLayer

use of net.osmand.plus.views.MapMarkersLayer in project Osmand by osmandapp.

the class PlanRouteFragment method exitPlanRouteMode.

private void exitPlanRouteMode() {
    MapActivity mapActivity = getMapActivity();
    MapMarkersLayer markersLayer = getMapMarkersLayer();
    if (mapActivity != null && markersLayer != null) {
        markersLayer.setInPlanRouteMode(false);
        mapActivity.enableDrawer();
        if (toolbarController != null) {
            mapActivity.hideTopToolbar(toolbarController);
        }
        mark(View.VISIBLE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info, R.id.map_route_info_button, R.id.map_menu_button, R.id.map_compass_button, R.id.map_layers_button, R.id.map_search_button, R.id.map_quick_actions_button);
        View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
        if (collapseButton != null && wasCollapseButtonVisible) {
            collapseButton.setVisibility(View.VISIBLE);
        }
        mapActivity.findViewById(R.id.snap_to_road_image_button).setVisibility(View.GONE);
        mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE);
        mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.VISIBLE);
        mapActivity.getMapView().setMapPosition(previousMapPosition);
        if (cancelSnapToRoad) {
            planRouteContext.cancelSnapToRoad();
        }
        markersLayer.setRoute(null);
        mapActivity.refreshMap();
    }
}
Also used : MapMarkersLayer(net.osmand.plus.views.MapMarkersLayer) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) RecyclerView(android.support.v7.widget.RecyclerView) MapActivity(net.osmand.plus.activities.MapActivity)

Example 4 with MapMarkersLayer

use of net.osmand.plus.views.MapMarkersLayer in project Osmand by osmandapp.

the class MapActivityLayers method createLayers.

public void createLayers(final OsmandMapTileView mapView) {
    OsmandApplication app = getApplication();
    RoutingHelper routingHelper = app.getRoutingHelper();
    // first create to make accessible
    mapTextLayer = new MapTextLayer();
    // 5.95 all labels
    mapView.addLayer(mapTextLayer, 5.95f);
    // 8. context menu layer
    contextMenuLayer = new ContextMenuLayer(activity);
    mapView.addLayer(contextMenuLayer, 8);
    // mapView.addLayer(underlayLayer, -0.5f);
    mapTileLayer = new MapTileLayer(true);
    mapView.addLayer(mapTileLayer, 0.0f);
    mapView.setMainLayer(mapTileLayer);
    // 0.5 layer
    mapVectorLayer = new MapVectorLayer(mapTileLayer, false);
    mapView.addLayer(mapVectorLayer, 0.5f);
    downloadedRegionsLayer = new DownloadedRegionsLayer();
    mapView.addLayer(downloadedRegionsLayer, 0.5f);
    // 0.9 gpx layer
    gpxLayer = new GPXLayer();
    mapView.addLayer(gpxLayer, 0.9f);
    // 1. route layer
    routeLayer = new RouteLayer(routingHelper);
    mapView.addLayer(routeLayer, 1);
    // 2. osm bugs layer
    // 3. poi layer
    poiMapLayer = new POIMapLayer(activity);
    mapView.addLayer(poiMapLayer, 3);
    // 4. favorites layer
    mFavouritesLayer = new FavouritesLayer();
    mapView.addLayer(mFavouritesLayer, 4);
    // 4.6 measurement tool layer
    measurementToolLayer = new MeasurementToolLayer();
    mapView.addLayer(measurementToolLayer, 4.6f);
    // 5. transport layer
    transportStopsLayer = new TransportStopsLayer(activity);
    mapView.addLayer(transportStopsLayer, 5);
    // 5.95 all text labels
    // 6. point location layer
    locationLayer = new PointLocationLayer(activity.getMapViewTrackingUtilities());
    mapView.addLayer(locationLayer, 6);
    // 7. point navigation layer
    navigationLayer = new PointNavigationLayer(activity);
    mapView.addLayer(navigationLayer, 7);
    // 7.3 map markers layer
    mapMarkersLayer = new MapMarkersLayer(activity);
    mapView.addLayer(mapMarkersLayer, 7.3f);
    // 7.5 Impassible roads
    impassableRoadsLayer = new ImpassableRoadsLayer(activity);
    mapView.addLayer(impassableRoadsLayer, 7.5f);
    // 7.8 ruler control layer
    rulerControlLayer = new RulerControlLayer(activity);
    mapView.addLayer(rulerControlLayer, 7.8f);
    // 8. context menu layer
    // 9. map info layer
    mapInfoLayer = new MapInfoLayer(activity, routeLayer);
    mapView.addLayer(mapInfoLayer, 9);
    // 11. route info layer
    mapControlsLayer = new MapControlsLayer(activity);
    mapView.addLayer(mapControlsLayer, 11);
    // 12. quick actions layer
    mapQuickActionLayer = new MapQuickActionLayer(activity, contextMenuLayer);
    mapView.addLayer(mapQuickActionLayer, 12);
    contextMenuLayer.setMapQuickActionLayer(mapQuickActionLayer);
    mapControlsLayer.setMapQuickActionLayer(mapQuickActionLayer);
    transparencyListener = new StateChangedListener<Integer>() {

        @Override
        public void stateChanged(Integer change) {
            mapTileLayer.setAlpha(change);
            mapVectorLayer.setAlpha(change);
            mapView.refreshMap();
        }
    };
    app.getSettings().MAP_TRANSPARENCY.addListener(transparencyListener);
    OsmandPlugin.createLayers(mapView, activity);
    app.getAppCustomization().createLayers(mapView, activity);
    app.getAidlApi().registerMapLayers(activity);
}
Also used : MapControlsLayer(net.osmand.plus.views.MapControlsLayer) PointLocationLayer(net.osmand.plus.views.PointLocationLayer) MapMarkersLayer(net.osmand.plus.views.MapMarkersLayer) OsmandApplication(net.osmand.plus.OsmandApplication) POIMapLayer(net.osmand.plus.views.POIMapLayer) MeasurementToolLayer(net.osmand.plus.measurementtool.MeasurementToolLayer) ImpassableRoadsLayer(net.osmand.plus.views.ImpassableRoadsLayer) ContextMenuLayer(net.osmand.plus.views.ContextMenuLayer) RoutingHelper(net.osmand.plus.routing.RoutingHelper) MapVectorLayer(net.osmand.plus.render.MapVectorLayer) RouteLayer(net.osmand.plus.views.RouteLayer) MapQuickActionLayer(net.osmand.plus.views.MapQuickActionLayer) GPXLayer(net.osmand.plus.views.GPXLayer) FavouritesLayer(net.osmand.plus.views.FavouritesLayer) PointNavigationLayer(net.osmand.plus.views.PointNavigationLayer) RulerControlLayer(net.osmand.plus.views.RulerControlLayer) MapTextLayer(net.osmand.plus.views.MapTextLayer) DownloadedRegionsLayer(net.osmand.plus.views.DownloadedRegionsLayer) MapTileLayer(net.osmand.plus.views.MapTileLayer) MapInfoLayer(net.osmand.plus.views.MapInfoLayer) TransportStopsLayer(net.osmand.plus.views.TransportStopsLayer)

Aggregations

MapMarkersLayer (net.osmand.plus.views.MapMarkersLayer)4 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 MapActivity (net.osmand.plus.activities.MapActivity)2 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)2 ApplicationMode (net.osmand.plus.ApplicationMode)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 MeasurementToolLayer (net.osmand.plus.measurementtool.MeasurementToolLayer)1 SnapToRoadFragmentListener (net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener)1 MapVectorLayer (net.osmand.plus.render.MapVectorLayer)1 RoutingHelper (net.osmand.plus.routing.RoutingHelper)1 ContextMenuLayer (net.osmand.plus.views.ContextMenuLayer)1 DownloadedRegionsLayer (net.osmand.plus.views.DownloadedRegionsLayer)1 FavouritesLayer (net.osmand.plus.views.FavouritesLayer)1 GPXLayer (net.osmand.plus.views.GPXLayer)1 ImpassableRoadsLayer (net.osmand.plus.views.ImpassableRoadsLayer)1 MapControlsLayer (net.osmand.plus.views.MapControlsLayer)1 MapInfoLayer (net.osmand.plus.views.MapInfoLayer)1