Render styles improvements
This commit is contained in:
@@ -134,6 +134,11 @@ class AndroidPaint implements Paint {
|
|||||||
return Math.abs(fm.bottom);
|
return Math.abs(fm.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStrokeWidth() {
|
||||||
|
return mPaint.getStrokeWidth();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
mPaint.getTextBounds(text, 0, text.length(), rect);
|
mPaint.getTextBounds(text, 0, text.length(), rect);
|
||||||
|
|||||||
@@ -212,6 +212,11 @@ public class AwtPaint implements Paint {
|
|||||||
stroke = new BasicStroke(strokeWidth, cap, join, join == BasicStroke.JOIN_MITER ? 1.0f : 0, null, 0);
|
stroke = new BasicStroke(strokeWidth, cap, join, join == BasicStroke.JOIN_MITER ? 1.0f : 0, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStrokeWidth() {
|
||||||
|
return strokeWidth;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
Graphics2D graphics2d = bufferedImage.createGraphics();
|
Graphics2D graphics2d = bufferedImage.createGraphics();
|
||||||
|
|||||||
@@ -337,6 +337,11 @@ public class IosPaint implements Paint {
|
|||||||
return descent;
|
return descent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStrokeWidth() {
|
||||||
|
return strokeWidth;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
return this.fontHeight;
|
return this.fontHeight;
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ public class GwtPaint implements Paint {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStrokeWidth() {
|
||||||
|
return strokeWidth;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public interface Paint {
|
|||||||
|
|
||||||
float getFontDescent();
|
float getFontDescent();
|
||||||
|
|
||||||
|
float getStrokeWidth();
|
||||||
|
|
||||||
float getTextHeight(String text);
|
float getTextHeight(String text);
|
||||||
|
|
||||||
float getTextWidth(String text);
|
float getTextWidth(String text);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
|||||||
if (!(style instanceof ExtrusionStyle))
|
if (!(style instanceof ExtrusionStyle))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ExtrusionStyle extrusion = (ExtrusionStyle) style;
|
ExtrusionStyle extrusion = (ExtrusionStyle) style.current();
|
||||||
|
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int minHeight = 0;
|
int minHeight = 0;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016 devemux86
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
*
|
*
|
||||||
@@ -56,7 +57,7 @@ public class LabelTileLoaderHook implements TileLoaderThemeHook {
|
|||||||
if (style instanceof TextStyle) {
|
if (style instanceof TextStyle) {
|
||||||
LabelTileData ld = get(tile);
|
LabelTileData ld = get(tile);
|
||||||
|
|
||||||
TextStyle text = (TextStyle) style;
|
TextStyle text = (TextStyle) style.current();
|
||||||
if (element.type == LINE) {
|
if (element.type == LINE) {
|
||||||
String value = element.tags.getValue(text.textKey);
|
String value = element.tags.getValue(text.textKey);
|
||||||
if (value == null || value.length() == 0)
|
if (value == null || value.length() == 0)
|
||||||
@@ -104,7 +105,7 @@ public class LabelTileLoaderHook implements TileLoaderThemeHook {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (style instanceof SymbolStyle) {
|
} else if (style instanceof SymbolStyle) {
|
||||||
SymbolStyle symbol = (SymbolStyle) style;
|
SymbolStyle symbol = (SymbolStyle) style.current();
|
||||||
|
|
||||||
if (symbol.bitmap == null && symbol.texture == null)
|
if (symbol.bitmap == null && symbol.texture == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public T reset() {
|
public T reset() {
|
||||||
|
level = -1;
|
||||||
fillColor = Color.WHITE;
|
fillColor = Color.WHITE;
|
||||||
strokeColor = Color.BLACK;
|
strokeColor = Color.BLACK;
|
||||||
strokeWidth = 0;
|
strokeWidth = 0;
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public final class CircleStyle extends RenderStyle<CircleStyle> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public T reset() {
|
public T reset() {
|
||||||
|
level = -1;
|
||||||
radius = 0;
|
radius = 0;
|
||||||
scaleRadius = false;
|
scaleRadius = false;
|
||||||
fillColor = Color.TRANSPARENT;
|
fillColor = Color.TRANSPARENT;
|
||||||
|
|||||||
@@ -173,25 +173,30 @@ public final class TextStyle extends RenderStyle<TextStyle> {
|
|||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextBuilder<?> from(TextStyle style) {
|
public TextBuilder<?> set(TextStyle text) {
|
||||||
this.style = style.style;
|
if (text == null)
|
||||||
this.textKey = style.textKey;
|
return reset();
|
||||||
this.caption = style.caption;
|
|
||||||
this.dy = style.dy;
|
this.style = text.style;
|
||||||
this.priority = style.priority;
|
this.textKey = text.textKey;
|
||||||
this.areaSize = style.areaSize;
|
this.caption = text.caption;
|
||||||
this.bitmap = style.bitmap;
|
this.dy = text.dy;
|
||||||
this.texture = style.texture;
|
this.priority = text.priority;
|
||||||
this.fillColor = style.paint.getColor();
|
this.areaSize = text.areaSize;
|
||||||
|
this.bitmap = text.bitmap;
|
||||||
|
this.texture = text.texture;
|
||||||
|
this.fillColor = text.paint.getColor();
|
||||||
this.fontFamily = FontFamily.DEFAULT;
|
this.fontFamily = FontFamily.DEFAULT;
|
||||||
this.fontStyle = FontStyle.NORMAL;
|
this.fontStyle = FontStyle.NORMAL;
|
||||||
this.strokeColor = style.stroke.getColor();
|
if (text.stroke != null) {
|
||||||
this.strokeWidth = 2;
|
this.strokeColor = text.stroke.getColor();
|
||||||
this.fontSize = style.fontSize;
|
this.strokeWidth = text.stroke.getStrokeWidth();
|
||||||
|
}
|
||||||
|
this.fontSize = text.fontSize;
|
||||||
|
|
||||||
this.symbolWidth = style.symbolWidth;
|
this.symbolWidth = text.symbolWidth;
|
||||||
this.symbolHeight = style.symbolHeight;
|
this.symbolHeight = text.symbolHeight;
|
||||||
this.symbolPercent = style.symbolPercent;
|
this.symbolPercent = text.symbolPercent;
|
||||||
|
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user