diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java index 2c5696c901..3c70a9a4e0 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java @@ -139,6 +139,7 @@ public class MapActivityLayers { mapView.addLayer(mFavouritesLayer, 4); // 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()); @@ -179,13 +180,7 @@ public class MapActivityLayers { OsmandSettings settings = getApplication().getSettings(); updateMapSource(mapView, settings.MAP_TILE_SOURCES); boolean showStops = settings.getCustomRenderBooleanProperty(OsmandSettings.TRANSPORT_STOPS_OVER_MAP).get(); - if (mapView.getLayers().contains(transportStopsLayer) != showStops) { - if (showStops) { - mapView.addLayer(transportStopsLayer, 5); - } else { - mapView.removeLayer(transportStopsLayer); - } - } + transportStopsLayer.setShowTransportStops(showStops); OsmandPlugin.refreshLayers(mapView, activity); } diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java index abbeca1187..9715308027 100644 --- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java @@ -46,6 +46,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa private MapLayerData> data; private TransportRoute route = null; + private boolean showTransportStops; private Path path; public TransportStopsLayer(MapActivity mapActivity) { @@ -149,9 +150,15 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa public void setRoute(TransportRoute route) { this.route = route; } - - + public boolean isShowTransportStops() { + return showTransportStops; + } + + public void setShowTransportStops(boolean showTransportStops) { + this.showTransportStops = showTransportStops; + } + public int getRadiusPoi(RotatedTileBox tb){ final double zoom = tb.getZoom(); int r; @@ -171,7 +178,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa @Override - public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb,DrawSettings settings) { + public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb, DrawSettings settings) { List objects = null; if (tb.getZoom() >= startZoomRoute) { if (route != null) { @@ -200,10 +207,12 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa } } } - if (tb.getZoom() >= startZoom && objects == null) { + + if (showTransportStops && tb.getZoom() >= startZoom && objects == null) { data.queryNewData(tb); objects = data.getResults(); } + if (objects != null) { float iconSize = stopBus.getWidth() * 3 / 2.5f; QuadTree boundIntersections = initBoundIntersections(tb);