Introduce icon order in rendering style
This commit is contained in:
parent
e52112636e
commit
583fa22205
2 changed files with 14 additions and 0 deletions
|
@ -44,6 +44,7 @@ public class RenderingRuleStorageProperties {
|
|||
public static final String COLOR__1 = "color__1";
|
||||
public static final String TEXT_BOLD = "textBold";
|
||||
public static final String TEXT_ORDER = "textOrder";
|
||||
public static final String ICON_ORDER = "iconOrder";
|
||||
public static final String TEXT_MIN_DISTANCE = "textMinDistance";
|
||||
public static final String TEXT_ON_PATH = "textOnPath";
|
||||
public static final String ICON = "icon";
|
||||
|
@ -101,6 +102,7 @@ public class RenderingRuleStorageProperties {
|
|||
public RenderingRuleProperty R_COLOR__1;
|
||||
public RenderingRuleProperty R_TEXT_BOLD;
|
||||
public RenderingRuleProperty R_TEXT_ORDER;
|
||||
public RenderingRuleProperty R_ICON_ORDER;
|
||||
public RenderingRuleProperty R_TEXT_MIN_DISTANCE;
|
||||
public RenderingRuleProperty R_TEXT_ON_PATH;
|
||||
public RenderingRuleProperty R_ICON;
|
||||
|
@ -175,6 +177,7 @@ public class RenderingRuleStorageProperties {
|
|||
R_TEXT_HALO_RADIUS = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_HALO_RADIUS));
|
||||
R_TEXT_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_SIZE));
|
||||
R_TEXT_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_ORDER));
|
||||
R_ICON_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(ICON_ORDER));
|
||||
R_TEXT_MIN_DISTANCE = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_MIN_DISTANCE));
|
||||
R_TEXT_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(TEXT_SHIELD));
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import gnu.trove.map.hash.TIntObjectHashMap;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -70,6 +72,7 @@ public class OsmandRenderer {
|
|||
float x = 0;
|
||||
float y = 0;
|
||||
String resId;
|
||||
int iconOrder;
|
||||
}
|
||||
|
||||
|
||||
|
@ -286,6 +289,13 @@ public class OsmandRenderer {
|
|||
}
|
||||
|
||||
private void drawIconsOverCanvas(RenderingContext rc, Canvas cv) {
|
||||
// 1. Sort text using text order
|
||||
Collections.sort(rc.iconsToDraw, new Comparator<IconDrawInfo>() {
|
||||
@Override
|
||||
public int compare(IconDrawInfo object1, IconDrawInfo object2) {
|
||||
return object1.iconOrder - object2.iconOrder;
|
||||
}
|
||||
});
|
||||
int skewConstant = (int) rc.getDensityValue(16);
|
||||
int iconsW = rc.width / skewConstant;
|
||||
int iconsH = rc.height / skewConstant;
|
||||
|
@ -598,6 +608,7 @@ public class OsmandRenderer {
|
|||
IconDrawInfo ico = new IconDrawInfo();
|
||||
ico.x = ps.x;
|
||||
ico.y = ps.y;
|
||||
ico.iconOrder = render.getIntPropertyValue(render.ALL.R_ICON_ORDER, 100);
|
||||
ico.resId = resId;
|
||||
rc.iconsToDraw.add(ico);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue