Skip to content

Commit de7134f

Browse files
authored
ThemeCallback: add getColor with tags (#1251)
1 parent 07063eb commit de7134f

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

docs/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Next version
44

5+
- `ThemeCallback.getColor` method [#1251](https://github.com/mapsforge/vtm/pull/1251)
56
- Minor improvements and bug fixes
67
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.27.0)
78

vtm/src/org/oscim/theme/ThemeCallback.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public interface ThemeCallback {
3232
*/
3333
int getColor(RenderStyle origin, int color);
3434

35+
/**
36+
* @return the color-int
37+
*/
38+
int getColor(String[] keys, String[] values, int color);
39+
3540
/**
3641
* @return the text
3742
*/

vtm/src/org/oscim/theme/XmlThemeBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,13 @@ else if ("symbol-scaling".equals(name))
825825
if (src != null)
826826
b.texture = Utils.loadTexture(mTheme.getRelativePathPrefix(), src, mTheme.getResourceProvider(), b.symbolWidth, b.symbolHeight, b.symbolPercent, mThemeCallback);
827827

828+
if (mThemeCallback != null) {
829+
if (mCurrentRule != null) {
830+
b.color(mThemeCallback.getColor(mCurrentRule.keys, mCurrentRule.values, b.fillColor));
831+
b.strokeColor(mThemeCallback.getColor(mCurrentRule.keys, mCurrentRule.values, b.strokeColor));
832+
}
833+
}
834+
828835
return b.build();
829836
}
830837

vtm/src/org/oscim/theme/rule/RuleBuilder.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright 2016-2017 devemux86
44
*
55
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
6-
*
6+
*
77
* This program is free software: you can redistribute it and/or modify it under the
88
* terms of the GNU Lesser General Public License as published by the Free Software
99
* Foundation, either version 3 of the License, or (at your option) any later version.
@@ -18,12 +18,7 @@
1818
package org.oscim.theme.rule;
1919

2020
import org.oscim.theme.IRenderTheme.ThemeException;
21-
import org.oscim.theme.rule.Rule.Element;
22-
import org.oscim.theme.rule.Rule.NegativeRule;
23-
import org.oscim.theme.rule.Rule.PositiveRuleK;
24-
import org.oscim.theme.rule.Rule.PositiveRuleKV;
25-
import org.oscim.theme.rule.Rule.PositiveRuleMultiKV;
26-
import org.oscim.theme.rule.Rule.PositiveRuleV;
21+
import org.oscim.theme.rule.Rule.*;
2722
import org.oscim.theme.styles.RenderStyle;
2823
import org.oscim.theme.styles.RenderStyle.StyleBuilder;
2924

@@ -48,8 +43,8 @@ public enum RuleType {
4843
int selector;
4944
RuleType type;
5045

51-
String keys[];
52-
String values[];
46+
public String keys[];
47+
public String values[];
5348

5449
ArrayList<RenderStyle> renderStyles = new ArrayList<>(4);
5550
ArrayList<RuleBuilder> subRules = new ArrayList<>(4);

0 commit comments

Comments
 (0)