rename theme style classes

This commit is contained in:
Hannes Janetzek 2014-03-17 22:48:20 +01:00
parent 4e473bf242
commit 46b2eb2a3e
28 changed files with 178 additions and 178 deletions

View File

@ -15,8 +15,8 @@ import org.oscim.jeo.JeoUtils;
import org.oscim.map.Map;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.renderer.elements.MeshLayer;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.LineStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -117,7 +117,7 @@ public class JeoVectorLayer extends JtsLayer {
if (ll.line == null) {
RGB color = rule.color(f, CartoCSS.LINE_COLOR, RGB.black);
float width = rule.number(f, CartoCSS.LINE_WIDTH, 1.2f);
ll.line = new Line(0, JeoUtils.color(color), width);
ll.line = new LineStyle(0, JeoUtils.color(color), width);
ll.setDropDistance(0.5f);
}
@ -131,14 +131,14 @@ public class JeoVectorLayer extends JtsLayer {
if (ll.line == null) {
float width = rule.number(f, CartoCSS.LINE_WIDTH, 1.2f);
RGB color = rule.color(f, CartoCSS.LINE_COLOR, RGB.black);
ll.line = new Line(0, JeoUtils.color(color), width);
ll.line = new LineStyle(0, JeoUtils.color(color), width);
ll.setDropDistance(0.5f);
}
MeshLayer mesh = t.layers.getMeshLayer(0);
if (mesh.area == null) {
int color = JeoUtils.color(rule.color(f, CartoCSS.POLYGON_FILL, RGB.red));
mesh.area = new Area(color);
mesh.area = new AreaStyle(color);
}
addPolygon(t, g, mesh, ll);

View File

@ -15,10 +15,10 @@ import org.oscim.renderer.elements.LineLayer;
import org.oscim.renderer.elements.MeshLayer;
import org.oscim.renderer.elements.TextItem;
import org.oscim.renderer.elements.TextLayer;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.Text.TextBuilder;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.TextStyle;
import org.oscim.theme.styles.TextStyle.TextBuilder;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
@ -27,7 +27,7 @@ import com.vividsolutions.jts.geom.LineString;
public class OSMIndoorLayer extends JeoVectorLayer {
protected TextLayer mTextLayer;
protected Text mText = new TextBuilder()
protected TextStyle mText = new TextBuilder()
.setFontSize(16).setColor(Color.BLACK)
.setStrokeWidth(2.2f).setStroke(Color.WHITE)
.build();
@ -62,7 +62,7 @@ public class OSMIndoorLayer extends JeoVectorLayer {
if (ll.line == null) {
RGB color = rule.color(f, CartoCSS.LINE_COLOR, RGB.black);
float width = rule.number(f, CartoCSS.LINE_WIDTH, 1.2f);
ll.line = new Line(0, JeoUtils.color(color), width);
ll.line = new LineStyle(0, JeoUtils.color(color), width);
ll.heightOffset = level * 4;
ll.setDropDistance(0);
}
@ -84,7 +84,7 @@ public class OSMIndoorLayer extends JeoVectorLayer {
if (level > -2 && !active)
color = Color.fade(color, 0.1f);
ll.line = new Line(0, color, width);
ll.line = new LineStyle(0, color, width);
ll.heightOffset = level * 4;
ll.setDropDistance(0);
}
@ -95,7 +95,7 @@ public class OSMIndoorLayer extends JeoVectorLayer {
if (level > -2 && !active)
color = Color.fade(color, 0.1f);
mesh.area = new Area(color);
mesh.area = new AreaStyle(color);
//mesh.area = new Area(Color.fade(Color.DKGRAY, 0.1f));
mesh.heightOffset = level * 4f;
}

View File

@ -19,8 +19,8 @@ import org.oscim.core.MapElement;
import org.oscim.core.Tag;
import org.oscim.core.TagSet;
import org.oscim.theme.IRenderTheme;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.RenderStyle;
public class RenderTheme implements IRenderTheme {
@ -147,11 +147,11 @@ public class RenderTheme implements IRenderTheme {
}
if (p != null) {
s.ri[0] = new Area(mCurLevel++, color(p));
s.ri[0] = new AreaStyle(mCurLevel++, color(p));
}
if (l != null) {
s.ri[1] = new Line(mCurLevel++, color(l), 1);
s.ri[1] = new LineStyle(mCurLevel++, color(l), 1);
}
if (p != null || l != null) {
@ -198,7 +198,7 @@ public class RenderTheme implements IRenderTheme {
RGB c = r.color(f, CartoCSS.POLYGON_FILL, RGB.black);
out.println(z + " " + c);
return new RenderStyle[] {
new Area(z, color(c))
new AreaStyle(z, color(c))
};
} else if (type == GeometryType.LINE) {
@ -207,7 +207,7 @@ public class RenderTheme implements IRenderTheme {
//out.println(z + " " + c);
return new RenderStyle[] {
new Line(100 + z, color(c), width)
new LineStyle(100 + z, color(c), width)
};
} else if (type == GeometryType.POINT) {

View File

@ -32,7 +32,7 @@ import org.oscim.renderer.ElementRenderer;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.elements.ElementLayers;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.LineStyle;
import org.oscim.utils.FastMath;
import org.oscim.utils.async.SimpleWorker;
import org.oscim.utils.geom.LineClipper;
@ -45,14 +45,14 @@ public class PathLayer extends Layer {
protected boolean mUpdatePoints;
/** Line style */
Line mLineStyle;
LineStyle mLineStyle;
final Worker mWorker;
public PathLayer(Map map, int lineColor, float lineWidth) {
super(map);
mWorker = new Worker(map);
mLineStyle = new Line(lineColor, lineWidth, Cap.BUTT);
mLineStyle = new LineStyle(lineColor, lineWidth, Cap.BUTT);
mRenderer = new RenderPath();
mPoints = new ArrayList<GeoPoint>();
}

View File

@ -3,8 +3,8 @@ package org.oscim.layers;
import org.oscim.backend.canvas.Paint.Cap;
import org.oscim.map.Map;
import org.oscim.renderer.GridRenderer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.TextStyle;
public class TileGridLayer extends GenericLayer {
@ -13,10 +13,10 @@ public class TileGridLayer extends GenericLayer {
}
public TileGridLayer(Map map, int color, float width, int repeat) {
super(map, new GridRenderer(repeat, new Line(color, width, Cap.BUTT), null));
super(map, new GridRenderer(repeat, new LineStyle(color, width, Cap.BUTT), null));
}
public TileGridLayer(Map map, int color, float width, Text text, int repeat) {
super(map, new GridRenderer(repeat, new Line(color, width, Cap.BUTT), text));
public TileGridLayer(Map map, int color, float width, TextStyle text, int repeat) {
super(map, new GridRenderer(repeat, new LineStyle(color, width, Cap.BUTT), text));
}
}

View File

@ -28,7 +28,7 @@ import org.oscim.layers.tile.VectorTileRenderer;
import org.oscim.map.Map;
import org.oscim.renderer.elements.ElementLayers;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.LineStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -52,7 +52,7 @@ public class TestTileLayer extends TileLayer {
}
GeometryBuffer mGeom = new GeometryBuffer(128, 16);
Line mLineStyle = new Line(Color.BLUE, 2f, Cap.ROUND);
LineStyle mLineStyle = new LineStyle(Color.BLUE, 2f, Cap.ROUND);
@Override
public boolean loadTile(MapTile tile) {

View File

@ -40,14 +40,14 @@ import org.oscim.renderer.elements.SymbolItem;
import org.oscim.renderer.elements.TextItem;
import org.oscim.theme.IRenderTheme;
import org.oscim.theme.RenderTheme;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Circle;
import org.oscim.theme.styles.Extrusion;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.CircleStyle;
import org.oscim.theme.styles.ExtrusionStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.LineSymbol;
import org.oscim.theme.styles.RenderStyle;
import org.oscim.theme.styles.Symbol;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.SymbolStyle;
import org.oscim.theme.styles.TextStyle;
import org.oscim.tiling.ITileDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -248,7 +248,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
/*** RenderThemeCallback ***/
@Override
public void renderWay(Line line, int level) {
public void renderWay(LineStyle line, int level) {
int numLayer = mCurLayer + level;
if (line.stipple == 0) {
@ -297,7 +297,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
protected final static boolean USE_MESH_POLY = false;
@Override
public void renderArea(Area area, int level) {
public void renderArea(AreaStyle area, int level) {
int numLayer = mCurLayer + level;
if (USE_MESH_POLY) {
MeshLayer l = mTile.layers.getMeshLayer(numLayer);
@ -311,7 +311,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
}
@Override
public void renderAreaText(Text text) {
public void renderAreaText(TextStyle text) {
// TODO place somewhere on polygon
String value = mElement.tags.getValue(text.textKey);
if (value == null || value.length() == 0)
@ -332,7 +332,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
}
@Override
public void renderPointText(Text text) {
public void renderPointText(TextStyle text) {
String value = mElement.tags.getValue(text.textKey);
if (value == null || value.length() == 0)
return;
@ -344,7 +344,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
}
@Override
public void renderWayText(Text text) {
public void renderWayText(TextStyle text) {
String value = mElement.tags.getValue(text.textKey);
if (value == null || value.length() == 0)
return;
@ -362,11 +362,11 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
}
@Override
public void renderPointCircle(Circle circle, int level) {
public void renderPointCircle(CircleStyle circle, int level) {
}
@Override
public void renderPointSymbol(Symbol symbol) {
public void renderPointSymbol(SymbolStyle symbol) {
if (symbol.texture == null)
return;
@ -380,7 +380,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
}
@Override
public void renderAreaSymbol(Symbol symbol) {
public void renderAreaSymbol(SymbolStyle symbol) {
}
@Override
@ -389,7 +389,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
}
@Override
public void renderExtrusion(Extrusion extrusion, int level) {
public void renderExtrusion(ExtrusionStyle extrusion, int level) {
int height = 0;
int minHeight = 0;

View File

@ -20,14 +20,14 @@ package org.oscim.layers.tile.vector;
import org.oscim.core.Tile;
import org.oscim.layers.tile.MapTile;
import org.oscim.renderer.elements.TextItem;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.TextStyle;
import org.oscim.utils.geom.GeometryUtils;
import org.oscim.utils.geom.LineClipper;
public final class WayDecorator {
public static void renderText(LineClipper clipper, float[] coordinates, String string,
Text text, int pos, int len, MapTile tile) {
TextStyle text, int pos, int len, MapTile tile) {
//TextItem items = textItems;
TextItem t = null;

View File

@ -22,7 +22,7 @@ import org.oscim.renderer.GLViewport;
import org.oscim.renderer.elements.ElementLayers;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.renderer.elements.TextItem;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.LineStyle;
class Debug {
@ -71,12 +71,12 @@ class Debug {
int alpha = 0xaaffffff;
dbg.clear();
dbg.addLineLayer(0, new Line((Color.BLUE & alpha), 2));
dbg.addLineLayer(1, new Line((Color.RED & alpha), 2));
dbg.addLineLayer(3, new Line((Color.YELLOW & alpha), 2));
dbg.addLineLayer(2, new Line((Color.GREEN & alpha), 2));
dbg.addLineLayer(4, new Line((Color.CYAN & alpha), 2));
dbg.addLineLayer(5, new Line((Color.MAGENTA & alpha), 2));
dbg.addLineLayer(0, new LineStyle((Color.BLUE & alpha), 2));
dbg.addLineLayer(1, new LineStyle((Color.RED & alpha), 2));
dbg.addLineLayer(3, new LineStyle((Color.YELLOW & alpha), 2));
dbg.addLineLayer(2, new LineStyle((Color.GREEN & alpha), 2));
dbg.addLineLayer(4, new LineStyle((Color.CYAN & alpha), 2));
dbg.addLineLayer(5, new LineStyle((Color.MAGENTA & alpha), 2));
}
public static void draw(MapPosition pos, GLViewport m, ElementLayers layers) {

View File

@ -23,13 +23,13 @@ import org.oscim.core.Tile;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.renderer.elements.TextItem;
import org.oscim.renderer.elements.TextLayer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.Text.TextBuilder;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.TextStyle;
import org.oscim.theme.styles.TextStyle.TextBuilder;
public class GridRenderer extends ElementRenderer {
private final TextLayer mTextLayer;
private final Text mText;
private final TextStyle mText;
private final LineLayer mLineLayer;
private final GeometryBuffer mLines;
private final StringBuffer mStringBuffer;
@ -37,11 +37,11 @@ public class GridRenderer extends ElementRenderer {
private int mCurX, mCurY, mCurZ;
public GridRenderer() {
this(1, new Line(Color.LTGRAY, 1.2f, Cap.BUTT),
this(1, new LineStyle(Color.LTGRAY, 1.2f, Cap.BUTT),
new TextBuilder().setFontSize(22).setColor(Color.RED).build());
}
public GridRenderer(int numLines, Line lineStyle, Text textStyle) {
public GridRenderer(int numLines, LineStyle lineStyle, TextStyle textStyle) {
int size = Tile.SIZE;
// not needed to set but we know:

View File

@ -25,8 +25,8 @@ import java.nio.ShortBuffer;
import org.oscim.backend.GL20;
import org.oscim.renderer.BufferObject;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.LineStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -83,7 +83,7 @@ public class ElementLayers {
* add the LineLayer for a level with a given Line style. Levels are
* ordered from bottom (0) to top
*/
public LineLayer addLineLayer(int level, Line style) {
public LineLayer addLineLayer(int level, LineStyle style) {
LineLayer l = (LineLayer) getLayer(level, LINE);
if (l == null)
return null;
@ -93,7 +93,7 @@ public class ElementLayers {
return l;
}
public PolygonLayer addPolygonLayer(int level, Area style) {
public PolygonLayer addPolygonLayer(int level, AreaStyle style) {
PolygonLayer l = (PolygonLayer) getLayer(level, POLYGON);
if (l == null)
return null;
@ -101,7 +101,7 @@ public class ElementLayers {
return l;
}
public MeshLayer addMeshLayer(int level, Area style) {
public MeshLayer addMeshLayer(int level, AreaStyle style) {
MeshLayer l = (MeshLayer) getLayer(level, MESH);
if (l == null)
return null;

View File

@ -29,7 +29,7 @@ import org.oscim.renderer.GLState;
import org.oscim.renderer.GLUtils;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.MapRenderer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.LineStyle;
import org.oscim.utils.pool.Inlist;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -64,7 +64,7 @@ public final class LineLayer extends RenderElement {
/* lines referenced by this outline layer */
public LineLayer outlines;
public Line line;
public LineStyle line;
public float scale = 1;
public boolean roundCap;
@ -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;
Line line = (Line) ll.line.getCurrent();
LineStyle line = (LineStyle) ll.line.getCurrent();
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) {
Line core = (Line) ref.line.getCurrent();
LineStyle core = (LineStyle) ref.line.getCurrent();
// core width
if (core.fixed) {

View File

@ -26,7 +26,7 @@ import org.oscim.renderer.GLState;
import org.oscim.renderer.GLUtils;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.MapRenderer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.LineStyle;
import org.oscim.utils.pool.Inlist;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -86,7 +86,7 @@ public final class LineTexLayer extends RenderElement {
/* lines referenced by this outline layer */
public LineLayer outlines;
public Line line;
public LineStyle line;
public float width;
//public boolean roundCap;
@ -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;
Line line = ll.line;
LineStyle line = ll.line;
GLUtils.setColor(hTexColor, line.stippleColor, 1);
GLUtils.setColor(hBgColor, line.color, 1);

View File

@ -27,7 +27,7 @@ import org.oscim.renderer.GLState;
import org.oscim.renderer.GLUtils;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.MapRenderer;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.utils.Tessellator;
import org.oscim.utils.pool.Inlist;
import org.slf4j.Logger;
@ -41,7 +41,7 @@ public class MeshLayer extends RenderElement {
int numIndices;
VertexItem indiceItems;
public Area area;
public AreaStyle area;
public float heightOffset;
public MeshLayer(int level) {

View File

@ -29,7 +29,7 @@ import org.oscim.renderer.GLState;
import org.oscim.renderer.GLUtils;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.MapRenderer;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.utils.FastMath;
import org.oscim.utils.math.Interpolation;
import org.oscim.utils.pool.Inlist;
@ -46,7 +46,7 @@ public final class PolygonLayer extends RenderElement {
private static final boolean enableTexture = true;
public Area area;
public AreaStyle area;
PolygonLayer(int layer) {
super(RenderElement.POLYGON);
@ -181,7 +181,7 @@ public final class PolygonLayer extends RenderElement {
int shader = polyShader;
for (int c = start; c < end; c++) {
Area a = (Area) mFillPolys[c].area.getCurrent();
AreaStyle a = (AreaStyle) mFillPolys[c].area.getCurrent();
if (enableTexture && a.texture != null) {
shader = texShader;

View File

@ -16,7 +16,7 @@
*/
package org.oscim.renderer.elements;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.TextStyle;
import org.oscim.utils.pool.Inlist;
import org.oscim.utils.pool.SyncPool;
@ -57,7 +57,7 @@ public class TextItem extends Inlist<TextItem> {
return ti;
}
public TextItem set(float x, float y, String string, Text text) {
public TextItem set(float x, float y, String string, TextStyle text) {
this.x = x;
this.y = y;
this.string = string;
@ -77,7 +77,7 @@ public class TextItem extends Inlist<TextItem> {
public String string;
// text style
public Text text;
public TextStyle text;
// label width
public float width;

View File

@ -28,9 +28,9 @@ import org.oscim.renderer.atlas.TextureAtlas.Slot;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.renderer.elements.TextItem;
import org.oscim.renderer.elements.TextLayer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.Text.TextBuilder;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.TextStyle;
import org.oscim.theme.styles.TextStyle.TextBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -43,19 +43,19 @@ public class AtlasRenderLayer extends ElementRenderer {
TextureAtlas mAtlas = TextureAtlas.create(2048, 2048, 1);
LineLayer ll = layers.getLineLayer(0);
ll.line = new Line(Color.BLUE, 3, Cap.BUTT);
ll.line = new LineStyle(Color.BLUE, 3, Cap.BUTT);
ll.scale = 1f;
LineLayer ll2 = layers.getLineLayer(1);
ll2.line = new Line(Color.RED, 3, Cap.BUTT);
ll2.line = new LineStyle(Color.RED, 3, Cap.BUTT);
ll2.scale = 1f;
LineLayer ll3 = layers.getLineLayer(2);
ll3.line = new Line(Color.GREEN, 3, Cap.BUTT);
ll3.line = new LineStyle(Color.GREEN, 3, Cap.BUTT);
ll3.scale = 1f;
TextLayer tl = new TextLayer();
Text t = new TextBuilder().setFontSize(20).setColor(Color.BLACK).build();
TextStyle t = new TextBuilder().setFontSize(20).setColor(Color.BLACK).build();
layers.setTextureLayers(tl);
float[] points = new float[10];

View File

@ -8,7 +8,7 @@ import org.oscim.core.Point;
import org.oscim.renderer.ElementRenderer;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.elements.LineLayer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.LineStyle;
import org.oscim.utils.geom.BezierPath;
public class BezierPathLayer extends ElementRenderer {
@ -27,7 +27,7 @@ public class BezierPathLayer extends ElementRenderer {
// System.out.println(pts[i]);
g.addPoint(pts[i]);
}
LineLayer ll = layers.addLineLayer(0, new Line(Color.BLUE, 2f));
LineLayer ll = layers.addLineLayer(0, new LineStyle(Color.BLUE, 2f));
ll.addLine(g);
List<Point> ctrl = BezierPath.cubicSplineControlPoints(pts, 0.1f);
@ -49,7 +49,7 @@ public class BezierPathLayer extends ElementRenderer {
}
p0 = p3;
}
ll = layers.addLineLayer(1, new Line(Color.CYAN, 2f));
ll = layers.addLineLayer(1, new LineStyle(Color.CYAN, 2f));
ll.addLine(g);
}

View File

@ -3,14 +3,14 @@ package org.oscim.theme;
import org.oscim.backend.canvas.Color;
import org.oscim.core.GeometryBuffer.GeometryType;
import org.oscim.core.TagSet;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.RenderStyle;
public class DebugTheme implements IRenderTheme {
private final static Line[] line = { new Line(1, Color.MAGENTA, 2) };
private final static Area[] area = { new Area(0, Color.CYAN) };
private final static LineStyle[] line = { new LineStyle(1, Color.MAGENTA, 2) };
private final static AreaStyle[] area = { new AreaStyle(0, Color.CYAN) };
@Override
public RenderStyle[] matchElement(GeometryType type, TagSet tags, int zoomLevel) {

View File

@ -19,14 +19,14 @@ package org.oscim.theme;
import org.oscim.core.GeometryBuffer.GeometryType;
import org.oscim.core.TagSet;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Circle;
import org.oscim.theme.styles.Extrusion;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.CircleStyle;
import org.oscim.theme.styles.ExtrusionStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.LineSymbol;
import org.oscim.theme.styles.RenderStyle;
import org.oscim.theme.styles.Symbol;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.SymbolStyle;
import org.oscim.theme.styles.TextStyle;
public interface IRenderTheme {
@ -76,7 +76,7 @@ public interface IRenderTheme {
* @param area
* @param level
*/
void renderArea(Area area, int level);
void renderArea(AreaStyle area, int level);
/**
* Renders an extrusion with the given parameters.
@ -84,7 +84,7 @@ public interface IRenderTheme {
* @param extrusion
* @param level
*/
void renderExtrusion(Extrusion extrusion, int level);
void renderExtrusion(ExtrusionStyle extrusion, int level);
/**
* Renders an area symbol with the given bitmap.
@ -92,7 +92,7 @@ public interface IRenderTheme {
* @param symbol
* the symbol to be rendered.
*/
void renderAreaSymbol(Symbol symbol);
void renderAreaSymbol(SymbolStyle symbol);
/**
* Renders an area caption with the given text.
@ -100,7 +100,7 @@ public interface IRenderTheme {
* @param text
* the text to be rendered.
*/
void renderAreaText(Text text);
void renderAreaText(TextStyle text);
/**
* Renders a point of interest circle with the given parameters.
@ -110,7 +110,7 @@ public interface IRenderTheme {
* @param level
* the drawing level on which the circle should be rendered.
*/
void renderPointCircle(Circle circle, int level);
void renderPointCircle(CircleStyle circle, int level);
/**
* Renders a point of interest symbol with the given bitmap.
@ -118,7 +118,7 @@ public interface IRenderTheme {
* @param symbol
* the symbol to be rendered.
*/
void renderPointSymbol(Symbol symbol);
void renderPointSymbol(SymbolStyle symbol);
/**
* Renders a point of interest caption with the given text.
@ -126,7 +126,7 @@ public interface IRenderTheme {
* @param text
* the text to be rendered.
*/
void renderPointText(Text text);
void renderPointText(TextStyle text);
/**
* Renders a way with the given parameters.
@ -134,7 +134,7 @@ public interface IRenderTheme {
* @param line
* @param level
*/
void renderWay(Line line, int level);
void renderWay(LineStyle line, int level);
/**
* Renders a way with the given symbol along the way path.
@ -149,7 +149,7 @@ public interface IRenderTheme {
*
* @param text
*/
void renderWayText(Text text);
void renderWayText(TextStyle text);
}

View File

@ -13,8 +13,8 @@ import org.oscim.theme.rule.RuleBuilder;
import org.oscim.theme.rule.Selector;
import org.oscim.theme.rule.SingleKeyMatcher;
import org.oscim.theme.rule.SingleValueMatcher;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.RenderStyle;
public class ThemeBuilder {
@ -90,11 +90,11 @@ public class ThemeBuilder {
b.push(RuleBuilder.get().select(Selector.FIRST))
.push("highway", null)
.addStyle(new Line(1, 1, 1))
.addStyle(new LineStyle(1, 1, 1))
.pop()
.push(RuleBuilder.get().select(Selector.WHEN_MATCHED))
.addStyle(new Area(1, 1))
.addStyle(new AreaStyle(1, 1))
.pop()
.pop();

View File

@ -41,17 +41,17 @@ import org.oscim.renderer.elements.TextureItem;
import org.oscim.theme.IRenderTheme.ThemeException;
import org.oscim.theme.rule.Rule;
import org.oscim.theme.rule.RuleBuilder;
import org.oscim.theme.styles.Area;
import org.oscim.theme.styles.Area.AreaBuilder;
import org.oscim.theme.styles.Circle;
import org.oscim.theme.styles.Extrusion;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.Line.LineBuilder;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.AreaStyle.AreaBuilder;
import org.oscim.theme.styles.CircleStyle;
import org.oscim.theme.styles.ExtrusionStyle;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.LineStyle.LineBuilder;
import org.oscim.theme.styles.LineSymbol;
import org.oscim.theme.styles.RenderStyle;
import org.oscim.theme.styles.Symbol;
import org.oscim.theme.styles.Text;
import org.oscim.theme.styles.Text.TextBuilder;
import org.oscim.theme.styles.SymbolStyle;
import org.oscim.theme.styles.TextStyle;
import org.oscim.theme.styles.TextStyle.TextBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
@ -205,7 +205,7 @@ public class XmlThemeBuilder extends DefaultHandler {
} else if ("style-text".equals(localName)) {
checkState(localName, Element.STYLE);
Text text = createText(localName, attributes, false);
TextStyle text = createText(localName, attributes, false);
mStyles.put(TEXT_STYLE + text.style, text);
} else if ("style-area".equals(localName)) {
@ -218,7 +218,7 @@ public class XmlThemeBuilder extends DefaultHandler {
} else if ("outline-layer".equals(localName)) {
checkState(localName, Element.RENDERING_INSTRUCTION);
Line line = createLine(null, localName, attributes, mLevels++, true);
LineStyle line = createLine(null, localName, attributes, mLevels++, true);
mStyles.put(OUTLINE_STYLE + line.style, line);
} else if ("area".equals(localName)) {
@ -227,11 +227,11 @@ public class XmlThemeBuilder extends DefaultHandler {
} else if ("caption".equals(localName)) {
checkState(localName, Element.RENDERING_INSTRUCTION);
Text text = createText(localName, attributes, true);
TextStyle text = createText(localName, attributes, true);
mCurrentRule.addStyle(text);
} else if ("circle".equals(localName)) {
checkState(localName, Element.RENDERING_INSTRUCTION);
Circle circle = createCircle(localName, attributes, mLevels++);
CircleStyle circle = createCircle(localName, attributes, mLevels++);
mCurrentRule.addStyle(circle);
} else if ("line".equals(localName)) {
@ -247,10 +247,10 @@ public class XmlThemeBuilder extends DefaultHandler {
checkState(localName, Element.RENDERING_INSTRUCTION);
String style = attributes.getValue("use");
if (style == null) {
Text text = createText(localName, attributes, false);
TextStyle text = createText(localName, attributes, false);
mCurrentRule.addStyle(text);
} else {
Text pt = (Text) mStyles.get(TEXT_STYLE + style);
TextStyle pt = (TextStyle) mStyles.get(TEXT_STYLE + style);
if (pt != null)
mCurrentRule.addStyle(pt);
else
@ -259,7 +259,7 @@ public class XmlThemeBuilder extends DefaultHandler {
} else if ("symbol".equals(localName)) {
checkState(localName, Element.RENDERING_INSTRUCTION);
Symbol symbol = createSymbol(localName, attributes);
SymbolStyle symbol = createSymbol(localName, attributes);
mCurrentRule.addStyle(symbol);
} else if ("outline".equals(localName)) {
@ -268,7 +268,7 @@ public class XmlThemeBuilder extends DefaultHandler {
} else if ("extrusion".equals(localName)) {
checkState(localName, Element.RENDERING_INSTRUCTION);
Extrusion extrusion = createExtrusion(localName, attributes, mLevels++);
ExtrusionStyle extrusion = createExtrusion(localName, attributes, mLevels++);
mCurrentRule.addStyle(extrusion);
} else if ("atlas".equals(localName)) {
@ -306,17 +306,17 @@ public class XmlThemeBuilder extends DefaultHandler {
throws SAXException {
String use = attributes.getValue("use");
Line style = null;
LineStyle style = null;
if (use != null) {
style = (Line) mStyles.get(LINE_STYLE + use);
style = (LineStyle) mStyles.get(LINE_STYLE + use);
if (style == null) {
log.debug("missing line style 'use': " + use);
return;
}
}
Line line = createLine(style, localName, attributes, mLevels++, false);
LineStyle line = createLine(style, localName, attributes, mLevels++, false);
if (isStyle) {
mStyles.put(LINE_STYLE + line.style, line);
@ -337,7 +337,7 @@ public class XmlThemeBuilder extends DefaultHandler {
* is outline layer
* @return a new Line with the given rendering attributes.
*/
private Line createLine(Line line, String elementName, Attributes attributes,
private LineStyle createLine(LineStyle line, String elementName, Attributes attributes,
int level, boolean isOutline) {
LineBuilder b = mLineBuilder.set(line);
b.isOutline(isOutline);
@ -414,17 +414,17 @@ public class XmlThemeBuilder extends DefaultHandler {
throws SAXException {
String use = attributes.getValue("use");
Area style = null;
AreaStyle style = null;
if (use != null) {
style = (Area) mStyles.get(AREA_STYLE + use);
style = (AreaStyle) mStyles.get(AREA_STYLE + use);
if (style == null) {
log.debug("missing area style 'use': " + use);
return;
}
}
Area area = createArea(style, localName, attributes, mLevels);
AreaStyle area = createArea(style, localName, attributes, mLevels);
mLevels += 2;
if (isStyle) {
@ -437,7 +437,7 @@ public class XmlThemeBuilder extends DefaultHandler {
/**
* @return a new Area with the given rendering attributes.
*/
private Area createArea(Area area, String elementName, Attributes attributes, int level) {
private AreaStyle createArea(AreaStyle area, String elementName, Attributes attributes, int level) {
AreaBuilder b = mAreaBuilder.set(area);
b.level(level);
@ -494,7 +494,7 @@ public class XmlThemeBuilder extends DefaultHandler {
private void addOutline(String style) {
if (style != null) {
Line line = (Line) mStyles.get(OUTLINE_STYLE + style);
LineStyle line = (LineStyle) mStyles.get(OUTLINE_STYLE + style);
if (line != null && line.outline)
mCurrentRule.addStyle(line);
else
@ -644,7 +644,7 @@ public class XmlThemeBuilder extends DefaultHandler {
* ...
* @return a new Text with the given rendering attributes.
*/
private Text createText(String elementName, Attributes attributes, boolean caption) {
private TextStyle createText(String elementName, Attributes attributes, boolean caption) {
TextBuilder b = mTextBuilder.reset();
b.caption = caption;
@ -706,7 +706,7 @@ public class XmlThemeBuilder extends DefaultHandler {
* the drawing level of this instruction.
* @return a new Circle with the given rendering attributes.
*/
private static Circle createCircle(String elementName, Attributes attributes, int level) {
private static CircleStyle createCircle(String elementName, Attributes attributes, int level) {
Float radius = null;
boolean scaleRadius = false;
int fill = Color.TRANSPARENT;
@ -740,7 +740,7 @@ public class XmlThemeBuilder extends DefaultHandler {
validateNonNegative("radius", radius);
validateNonNegative("stroke-width", strokeWidth);
return new Circle(radius, scaleRadius, fill, stroke, strokeWidth, level);
return new CircleStyle(radius, scaleRadius, fill, stroke, strokeWidth, level);
}
/**
@ -775,7 +775,7 @@ public class XmlThemeBuilder extends DefaultHandler {
/**
* @return a new Symbol with the given rendering attributes.
*/
private Symbol createSymbol(String elementName, Attributes attributes) {
private SymbolStyle createSymbol(String elementName, Attributes attributes) {
String src = null;
for (int i = 0; i < attributes.getLength(); ++i) {
@ -790,10 +790,10 @@ public class XmlThemeBuilder extends DefaultHandler {
validateExists("src", src, elementName);
return new Symbol(getAtlasRegion(src));
return new SymbolStyle(getAtlasRegion(src));
}
private Extrusion createExtrusion(String elementName, Attributes attributes, int level) {
private ExtrusionStyle createExtrusion(String elementName, Attributes attributes, int level) {
int colorSide = 0;
int colorTop = 0;
int colorLine = 0;
@ -819,7 +819,7 @@ public class XmlThemeBuilder extends DefaultHandler {
logUnknownAttribute(elementName, name, value, i);
}
return new Extrusion(level, colorSide, colorTop, colorLine, defaultHeight);
return new ExtrusionStyle(level, colorSide, colorTop, colorLine, defaultHeight);
}
public static void validateNonNegative(String name, float value) {

View File

@ -22,7 +22,7 @@ import org.oscim.backend.canvas.Color;
import org.oscim.renderer.elements.TextureItem;
import org.oscim.theme.IRenderTheme.Callback;
public class Area extends RenderStyle {
public class AreaStyle extends RenderStyle {
/** Drawing order level */
private final int level;
@ -46,13 +46,13 @@ public class Area extends RenderStyle {
public final TextureItem texture;
/** Outline */
public final Line outline;
public final LineStyle outline;
public Area(int color) {
public AreaStyle(int color) {
this(0, color);
}
public Area(int level, int color) {
public AreaStyle(int level, int color) {
this.level = level;
this.style = "";
this.fadeScale = -1;
@ -63,7 +63,7 @@ public class Area extends RenderStyle {
this.outline = null;
}
public Area(AreaBuilder b) {
public AreaStyle(AreaBuilder b) {
this.level = b.level;
this.style = b.style;
this.fadeScale = b.fadeScale;
@ -77,7 +77,7 @@ public class Area extends RenderStyle {
b.outlineWidth == b.outline.width) {
this.outline = b.outline;
} else if (b.outlineColor != Color.TRANSPARENT) {
this.outline = new Line(-1, b.outlineColor, b.outlineWidth);
this.outline = new LineStyle(-1, b.outlineColor, b.outlineWidth);
} else {
this.outline = null;
}
@ -91,8 +91,8 @@ public class Area extends RenderStyle {
outline.update();
}
public Area current() {
return (Area) (mCurrent == null ? this : mCurrent);
public AreaStyle current() {
return (AreaStyle) (mCurrent == null ? this : mCurrent);
}
@Override
@ -106,7 +106,7 @@ public class Area extends RenderStyle {
public static class AreaBuilder {
public int level;
public String style;
public Line outline;
public LineStyle outline;
public int color;
public int fadeScale;
public int blendColor;
@ -117,7 +117,7 @@ public class Area extends RenderStyle {
public TextureItem texture;
public AreaBuilder set(Area area) {
public AreaBuilder set(AreaStyle area) {
if (area == null)
return reset();
@ -220,8 +220,8 @@ public class Area extends RenderStyle {
return this;
}
public Area build() {
return new Area(this);
public AreaStyle build() {
return new AreaStyle(this);
}
}
}

View File

@ -22,7 +22,7 @@ import org.oscim.theme.IRenderTheme.Callback;
/**
* Represents a round area on the map.
*/
public final class Circle extends RenderStyle {
public final class CircleStyle extends RenderStyle {
public final int level;
@ -33,7 +33,7 @@ public final class Circle extends RenderStyle {
public final boolean scaleRadius;
public final float strokeWidth;
public Circle(Float radius, boolean scaleRadius, int fill, int stroke,
public CircleStyle(Float radius, boolean scaleRadius, int fill, int stroke,
float strokeWidth, int level) {
super();

View File

@ -19,9 +19,9 @@ package org.oscim.theme.styles;
import org.oscim.backend.canvas.Color;
import org.oscim.theme.IRenderTheme.Callback;
public class Extrusion extends RenderStyle {
public class ExtrusionStyle extends RenderStyle {
public Extrusion(int level, int colorSides, int colorTop, int colorLine, int defaultHeight) {
public ExtrusionStyle(int level, int colorSides, int colorTop, int colorLine, int defaultHeight) {
this.colors = new float[16];
fillColors(colorSides, colorTop, colorLine, colors);

View File

@ -23,7 +23,7 @@ import org.oscim.backend.canvas.Color;
import org.oscim.backend.canvas.Paint.Cap;
import org.oscim.theme.IRenderTheme.Callback;
public final class Line extends RenderStyle {
public final class LineStyle extends RenderStyle {
final int level;
public final String style;
@ -39,7 +39,7 @@ public final class Line extends RenderStyle {
public final int stippleColor;
public final float stippleWidth;
private Line(LineBuilder builer) {
private LineStyle(LineBuilder builer) {
this.level = builer.level;
this.style = builer.style;
this.width = builer.width;
@ -54,7 +54,7 @@ public final class Line extends RenderStyle {
this.stippleWidth = builer.stippleWidth;
}
public Line(int level, String style, int color, float width,
public LineStyle(int level, String style, int color, float width,
Cap cap, boolean fixed,
int stipple, int stippleColor, float stippleWidth,
int fadeScale, float blur, boolean isOutline) {
@ -76,15 +76,15 @@ public final class Line extends RenderStyle {
this.fadeScale = fadeScale;
}
public Line(int stroke, float width) {
public LineStyle(int stroke, float width) {
this(0, "", stroke, width, Cap.BUTT, true, 0, 0, 0, -1, 0, false);
}
public Line(int level, int stroke, float width) {
public LineStyle(int level, int stroke, float width) {
this(level, "", stroke, width, Cap.BUTT, true, 0, 0, 0, -1, 0, false);
}
public Line(int stroke, float width, Cap cap) {
public LineStyle(int stroke, float width, Cap cap) {
this(0, "", stroke, width, cap, true, 0, 0, 0, -1, 0, false);
}
@ -109,7 +109,7 @@ public final class Line extends RenderStyle {
public int stippleColor;
public float stippleWidth;
public LineBuilder set(Line line) {
public LineBuilder set(LineStyle line) {
if (line == null)
return reset();
this.level = line.level;
@ -195,8 +195,8 @@ public final class Line extends RenderStyle {
return this;
}
public Line build() {
return new Line(this);
public LineStyle build() {
return new LineStyle(this);
}
}
}

View File

@ -23,11 +23,11 @@ import org.oscim.theme.IRenderTheme.Callback;
/**
* Represents an icon on the map.
*/
public final class Symbol extends RenderStyle {
public final class SymbolStyle extends RenderStyle {
public final TextureRegion texture;
public Symbol(TextureRegion symbol) {
public SymbolStyle(TextureRegion symbol) {
this.texture = symbol;
}

View File

@ -25,7 +25,7 @@ import org.oscim.backend.canvas.Paint.FontStyle;
import org.oscim.renderer.atlas.TextureRegion;
import org.oscim.theme.IRenderTheme.Callback;
public final class Text extends RenderStyle {
public final class TextStyle extends RenderStyle {
public static class TextBuilder {
@ -64,15 +64,15 @@ public final class Text extends RenderStyle {
reset();
}
public Text build() {
Text t = new Text(this);
public TextStyle build() {
TextStyle t = new TextStyle(this);
t.fontHeight = t.paint.getFontHeight();
t.fontDescent = t.paint.getFontDescent();
return t;
}
public Text buildInternal() {
return new Text(this);
public TextStyle buildInternal() {
return new TextStyle(this);
}
public TextBuilder setStyle(String style) {
@ -136,7 +136,7 @@ public final class Text extends RenderStyle {
}
}
Text(TextBuilder tb) {
TextStyle(TextBuilder tb) {
this.style = tb.style;
this.textKey = tb.textKey;
this.caption = tb.caption;