use of uk.me.parabola.mkgmap.build.MapBuilder in project mkgmap by openstreetmap.
the class OverviewBuilder method writeOverviewMap.
/**
* Write out the overview map.
*/
private void writeOverviewMap() {
if (overviewSource.mapLevels() == null)
return;
MapBuilder mb = new MapBuilder();
mb.setEnableLineCleanFilters(false);
FileSystemParam params = new FileSystemParam();
params.setMapDescription(areaName);
mb.setCopyrights(creMsgList(copyrightMsgs));
mb.setMapInfo(creMsgList(licenseInfos));
try {
if (codepage == null) {
// should not happen
codepage = 0;
}
Sort sort = SrtTextReader.sortForCodepage(codepage);
Map map = Map.createMap(overviewMapname, outputDir, params, overviewMapnumber, sort);
if (!demProps.isEmpty()) {
map.config(demProps);
mb.config(demProps);
}
if (encodingType != null) {
map.getLblFile().setEncoder(encodingType, codepage);
}
mb.makeMap(map, overviewSource);
map.close();
} catch (FileExistsException e) {
throw new ExitException("Could not create overview map", e);
} catch (FileNotWritableException e) {
throw new ExitException("Could not write to overview map", e);
}
}
use of uk.me.parabola.mkgmap.build.MapBuilder in project mkgmap by openstreetmap.
the class MapMaker method makeMap.
/**
* Make a map from the given map data source.
*
* @param args User supplied arguments.
* @param src The data source to load.
* @param mapNameExt
* @return The output filename for the map.
*/
private String makeMap(CommandArgs args, LoadableMapDataSource src, String mapNamePrefix) {
if (src.getBounds().isEmpty())
return null;
FileSystemParam params = new FileSystemParam();
params.setBlockSize(args.getBlockSize());
params.setMapDescription(args.getDescription());
log.info("Started making", args.getMapname(), "(" + args.getDescription() + ")");
try {
Map map = Map.createMap(mapNamePrefix + args.getMapname(), args.getOutputDir(), params, args.getMapname(), sort);
setOptions(map, args);
MapBuilder builder = new MapBuilder();
builder.config(args.getProperties());
if (!OverviewBuilder.OVERVIEW_PREFIX.equals(mapNamePrefix)) {
if (args.getProperties().containsKey("route") || args.getProperties().containsKey("net"))
builder.setDoRoads(true);
}
builder.makeMap(map, src);
// Collect information on map complete.
String outName = map.getFilename();
log.info("finished making map", outName, "closing");
map.close();
return outName;
} catch (FileExistsException e) {
throw new MapFailedException("File exists already", e);
} catch (FileNotWritableException e) {
throw new MapFailedException("Could not create or write to file", e);
}
}
Aggregations