use of net.osmand.plus.views.layers.DownloadedRegionsLayer in project Osmand by osmandapp.
the class DashboardOnMap method updateDownloadBtn.
private void updateDownloadBtn() {
Button btn = dashboardView.findViewById(R.id.map_download_button);
String filter = null;
String txt = "";
OsmandMapTileView mv = mapActivity.getMapView();
if (mv != null && !mapActivity.getMyApplication().isApplicationInitializing()) {
if (mv.getZoom() < 11 && !mapActivity.getMyApplication().getResourceManager().containsBasemap()) {
filter = "basemap";
txt = mapActivity.getString(R.string.shared_string_download) + " " + mapActivity.getString(R.string.base_world_map);
} else {
DownloadedRegionsLayer dl = mv.getLayerByClass(DownloadedRegionsLayer.class);
if (dl != null) {
StringBuilder btnName = new StringBuilder();
filter = dl.getFilter(btnName);
txt = btnName.toString();
}
}
}
btn.setText(txt);
btn.setVisibility(filter == null ? View.GONE : View.VISIBLE);
final String f = filter;
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hideDashboard(false);
final Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getDownloadIndexActivity());
if (f != null && !f.equals("basemap")) {
intent.putExtra(DownloadActivity.FILTER_KEY, f);
}
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
mapActivity.startActivity(intent);
}
});
scheduleDownloadButtonCheck();
}
use of net.osmand.plus.views.layers.DownloadedRegionsLayer 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();
}
use of net.osmand.plus.views.layers.DownloadedRegionsLayer in project Osmand by osmandapp.
the class WikipediaPlugin method showDownloadWikiMapsScreen.
public void showDownloadWikiMapsScreen() {
if (mapActivity != null) {
OsmandMapTileView mv = mapActivity.getMapView();
DownloadedRegionsLayer dl = mv.getLayerByClass(DownloadedRegionsLayer.class);
String filter = dl.getFilter(new StringBuilder());
final Intent intent = new Intent(app, app.getAppCustomization().getDownloadIndexActivity());
intent.putExtra(DownloadActivity.FILTER_KEY, filter);
intent.putExtra(DownloadActivity.FILTER_CAT, DownloadActivityType.WIKIPEDIA_FILE.getTag());
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
mapActivity.startActivity(intent);
}
}
Aggregations