From 9b8ae07b4d81bd2bc1880485617f42b61b54f7c2 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 26 Nov 2010 11:08:16 +0000 Subject: [PATCH] implement basic car rendering git-svn-id: https://osmand.googlecode.com/svn/trunk@709 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../net/osmand/render/car-night.render.xml | 166 ++++++++++++++++++ .../src/net/osmand/render/car.render.xml | 166 ++++++++++++++++++ .../osmand/render/default-night.render.xml | 105 ++++++++++- .../src/net/osmand/render/default.render.xml | 63 +++---- OsmAnd/res/values-sk/strings.xml | 4 +- .../net/osmand/render/BaseOsmandRender.java | 20 +-- .../src/net/osmand/render/OsmandRenderer.java | 8 +- .../net/osmand/render/RendererRegistry.java | 7 +- 8 files changed, 491 insertions(+), 48 deletions(-) create mode 100644 DataExtractionOSM/src/net/osmand/render/car-night.render.xml create mode 100644 DataExtractionOSM/src/net/osmand/render/car.render.xml diff --git a/DataExtractionOSM/src/net/osmand/render/car-night.render.xml b/DataExtractionOSM/src/net/osmand/render/car-night.render.xml new file mode 100644 index 0000000000..854905c74b --- /dev/null +++ b/DataExtractionOSM/src/net/osmand/render/car-night.render.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/render/car.render.xml b/DataExtractionOSM/src/net/osmand/render/car.render.xml new file mode 100644 index 0000000000..534814e46b --- /dev/null +++ b/DataExtractionOSM/src/net/osmand/render/car.render.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/render/default-night.render.xml b/DataExtractionOSM/src/net/osmand/render/default-night.render.xml index 49367233f0..5b243a401f 100644 --- a/DataExtractionOSM/src/net/osmand/render/default-night.render.xml +++ b/DataExtractionOSM/src/net/osmand/render/default-night.render.xml @@ -1,3 +1,106 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/render/default.render.xml b/DataExtractionOSM/src/net/osmand/render/default.render.xml index 92558c3ad1..8978d72dd3 100644 --- a/DataExtractionOSM/src/net/osmand/render/default.render.xml +++ b/DataExtractionOSM/src/net/osmand/render/default.render.xml @@ -39,16 +39,16 @@ - + - + - + @@ -61,21 +61,21 @@ - + - + - + @@ -147,31 +147,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 1c2e4a05a3..fef3d64dea 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -1,8 +1,10 @@ +Nastala chyba pri vykresľovaní vybratej oblasti +Nedostatok pamäte na zobrazenie vybratej oblasti Možnosti bodu Vykresľovač bol úspešne načítaný -Nastala sa výnimka: vykresľovač nebol načítaný +Nastala výnimka: vykresľovač nebol načítaný Vektorový vykresľovač Vybrať štýl vektorového vykresľovania diff --git a/OsmAnd/src/net/osmand/render/BaseOsmandRender.java b/OsmAnd/src/net/osmand/render/BaseOsmandRender.java index 6ba2239d66..e8dfc47b14 100644 --- a/OsmAnd/src/net/osmand/render/BaseOsmandRender.java +++ b/OsmAnd/src/net/osmand/render/BaseOsmandRender.java @@ -180,22 +180,19 @@ public class BaseOsmandRender implements RenderingRuleVisitor { return null; } String ret = renderObjectTextImpl(name, tag, val, rc, ref); - if(rc.textSize == 0){ + if(ret == null){ ret = renderObjectTextImpl(name, tag, null, rc, ref); } - if(rc.textSize == 0){ + if(ret == null){ for(BaseOsmandRender d : dependRenderers){ ret = d.renderObjectText(name, tag, val, rc, ref); - if (rc.textSize > 0) { + if (ret != null) { break; } } } - if(rc.textSize > 0){ - return ret; - } else { - return null; - } + + return ret; } private float getObjectOrderImpl(String tag, String val, int type, int layer) { @@ -223,7 +220,8 @@ public class BaseOsmandRender implements RenderingRuleVisitor { if (list != null) { for (FilterState f : list) { if (f.minzoom <= zoom && (zoom <= f.maxzoom || f.maxzoom == -1)) { - return RenderingIcons.getIcons().get(f.icon); + Integer i = RenderingIcons.getIcons().get(f.icon); + return i == null ? 0 : i; } } } @@ -355,7 +353,7 @@ public class BaseOsmandRender implements RenderingRuleVisitor { // first find rule with same text length for (FilterState f : list) { if (f.minzoom <= rc.zoom && (rc.zoom <= f.maxzoom || f.maxzoom == -1) && checkRefTextRule(f, ref)) { - if(f.textLength == name.length() && f.text.textSize > 0){ + if(f.textLength == name.length()){ fillTextProperties(f, rc); return name; } @@ -364,7 +362,7 @@ public class BaseOsmandRender implements RenderingRuleVisitor { for (FilterState f : list) { if (f.minzoom <= rc.zoom && (rc.zoom <= f.maxzoom || f.maxzoom == -1) && checkRefTextRule(f, ref)) { - if(f.textLength == 0 && f.text.textSize > 0){ + if(f.textLength == 0){ fillTextProperties(f, rc); return name; } diff --git a/OsmAnd/src/net/osmand/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/render/OsmandRenderer.java index 7b51f6bb23..b080f5a964 100644 --- a/OsmAnd/src/net/osmand/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/render/OsmandRenderer.java @@ -744,7 +744,7 @@ public class OsmandRenderer { name = render.renderObjectText(name, pair.tag, pair.value, rc, false); } } - if(resId == null && name == null){ + if((resId == null || resId == 0) && name == null){ return; } int len = obj.getPointsLength(); @@ -760,7 +760,7 @@ public class OsmandRenderer { ps.y /= len; } - if(resId != null){ + if(resId != null && resId != 0){ IconDrawInfo ico = new IconDrawInfo(); ico.x = ps.x; ico.y = ps.y; @@ -787,8 +787,8 @@ public class OsmandRenderer { return; } int layer = MapRenderingTypes.getNegativeWayLayer(wholeType); - render.renderPolyline(pair.tag, pair.value, rc.zoom, rc, this, layer); - if(rc.main.strokeWidth == 0){ + boolean res = render.renderPolyline(pair.tag, pair.value, rc.zoom, rc, this, layer); + if(rc.main.strokeWidth == 0 || !res){ return; } int length = obj.getPointsLength(); diff --git a/OsmAnd/src/net/osmand/render/RendererRegistry.java b/OsmAnd/src/net/osmand/render/RendererRegistry.java index 006c62f509..b1c94316b8 100644 --- a/OsmAnd/src/net/osmand/render/RendererRegistry.java +++ b/OsmAnd/src/net/osmand/render/RendererRegistry.java @@ -24,8 +24,11 @@ public class RendererRegistry { private final static Log log = LogUtil.getLog(RendererRegistry.class); public final static String DEFAULT_RENDER = "default"; //$NON-NLS-1$ + public final static String CAR_RENDER = "car"; //$NON-NLS-1$ public final static String NIGHT_SUFFIX = "-night"; //$NON-NLS-1$ public final static String DEFAULT_NIGHT_RENDER = DEFAULT_RENDER + NIGHT_SUFFIX; + public final static String CAR_NIGHT_RENDER = CAR_RENDER + NIGHT_SUFFIX; + public static RendererRegistry getRegistry() { return registry; @@ -34,6 +37,8 @@ public class RendererRegistry { public RendererRegistry(){ internalRenderers.put(DEFAULT_RENDER, "default.render.xml"); //$NON-NLS-1$ internalRenderers.put(DEFAULT_NIGHT_RENDER, "default-night.render.xml"); //$NON-NLS-1$ + internalRenderers.put(CAR_RENDER, "car.render.xml"); //$NON-NLS-1$ + internalRenderers.put(CAR_NIGHT_RENDER, "car-night.render.xml"); //$NON-NLS-1$ } private BaseOsmandRender defaultRender = null; @@ -91,7 +96,7 @@ public class RendererRegistry { if(externalRenderers.containsKey(name)){ is = new FileInputStream(externalRenderers.get(name)); } else if(internalRenderers.containsKey(name)){ - is = OsmandRenderingRulesParser.class.getResourceAsStream("default.render.xml"); //$NON-NLS-1$ + is = OsmandRenderingRulesParser.class.getResourceAsStream(internalRenderers.get(name)); } else { throw new IllegalArgumentException("Not found " + name); //$NON-NLS-1$ }