From b442252e0c0156376c96e59558e80fa237c0668c Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 8 Jan 2015 22:53:25 +0100 Subject: [PATCH] Add dependent rendering attribute --- OsmAnd-java/src/net/osmand/render/RenderingRule.java | 7 +++++++ .../src/net/osmand/render/RenderingRulesStorage.java | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRule.java b/OsmAnd-java/src/net/osmand/render/RenderingRule.java index 74657b6f93..a153b6337f 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRule.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRule.java @@ -160,6 +160,13 @@ public class RenderingRule { ifElseChildren.add(rr); } + public void addToBeginIfElseChildren(RenderingRule rr){ + if(ifElseChildren == null){ + ifElseChildren = new ArrayList(); + } + ifElseChildren.add(0, rr); + } + public boolean isGroup() { return isGroup; } diff --git a/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java b/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java index a25b3c829d..6cca8467bb 100644 --- a/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java +++ b/OsmAnd-java/src/net/osmand/render/RenderingRulesStorage.java @@ -107,8 +107,11 @@ public class RenderingRulesStorage { if (renderingAttributes.containsKey(e.getKey())) { RenderingRule root = renderingAttributes.get(e.getKey()); List list = e.getValue().getIfElseChildren(); + e.getValue().addToBeginIfElseChildren(root); for (RenderingRule every : list) { - root.addIfElseChildren(every); + if(every != root) { + root.addIfElseChildren(every); + } } } else { renderingAttributes.put(e.getKey(), e.getValue());