add StyleBuilder interface

This commit is contained in:
Hannes Janetzek 2014-03-31 15:03:04 +02:00
parent f5645cf292
commit 4f254bde75
4 changed files with 19 additions and 3 deletions

View File

@ -104,7 +104,7 @@ public class AreaStyle extends RenderStyle {
renderCallback.renderWay(outline, level + 1);
}
public static class AreaBuilder {
public static class AreaBuilder implements StyleBuilder {
public int level;
public String style;
public LineStyle outline;

View File

@ -98,7 +98,7 @@ public final class LineStyle extends RenderStyle {
return (LineStyle) mCurrent;
}
public final static class LineBuilder {
public final static class LineBuilder implements StyleBuilder {
public int level;
public String style;
@ -203,5 +203,10 @@ public final class LineStyle extends RenderStyle {
public LineStyle build() {
return new LineStyle(this);
}
public LineBuilder cap(Cap cap) {
this.cap = cap;
return this;
}
}
}

View File

@ -24,6 +24,12 @@ import org.oscim.theme.IRenderTheme.Callback;
*/
public abstract class RenderStyle {
public interface StyleBuilder {
RenderStyle build();
StyleBuilder level(int level);
}
RenderStyle mCurrent = this;
RenderStyle mNext;
boolean update;

View File

@ -27,7 +27,7 @@ import org.oscim.theme.IRenderTheme.Callback;
public final class TextStyle extends RenderStyle {
public static class TextBuilder {
public static class TextBuilder implements StyleBuilder {
public String style;
public float fontSize;
@ -134,6 +134,11 @@ public final class TextStyle extends RenderStyle {
this.strokeWidth = strokeWidth;
return this;
}
@Override
public TextBuilder level(int level) {
return this;
}
}
TextStyle(TextBuilder tb) {