void loadMap(File areaFolder) {
//map event receiver
mapView.map().layers().add(new MapEventsReceiver(mapView.map()));
//map file source
MapFileTileSource tileSource = new MapFileTileSource();
File mapFile = new File(areaFolder, AREA + ".map").getAbsoluteFile();
Log.d("LOAD", "loadMap: " + mapFile);
tileSource.setMapFile(String.valueOf(mapFile));
VectorTileLayer l = mapView.map().setBaseMap(tileSource);
mapView.map().setTheme(VtmThemes.DEFAULT);
mapView.map().layers().add(new BuildingLayer(mapView.map(), l));
mapView.map().layers().add(new LabelLayer(mapView.map(), l));
//marker's layer
itemLayer = new ItemizedLayer<>(mapView.map(), (MarkerSymbol) null);
mapView.map().layers().add(itemLayer);
//map position
MapInfo mapInfo = tileSource.getMapInfo();
if (mapInfo == null) {
Log.d("LOAD", "loadMap: null mapinfo");
} else if (mapInfo.boundingBox == null) {
Log.d("LOAD", "loadMap: bbox is null");
} else {
GeoPoint mapCenter = tileSource.getMapInfo().boundingBox.getCenterPoint();
mapView.map().setMapPosition(mapCenter.getLatitude(), mapCenter.getLongitude(), 1 << 17);
//mapView.map().setMapPosition(18.551576, 73.831151, 1 << 17);
setContentView(mapView);
loadGraph();
}
}
//mapFile returns a valid file that exists and is proper