From 11280b62ba0fa268910d1723e59ca39f78faf41e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 19 Jun 2014 22:39:45 +0200 Subject: [PATCH] Fix rendering style --- OsmAnd-java/src/net/osmand/RenderingContext.java | 8 ++++++-- OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java | 6 +++--- OsmAnd/src/net/osmand/plus/render/TextRenderer.java | 10 +++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/RenderingContext.java b/OsmAnd-java/src/net/osmand/RenderingContext.java index 87954d0af8..ea7ccf03a6 100644 --- a/OsmAnd-java/src/net/osmand/RenderingContext.java +++ b/OsmAnd-java/src/net/osmand/RenderingContext.java @@ -63,8 +63,12 @@ public class RenderingContext { return val * density; } - public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, float defVal) { - return req.getFloatPropertyValue(prop, defVal) * density + req.getIntPropertyValue(prop, 0); + public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, int defVal) { + return req.getFloatPropertyValue(prop, 0) * density + req.getIntPropertyValue(prop, defVal); + } + + public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop) { + return req.getFloatPropertyValue(prop, 0) * density + req.getIntPropertyValue(prop, 0); } protected byte[] getIconRawData(String data) { diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index 0903edb793..7e65958f68 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -664,7 +664,7 @@ public class OsmandRenderer { p.setColorFilter(null); p.clearShadowLayer(); p.setStyle(Style.STROKE); - p.setStrokeWidth(rc.getComplexValue(req, rStrokeW, 0)); + p.setStrokeWidth(rc.getComplexValue(req, rStrokeW)); String cap = req.getStringPropertyValue(rCap); if(!Algorithms.isEmpty(cap)){ p.setStrokeCap(Cap.valueOf(cap.toUpperCase())); @@ -715,7 +715,7 @@ public class OsmandRenderer { if(shadowColor == 0) { shadowColor = rc.shadowRenderingColor; } - int shadowRadius = (int) rc.getComplexValue(req, req.ALL.R_SHADOW_RADIUS, 0); + int shadowRadius = (int) rc.getComplexValue(req, req.ALL.R_SHADOW_RADIUS); if (shadowColor == 0) { shadowRadius = 0; } @@ -869,7 +869,7 @@ public class OsmandRenderer { if (path != null) { if(drawOnlyShadow) { int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR); - int shadowRadius = (int) rc.getComplexValue(render, render.ALL.R_SHADOW_RADIUS, 0); + int shadowRadius = (int) rc.getComplexValue(render, render.ALL.R_SHADOW_RADIUS); if(shadowColor == 0) { shadowColor = rc.shadowRenderingColor; } diff --git a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java index dac1598979..4b3c3770a9 100644 --- a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java @@ -63,21 +63,21 @@ public class TextRenderer { public void fillProperties(RenderingContext rc, RenderingRuleSearchRequest render, float centerX, float centerY) { this.centerX = centerX; // used only for draw on path where centerY doesn't play role - this.vOffset = (int) rc.getComplexValue(render, render.ALL.R_TEXT_DY, 0); + this.vOffset = (int) rc.getComplexValue(render, render.ALL.R_TEXT_DY); this.centerY = centerY + this.vOffset; textColor = render.getIntPropertyValue(render.ALL.R_TEXT_COLOR); if (textColor == 0) { textColor = Color.BLACK; } - textSize = rc.getComplexValue(render, render.ALL.R_TEXT_SIZE, 0); - textShadow = (int) rc.getComplexValue(render, render.ALL.R_TEXT_HALO_RADIUS, 0); + textSize = rc.getComplexValue(render, render.ALL.R_TEXT_SIZE); + textShadow = (int) rc.getComplexValue(render, render.ALL.R_TEXT_HALO_RADIUS); textShadowColor = render.getIntPropertyValue(render.ALL.R_TEXT_HALO_COLOR); if(textShadowColor == 0) { textShadowColor = Color.WHITE; } - textWrap = (int) rc.getComplexValue(render, render.ALL.R_TEXT_WRAP_WIDTH, 0); + textWrap = (int) rc.getComplexValue(render, render.ALL.R_TEXT_WRAP_WIDTH); bold = render.getIntPropertyValue(render.ALL.R_TEXT_BOLD, 0) > 0; - minDistance = rc.getComplexValue(render, render.ALL.R_TEXT_MIN_DISTANCE, 0); + minDistance = rc.getComplexValue(render, render.ALL.R_TEXT_MIN_DISTANCE); if (render.isSpecified(render.ALL.R_TEXT_SHIELD)) { shieldRes = render.getStringPropertyValue(render.ALL.R_TEXT_SHIELD); }