add option for text priorities
This commit is contained in:
parent
fab415057e
commit
f2f93d180b
@ -50,8 +50,8 @@ public final class Text extends RenderInstruction {
|
|||||||
int stroke = Color.BLACK;
|
int stroke = Color.BLACK;
|
||||||
float strokeWidth = 0;
|
float strokeWidth = 0;
|
||||||
String style = null;
|
String style = null;
|
||||||
// boolean caption = false;
|
|
||||||
float dy = 0;
|
float dy = 0;
|
||||||
|
int priority = Integer.MAX_VALUE;
|
||||||
|
|
||||||
for (int i = 0; i < attributes.getLength(); ++i) {
|
for (int i = 0; i < attributes.getLength(); ++i) {
|
||||||
String name = attributes.getLocalName(i);
|
String name = attributes.getLocalName(i);
|
||||||
@ -74,6 +74,8 @@ public final class Text extends RenderInstruction {
|
|||||||
strokeWidth = Float.parseFloat(value);
|
strokeWidth = Float.parseFloat(value);
|
||||||
} else if ("caption".equals(name)) {
|
} else if ("caption".equals(name)) {
|
||||||
caption = Boolean.parseBoolean(value);
|
caption = Boolean.parseBoolean(value);
|
||||||
|
} else if ("priority".equals(name)) {
|
||||||
|
priority = Integer.parseInt(value);
|
||||||
} else if ("dy".equals(name)) {
|
} else if ("dy".equals(name)) {
|
||||||
dy = Float.parseFloat(value);
|
dy = Float.parseFloat(value);
|
||||||
} else {
|
} else {
|
||||||
@ -94,7 +96,7 @@ public final class Text extends RenderInstruction {
|
|||||||
if (typeface == null)
|
if (typeface == null)
|
||||||
typeface = Typeface.create(fontFamily.toTypeface(), fontStyle.toInt());
|
typeface = Typeface.create(fontFamily.toTypeface(), fontStyle.toInt());
|
||||||
|
|
||||||
return new Text(style, textKey, typeface, fontSize, fill, stroke, strokeWidth, dy, caption);
|
return new Text(style, textKey, typeface, fontSize, fill, stroke, strokeWidth, dy, caption, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Typeface typefaceNormal = Typeface.create(FontFamily.DEFAULT.toTypeface(),
|
private static Typeface typefaceNormal = Typeface.create(FontFamily.DEFAULT.toTypeface(),
|
||||||
@ -125,24 +127,24 @@ public final class Text extends RenderInstruction {
|
|||||||
public String style;
|
public String style;
|
||||||
public final boolean caption;
|
public final boolean caption;
|
||||||
public final float dy;
|
public final float dy;
|
||||||
|
public final int priority;
|
||||||
|
|
||||||
public float fontHeight;
|
public float fontHeight;
|
||||||
public float fontDescent;
|
public float fontDescent;
|
||||||
|
|
||||||
public static Text createText(float fontSize, float strokeWidth, int fill, int outline,
|
public static Text createText(float fontSize, float strokeWidth, int fill, int outline,
|
||||||
boolean billboard) {
|
boolean billboard) {
|
||||||
|
|
||||||
return new Text("", "", typefaceNormal, fontSize, fill, outline, strokeWidth, 0, billboard);
|
return new Text("", "", typefaceNormal, fontSize, fill, outline, strokeWidth, 0, billboard, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Text(String style, String textKey, Typeface typeface, float fontSize,
|
private Text(String style, String textKey, Typeface typeface, float fontSize,
|
||||||
int fill, int outline, float strokeWidth, float dy, boolean caption) {
|
int fill, int outline, float strokeWidth, float dy, boolean caption, int priority) {
|
||||||
// super();
|
|
||||||
|
|
||||||
this.style = style;
|
this.style = style;
|
||||||
this.textKey = textKey;
|
this.textKey = textKey;
|
||||||
this.caption = caption;
|
this.caption = caption;
|
||||||
this.dy = dy;
|
this.dy = dy;
|
||||||
|
this.priority = priority;
|
||||||
|
|
||||||
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
paint.setTextAlign(Align.CENTER);
|
paint.setTextAlign(Align.CENTER);
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
xsi:schemaLocation="http://mapsforge.org/renderTheme ../renderTheme.xsd"
|
xsi:schemaLocation="http://mapsforge.org/renderTheme ../renderTheme.xsd"
|
||||||
version="1" map-background="#fdfdfc">
|
version="1" map-background="#fdfdfc">
|
||||||
|
|
||||||
<style-text name="road" k="name" font-size="16" fill="#101010" stroke="#ffffff" stroke-width="2.0" />
|
<style-text name="road" k="name" font-size="16" fill="#101010" stroke="#ffffff" stroke-width="2.0" priority="2"/>
|
||||||
<style-text name="major-road" k="name" font-style="bold" font-size="16" fill="#101010" stroke="#ffffff" stroke-width="2.0" />
|
<style-text name="major-road" k="name" font-style="bold" font-size="16" fill="#101010" stroke="#ffffff" stroke-width="2.0" priority="1"/>
|
||||||
|
|
||||||
<style-area name="residential" fill="#f0eee8" fade="10"/>
|
<style-area name="residential" fill="#f0eee8" fade="10"/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user