From 30f1920e2e3491709ddb3a86bf2cc251551e67a8 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 15 Dec 2014 00:46:20 +0100 Subject: [PATCH] Add layer __2 and _5 for more complex cases --- .../RenderingRuleStorageProperties.java | 26 +++++++++++++++++++ .../osmand/plus/render/OsmandRenderer.java | 21 +++++++++++---- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java b/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java index e5d7982947..b6a2f9b885 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRuleStorageProperties.java @@ -27,30 +27,38 @@ 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_5 = "cap_5"; 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 CAP__2 = "cap__2"; + public static final String PATH_EFFECT_5 = "pathEffect_5"; 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 PATH_EFFECT__2 = "pathEffect__2"; + public static final String STROKE_WIDTH_5 = "strokeWidth_5"; 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 STROKE_WIDTH__2 = "strokeWidth__2"; + public static final String COLOR_5 = "color_5"; 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"; public static final String COLOR_0 = "color_0"; public static final String COLOR__1 = "color__1"; + public static final String COLOR__2 = "color__2"; public static final String TEXT_BOLD = "textBold"; public static final String TEXT_ORDER = "textOrder"; public static final String ICON_ORDER = "iconOrder"; @@ -93,30 +101,38 @@ public class RenderingRuleStorageProperties { public RenderingRuleProperty R_SHADOW_RADIUS; public RenderingRuleProperty R_SHADOW_COLOR; public RenderingRuleProperty R_SHADER; + public RenderingRuleProperty R_CAP_5; 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_CAP__2; + public RenderingRuleProperty R_PATH_EFFECT_5; 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_PATH_EFFECT__2; + public RenderingRuleProperty R_STROKE_WIDTH_5; 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_STROKE_WIDTH__2; + public RenderingRuleProperty R_COLOR_5; public RenderingRuleProperty R_COLOR_4; public RenderingRuleProperty R_COLOR_3; public RenderingRuleProperty R_COLOR; public RenderingRuleProperty R_COLOR_2; public RenderingRuleProperty R_COLOR_0; public RenderingRuleProperty R_COLOR__1; + public RenderingRuleProperty R_COLOR__2; public RenderingRuleProperty R_TEXT_BOLD; public RenderingRuleProperty R_TEXT_ORDER; public RenderingRuleProperty R_ICON_ORDER; @@ -219,27 +235,37 @@ public class RenderingRuleStorageProperties { 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_5 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_5)); R_COLOR_0 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR_0)); R_COLOR__1 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR__1)); + R_COLOR__2 = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR__2)); + 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_5 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_5)); R_STROKE_WIDTH_0 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH_0)); R_STROKE_WIDTH__1 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH__1)); + R_STROKE_WIDTH__2 = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(STROKE_WIDTH__2)); 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_5 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_5)); R_PATH_EFFECT_0 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT_0)); R_PATH_EFFECT__1 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT__1)); + R_PATH_EFFECT__2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(PATH_EFFECT__2)); + 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_5 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_5)); R_CAP_0 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP_0)); R_CAP__1 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP__1)); + R_CAP__2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(CAP__2)); R_SHADER = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHADER)); R_SHADOW_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(SHADOW_COLOR)); diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index 5c7674f11a..cf776b4061 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -655,22 +655,26 @@ public class OsmandRenderer { rStrokeW = req.ALL.R_STROKE_WIDTH__1; rCap = req.ALL.R_CAP__1; rPathEff = req.ALL.R_PATH_EFFECT__1; - } 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__2; + rStrokeW = req.ALL.R_STROKE_WIDTH__2; + rCap = req.ALL.R_CAP__2; + rPathEff = req.ALL.R_PATH_EFFECT__2; } 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; + rColor = req.ALL.R_COLOR_5; + rStrokeW = req.ALL.R_STROKE_WIDTH_5; + rCap = req.ALL.R_CAP_5; + rPathEff = req.ALL.R_PATH_EFFECT_5; } if(area){ if(!req.isSpecified(rColor) && !req.isSpecified(req.ALL.R_SHADER)){ @@ -902,6 +906,10 @@ public class OsmandRenderer { drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius); } else { boolean update = false; + if (updatePaint(render, paint, -3, false, rc)) { + update = true; + canvas.drawPath(path, paint); + } if (updatePaint(render, paint, -2, false, rc)) { update = true; canvas.drawPath(path, paint); @@ -923,6 +931,9 @@ public class OsmandRenderer { if (updatePaint(render, paint, 3, false, rc)) { canvas.drawPath(path, paint); } + if (updatePaint(render, paint, 4, false, rc)) { + canvas.drawPath(path, paint); + } } if(oneway != 0 && !drawOnlyShadow){