use of org.mapsforge.map.layer.download.tilesource.AbstractTileSource in project RSAndroidApp by RailwayStations.
the class MapsActivity method createLayers.
protected void createLayers() {
final String map = baseApplication.getMap();
final Uri mapUri = baseApplication.toUri(map);
final MapDataStore mapFile = getMapFile(mapUri);
if (mapFile != null) {
final TileRendererLayer rendererLayer = new TileRendererLayer(this.tileCaches.get(0), mapFile, this.binding.map.mapView.getModel().mapViewPosition, false, true, false, AndroidGraphicFactory.INSTANCE) {
@Override
public boolean onLongPress(final LatLong tapLatLong, final Point thisXY, final Point tapXY) {
MapsActivity.this.onLongPress(tapLatLong);
return true;
}
};
rendererLayer.setXmlRenderTheme(getRenderTheme());
this.layer = rendererLayer;
binding.map.mapView.getLayerManager().getLayers().add(this.layer);
} else {
AbstractTileSource tileSource = onlineTileSources.get(map);
if (tileSource == null) {
tileSource = OpenStreetMapMapnik.INSTANCE;
}
tileSource.setUserAgent(USER_AGENT);
this.layer = new TileDownloadLayer(this.tileCaches.get(0), this.binding.map.mapView.getModel().mapViewPosition, tileSource, AndroidGraphicFactory.INSTANCE) {
@Override
public boolean onLongPress(final LatLong tapLatLong, final Point thisXY, final Point tapXY) {
MapsActivity.this.onLongPress(tapLatLong);
return true;
}
};
binding.map.mapView.getLayerManager().getLayers().add(this.layer);
binding.map.mapView.setZoomLevelMin(tileSource.getZoomLevelMin());
binding.map.mapView.setZoomLevelMax(tileSource.getZoomLevelMax());
}
}
Aggregations