From 61a558feb4c4040fb986e2ade591a1fef86e14d2 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 7 Oct 2012 14:53:35 +0200 Subject: [PATCH] Fix name appearance --- .../src/net/osmand/render/RenderingRulesStorage.java | 10 +++------- .../src/net/osmand/swing/NativeSwingRendering.java | 6 ++++-- .../src/net/osmand/plus/render/RendererRegistry.java | 5 +++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/render/RenderingRulesStorage.java b/DataExtractionOSM/src/net/osmand/render/RenderingRulesStorage.java index 051cb06640..6eb9ecde36 100644 --- a/DataExtractionOSM/src/net/osmand/render/RenderingRulesStorage.java +++ b/DataExtractionOSM/src/net/osmand/render/RenderingRulesStorage.java @@ -62,13 +62,9 @@ public class RenderingRulesStorage { RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException; } - public RenderingRulesStorage(String name){ - // register empty string as 0 + public RenderingRulesStorage(String name, Map renderingConstants){ getDictionaryValue(""); this.renderingName = name; - } - - public RenderingRulesStorage(String name, Map renderingConstants){ if(renderingConstants != null) { this.renderingConstants.putAll(renderingConstants); } @@ -436,11 +432,11 @@ public class RenderingRulesStorage { public static void main(String[] args) throws SAXException, IOException { - RenderingRulesStorage storage = new RenderingRulesStorage("test"); + RenderingRulesStorage storage = new RenderingRulesStorage("test", null); final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() { @Override public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException { - RenderingRulesStorage depends = new RenderingRulesStorage("test"); + RenderingRulesStorage depends = new RenderingRulesStorage("test", null); try { depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"), ref); diff --git a/DataExtractionOSM/src/net/osmand/swing/NativeSwingRendering.java b/DataExtractionOSM/src/net/osmand/swing/NativeSwingRendering.java index 3b0508fa59..357acfd9e3 100644 --- a/DataExtractionOSM/src/net/osmand/swing/NativeSwingRendering.java +++ b/DataExtractionOSM/src/net/osmand/swing/NativeSwingRendering.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import javax.imageio.ImageIO; import javax.imageio.ImageReader; @@ -33,11 +34,12 @@ public class NativeSwingRendering extends NativeLibrary { private static NativeSwingRendering defaultLoadedLibrary; public void loadRuleStorage(String path, String renderingProperties) throws SAXException, IOException{ - RenderingRulesStorage storage = new RenderingRulesStorage("default"); + final LinkedHashMap renderingAttributes = new LinkedHashMap(); + RenderingRulesStorage storage = new RenderingRulesStorage("default", renderingAttributes); final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() { @Override public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException { - RenderingRulesStorage depends = new RenderingRulesStorage(name); + RenderingRulesStorage depends = new RenderingRulesStorage(name, renderingAttributes); try { depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"), ref); diff --git a/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java b/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java index a0564f576f..a2046d0282 100644 --- a/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java +++ b/OsmAnd/src/net/osmand/plus/render/RendererRegistry.java @@ -60,7 +60,9 @@ public class RendererRegistry { return null; } try { - return loadRenderer(name, new LinkedHashMap(), new LinkedHashMap()); + RenderingRulesStorage r = loadRenderer(name, new LinkedHashMap(), new LinkedHashMap()); + renderers.put(name, r); + return r; } catch (IOException e) { log.error("Error loading renderer", e); //$NON-NLS-1$ } catch (SAXException e) { @@ -124,7 +126,6 @@ public class RendererRegistry { } finally { is.close(); } - renderers.put(name, main); return main; }