use of uk.me.parabola.mkgmap.osmstyle.StyleFileLoader in project mkgmap by openstreetmap.
the class Main method listStyles.
private void listStyles() {
String[] names;
try {
StyleFileLoader loader = StyleFileLoader.createStyleLoader(styleFile, null);
names = loader.list();
loader.close();
} catch (FileNotFoundException e) {
log.debug("didn't find style file", e);
throw new ExitException("Could not list style file " + styleFile);
}
Arrays.sort(names);
System.out.println("The following styles are available:");
for (String name : names) {
Style style = readOneStyle(name, false);
if (style == null)
continue;
StyleInfo info = style.getInfo();
System.out.format("%-15s %6s: %s\n", searchedStyleName, info.getVersion(), info.getSummary());
if (verbose) {
for (String s : info.getLongDescription().split("\n")) System.out.printf("\t%s\n", s.trim());
}
}
}
use of uk.me.parabola.mkgmap.osmstyle.StyleFileLoader in project mkgmap by openstreetmap.
the class Main method checkStyles.
/**
* Check one or all styles in the path given in styleFile.
*/
private void checkStyles() {
String[] names;
try {
StyleFileLoader loader = StyleFileLoader.createStyleLoader(styleFile, null);
names = loader.list();
loader.close();
} catch (FileNotFoundException e) {
log.debug("didn't find style file", e);
throw new ExitException("Could not check style file " + styleFile);
}
Arrays.sort(names);
if (styleOption == null) {
if (names.length > 1)
System.out.println("The following styles are available:");
else
System.out.println("Found one style in " + styleFile);
}
int checked = 0;
for (String name : names) {
if (styleOption != null && !Objects.equals(name, styleOption))
continue;
if (names.length > 1) {
System.out.println("checking style: " + name);
}
++checked;
boolean performChecks = true;
if (Objects.equals("classpath:styles", styleFile) && !Objects.equals("default", name)) {
performChecks = false;
}
Style style = readOneStyle(name, performChecks);
if (style == null) {
System.out.println("could not open style " + name);
}
}
if (checked == 0)
System.out.println("could not open style " + styleOption + " in " + styleFile);
System.out.println("finished check-styles");
}
use of uk.me.parabola.mkgmap.osmstyle.StyleFileLoader in project mkgmap by openstreetmap.
the class StyleTester method readGivenResults.
private static List<String> readGivenResults() {
List<String> givenResults = new ArrayList<>();
// BufferedReader br = null;
try (StyleFileLoader fileLoader = StyleFileLoader.createStyleLoader(STYLETESTER_STYLE, null);
Reader reader = fileLoader.open("results");
BufferedReader br = new BufferedReader(reader)) {
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.isEmpty())
continue;
givenResults.add(line);
}
} catch (IOException e) {
// there are no known good results given, that is OK
}
return givenResults;
}
Aggregations