Search in sources :

Example 1 with TransportStopsLayer

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

the class MapContextMenuFragment method createTransportStopRouteAdapter.

@Nullable
private TransportStopRouteAdapter createTransportStopRouteAdapter(List<TransportStopRoute> routes, boolean needMoreItem) {
    OsmandApplication app = getMyApplication();
    if (app == null) {
        return null;
    }
    List<Object> items = new ArrayList<Object>(routes);
    if (needMoreItem) {
        items.add(TRANSPORT_BADGE_MORE_ITEM);
    }
    final TransportStopRouteAdapter adapter = new TransportStopRouteAdapter(app, items, nightMode);
    adapter.setListener(new TransportStopRouteAdapter.OnClickListener() {

        @Override
        public void onClick(int position) {
            Object object = adapter.getItem(position);
            MapActivity mapActivity = getMapActivity();
            if (object != null && mapActivity != null) {
                OsmandApplication app = mapActivity.getMyApplication();
                if (object instanceof TransportStopRoute) {
                    TransportStopRoute route = (TransportStopRoute) object;
                    PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE, route.getDescription(app, false));
                    menu.show(menu.getLatLon(), pd, route);
                    TransportStopsLayer stopsLayer = mapActivity.getMapLayers().getTransportStopsLayer();
                    stopsLayer.setRoute(route);
                    int cz = route.calculateZoom(0, mapActivity.getMapView().getCurrentRotatedTileBox());
                    app.getOsmandMap().changeZoom(cz - mapActivity.getMapView().getZoom());
                } else if (object instanceof String) {
                    if (object.equals(TRANSPORT_BADGE_MORE_ITEM)) {
                        if (menu.isLandscapeLayout()) {
                            changeMenuState(getFullScreenTopPosY(), false, false);
                        } else {
                            openMenuFullScreen();
                        }
                    }
                }
            }
        }
    });
    return adapter;
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) ArrayList(java.util.ArrayList) QuadPoint(net.osmand.data.QuadPoint) TransportStopRoute(net.osmand.plus.transport.TransportStopRoute) PointDescription(net.osmand.data.PointDescription) TransportStopsLayer(net.osmand.plus.views.layers.TransportStopsLayer) MapActivity(net.osmand.plus.activities.MapActivity) Nullable(androidx.annotation.Nullable)

Example 2 with TransportStopsLayer

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

the class MapLayers method createLayers.

public void createLayers(@NonNull OsmandMapTileView mapView) {
    // first create to make accessible
    mapTextLayer = new MapTextLayer(app);
    // 5.95 all labels
    mapView.addLayer(mapTextLayer, 5.95f);
    // 8. context menu layer
    contextMenuLayer = new ContextMenuLayer(app);
    mapView.addLayer(contextMenuLayer, 8);
    // mapView.addLayer(underlayLayer, -0.5f);
    mapTileLayer = new MapTileLayer(app, true);
    mapView.addLayer(mapTileLayer, 0.05f);
    mapView.setMainLayer(mapTileLayer);
    // 0.5 layer
    mapVectorLayer = new MapVectorLayer(app);
    mapView.addLayer(mapVectorLayer, 0.0f);
    downloadedRegionsLayer = new DownloadedRegionsLayer(app);
    mapView.addLayer(downloadedRegionsLayer, 0.5f);
    // 0.9 gpx layer
    gpxLayer = new GPXLayer(app);
    mapView.addLayer(gpxLayer, 0.9f);
    // 1. route layer
    routeLayer = new RouteLayer(app);
    mapView.addLayer(routeLayer, 1);
    // 1.5 preview route line layer
    previewRouteLineLayer = new PreviewRouteLineLayer(app);
    mapView.addLayer(previewRouteLineLayer, 1.5f);
    // 2. osm bugs layer
    // 3. poi layer
    poiMapLayer = new POIMapLayer(app);
    mapView.addLayer(poiMapLayer, 3);
    // 4. favorites layer
    mFavouritesLayer = new FavouritesLayer(app);
    mapView.addLayer(mFavouritesLayer, 4);
    // 4.6 measurement tool layer
    measurementToolLayer = new MeasurementToolLayer(app);
    mapView.addLayer(measurementToolLayer, 4.6f);
    // 5. transport layer
    transportStopsLayer = new TransportStopsLayer(app);
    mapView.addLayer(transportStopsLayer, 5);
    // 5.95 all text labels
    // 6. point location layer
    locationLayer = new PointLocationLayer(app);
    mapView.addLayer(locationLayer, 6);
    // 7. point navigation layer
    navigationLayer = new PointNavigationLayer(app);
    mapView.addLayer(navigationLayer, 7);
    // 7.3 map markers layer
    mapMarkersLayer = new MapMarkersLayer(app);
    mapView.addLayer(mapMarkersLayer, 7.3f);
    // 7.5 Impassible roads
    impassableRoadsLayer = new ImpassableRoadsLayer(app);
    mapView.addLayer(impassableRoadsLayer, 7.5f);
    // 7.8 radius ruler control layer
    radiusRulerControlLayer = new RadiusRulerControlLayer(app);
    mapView.addLayer(radiusRulerControlLayer, 7.8f);
    // 7.9 ruler by tap control layer
    distanceRulerControlLayer = new DistanceRulerControlLayer(app);
    mapView.addLayer(distanceRulerControlLayer, 7.9f);
    // 8. context menu layer
    // 9. map info layer
    mapInfoLayer = new MapInfoLayer(app, routeLayer);
    mapView.addLayer(mapInfoLayer, 9);
    // 11. route info layer
    mapControlsLayer = new MapControlsLayer(app);
    mapView.addLayer(mapControlsLayer, 11);
    // 12. quick actions layer
    mapQuickActionLayer = new MapQuickActionLayer(app);
    mapView.addLayer(mapQuickActionLayer, 12);
    contextMenuLayer.setMapQuickActionLayer(mapQuickActionLayer);
    transparencyListener = change -> app.runInUIThread(() -> {
        mapTileLayer.setAlpha(change);
        mapVectorLayer.setAlpha(change);
        mapView.refreshMap();
    });
    app.getSettings().MAP_TRANSPARENCY.addListener(transparencyListener);
    createAdditionalLayers();
}
Also used : MapControlsLayer(net.osmand.plus.views.layers.MapControlsLayer) PointLocationLayer(net.osmand.plus.views.layers.PointLocationLayer) MapMarkersLayer(net.osmand.plus.views.layers.MapMarkersLayer) POIMapLayer(net.osmand.plus.views.layers.POIMapLayer) MeasurementToolLayer(net.osmand.plus.measurementtool.MeasurementToolLayer) ImpassableRoadsLayer(net.osmand.plus.views.layers.ImpassableRoadsLayer) ContextMenuLayer(net.osmand.plus.views.layers.ContextMenuLayer) MapVectorLayer(net.osmand.plus.views.layers.MapVectorLayer) RouteLayer(net.osmand.plus.views.layers.RouteLayer) MapQuickActionLayer(net.osmand.plus.views.layers.MapQuickActionLayer) GPXLayer(net.osmand.plus.views.layers.GPXLayer) FavouritesLayer(net.osmand.plus.views.layers.FavouritesLayer) PointNavigationLayer(net.osmand.plus.views.layers.PointNavigationLayer) MapTextLayer(net.osmand.plus.views.layers.MapTextLayer) DownloadedRegionsLayer(net.osmand.plus.views.layers.DownloadedRegionsLayer) RadiusRulerControlLayer(net.osmand.plus.views.layers.RadiusRulerControlLayer) DistanceRulerControlLayer(net.osmand.plus.views.layers.DistanceRulerControlLayer) MapTileLayer(net.osmand.plus.views.layers.MapTileLayer) MapInfoLayer(net.osmand.plus.views.layers.MapInfoLayer) PreviewRouteLineLayer(net.osmand.plus.views.layers.PreviewRouteLineLayer) TransportStopsLayer(net.osmand.plus.views.layers.TransportStopsLayer)

Example 3 with TransportStopsLayer

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

the class TransportRouteController method showRoute.

private void showRoute() {
    transportRoute.showWholeRoute = true;
    MapActivity mapActivity = getMapActivity();
    if (mapActivity != null) {
        TransportStopsLayer stopsLayer = mapActivity.getMapLayers().getTransportStopsLayer();
        int cz = transportRoute.calculateZoom(0, mapActivity.getMapView().getCurrentRotatedTileBox());
        mapActivity.getMyApplication().getOsmandMap().changeZoom(cz - mapActivity.getMapView().getZoom());
        stopsLayer.setRoute(transportRoute);
    }
}
Also used : TransportStopsLayer(net.osmand.plus.views.layers.TransportStopsLayer) MapActivity(net.osmand.plus.activities.MapActivity)

Example 4 with TransportStopsLayer

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

the class TransportRouteController method resetRoute.

private void resetRoute() {
    MapActivity mapActivity = getMapActivity();
    if (mapActivity != null) {
        TransportStopsLayer stopsLayer = mapActivity.getMapLayers().getTransportStopsLayer();
        stopsLayer.setRoute(null);
    }
}
Also used : TransportStopsLayer(net.osmand.plus.views.layers.TransportStopsLayer) MapActivity(net.osmand.plus.activities.MapActivity)

Example 5 with TransportStopsLayer

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

the class MenuBuilder method createTransportRoutesViewClickListener.

private View.OnClickListener createTransportRoutesViewClickListener(final TransportStopRoute r) {
    return new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            MapContextMenu mm = getMapActivity().getContextMenu();
            PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE, r.getDescription(getMapActivity().getMyApplication(), false));
            mm.show(latLon, pd, r);
            TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
            stopsLayer.setRoute(r);
            int cz = r.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
            app.getOsmandMap().changeZoom(cz - getMapActivity().getMapView().getZoom());
        }
    };
}
Also used : PointDescription(net.osmand.data.PointDescription) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) TransportStopsLayer(net.osmand.plus.views.layers.TransportStopsLayer)

Aggregations

TransportStopsLayer (net.osmand.plus.views.layers.TransportStopsLayer)5 MapActivity (net.osmand.plus.activities.MapActivity)3 PointDescription (net.osmand.data.PointDescription)2 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 Nullable (androidx.annotation.Nullable)1 ArrayList (java.util.ArrayList)1 QuadPoint (net.osmand.data.QuadPoint)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 MeasurementToolLayer (net.osmand.plus.measurementtool.MeasurementToolLayer)1 TransportStopRoute (net.osmand.plus.transport.TransportStopRoute)1 ContextMenuLayer (net.osmand.plus.views.layers.ContextMenuLayer)1 DistanceRulerControlLayer (net.osmand.plus.views.layers.DistanceRulerControlLayer)1 DownloadedRegionsLayer (net.osmand.plus.views.layers.DownloadedRegionsLayer)1 FavouritesLayer (net.osmand.plus.views.layers.FavouritesLayer)1 GPXLayer (net.osmand.plus.views.layers.GPXLayer)1 ImpassableRoadsLayer (net.osmand.plus.views.layers.ImpassableRoadsLayer)1 MapControlsLayer (net.osmand.plus.views.layers.MapControlsLayer)1