use RenderStyle.current() to get the active style

This commit is contained in:
Hannes Janetzek 2014-03-15 05:31:12 +01:00
parent 1b09774413
commit b0217767b8
9 changed files with 30 additions and 6 deletions

View File

@ -749,7 +749,7 @@ public final class LineLayer extends RenderElement {
RenderElement l = curLayer;
for (; l != null && l.type == RenderElement.LINE; l = l.next) {
LineLayer ll = (LineLayer) l;
LineStyle line = (LineStyle) ll.line.getCurrent();
LineStyle line = ll.line.current();
if (ll.heightOffset != heightOffset) {
heightOffset = ll.heightOffset;
@ -820,7 +820,7 @@ public final class LineLayer extends RenderElement {
/* draw LineLayers references by this outline */
for (LineLayer ref = ll.outlines; ref != null; ref = ref.outlines) {
LineStyle core = (LineStyle) ref.line.getCurrent();
LineStyle core = ref.line.current();
// core width
if (core.fixed) {

View File

@ -362,7 +362,7 @@ public final class LineTexLayer extends RenderElement {
RenderElement l = curLayer;
for (; l != null && l.type == TEXLINE; l = l.next) {
LineTexLayer ll = (LineTexLayer) l;
LineStyle line = ll.line;
LineStyle line = ll.line.current();
GLUtils.setColor(hTexColor, line.stippleColor, 1);
GLUtils.setColor(hBgColor, line.color, 1);

View File

@ -91,6 +91,7 @@ public class AreaStyle extends RenderStyle {
outline.update();
}
@Override
public AreaStyle current() {
return (AreaStyle) (mCurrent == null ? this : mCurrent);
}

View File

@ -51,4 +51,9 @@ public final class CircleStyle extends RenderStyle {
public void renderNode(Callback renderCallback) {
renderCallback.renderCircle(this, this.level);
}
@Override
public CircleStyle current() {
return (CircleStyle) (mCurrent == null ? this : mCurrent);
}
}

View File

@ -61,6 +61,11 @@ public class ExtrusionStyle extends RenderStyle {
renderCallback.renderExtrusion(this, this.level);
}
@Override
public ExtrusionStyle current() {
return (ExtrusionStyle) (mCurrent == null ? this : mCurrent);
}
private final int level;
public final float[] colors;
public final int defaultHeight;

View File

@ -93,6 +93,11 @@ public final class LineStyle extends RenderStyle {
renderCallback.renderWay(this, level);
}
@Override
public LineStyle current() {
return (LineStyle) (mCurrent == null ? this : mCurrent);
}
public final static class LineBuilder {
public int level;

View File

@ -74,7 +74,5 @@ public abstract class RenderStyle {
}
}
public RenderStyle getCurrent() {
return mCurrent == null ? this : mCurrent;
}
public abstract RenderStyle current();
}

View File

@ -44,4 +44,9 @@ public final class SymbolStyle extends RenderStyle {
public void renderWay(Callback cb) {
cb.renderSymbol(this);
}
@Override
public SymbolStyle current() {
return (SymbolStyle) (mCurrent == null ? this : mCurrent);
}
}

View File

@ -191,6 +191,11 @@ public final class TextStyle extends RenderStyle {
cb.renderText(this);
}
@Override
public TextStyle current() {
return (TextStyle) (mCurrent == null ? this : mCurrent);
}
@Override
public void scaleTextSize(float scaleFactor) {
paint.setTextSize(fontSize * scaleFactor);