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