use of uk.me.parabola.mkgmap.reader.osm.StyleInfo in project mkgmap by openstreetmap.
the class StyleImpl method readInfo.
/**
* Read the info file. This is just information about the style.
*/
private void readInfo() {
try {
Reader br = new BufferedReader(fileLoader.open(FILE_INFO));
info = new StyleInfo();
Options opts = new Options(new OptionProcessor() {
public void processOption(Option opt) {
String word = opt.getOption();
String value = opt.getValue();
if (word.equals("summary"))
info.setSummary(value);
else if (word.equals("version")) {
info.setVersion(value);
} else if (word.equals("base-style")) {
info.addBaseStyleName(value);
} else if (word.equals("description")) {
info.setLongDescription(value);
}
}
});
opts.readOptionFile(br, FILE_INFO);
} catch (FileNotFoundException e) {
// optional file..
log.debug("no info file");
}
}
use of uk.me.parabola.mkgmap.reader.osm.StyleInfo in project mkgmap by openstreetmap.
the class StyleImplTest method testGetInfo.
@Test
public void testGetInfo() throws FileNotFoundException {
StyleImpl style = new StyleImpl(STYLE_LOC, "simple");
printStyle(style);
StyleInfo info = style.getInfo();
assertEquals("version", "2.2", info.getVersion());
assertEquals("version", "A simple test style with just one example of most things", info.getSummary());
assertEquals("version", "This style is used for testing.", info.getLongDescription());
}
use of uk.me.parabola.mkgmap.reader.osm.StyleInfo in project mkgmap by openstreetmap.
the class StylePrinter method dumpInfo.
private void dumpInfo(Formatter fmt) {
fmt.format("<<<info>>>\n");
StyleInfo styleInfo = style.getInfo();
fmt.format("version %s\n", dumpInfoVal(styleInfo.getVersion()));
fmt.format("summary %s\n", dumpInfoVal(styleInfo.getSummary()));
// documentation/testing purposes.
for (String name : styleInfo.baseStyles()) fmt.format("# base-style %s\n", dumpInfoVal(name));
fmt.format("description %s\n", dumpInfoVal(styleInfo.getLongDescription()));
}
use of uk.me.parabola.mkgmap.reader.osm.StyleInfo 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());
}
}
}
Aggregations