use of uk.me.parabola.mkgmap.scan.SyntaxException in project mkgmap by openstreetmap.
the class CommonSection method readColourInfo.
/**
* Read the colour lines from the XPM format image.
*/
protected ColourInfo readColourInfo(TokenScanner scanner, String header) {
ColourInfo colourInfo = new ColourInfo();
parseXpmHeader(scanner, colourInfo, header);
for (int i = 0; i < colourInfo.getNumberOfColours(); i++) {
scanner.validateNext("\"");
int cpp = colourInfo.getCharsPerPixel();
Token token = scanner.nextRawToken();
String colourTag = token.getValue();
while (colourTag.length() < cpp) colourTag += scanner.nextRawToken().getValue();
colourTag = colourTag.substring(0, cpp);
scanner.validateNext("c");
String colour = scanner.nextValue();
if (colour.charAt(0) == '#') {
colour = scanner.nextValue();
colourInfo.addColour(colourTag, new Rgb(colour));
} else if (colour.equalsIgnoreCase("none")) {
colourInfo.addTransparent(colourTag);
} else {
throw new SyntaxException(scanner, "Unrecognised colour: " + colour);
}
scanner.validateNext("\"");
readExtraColourInfo(scanner, colourInfo);
}
return colourInfo;
}
use of uk.me.parabola.mkgmap.scan.SyntaxException in project mkgmap by openstreetmap.
the class LineSection method processLine.
public void processLine(TokenScanner scanner, String name, String value) {
if (commonKey(scanner, current, name, value))
return;
if (name.equalsIgnoreCase("UseOrientation")) {
current.setUseOrientation(value.charAt(0) == 'Y');
} else if (name.equalsIgnoreCase("LineWidth")) {
try {
int ival = Integer.decode(value);
current.setLineWidth(ival);
} catch (NumberFormatException e) {
throw new SyntaxException(scanner, "Bad number for line width: " + value);
}
} else if (name.equalsIgnoreCase("BorderWidth")) {
try {
int ival = Integer.decode(value);
current.setBorderWidth(ival);
} catch (NumberFormatException e) {
throw new SyntaxException(scanner, "Bad number for line width: " + value);
}
} else
warnUnknown(name);
}
Aggregations