Height offset in render styles, close #368
This commit is contained in:
parent
3041ab5515
commit
25f0310334
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2012 osmdroid authors: Viesturs Zarins, Martin Pearman
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2016 Pedinel
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@ -50,6 +50,7 @@ public class PathLayer extends VectorLayer {
|
||||
|
||||
public PathLayer(Map map, int lineColor, float lineWidth) {
|
||||
this(map, Style.builder()
|
||||
.fixed(true)
|
||||
.strokeColor(lineColor)
|
||||
.strokeWidth(lineWidth)
|
||||
.build());
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -256,21 +257,20 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> {
|
||||
else
|
||||
ll = t.buckets.getLineTexBucket(level);
|
||||
if (ll.line == null) {
|
||||
if (style.stipple == 0 && style.texture == null)
|
||||
ll.line = new LineStyle(style.strokeColor, style.strokeWidth, style.cap);
|
||||
else
|
||||
ll.line = LineStyle.builder()
|
||||
.cap(style.cap)
|
||||
.color(style.strokeColor)
|
||||
.fixed(style.fixed)
|
||||
.level(0)
|
||||
.randomOffset(style.randomOffset)
|
||||
.stipple(style.stipple)
|
||||
.stippleColor(style.stippleColor)
|
||||
.stippleWidth(style.stippleWidth)
|
||||
.strokeWidth(style.strokeWidth)
|
||||
.texture(style.texture)
|
||||
.build();
|
||||
ll.line = LineStyle.builder()
|
||||
.reset()
|
||||
.cap(style.cap)
|
||||
.color(style.strokeColor)
|
||||
.fixed(style.fixed)
|
||||
.heightOffset(style.heightOffset)
|
||||
.level(0)
|
||||
.randomOffset(style.randomOffset)
|
||||
.stipple(style.stipple)
|
||||
.stippleColor(style.stippleColor)
|
||||
.stippleWidth(style.stippleWidth)
|
||||
.strokeWidth(style.strokeWidth)
|
||||
.texture(style.texture)
|
||||
.build();
|
||||
}
|
||||
|
||||
if (style.generalization != Style.GENERALIZATION_NONE) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -50,6 +51,7 @@ public class Style {
|
||||
public final float stippleWidth;
|
||||
public final TextureItem texture;
|
||||
|
||||
public final float heightOffset;
|
||||
public final boolean randomOffset;
|
||||
|
||||
private Style(Builder builder) {
|
||||
@ -71,6 +73,7 @@ public class Style {
|
||||
stippleWidth = builder.stippleWidth;
|
||||
texture = builder.texture;
|
||||
|
||||
heightOffset = builder.heightOffset;
|
||||
randomOffset = builder.randomOffset;
|
||||
}
|
||||
|
||||
@ -103,6 +106,7 @@ public class Style {
|
||||
public float stippleWidth = 1;
|
||||
public TextureItem texture = null;
|
||||
|
||||
public float heightOffset = 0;
|
||||
public boolean randomOffset = true;
|
||||
|
||||
protected Builder() {
|
||||
@ -228,6 +232,11 @@ public class Style {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder heightOffset(float heightOffset) {
|
||||
this.heightOffset = heightOffset;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder randomOffset(boolean randomOffset) {
|
||||
this.randomOffset = randomOffset;
|
||||
return this;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -633,6 +633,8 @@ public class LineBucket extends RenderBucket {
|
||||
LineBucket lb = (LineBucket) b;
|
||||
LineStyle line = lb.line.current();
|
||||
|
||||
if (line.heightOffset != lb.heightOffset)
|
||||
lb.heightOffset = line.heightOffset;
|
||||
if (lb.heightOffset != heightOffset) {
|
||||
heightOffset = lb.heightOffset;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -182,7 +183,10 @@ public class MeshBucket extends RenderBucket {
|
||||
|
||||
for (; l != null && l.type == MESH; l = l.next) {
|
||||
MeshBucket ml = (MeshBucket) l;
|
||||
AreaStyle area = ml.area.current();
|
||||
|
||||
if (area.heightOffset != ml.heightOffset)
|
||||
ml.heightOffset = area.heightOffset;
|
||||
if (ml.heightOffset != heightOffset) {
|
||||
heightOffset = ml.heightOffset;
|
||||
|
||||
@ -193,7 +197,7 @@ public class MeshBucket extends RenderBucket {
|
||||
if (ml.area == null)
|
||||
GLUtils.setColor(s.uColor, Color.BLUE, 0.4f);
|
||||
else {
|
||||
setColor(ml.area.current(), s, v.pos);
|
||||
setColor(area, s, v.pos);
|
||||
}
|
||||
gl.vertexAttribPointer(s.aPos, 2, GL.SHORT,
|
||||
false, 0, ml.vertexOffset);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -78,6 +78,8 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
*/
|
||||
public final boolean mesh;
|
||||
|
||||
public final float heightOffset;
|
||||
|
||||
public final int symbolWidth;
|
||||
public final int symbolHeight;
|
||||
public final int symbolPercent;
|
||||
@ -98,6 +100,8 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
this.strokeWidth = 1;
|
||||
this.mesh = false;
|
||||
|
||||
this.heightOffset = 0;
|
||||
|
||||
this.symbolWidth = 0;
|
||||
this.symbolHeight = 0;
|
||||
this.symbolPercent = 100;
|
||||
@ -115,6 +119,8 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
this.strokeWidth = b.strokeWidth;
|
||||
this.mesh = b.mesh;
|
||||
|
||||
this.heightOffset = b.heightOffset;
|
||||
|
||||
this.symbolWidth = b.symbolWidth;
|
||||
this.symbolHeight = b.symbolHeight;
|
||||
this.symbolPercent = b.symbolPercent;
|
||||
@ -176,6 +182,8 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
|
||||
public TextureItem texture;
|
||||
|
||||
public float heightOffset;
|
||||
|
||||
public int symbolWidth;
|
||||
public int symbolHeight;
|
||||
public int symbolPercent;
|
||||
@ -198,6 +206,8 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
this.strokeWidth = area.strokeWidth;
|
||||
this.mesh = area.mesh;
|
||||
|
||||
this.heightOffset = area.heightOffset;
|
||||
|
||||
this.symbolWidth = area.symbolWidth;
|
||||
this.symbolHeight = area.symbolHeight;
|
||||
this.symbolPercent = area.symbolPercent;
|
||||
@ -235,6 +245,11 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
return self();
|
||||
}
|
||||
|
||||
public T heightOffset(float heightOffset) {
|
||||
this.heightOffset = heightOffset;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T symbolWidth(int symbolWidth) {
|
||||
this.symbolWidth = symbolWidth;
|
||||
return self();
|
||||
@ -262,6 +277,8 @@ public class AreaStyle extends RenderStyle<AreaStyle> {
|
||||
texture = null;
|
||||
mesh = false;
|
||||
|
||||
heightOffset = 0;
|
||||
|
||||
symbolWidth = 0;
|
||||
symbolHeight = 0;
|
||||
symbolPercent = 100;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -41,6 +41,7 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
public final float stippleWidth;
|
||||
public final TextureItem texture;
|
||||
|
||||
public final float heightOffset;
|
||||
public final boolean randomOffset;
|
||||
|
||||
public final int symbolWidth;
|
||||
@ -82,6 +83,7 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
this.blur = blur;
|
||||
this.fadeScale = fadeScale;
|
||||
|
||||
this.heightOffset = 0;
|
||||
this.randomOffset = randomOffset;
|
||||
|
||||
this.symbolWidth = 0;
|
||||
@ -103,6 +105,8 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
this.stippleColor = b.themeCallback != null ? b.themeCallback.getColor(b.stippleColor) : b.stippleColor;
|
||||
this.stippleWidth = b.stippleWidth;
|
||||
this.texture = b.texture;
|
||||
|
||||
this.heightOffset = b.heightOffset;
|
||||
this.randomOffset = b.randomOffset;
|
||||
|
||||
this.symbolWidth = b.symbolWidth;
|
||||
@ -133,6 +137,7 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
public float stippleWidth;
|
||||
public TextureItem texture;
|
||||
|
||||
public float heightOffset;
|
||||
public boolean randomOffset;
|
||||
|
||||
public int symbolWidth;
|
||||
@ -159,6 +164,8 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
this.stippleColor = themeCallback != null ? themeCallback.getColor(line.stippleColor) : line.stippleColor;
|
||||
this.stippleWidth = line.stippleWidth;
|
||||
this.texture = line.texture;
|
||||
|
||||
this.heightOffset = line.heightOffset;
|
||||
this.randomOffset = line.randomOffset;
|
||||
|
||||
this.symbolWidth = line.symbolWidth;
|
||||
@ -218,6 +225,11 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
return self();
|
||||
}
|
||||
|
||||
public T heightOffset(float heightOffset) {
|
||||
this.heightOffset = heightOffset;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T randomOffset(boolean randomOffset) {
|
||||
this.randomOffset = randomOffset;
|
||||
return self();
|
||||
@ -243,6 +255,7 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
style = null;
|
||||
fillColor = Color.BLACK;
|
||||
cap = Cap.ROUND;
|
||||
outline = false;
|
||||
strokeWidth = 1;
|
||||
fixed = false;
|
||||
|
||||
@ -254,6 +267,7 @@ public final class LineStyle extends RenderStyle<LineStyle> {
|
||||
stippleColor = Color.BLACK;
|
||||
texture = null;
|
||||
|
||||
heightOffset = 0;
|
||||
randomOffset = true;
|
||||
|
||||
symbolWidth = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user