RenderTheme: ignore missing symbol atlas for now. formatting

This commit is contained in:
Hannes Janetzek 2013-09-12 01:32:53 +02:00
parent d05c4ad0d1
commit 7c0e1540cb

View File

@ -277,12 +277,13 @@ public class RenderThemeHandler extends DefaultHandler {
checkState(localName, Element.RENDERING_INSTRUCTION);
Symbol symbol = createSymbol(localName, attributes);
mCurrentRule.addRenderingInstruction(symbol);
if (mTextureAtlas != null) {
if ((symbol.texture = mTextureAtlas.getTextureRegion(symbol.src)) == null)
Log.d(TAG, "missing texture atlas item '" + symbol.src + "'");
//else
// Log.d(TAG, "using atlas item '" + symbol.src + "'");
}
}
else if (ELEMENT_NAME_USE_STYLE_LINE.equals(localName)) {
checkState(localName, Element.RENDERING_INSTRUCTION);
@ -336,6 +337,7 @@ public class RenderThemeHandler extends DefaultHandler {
checkState(localName, Element.ATLAS);
createTextureRegion(localName, attributes);
} else {
//Log.d(TAG, "unknown element: " + localName);
throw new SAXException("unknown element: " + localName);
}
} catch (IllegalArgumentException e) {
@ -399,7 +401,6 @@ public class RenderThemeHandler extends DefaultHandler {
mTextureAtlas.addTextureRegion(regionName.intern(), r);
}
private void checkElement(String elementName, Element element) throws SAXException {
Element parentElement;
switch (element) {
@ -447,7 +448,6 @@ public class RenderThemeHandler extends DefaultHandler {
mElementStack.push(element);
}
static RenderTheme createRenderTheme(String elementName, Attributes attributes) {
Integer version = null;
int mapBackground = Color.WHITE;
@ -645,6 +645,8 @@ public class RenderThemeHandler extends DefaultHandler {
blur = Float.parseFloat(value);
} else if ("from".equals(name)) {
// ignore
} else if ("dasharray".equals(name)) {
// ignore
} else {
logUnknownAttribute(elementName, name, value, i);
}
@ -718,14 +720,19 @@ public class RenderThemeHandler extends DefaultHandler {
}
}
validateArea(strokeWidth);
if (src != null){
if (src != null) {
try {
Bitmap b = CanvasAdapter.g.loadBitmapAsset(src);
if (b != null)
texture = new TextureItem(b, true);
} catch (Exception e) {
Log.d(TAG, e.getMessage());
}
}
return new Area(style, fill, stroke, strokeWidth, fade, level, blend,
blendFill, texture);
@ -758,7 +765,7 @@ public class RenderThemeHandler extends DefaultHandler {
String name = attributes.getLocalName(i);
String value = attributes.getValue(i);
if ("r".equals(name)) {
if ("r".equals(name) || "radius".equals(name)) {
radius = Float.valueOf(Float.parseFloat(value));
} else if ("scale-radius".equals(name)) {
scaleRadius = Boolean.parseBoolean(value);