Height offset in render styles, close #368
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user