use of net.osmand.IProgress in project OsmAnd-tools by osmandapp.
the class DownloadOsmGPX method generateObfFile.
private void generateObfFile(QueryParams qp) throws IOException, SQLException, InterruptedException, XmlPullParserException {
if (qp.obfFile != null) {
IndexCreatorSettings settings = new IndexCreatorSettings();
settings.indexMap = true;
settings.indexAddress = false;
settings.indexPOI = true;
settings.indexTransport = false;
settings.indexRouting = false;
RTree.clearCache();
File folder = new File(qp.obfFile.getParentFile(), "gen");
String fileName = qp.obfFile.getName();
File targetObf = qp.obfFile;
try {
folder.mkdirs();
IndexCreator ic = new IndexCreator(folder, settings);
MapRenderingTypesEncoder types = new MapRenderingTypesEncoder(null, fileName);
ic.setMapFileName(fileName);
IProgress prog = IProgress.EMPTY_PROGRESS;
prog = new ConsoleProgressImplementation();
ic.generateIndexes(qp.osmFile, prog, null, MapZooms.getDefault(), types, null);
new File(folder, ic.getMapFileName()).renameTo(targetObf);
} finally {
Algorithms.removeAllFiles(folder);
}
}
}
use of net.osmand.IProgress in project OsmAnd-tools by osmandapp.
the class OsmGpxWriteContext method writeObf.
public File writeObf(List<File> files, File tmpFolder, String fileName, File targetObf) throws IOException, SQLException, InterruptedException, XmlPullParserException {
startDocument();
for (File gf : files) {
GPXFile f = GPXUtilities.loadGPXFile(gf);
GPXTrackAnalysis analysis = f.getAnalysis(gf.lastModified());
writeTrack(null, null, f, analysis, "GPX");
}
endDocument();
IndexCreatorSettings settings = new IndexCreatorSettings();
settings.indexMap = true;
settings.indexAddress = false;
settings.indexPOI = true;
settings.indexTransport = false;
settings.indexRouting = false;
RTree.clearCache();
try {
tmpFolder.mkdirs();
IndexCreator ic = new IndexCreator(tmpFolder, settings);
MapRenderingTypesEncoder types = new MapRenderingTypesEncoder(null, fileName);
ic.setMapFileName(fileName);
// IProgress.EMPTY_PROGRESS
IProgress prog = IProgress.EMPTY_PROGRESS;
// prog = new ConsoleProgressImplementation();
ic.generateIndexes(qp.osmFile, prog, null, MapZooms.getDefault(), types, null);
new File(tmpFolder, ic.getMapFileName()).renameTo(targetObf);
} finally {
Algorithms.removeAllFiles(tmpFolder);
}
return targetObf;
}
Aggregations