Skip to content

Commit

Permalink
Samples desktop improvements mapsforge#724
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 committed Sep 25, 2016
1 parent 6abd530 commit ff12785
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,20 @@ private static BoundingBox addLayers(MapView mapView, List<File> mapFiles) {
Layers layers = mapView.getLayerManager().getLayers();

// Raster
/*TileDownloadLayer tileDownloadLayer = createTileDownloadLayer(createTileCache(0), mapView.getModel().mapViewPosition);
/*mapView.getModel().displayModel.setFixedTileSize(256);
TileDownloadLayer tileDownloadLayer = createTileDownloadLayer(createTileCache(0, 256), mapView.getModel().mapViewPosition);
layers.add(tileDownloadLayer);
tileDownloadLayer.start();
BoundingBox result = new BoundingBox(LatLongUtils.LATITUDE_MIN, LatLongUtils.LONGITUDE_MIN, LatLongUtils.LATITUDE_MAX, LatLongUtils.LONGITUDE_MAX);
mapView.setZoomLevelMin(OpenStreetMapMapnik.INSTANCE.getZoomLevelMin());
mapView.setZoomLevelMax(OpenStreetMapMapnik.INSTANCE.getZoomLevelMax());*/

// Vector
mapView.getModel().displayModel.setFixedTileSize(512);
BoundingBox result = null;
for (int i = 0; i < mapFiles.size(); i++) {
File mapFile = mapFiles.get(i);
TileRendererLayer tileRendererLayer = createTileRendererLayer(createTileCache(i),
TileRendererLayer tileRendererLayer = createTileRendererLayer(createTileCache(i, 64),
mapView.getModel().mapViewPosition, true, true, false, mapFile);
BoundingBox boundingBox = tileRendererLayer.getMapDataStore().boundingBox();
result = result == null ? boundingBox : result.extendBoundingBox(boundingBox);
Expand All @@ -144,7 +146,6 @@ private static BoundingBox addLayers(MapView mapView, List<File> mapFiles) {

private static MapView createMapView() {
MapView mapView = new MapView();
mapView.getModel().displayModel.setFixedTileSize(512);
mapView.getMapScaleBar().setVisible(true);
if (SHOW_DEBUG_LAYERS) {
mapView.getFpsCounter().setVisible(true);
Expand All @@ -153,8 +154,8 @@ private static MapView createMapView() {
return mapView;
}

private static TileCache createTileCache(int index) {
TileCache firstLevelTileCache = new InMemoryTileCache(64);
private static TileCache createTileCache(int index, int capacity) {
TileCache firstLevelTileCache = new InMemoryTileCache(capacity);
File cacheDirectory = new File(System.getProperty("java.io.tmpdir"), "mapsforge" + index);
TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, GRAPHIC_FACTORY);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
Expand Down

0 comments on commit ff12785

Please sign in to comment.