use of uk.me.parabola.mkgmap.Version in project mkgmap by openstreetmap.
the class MapBuilder method getMapInfo.
/**
* Set all the information that appears in the header.
*/
private void getMapInfo() {
if (licenseFileName != null) {
List<String> licenseArray = new ArrayList<>();
try {
File file = new File(licenseFileName);
licenseArray = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
} catch (Exception e) {
throw new ExitException("Error reading license file " + licenseFileName, e);
}
if ((licenseArray.size() > 0) && licenseArray.get(0).startsWith("\ufeff"))
licenseArray.set(0, licenseArray.get(0).substring(1));
UnaryOperator<String> replaceVariables = s -> s.replace("$MKGMAP_VERSION$", Version.VERSION).replace("$JAVA_VERSION$", System.getProperty("java.version")).replace("$YEAR$", Integer.toString(now.getYear())).replace("$LONGDATE$", now.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG))).replace("$SHORTDATE$", now.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT))).replace("$TIME$", now.toLocalTime().toString().substring(0, 5));
licenseArray.replaceAll(replaceVariables);
mapInfo.addAll(licenseArray);
} else {
mapInfo.add("Map data (c) OpenStreetMap and its contributors");
mapInfo.add("http://www.openstreetmap.org/copyright");
mapInfo.add("");
mapInfo.add("This map data is made available under the Open Database License:");
mapInfo.add("http://opendatacommons.org/licenses/odbl/1.0/");
mapInfo.add("Any rights in individual contents of the database are licensed under the");
mapInfo.add("Database Contents License: http://opendatacommons.org/licenses/dbcl/1.0/");
mapInfo.add("");
// Pad the version number with spaces so that version
// strings that are different lengths do not change the size and
// offsets of the following sections.
mapInfo.add("Map created with mkgmap-r" + String.format("%-10s", Version.VERSION));
mapInfo.add("Program released under the GPL");
}
}
Aggregations