use of net.osmand.binary.BinaryMapIndexReader in project Osmand by osmandapp.
the class CurrentPositionHelper method setRepositories.
public void setRepositories() {
ArrayList<File> files = new ArrayList<File>();
File appPath = app.getAppPath(null);
SampleUtils.collectFiles(appPath, IndexConstants.BINARY_MAP_INDEX_EXT, files);
readers.clear();
for (File f : files) {
try {
RandomAccessFile mf = new RandomAccessFile(f.getPath(), "r");
BinaryMapIndexReader reader = new BinaryMapIndexReader(mf, f);
readers.add(reader);
} catch (IOException e) {
e.printStackTrace();
}
}
}
use of net.osmand.binary.BinaryMapIndexReader in project Osmand by osmandapp.
the class CurrentPositionHelper method initCtx.
private void initCtx(SampleApplication app, List<BinaryMapIndexReader> checkReaders) {
BinaryMapIndexReader[] rs = checkReaders.toArray(new BinaryMapIndexReader[checkReaders.size()]);
if (rs.length > 0) {
RoutingConfiguration defCfg = RoutingConfiguration.getDefault().build("geocoding", 10, new HashMap<String, String>());
defCtx = new RoutePlannerFrontEnd(false).buildRoutingContext(defCfg, null, rs);
} else {
defCtx = null;
}
usedReaders = checkReaders;
}
use of net.osmand.binary.BinaryMapIndexReader in project Osmand by osmandapp.
the class MapRenderRepositories method containsLatLonMapData.
public boolean containsLatLonMapData(double lat, double lon, int zoom) {
int x = MapUtils.get31TileNumberX(lon);
int y = MapUtils.get31TileNumberY(lat);
for (BinaryMapIndexReader reader : files.values()) {
if (reader.containsMapData(x, y, zoom)) {
return true;
}
}
return false;
}
Aggregations