From 8d540d66ac86c38babe544aa40f1515a1451dc46 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 31 Aug 2014 23:40:51 +0200 Subject: [PATCH] Fix rendering rules --- .../render/RenderingRuleStorageProperties.java | 12 ++++++++++++ .../net/osmand/render/RenderingRulesStorage.java | 1 - .../src/net/osmand/plus/render/OsmandRenderer.java | 13 ++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java b/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java index 9ba61df125..3ce078ef41 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java @@ -24,21 +24,25 @@ public class RenderingRuleStorageProperties { public static final String SHADOW_RADIUS = "shadowRadius"; public static final String SHADOW_COLOR = "shadowColor"; public static final String SHADER = "shader"; + public static final String CAP_4 = "cap_4"; public static final String CAP_3 = "cap_3"; public static final String CAP_2 = "cap_2"; public static final String CAP = "cap"; public static final String CAP_0 = "cap_0"; public static final String CAP__1 = "cap__1"; + public static final String PATH_EFFECT_4 = "pathEffect_4"; public static final String PATH_EFFECT_3 = "pathEffect_3"; public static final String PATH_EFFECT_2 = "pathEffect_2"; public static final String PATH_EFFECT = "pathEffect"; public static final String PATH_EFFECT_0 = "pathEffect_0"; public static final String PATH_EFFECT__1 = "pathEffect__1"; + public static final String STROKE_WIDTH_4 = "strokeWidth_4"; public static final String STROKE_WIDTH_3 = "strokeWidth_3"; public static final String STROKE_WIDTH_2 = "strokeWidth_2"; public static final String STROKE_WIDTH = "strokeWidth"; public static final String STROKE_WIDTH_0 = "strokeWidth_0"; public static final String STROKE_WIDTH__1 = "strokeWidth__1"; + public static final String COLOR_4 = "color_4"; public static final String COLOR_3 = "color_3"; public static final String COLOR = "color"; public static final String COLOR_2 = "color_2"; @@ -86,21 +90,25 @@ public class RenderingRuleStorageProperties { public RenderingRuleProperty R_SHADOW_RADIUS; public RenderingRuleProperty R_SHADOW_COLOR; public RenderingRuleProperty R_SHADER; + public RenderingRuleProperty R_CAP_4; public RenderingRuleProperty R_CAP_3; public RenderingRuleProperty R_CAP_2; public RenderingRuleProperty R_CAP; public RenderingRuleProperty R_CAP_0; public RenderingRuleProperty R_CAP__1; + public RenderingRuleProperty R_PATH_EFFECT_4; public RenderingRuleProperty R_PATH_EFFECT_3; public RenderingRuleProperty R_PATH_EFFECT_2; public RenderingRuleProperty R_PATH_EFFECT; public RenderingRuleProperty R_PATH_EFFECT_0; public RenderingRuleProperty R_PATH_EFFECT__1; + public RenderingRuleProperty R_STROKE_WIDTH_4; public RenderingRuleProperty R_STROKE_WIDTH_3; public RenderingRuleProperty R_STROKE_WIDTH_2; public RenderingRuleProperty R_STROKE_WIDTH; public RenderingRuleProperty R_STROKE_WIDTH_0; public RenderingRuleProperty R_STROKE_WIDTH__1; + public RenderingRuleProperty R_COLOR_4; public RenderingRuleProperty R_COLOR_3; public RenderingRuleProperty R_COLOR; public RenderingRuleProperty R_COLOR_2; @@ -207,22 +215,26 @@ public class RenderingRuleStorageProperties { R_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR)); R_COLOR_2 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_2)); R_COLOR_3 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_3)); + R_COLOR_4 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_4)); R_COLOR_0 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_0)); R_COLOR__1 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR__1)); R_STROKE_WIDTH = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH)); R_STROKE_WIDTH_2 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_2)); R_STROKE_WIDTH_3 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_3)); + R_STROKE_WIDTH_4 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_4)); R_STROKE_WIDTH_0 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_0)); R_STROKE_WIDTH__1 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH__1)); R_PATH_EFFECT = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT)); R_PATH_EFFECT_2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_2)); R_PATH_EFFECT_3 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_3)); + R_PATH_EFFECT_4 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_4)); R_PATH_EFFECT_0 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_0)); R_PATH_EFFECT__1 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT__1)); R_CAP = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP)); R_CAP_2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_2)); R_CAP_3 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_3)); + R_CAP_4 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_4)); R_CAP_0 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_0)); R_CAP__1 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP__1)); R_SHADER = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHADER)); diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java b/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java index 4ee956254d..372996952b 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java @@ -302,7 +302,6 @@ public class RenderingRulesStorage { stateChanged = true; } else if("renderingAttribute".equals(name)){ //$NON-NLS-1$ String attr = parser.getAttributeValue("", "name"); - @SuppressWarnings("unchecked") RenderingRule root = new RenderingRule(new HashMap( ), RenderingRulesStorage.this); renderingAttributes.put(attr, root); stack.push(root); diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index c2dc8396a7..ade3541292 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -652,11 +652,22 @@ public class OsmandRenderer { rStrokeW = req.ALL.R_STROKE_WIDTH__1; rCap = req.ALL.R_CAP__1; rPathEff = req.ALL.R_PATH_EFFECT__1; - } else { + + } else if(ind == 2){ rColor = req.ALL.R_COLOR_3; rStrokeW = req.ALL.R_STROKE_WIDTH_3; rCap = req.ALL.R_CAP_3; rPathEff = req.ALL.R_PATH_EFFECT_3; + } else if(ind == 3){ + rColor = req.ALL.R_COLOR_4; + rStrokeW = req.ALL.R_STROKE_WIDTH_4; + rCap = req.ALL.R_CAP_4; + rPathEff = req.ALL.R_PATH_EFFECT_4; + } else { + rColor = req.ALL.R_COLOR_4; + rStrokeW = req.ALL.R_STROKE_WIDTH_4; + rCap = req.ALL.R_CAP_4; + rPathEff = req.ALL.R_PATH_EFFECT_4; } if(area){ if(!req.isSpecified(rColor) && !req.isSpecified(req.ALL.R_SHADER)){